Images from the Robot

From Wiki for iCub and Friends
Jump to: navigation, search

Images from one of the robots are available on port:

 /james/cam/left

(this service may be brought down from time to time for maintenance, we'll tell you when it is stable).

You can view these images with:

 [terminal 1] yarpview --name /USERNAME/viewer
 [terminal 2] yarp connect /james/cam/left /USERNAME/viewer mcast

Notice the "mcast" at the end of the "yarp connect" line. This is not necessary, but will help us supply images to everyone without swamping the network. Please use "mcast" for large image data travelling to many targets.

For mcast to work reliably on your machine you may need to modify some system settings. If yarp runs into problems it will print a suggestion to your console. For Linux, you can increase buffering for packets by doing (as superuser):

 sysctl -w net.core.rmem_max=8388608

Example code

Lorenzo has written an example program that takes an image stream on one port, puts a moving dot on it, and then sends that stream out on another port. The code is in:

 iCub/src/vvv/nat/image_sink

(You will need to tell cmake where your build of YARP is).

Instructions for using the program are here:

 http://eris.liralab.it/vvv/Image_sink_example

When the program is compiled, you can it like this:

 imagesink --name /USERNAME/image

This will display something like:

 yarp: Port /USERNAME/image/in listening at tcp://10.0.0.113:10092
 yarp: Port /USERNAME/image/out listening at tcp://10.0.0.113:10102

And that's all. It is waiting for images to come in on "/USERNAME/image/in". So we'll connect this to a camera feed:

 yarp connect /james/cam/left /USERNAME/image/in mcast

Now let's start a viewer for the output:

 yarpview --name /USERNAME/viewer

Now let's connect the output of Lorenzo's program to that viewer:

 yarp connect /USERNAME/image/out /USERNAME/viewer

You should see an image of our room with a dot moving across it.