Skip to content

Webcam to Face Example

Chris Gindel edited this page Nov 12, 2013 · 3 revisions

The idea is just to get your webcam into a ROS standard sensor_msgs/Image message, and then publish it on /robot/xdisplay, which takes Image messages and puts them on a screen.

To get the webcam image as a ROS sensor_msgs/Image, we use a library called gscam from Brown's perception library:

    $ sudo apt-get install ros-electric-brown-perception    

To just get it to run:

    $ ./init.sh baxter.local
    $ export ROS_HOSTNAME=`hostname`
    $ roscd gscam
    $ cd bin
    $ ls /dev/video*
    /dev/video0
    $ export GSCAM_CONFIG="v4l2src device=/dev/video0 ! video/x-raw-rgb,framerate=30/1 ! ffmpegcolorspace"
    $ rosrun gscam gscam /gscam/image_raw:=/robot/xdisplay

Explanation:
The steps are, from an init'd environment, cd to the new package, figure out what webcams are connected and setup your configuration appropriately, then start the streamer with a topic remapping from the standard topic it publishes webcam images on to the receiving xdisplay topic for Baxter's screen.

Clone this wiki locally