This website uses browsing/session and functional cookies to ensure you get the best experience. Learn More

YARP Tutorial

From Wiki for iCub and Friends
Jump to: navigation, search
Yarp-yal01.png

Contents


Getting Started

  • YARP Server Check - make sure all the computers you are working with can find the YARP "name server".

Communicating

  • YARP Read and Write - If you have two computers sitting beside each other on a local network, you can try communicating between them using YARP. Maybe team up with a colleague for this.
  • For more explanation on what is going on here, read Port tutorial 1.
  • Try out some examples in $YARP_ROOT/example/os/
  • If you like, you can try playing a multi-user Game.

Image Processing

  • Then you can work on The Kibitzer, a project to process data coming from a robot head.

The Fake and Real Robot

(Wait for a teaching assistant to ask you to read this section.)

  • Read information here on the Fakebot, a fake robot "head" to test on.
  • The real robot camera is at:
 /icub/cam/left
  • (Check with teaching assistant if the robot is really running before trying to connect).
  • Please use "mcast" (broadcast) when reading from the robot camera. This is more efficient when many people are viewing it. All you need to do is add "mcast" to your connection commands:
 yarp connect /icub/cam/left /YOUR/PORT mcast

or from code:

 Network::connect("/icub/cam/left","/YOUR/PORT","mcast");
  • When you are ready to control the robot, and the teaching assistant says the robot is ready, read Output your target

Reference tutorials

Instructions for the Instructor

The notes here are to assist whoever is running this tutorial. Students can ignore this, unless they are interested in what's running in the background.

You'll need to dedicate a computer to run some servers on. On that machine, do the following (instructions assume a Linux machine):

  • Start a yarp server, if you don't have one running already in the lab.
 yarp server
  • Start a server for the online Game.
 cd $YARP_ROOT/example/game/game_server
 cmake .
 make
 ./game_server
 # game is available on port /game
  • Start a "fakebot" fake robot server.
 cd $YARP_ROOT/example/tutorial
 cmake .
 make
 # edit fakebot.ini, remove /USERNAME from port names if present
 ./run_fakebot --file fakebot.ini --name fakebot
 # fakebot is available on port /fakebot/camera, /fakebot/motor/rpc:i
 # type help to "yarp rpc /fakebot/motor/rpc:i
  • Start a "tracker" process - this isn't strictly necessary, but it gives a safe proxy for controlling the icub robot.
 cd $ICUB_ROOT/src/tracker
 cmake .
 make
 tracker --rel
 # students can send summer-school style messages to /tracker/pos
  • Make a view:
 yarpview --name /admin/view --out /admin/clicker
  • Connect things
 yarp connect /fakebot/camera /tracker/img
 yarp connect /tracker/img /admin/view
 yarp connect /admin/clicker /tracker/pos
 yarp connect /tracker/pos /fakebot/motor/rpc:i

Ideally, a physical robot will also be set up for the students to try things out on. There are no easy instructions on this, that depends on you. The tutorial assumes the iCub robot is available, with images on port:

 /icub/cam/left

and that "summer school" format messages can be sent to control the head at:

 /icub/target

(see Output your target)

Personal tools
Namespaces

Variants
Actions
Navigation
Print/export
Toolbox