Yet Another Robot Platform
No Matches
Decide on what name server to use

Both YARP and ROS usually operate with a name server to help track what ports/topics/nodes are where (but see also Using YARP without a name server).

We assume you have ROS's usual name server "roscore" running somewhere. Now, with YARP, you have several options:

  • You can configure YARP to use ROS's name server. So "roscore" will run, but not "yarpserver". This is the best option if the bulk of the network is ROS-based and you have just one or two YARP modules you want to hook in.
  • You can configure YARP's name server to talk to ROS's name server. So both "roscore" and "yarpserver" will run. This is the best option for mixed networks, with many YARP modules and many ROS modules.
  • You can configure YARP clients to talk to multiple name servers, in this case the YARP server and the ROS name server. This solution works but can be confusing to understand.

For the first option, using "roscore" only, see Using YARP with roscore only. For the third option, using both name servers independently, see Configuring YARP clients to use two nameservers independently. Here we are going to the middle option, where yarpserver is configured to be ROS-aware. Setting this up is simple. Once roscore is running, and ROS_MASTER_URI is correctly set to point to it, do:

yarpserver --ros

You should see lines like these as the server starts up:

 * register "/ros" xmlrpc "" 11311

To make sure that everything has worked, start a quick test program in one console:

yarp read /testtopic@/testnode

Then in another do:

rostopic list  # /testtopic should be listed
rosnode list   # /testnode should be listed
rostopic pub /testtopic std_msgs/String "Hello YARP" # yarp read should echo this

Using YARP with roscore only

If instructed, YARP can use ROSCORE's name server (the "roscore" program) rather than its own native name server (the "yarpserver" program). Here's how. First, make sure you have started roscore:


Make sure that the ROS_MASTER_URI environment variable is set as roscore proposes. Now, place YARP in a new namespace, called for example "/ros" itself

yarp namespace /ros

Then ask YARP to detect ROS a nameserver and save its address:

yarp detect --ros --write

This should report something along the lines of:

Reachable.  Writing.
Configuration stored.  Testing.
Looking for name server on, port number 11311
If there is a long delay, try:
  yarp conf --clean
ROS Name server /ros is available at ip port 11311

An alternative procedure is to manually configure YARP to use a ROS name server with a particular host name or ip address and port number:

yarp conf icubsrv 11311 ros

YARP ports should be usable at the point. To test this, you could run:

yarp check

Or try some of the exercises in Getting Started with YARP Ports.

YARP ports should behave as normal. One caveat: the multicast protocol requires some support from the name server that ROSCORE does not currently provide. So don't use multicast if you want to work also with ROS (or use multiple name servers).

Configuring YARP clients to use two nameservers independently

YARP has a general ability to use multiple nameservers. The trick is to set up two namespaces, for example /yarp and /ros:

yarp namespace /yarp        # Make a YARP namespace
yarp detect --write         # detect and store contact info for yarpserver
yarp namespace /ros         # Make a ROS namespace
yarp detect --ros --write   # detect and store contact info for roscore
yarp namespace /yarp /ros   # Now select *both* namespaces
# queries / registrations now go to *both* YARP and ROS as needed