Skip to content

Bashrc_icub

Serena Ivaldi edited this page Jul 19, 2017 · 6 revisions

It may be useful to have all the environment variables in one single file, called bashrc_icub, that you can use to configure your environment. It is good practice to have this file in your local folder, where you can edit it easily. For example in \home\icub\software. You can load this file in your bashrc. Just add to the top of your bashrc file these lines:

# iCub software
  if [ -f /home/icub/software/bashrc_icub ]; then
      . /home/icub/software/bashrc_icub
  fi

IMPORTANT: add them at the beginning of the file, before the " interactive" session comment.

The bashrc_icub should be used to set important environment variables, such as YARP_ROBOT_NAME (which defines the robot configuration files you use) or YARP_DATA_DIRS pointing at resource files. The PATH and LD_LIBRARY_PATH as well. It is important to configure the environment coherently with the way you install the software. If you generally do make and make install, you should choose a location (in your home folder please!! for example /home/icub/software) where to have your installed files, and add this to the PATH (for example home/icub/software/bin). If you just compile with make without doing the install, then you need to add the build/bin folders of your projects to the PATH. I prefer the install solution, but it's up to you and your installation.

This is a copy-paste from the bashrc in icub01. It is to provide a template for people installing the robot... Since the projects evolve quickly together with their installation rules, check the project's READMEs if you find troubles.

#BASHRC_ICUB:

echo "Exporting iCub environment variables from specific file.."

# MATLAB
#----------------------------------------
export PATH=$PATH:/home/icub/Documents/MATLAB/bin

#### yarp & icub related variables ###

export code=/home/icub/software/src


#GAZEBO VARIABLES
#----------------------------------------
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:/home/icub/software/lib

if [ -z "$GAZEBO_MODEL_PATH" ]; then
    export GAZEBO_MODEL_PATH=/home/icub/software/src/icub-gazebo
else
    export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/home/icub/software/src/icub-gazebo:$code/icub-gazebo-wholebody/models:/home/icub/software/share/gazebo/models
fi

#Don't work yet
#export  GAZEBO_RESOUCRCE_PATH = ${GAZEBO_RESOUCRCE_PATH}:/home/icub/software/share/gazebo/worlds


#YARP
#----------------------------------------

#choose your icub robot by commenting the robot that you do not use
#by default you can use iCub in gazebo
#export YARP_ROBOT_NAME=icubGazeboSim
#export YARP_ROBOT_NAME=icubSim
#export YARP_ROBOT_NAME=iCubNancy01Resibots
export YARP_ROBOT_NAME= iCubNancy01

export YARP_ROOT=$code/yarp
export YARP_DIR=$YARP_ROOT/build

#not sure if needed - leave comment for the moment
#export YARP_CONF=/home/icub/.yarp

# comment if not using python bindings
#export PYTHONPATH=/home/icub/software/src/yarp/build/lib/python:~/software/yarp/build/bindings:$PYTHONPATH


#ICUB
#----------------------------------------
export ICUB_ROOT=$code/icub-main
export ICUB_DIR=$ICUB_ROOT/build


#ICUB-CONTRIB-COMMON
#----------------------------------------
export ICUBcontrib_DIR=/home/icub/software
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/home/icub/software

#CODYCO
#----------------------------------------
export CODYCO_SUPERBUILD_ROOT=$code/codyco-superbuild
export CODYCO_SUPERBUILD_DIR=$CODYCO_SUPERBUILD_ROOT/build

#not sure if needed - leave comment for the moment
#export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$CODYCO_SUPERBUILD_DIR/install/lib


# YARP_DATA_DIRS
#----------------------------------------

## WITH INSTALLATION (MAKE + MAKE INSTALL)
export YARP_DATA_DIRS=$YARP_DATA_DIRS:$code/share/yarp:$code/share/iCub:$code/share/iCUBcontrib
export YARP_DATA_DIRS=$YARP_DATA_DIRS:$code/share/speech

## NO INSTALLATION (MAKE only)
#export YARP_DATA_DIRS=$YARP_DATA_DIRS:$YARP_DIR/share/yarp:$ICUB_DIR/share/iCub:$CODYCO_SUPERBUILD_DIR/install/share/codyco:$icub_apps

# to check
export YARP_DATA_DIRS=$YARP_DATA_DIRS:$CODYCO_SUPERBUILD_ROOT/build/install/share/codyco


# ICUB-APPS
#----------------------------------------
### add here the location of your app files
#export crawling_app=$code/serena-github/iCub_crawling/app

### add to this variable the location of your apps
#export icub_apps=$icub_apps:$crawling_app



# PATH
#----------------------------------------

## WITH INSTALLATION (MAKE + MAKE INSTALL)
export PATH=$PATH:/home/icub/software/bin

## NO INSTALLATION (MAKE only)
#export PATH=$PATH:$YARP_DIR/bin:$ICUB_DIR/bin

# to check if it is still local, without installation
export PATH=$PATH:$CODYCO_SUPERBUILD_ROOT/build/install/bin 


# LD_LIBRARY 
#----------------------------------------
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/icub/software/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODYCO_SUPERBUILD_ROOT/build/install/lib/



#----------------------------------------
echo "Welcome $YARP_ROBOT_NAME!"

This is icub01 bashrc (machine of our cluster)

#BASHRC_ICUB:

#BASHRC_ICUB:

echo "Exporting iCub environment variables from specific file.."

# MATLAB
#----------------------------------------
#export PATH=$PATH:/home/icub/Documents/MATLAB/bin
export PATH=$PATH:/home/icub/Documents/MATLAB2015b/bin

alias matlab2015b="cd ~/Documents/MATLAB && LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab"

#launch it with:
#LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6" matlab2015b
#alias matlab2015b="/home/icub/Documents/MATLAB2015b/bin/matlab"

#### yarp & icub related variables ###

export code=/home/icub/software/src



#GAZEBO VARIABLES
#----------------------------------------
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:/home/icub/software/lib

if [ -z "$GAZEBO_MODEL_PATH" ]; then
    export GAZEBO_MODEL_PATH=$code/icub-gazebo:$code/icub-gazebo-wholebody/models:/home/icub/software/share/gazebo/models
else
    export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$code/icub-gazebo:$code/icub-gazebo-wholebody/models:/home/icub/software/share/gazebo/models
fi

#if [ -z "$GAZEBO_RESOURCE_PATH" ]; then
#    export GAZEBO_RESOURCE_PATH=/home/icub/software/share/gazebo/worlds
#else
#    export GAZEBO_RESOURCE_PATH=$GAZEBO_RESOURCE_PATH:/home/icub/software/share/gazebo/worlds
#fi


#YARP
#----------------------------------------

#choose your icub robot by commenting the robot that you do not use
#by default you can use iCub in gazebo
#export YARP_ROBOT_NAME=icubGazeboSim  #to be used with Gazebo and codyco in simulink
#export YARP_ROBOT_NAME=icubSim
#export YARP_ROBOT_NAME=iCubNancy01Resibots
export YARP_ROBOT_NAME=iCubNancy01     #our real iCub

export YARP_ROOT=$code/yarp
export YARP_DIR=$YARP_ROOT/build

#not sure if needed - leave comment for the moment
#export YARP_CONF=/home/icub/.yarp

# comment if not using python bindings
#export PYTHONPATH=/home/icub/software/src/yarp/build/lib/python:~/software/yarp/build/bindings:$PYTHONPATH


#ICUB
#----------------------------------------
export ICUB_ROOT=$code/icub-main
export ICUB_DIR=$ICUB_ROOT/build


#ICUB-CONTRIB-COMMON
#----------------------------------------
export ICUBcontrib_DIR=/home/icub/software
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$ICUBcontrib_DIR

#CODYCO
#----------------------------------------
export CODYCO_SUPERBUILD_ROOT=$code/codyco-superbuild
export CODYCO_SUPERBUILD_DIR=$CODYCO_SUPERBUILD_ROOT/build

#not sure if needed - leave comment for the moment
#export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$CODYCO_SUPERBUILD_DIR/install/lib

#icub standing up 
#see https://github.com/robotology-playground/icub-gazebo-wholebody/tree/master/worlds/icub_standup_world
#alias gazebo_standup="cd $CODYCO_SUPERBUILD_ROOT/build/install/share/gazebo/worlds/icub_standup_world && gazebo -slibgazebo_yarp_clock.so" 
alias gazebo_standup="cd $code/icub-gazebo-wholebody/worlds/icub_standup_world && gazebo -slibgazebo_yarp_clock.so" 



# YARP_DATA_DIRS
#----------------------------------------

## WITH INSTALLATION (MAKE + MAKE INSTALL)
export YARP_DATA_DIRS=$YARP_DATA_DIRS:/home/icub/software/share/yarp:/home/icub/software/share/iCub:/home/icub/software/share/ICUBcontrib
export YARP_DATA_DIRS=$YARP_DATA_DIRS:/home/icub/software/share/speech

## NO INSTALLATION (MAKE only)
#export YARP_DATA_DIRS=$YARP_DATA_DIRS:$YARP_DIR/share/yarp:$ICUB_DIR/share/iCub:$CODYCO_SUPERBUILD_DIR/install/share/codyco:$icub_apps

# CODYCO (see https://github.com/robotology/codyco-superbuild#installation)
export YARP_DATA_DIRS=$YARP_DATA_DIRS:$CODYCO_SUPERBUILD_ROOT/build/install/share/codyco
#                                     :$CODYCO_SUPERBUILD_ROOT/build/install/share/yarp
#                                     :$CODYCO_SUPERBUILD_ROOT/build/install/share/iCub


# ICUB-APPS
#----------------------------------------
### add here the location of your app files
#export crawling_app=$code/serena-github/iCub_crawling/app

### add to this variable the location of your apps
#export icub_apps=$icub_apps:$crawling_app



# PATH
#----------------------------------------

## WITH INSTALLATION (MAKE + MAKE INSTALL)
export PATH=$PATH:$ICUBcontrib_DIR/bin

## NO INSTALLATION (MAKE only)
#export PATH=$PATH:$YARP_DIR/bin:$ICUB_DIR/bin

# to check if it is still local, without installation
export PATH=$PATH:$CODYCO_SUPERBUILD_ROOT/build/install/bin 


# LD_LIBRARY 
#----------------------------------------
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/icub/software/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODYCO_SUPERBUILD_ROOT/build/install/lib/





#----------------------------------------
echo "Welcome $YARP_ROBOT_NAME!"