ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How many ROS paths can ~/.bashrc file store? Will the path influence each other

asked 2016-11-22 19:48:58 -0600

chaoqunzhuoyue gravatar image

updated 2016-11-23 02:24:28 -0600

mgruhler gravatar image

I met a strange problem. This is the path in my bashrc


#source /opt/ros/indigo/setup.bash
#export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/home/chaoqun/catkin_test/src/ORB_SLAM
#source /home/chaoqun/active_exploring/devel/setup.bash
#source /home/chaoqun/catkin_test/devel/setup.bash
#source /home/chaoqun/active_exploring/devel/setup.bash

And when I typed echo $ROS_PACKAGE_PATH in the terminal ,I got nothing, that's right according to my knowledge even I have to restart the terminal instead of typed soure ~/.bashrc while if I change the bashrc like this:


source /opt/ros/indigo/setup.bash
#export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/home/chaoqun/catkin_test/src/ORB_SLAM
source /home/chaoqun/catkin_test/devel/setup.bash
#source /home/chaoqun/active_exploring/devel/setup.bash

when I echo the ROS path ,I got:

/home/chaoqun/catkin_test/src:/home/chaoqun/active_exploring/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks

It's really strange why I got the path :/home/chaoqun/active_exploring/src:, it is clearly that I have moved this path in bashrc file. why I still get this ? But If I write like below:


source /opt/ros/indigo/setup.bash
#export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/home/chaoqun/catkin_test/src/ORB_SLAM
#source /home/chaoqun/catkin_test/devel/setup.bash
source /home/chaoqun/active_exploring/devel/setup.bash

Then I can get desired output:

/home/chaoqun/active_exploring/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks

What's wrong?

edit retag flag offensive close merge delete

Comments

Please use the preformatted text button (with 1s and 0s) to copy in terminal output.

mgruhler gravatar image mgruhler  ( 2016-11-23 02:23:09 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-11-23 03:30:45 -0600

mgruhler gravatar image

You should not manually adapt the ROS_PACKAGE_PATH. This will get overwritten every time you source a setup.bash. And there, last sourced setup.bash wins.

You need to chain your workspaces correctly.

Let me give you a short example.

You start with source /opt/ros/indigo/setup.bash, this gives you:

/opt/ros/indigo/share:/opt/ros/indigo/stacks

You now create a workspace in ~/catkin_ws, do a catkin_make and source ~/catkin_ws/devel/setup.bash. This gives you:

/home/USER/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks

You will get this every time you source ~/catkin_ws/devel/setup.bash, no matter which other setup.bash you sourced before.

If you now create another workspace, catkin_ws_overlay you can do two things:

  1. source /opt/ros/indigo/setup.bash, catkin_make your new ws catkin_ws_overlay and soruce ~/catkin_ws_overlay/devel/setup.bash. This will give you

    /home/USER/catkin_ws_overlay/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks
    
  2. or source ~/catkin_ws/devel/setup.bash, catkin_make your new ws catkin_ws_overlay and source ~/catkin_ws_overlay/devel/setup.bash. This will give you

    /home/USER/catkin_ws_overlay/src:/home/USER/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks
    

    with this, you have "chained" your workspaces such that it first searches catkin_ws_overaly, then catkin_ws and then /opt/ros.

If you want to undo a chaining, simply delete the build, devel and (potentially) install folder, source the setup.bash you want and compile again.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-11-22 19:48:58 -0600

Seen: 189 times

Last updated: Nov 23 '16