Debugging problems with yarprun

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

Make sure all environment variables are set correctly when you run yarprun. In addition new process are executed with xterm, so you have to make sure the xterm sources your bashrc (or equivalent).

  • Check the environment of processes executed by yarprun:
 yarprun --on node1 --cmd "printenv" --hold --stdio node2

Where node1 and node2 match your setup.

Check that the console from which you run yarprun has the correct environment:

  • On the console from which you run the yarprun server type:
printenv

or

printenv | grep PATH

check PATH and make sure YARP_DIR/bin and ICUB_DIR/bin are in there

  • Check that when running non-interactive xterm has correct environment:
xterm -hold -e "printenv"

or

xterm -hold -e "printenv | grep PATH"


Possible solutions

It is possible that even if the .bashrc file is set correctly xterm does not use it. Since this behavior has been noticed sporadically, a possible interpretation is that it depends on the Linux distribution/version of xterm (just guessing).

In any case this should solve it:

  • put the desired variables in your .bashrc_iCub file, such as
 export CODE=/home/yourname/code
 export YARP_ROOT=$CODE/yarp
 export YARP_DIR=$YARP_ROOT/build
 export ICUB_ROOT=$CODE/icub-main
 export ICUB_DIR=$CODE/icub-main/build
 export YARP_DATA_DIRS=$YARP_DIR/share/yarp:$ICUB_DIR/share/iCub
 export PATH=$PATH:$YARP_DIR/bin:$ICUB_DIR/bin
 export ICUB_ROBOTNAME=your_robotname

Now you can fix your bashrc so that it executes .bashrc_iCub, remember to remove duplicated "export" commands.

  • before the line that says "[ -z "$PS1" ] && return" in .bashrc, add the following:
 # per-user environment variables (non-interactive and interactive modes)
 source $HOME/.bashrc_iCub

It is important to add this line before the [-z "$PS1"] && return line.

Another reported solution is to edit /etc/environment.

This link might be useful: http://stefaanlippens.net/bashrc_and_others