From Wiki for iCub and Friends
Revision as of 16:04, 10 June 2014 by Randaz (talk | contribs) (Robot configuration (on the PC104))
Jump to: navigation, search

The utility yarp-config allows to customize robot and context files, by copying the files from installation to the user private directories (we call this importing).

This tool knows from the ResourceFinder where all files are located and where to put them given the system and user's environment.

The main commands are context to handle files in context directories and robot to handle robot directories.

 yarp-config context --list

Shows all the contexts visible to the ResourceFinder. To limit the list to the context in the installed locations you can add:

 yarp-config context --list --installed

To import contexts to the home directory:

 yarp-config context --import <context-name> 
 yarp-config context --import <context-name> file1 file2
 yarp-config context --import-all

The first two commands affects individual contexts, and allow to import a whole context (first command) or only some specific files (second one); the third command affects all contexts (not recommended).

After you finished importing a context you can go to your local private directory (in Linux usually: $HOME/.local/share/yarp/contexts/) and edit it.

The utility works similarly for robot specific files:

 yarp-config robot --list
 yarp-config robot --import <robot-name> 
 yarp-config robot --import <robot-name> file1 file2

In any case:

 yarp-config help

provides an explanation of the commands supported by the yarp-config tool.


Suppose you have installed both YARP and iCub.


 yarp-config context --list

The result should be something like:

* Directory : /home/nat/.local/share/yarp/contexts
* Directory : /usr/local/share/yarp/contexts
* Directory : /usr/local/share/iCub/contexts

This shows us that:

  • The local user directory /home/nat/.local/share/yarp/contexts is empty, i.e. no contexts have been imported
  • The shared installation directory for YARP /usr/local/share/yarp/contexts contains one context: yarpscope
  • The shared installation directory for iCub /usr/local/share/iCub/contexts contains several contexts

To be able to modify a contexts, for example to customize one parameter you have to first import it in the user directory. Suppose for example you want to customize the context cartesianSolver:

 yarp-config context --import cartesianSolver

This is the output you should get:

Copied context cartesianSolver from 
/usr/local/share/iCub/contexts/cartesianSolver to 
Current locations for this context: /home/nat/.local/share/yarp/contexts/cartesianSolver /usr/local/share/iCub/contexts/cartesianSolver

Now type:

 yarp-config context --list 

To verify that cartesianSolver is indeed now present in /home/nat/.local/share/yarp/contexts

This means that files from cartesianSolver in /home/nat/.local/share/yarp/contexts/ will take precedence over the ones in /usr/local/share/iCub/contexts. This is indeed what we wanted since the latter contains the default values we are going to modify to customize the behavior of the module.

To undo you can remove the context:

 yarp-config context --remove cartesianSolver

Robot configuration (on the PC104)

The following rules apply to a robot with standard laptop installation.

  • repository files are located in the folder:

If you want to do permanent modification to the configuration of your robot, you need to edit files located in the above path and commit them to the repository. This path is not searched by robotInterface.

  • when the user executes the following commands:

on the pc104 from the folder /usr/local/src/robot/icub-main/build-pc104, files are copied from the above directory (/usr/local/src/robot/icub-main/app/robots/<YARP_ROBOT_NAME>) to the folder:


RobotInterface tipically searches the configuration files of the robot in this folder. It's important to remember that this folder is overwritten everytime the user ru ns ccmake/make. So build-pc104/share is a good place only for testing a new configuration, but not to make permanent changes.

  • if you want to make permanent changes, but you still do not want to commit files to repository you can copy them to the local user directoy (which has priority respect the the build-pc104/share folder). For this purpose, you can use the yarp-config tool to copy ALL the robot files:
yarp-config robot import <YARP_ROBOT_NAME>

If you want to copy just a subset of files, leaving the others in the build-pc104/share folder, you can use the following command:

yarp-config robot import <YARP_ROBOT_NAME> <file1> <file2>
  • Summarizing, when you start robotInterface (or iCubInterface) on the PC104, robot configuration files are searched in the following order:
 1.in the current directory .
 2.in the local user directory /home/icub/.local/share/yarp/robot/<YARP_ROBOT_NAME>
 3.in the build directory /usr/local/src/robot/icub-main/build-pc104/share/<YARP_ROBOT_NAME>
  • If you are not sure about which files are currently used by your robotInterface, you can look at log:
robotInterface &> log.txt

at the beginning of the log, you'll find the full path used by robotInterface.

found /usr/local/src/robot/iCub/main/build-pc104/share/iCub/robots/iCubGenova01/./icub_all.xml