Difference between revisions of "Getting YARPed"

From Wiki for iCub and Friends
Jump to: navigation, search
(Compiling YARP)
(Downloading YARP from CVS)
Line 31: Line 31:
 
* http://www.wincvs.org
 
* http://www.wincvs.org
 
* Run WinCVS, do Remote->Checkout module with:
 
* Run WinCVS, do Remote->Checkout module with:
   Modue name and path on the server: "yarp2"
+
   Module name and path on the server: "yarp2"
 
   Local folder to checkout to: anything you like, for example "c:\yarp2"
 
   Local folder to checkout to: anything you like, for example "c:\yarp2"
 
   CVSROOT: ":pserver:anonymous@yarp0.cvs.sourceforge.net:/cvsroot/yarp0"
 
   CVSROOT: ":pserver:anonymous@yarp0.cvs.sourceforge.net:/cvsroot/yarp0"

Revision as of 10:21, 17 July 2006

Why YARP?

YARP is a robotics library we will be using at the school. It helps free your code from being overly dependent on your robot hardware and processing setup. It is in a similar spirit to the player/stage project for mobile robots.

Read about YARP here: http://yarp0.sourceforge.net/

Downloading YARP as a Source Package

Download YARP here: http://yarp0.sourceforge.net/specs/dox/

Downloading YARP from CVS

We're updating YARP all the time. If you're adventurous and want to be able to keep up to date easily, you can install YARP from CVS. Follow the instructions at:

with modulename "yarp2" to get the code.

Here's a summary of the commands needed if you have command-line cvs:

 cvs -d:pserver:anonymous@yarp0.cvs.sourceforge.net:/cvsroot/yarp0 login
 cvs -z3 -d:pserver:anonymous@yarp0.cvs.sourceforge.net:/cvsroot/yarp0 co -P yarp2

The code should appear in a subdirectory called yarp2. See yarp2/README for compilation tips.

If you use Microsoft Windows, and don't use Cygwin, we recommend WinCvs (version>=2.0):

 Module name and path on the server: "yarp2"
 Local folder to checkout to: anything you like, for example "c:\yarp2"
 CVSROOT: ":pserver:anonymous@yarp0.cvs.sourceforge.net:/cvsroot/yarp0"

On Unix, you probably already have the command line "cvs" program.

Compiling YARP

Once you have downloaded YARP, you can compile it using CMake. See the README file in the source code for details. In summary, simply run CMake in the directory YARP is in, check that it finds ACE correctly (and help it if not), and when everything is configured build the code with "make" in Unix or whatever compiler you are using for Windows.

Testing YARP

On Unix, you can type "make test" to run some tests.

In the "bin" directory after compilation (possibly under a "debug" or "release" subdirectory) you should find some executables, including one called "yarp" or "yarp.exe".

On Unix, enter the directory containing the yarp executable and put it in your PATH using one of:

 export PATH=$PWD:$PATH
 setenv PATH $PWD:$PATH

(on Windows, set the environment variable called PATH, and run cmd.exe).

Type "yarp" or "yarp.exe". You should see this message:

 This is the YARP network companion. 
 Call with the argument "help" to see a list of ways to use this program.

If this works, type "yarp check" or "yarp.exe check". You should see:

 yarp: ==================================================================
 yarp: === Trying to register some ports
 yarp: no connection to nameserver
 yarp: no connection to nameserver, scanning mcast
 yarp: Polling for name server (using multicast), try 1 of max 3
 ++++++++++++++++++++++++++++++++++++++++
 ++++++++++++++++++++++++++++++++++++++++
 yarp: No response to search for server
 yarp: Polling for name server (using multicast), try 2 of max 3
 ++++++++++++++++++++++++++++++++++++++++
 ++++++++++++++++++++++++++++++++++++++++
 yarp: No response to search for server
 yarp: Polling for name server (using multicast), try 3 of max 3
 ++++++++++++++++++++++++++++++++++++++++
 ++++++++++++++++++++++++++++++++++++++++
 yarp: No response to search for server
 yarp: === NO NAME SERVER!  Switching to local, fake mode
 yarp: ==================================================================
 yarp: === Trying to connect some ports
 yarp: Receiving input from /tmp/port/2 to /tmp/port/1 using tcp
 yarp: Sending output from /tmp/port/2 to /tmp/port/1 using tcp
 yarp: ==================================================================
 yarp: === Trying to write some data
 yarp: ==================================================================
 yarp: === Trying to read some data
 yarp: *** Read number 42
 yarp: ==================================================================
 yarp: === Trying to close some ports
 yarp: Removing input from /tmp/port/2 to /tmp/port/1
 yarp: Removing output from /tmp/port/2 to /tmp/port/1
 yarp: *** YARP seems okay, but there is no name server available.

Now start four terminals, called A-D. Do the following (where "yarp" may need to be replaced with "yarp.exe"):

 [in terminal A] yarp server
 [in terminal B] yarp check

Terminal B should run some tests, as before, then say yarp is "ok". Now do the following, leaving terminal A untouched:

 [in terminal B] yarp read /read
 [in terminal C] yarp write /write verbatim /read

Now type some stuff into terminal C and hit return. That stuff should be echoed on terminal B. Now try:

 [in terminal D] yarp disconnect /write /read

Now if you type stuff in terminal C, it no longer appears on B. Now try:

 [in terminal D] yarp connect /write /read

Now if you type stuff in terminal C, it appears on B again.

If you've gotten this far, things are looking good!

There's a slightly longer test at the end of this page:

It requires that you set the "CREATE_GUIS" and "CREATE_DEVICE_LIBRARY" flags in cmake while compiling (use "ccmake ." to do this on Unix, or just rerun the cmake GUI on windows).

There's a very simple code example at:

This and other examples are in the "example" subdirectory of the source code.

Troubleshooting

YARP Installation Troubleshooting Tips