0
$\begingroup$

Rosanswers logo

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.


Originally posted by marcofe on ROS Answers with karma: 35 on 2017-02-07

Post score: 0


Original comments

Comment by DavidN on 2017-02-07:
Have you tried to delete the devel folder in the first workspace and redo catkin_make?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by gvdhoorn with karma: 86574 on 2017-02-07

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by marcofe on 2017-02-07:
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!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.