Create simple ROS package

Setup environment for own packages

When package was created there was a warning shown

WARNING: current working directory is not on ROS_PACKAGE_PATH!
Please update your ROS_PACKAGE_PATH environment variable.

Environment variable ROS_PACKAGE_PATH keeps paths where packages can be found by ROS. Command “export” sets or shows (with assistance of a command “grep”) variables

export | grep ROS_PACKAGE_PATH


At this moment ROS_PACKAGE_PATH points to two folders where ROS supposed to find packages (divided in variable by semicolon): /opt/ros/hydro/share and /opt/ros/hydro/stacks

Add a folder with own ROS-packages to the variable ROS_PACKAGE_PATH using a command “export”. This command assigns to a variable ROS_PACKAGE_PATH a new value with three paths divided by semicolons

export ROS_PACKAGE_PATH=/home/user1/ros-sandbox:/opt/ros/hydro/share:/opt/ros/hydro/stacks

The same result can be achieved using symbol “~” (“tilda”) representing a home directory of this user and with adding current value of the variable ROS_PACKAGE_PATH lead by symbol “$” (the value is not surrounded with quotes). In both cases result is the same



Every time a Terminal is started – it’s needed to run this “export” command with setting of the path to the “~/ros-sandbox” folder. There is a way to avoid this annoying work – add this command in the script “.bashrc” located in the home-folder

echo “export ROS_PACKAGE_PATH=~/ros-sandbox:$ROS_PACKAGE_PATH”>>~/.bashrc

Check if this command has been added to the end of this script file

cat ~/.bashrc



hint Command 'cat'

Command cat displays content of the file specified as an argument. This command has even more features – e.g. it can concatenate several files and display its content. For details run “man cat” in the Terminal.