gscam package

901 views
Skip to first unread message

William Phan

unread,
May 29, 2015, 6:10:24 PM5/29/15
to meta...@googlegroups.com
Hi,

Has anyone been able to get the gscam package working with the meta-ros layer?  I'm trying to send a live video feed from a webcam attached to a Gumstix Overo COM on a Tobi expansion board to a host machine(where roscore is running) with Ubuntu 14.04+ROS Indigo.  My gumstix-console-image.bb includes the following:


 89 GSCAM_INSTALL = " \
 90   gscam \
 91   nodelet \
 92   cv-bridge \
 93   roscpp \
 94   theora-image-transport \
 95   sensor-msgs \
 96   camera-calibration-parsers \
 97   camera-info-manager \
 98 "

 
99
100 IMAGE_INSTALL += " \
101   ${FIRMWARE_INSTALL} \
102   ${SYSTEM_TOOLS_INSTALL} \
103   ${DEV_TOOLS_INSTALL} \
104   ${NETWORK_TOOLS_INSTALL} \
105   ${MEDIA_TOOLS_INSTALL} \
106   ${GRAPHICS_LIBS} \
107   ${UTILITIES_INSTALL} \
108   ${GSCAM_INSTALL} \
109 "



The COM recognizes the webcam (Microsoft LifeCam VX3000) and assigns it to /dev/video0.

I then install some missing plugins:

$ smart update
$ smart install gst
-plugins-good-video4linux2

and source the environmental variable:

$ export GSCAM_CONFIG="v4l2src device=/dev/video0 ! video/x-raw-rgb ! ffmpegcolorspace"

but upon launching the gscam node, I am stuck at the following error message:

root@overo:~# rosrun gscam gscam
[ INFO] [1432936018.001607854]: Using gstreamer config from env: "v4l2src device=/dev/video0 ! video/x-raw-rgb ! ffmpegcolorspace"
[ INFO] [1432936018.140851232]: using default calibration URL
[ INFO] [1432936018.144604670]: camera calibration URL: file:///home/root/.ros/camera_info/camera.yaml
[ INFO] [1432936018.147747792]: Unable to open camera calibration file [/home/root/.ros/camera_info/camera.yaml]
[ WARN] [1432936018.151226588]: Camera calibration file /home/root/.ros/camera_info/camera.yaml not found.
[ INFO] [1432936018.153820427]: Loaded camera calibration from

** (gscam:1952): CRITICAL **: gst_app_sink_set_caps: assertion 'GST_IS_APP_SINK (appsink)' failed

** (gscam:1952): CRITICAL **: gst_base_sink_set_sync: assertion 'GST_IS_BASE_SINK (sink)' failed

(gscam:1952): GStreamer-CRITICAL **: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (dest)' failed
[FATAL] [1432936020.927885414]: GStreamer: cannot link launchpipe -> sink
[FATAL] [1432936020.931242147]: Failed to initialize gscam stream!

Based on the error I suspected that GStreamer was the problem, so I ran and installed:
root@overo:~# gst-launch v4l2src device=/dev/video0 ! video/x-raw-rgb ! ffmpegco
WARNING
: erroneous pipeline: no element "ffmpegcolorspace"
root@overo
:~# smart install gst-plugins-base-ffmpegcolorspace

Now launching gscam again gives the following:
root@overo:~# rosrun gscam gscam
[ INFO] [1432936847.626166516]: Using gstreamer config from env: "v4l2src device=/dev/video0 ! video/x-raw-rgb ! ffmpegcolorspace"
[ INFO] [1432936847.802852723]: using default calibration URL
[ INFO] [1432936847.806423066]: camera calibration URL: file:///home/root/.ros/camera_info/camera.yaml
[ INFO] [1432936847.811702291]: Unable to open camera calibration file [/home/root/.ros/camera_info/camera.yaml]
[ WARN] [1432936847.815394697]: Camera calibration file /home/root/.ros/camera_info/camera.yaml not found.
[ INFO] [1432936847.819422776]: Loaded camera calibration from

** (gscam:2019): CRITICAL **: gst_app_sink_set_caps: assertion 'GST_IS_APP_SINK (appsink)' failed

** (gscam:2019): CRITICAL **: gst_base_sink_set_sync: assertion 'GST_IS_BASE_SINK (sink)' failed

(gscam:2019): GStreamer-CRITICAL **: gst_bin_add: assertion 'GST_IS_ELEMENT (element)' failed
[FATAL] [1432936851.527239271]: gst_bin_add() failed
[FATAL] [1432936851.531999729]: Failed to initialize gscam stream!


It looks like it is probably a GStreamer problem, any pointers or suggestions will be much appreciated!
William

Ash Charles

unread,
Jun 2, 2015, 8:00:56 PM6/2/15
to meta...@googlegroups.com
HI William,

I played around with a JPEG-webcam using GSCAM.  I needed to make two tweaks.
1. Install the gstreamer appsink package i.e. "smart install
gst-plugins-base-app".  It looks like [1] gscam is tacking this plugin
onto the end of the gstreamer pipeline.
2. Specify the (undocumented) 'image_encoding' parameter as 'jpeg'.
For this, I grabbed the example launch [2] file and added a "<param
name="image_encoding" value="jpeg"/>" line.  Perhaps unnecessarily, I
also tweaked the gstreamer pipeline and disabled sync_sink so my
launch file looked like this:
<launch>
  <!-- This launchfile should bring up a node that broadcasts a ros image
       transport on /webcam/image_raw -->

  <arg name="DEVICE" default="/dev/video0"/>
  <!-- The GStreamer framerate needs to be an integral fraction -->
  <arg name="FPS" default="5/1"/>
  <arg name="PUBLISH_FRAME" default="false"/>

  <node ns="v4l" name="gscam_driver_v4l" pkg="gscam" type="gscam"
output="screen">
    <param name="camera_name" value="default"/>
    <param name="gscam_config" value="v4l2src device=$(arg DEVICE) !
image/jpeg,framerate=$(arg FPS) "/>
    <param name="frame_id" value="/v4l_frame"/>
    <param name="sync_sink" value="false"/>
    <param name="image_encoding" value="jpeg"/>
  </node>

  <node if="$(arg PUBLISH_FRAME)" name="v4l_transform" pkg="tf"
type="static_transform_publisher" args="1 2 3 0 -3.141 0 /world
/v4l_frame 10"/>
</launch>


[1] https://github.com/ros-drivers/gscam/blob/master/src/gscam.cpp
[2] https://raw.githubusercontent.com/ros-drivers/gscam/master/examples/v4l.launch

HTH,

Ash

William Phan

unread,
Jun 4, 2015, 8:34:07 PM6/4/15
to meta...@googlegroups.com
Thanks Ash!

For anyone following along, using Ash's fix no longer requires the ffmpegcolorspace plugin for gstreamer, nor the need to set GSCAM_CONFIG.

Oh and it appears you also need gscam installed on the host machine (from source if you're on Indigo, or with sudo apt-get install ros-hydro-gscam on Hydro.

To get a simple video stream:
On the Overo:

$ roslaunch gscam v4l.launch

On the host machine:
$ rosrun image_view image_view image:=/v4l/camera/image_raw compressed

Christoph Schultz

unread,
Jun 12, 2015, 4:01:27 PM6/12/15
to meta...@googlegroups.com
Hi Ash, hi William,

thanks for the hints! It helped me quite a lot :-)

I had the same issue on an Edison build with meta-ros.

It worked fine after installing the gst plugins manually. I basically needed to 'bitbake gst-plugins-good-video4linux2' and 'bitbake gst-plugins-base-app', copy them from build/tmp/deploy/ipk/core2-32 to a repository (including the Package files in that directory) and could finally install them on the Edison directly using opkg install gst-plugins-(...).

What I was missing was a valid launch file as I got always some errors without the correct parameters in the launch file.

@Lukas: Can't we add another gscam-full_${PV}.bb recipe that includes those two plugins, so the ROS tutorials run without any manual updates? I would expect that most try with a simple USB-webcam first, leaving some more exotic HW for further trials...

Best regards
Christoph

Lukas Bulwahn

unread,
Jul 20, 2015, 1:24:58 AM7/20/15
to meta...@googlegroups.com, schul...@gmail.com
Hi Christoph,

sorry for the late response. I was quite busy, and answering emails were of secondary priority. You are free to enhance the current recipes, and open a pull request for the meta-ros repository. Kristof and I will then review and merge it.

Best regards,

Lukas
Reply all
Reply to author
Forward
0 new messages