Ask Your Question
0

roscd does not return a specific workspace after sourcing setup.bash

asked 2017-02-07 03:47:49 -0500

marcofe gravatar image

Hi all, I run ROS Indigo on Ubuntu 14.04, and I have my catkin_ws in a given path. Everything worked perfectly until yesterday. However, yesterday I tried to set up the Matlab engine to see if it was compatible with ROS. I got some errors for some reasons, but I don't care right now. What bothers me is that now I cannot change directory on my catkin_ws anymore, through roscd, because the command redirects me to /opt/ros/indigo. Obviously, I tried to source both the corresponding devel/setup.bash again, and my ~/.bashrc after inserting the source command inside, None of the solutions worked.

So, I tried to create a second workspace, say test_catkin_ws, and after building it I sourced its devel/setup.bash. This time roscd command correctly worked and successfully redirected to test_catkin_ws/devel. However, If I try to source again the first workspace, roscd command wrongly redirects me to test_catkin_ws/devel. So, it seems that the setup.bash does not work for the first workspace, and the system redirects to the last workspace correctly sourced.

If useful, I show here the output of printenv | grep -i ros:

ROS_ROOT=/opt/ros/indigo/share/ros ROS_PACKAGE_PATH=/home/marcofe1404/Documents/Software/ROS/test_catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks:/home/marcofe1404/Documents/Software/ROS/catkin_ws/src ROS_MASTER_URI=http://localhost:11311 OLDPWD=/home/marcofe1404/Documents/Software/ROS/catkin_ws LD_LIBRARY_PATH=/home/marcofe1404/Documents/Software/ROS/test_catkin_ws/devel/lib:/opt/ros/indigo/lib:/home/marcofe1404/Documents/Software/ROS/catkin_ws/devel/lib CPATH=/home/marcofe1404/Documents/Software/ROS/test_catkin_ws/devel/include:/opt/ros/indigo/include PATH=/opt/ros/indigo/bin:/usr/local/MATLAB/R2012b:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games PWD=/home/marcofe1404/Documents/Software/ROS/test_catkin_ws/devel ROSLISP_PACKAGE_DIRECTORIES=/home/marcofe1404/Documents/Software/ROS/test_catkin_ws/devel/share/common-lisp:/home/marcofe1404/Documents/Software/ROS/catkin_ws/devel/share/common-lisp ROS_DISTRO=indigo PYTHONPATH=/home/marcofe1404/Documents/Software/ROS/test_catkin_ws/devel/lib/python2.7/dist-packages:/opt/ros/indigo/lib/python2.7/dist-packages PKG_CONFIG_PATH=/home/marcofe1404/Documents/Software/ROS/test_catkin_ws/devel/lib/pkgconfig:/opt/ros/indigo/lib/pkgconfig CMAKE_PREFIX_PATH=/home/marcofe1404/Documents/Software/ROS/test_catkin_ws/devel:/opt/ros/indigo:/home/marcofe1404/Documents/Software/ROS/catkin_ws/devel ROS_ETC_DIR=/opt/ros/indigo/etc/ros

Thank you in advance for whoever can help me to solve this issue.

edit retag flag offensive close merge delete

Comments

Have you tried to delete the devel folder in the first workspace and redo catkin_make?

DavidN gravatar imageDavidN ( 2017-02-07 04:06:27 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-02-07 04:10:03 -0500

gvdhoorn gravatar image

Try the following and see if it improves your situation:

  1. remove all source .. lines that you added from your .bashrc
  2. delete the build and devel folder from your first workspace (ignore your second one for now)
  3. in a new terminal, source /opt/ros/indigo/setup.bash
  4. run catkin_make (or catkin build, whichever you prefer)
  5. source devel/setup.bash

Now see whether you end up in the correct location.

The setup files are not magic, they basically just set some environment variables, and depending on what you sourced before, those variables could / may include additional paths.

By rebuilding your workspace you regenerate a fresh set of setup.* files, which, if you followed the proper procedure, should work correctly.

edit flag offensive delete link more

Comments

I had done all of these steps before, but now following your instructions in your order works. Probably I was forgetting to source /opt/ros/indigo/setup.bash before running catkin_make. Thank you so much!

marcofe gravatar imagemarcofe ( 2017-02-07 04:48:56 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-02-07 03:47:49 -0500

Seen: 382 times

Last updated: Feb 07 '17