Ask Your Question

roscd is not working despite sourcing the workspace. [closed]

asked 2015-07-28 01:11:24 -0600

Asaad Irfan gravatar image

updated 2015-07-28 04:07:40 -0600

I added a workspace to ROS_PACKAGE_PATH using:

source ~/catkin_ws/devel/setup.bash

(catkin_ws is the name of my workspace).

To check if it was actually added i typed:


and it did show the path to that workspace that i just added (which means it was correctly added to ros package path). But the problem is, when i use roscd to change directories inside this workspace it gives the error:

roscd: No such package/stack 'Directory_Name'.

Shouldn't roscd be able to change/shift between directories just like cd because this workspace is already added to ROS_PACKAGE_PATH? ( i shift between directories using cd for now).

EDIT: The output of tree -d ~/catkin_ws is available in the form of images here:
( ) "Image1" ( ) "Image 2"

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Asaad Irfan
close date 2015-08-11 05:49:03.937468

1 Answer

Sort by ยป oldest newest most voted

answered 2015-07-28 01:33:40 -0600

mgruhler gravatar image

I'm not 100% sure if this is your question, but I'll give it a go.

roscd <packagename> is used to move into a package. You cannot use it to move to arbitrary directories within your workspace. E.g. roscd src would end up with multiple conflicting directories.

You can however pass in directories relative to a package. So e.g. roscd move_base/src would work.

For more info, have a look at the documentation.

edit flag offensive delete link more


Ok. I tried doing roscd src/Mydirectory when i was inside the sourced workspace. but it didnt take me to MyDirectory although it should have. shouldn't it?

THere was only one folder named src at this stage in the workspace so should there be any confusion as you suggested?

Asaad Irfan gravatar image Asaad Irfan  ( 2015-07-28 02:03:25 -0600 )edit

Is this actually a ROS package? I.e. does it have a CMakeLists.txt and a package.xml? If not, this will not work.

Can you post the output of tree -d ~/catkin_ws? Please use the edit button below your question.

mgruhler gravatar image mgruhler  ( 2015-07-28 02:36:04 -0600 )edit

^Post Edited.

Asaad Irfan gravatar image Asaad Irfan  ( 2015-07-28 04:08:32 -0600 )edit

If you have created the package ros_wkshop with catkin_create_pkg, you should be able to get into this using roscd ros_wkshop. If you source devel/setup.bash, in the ROS_PACKAGE_PATH you should have ~/catkin_ws/src added. So you cannot access ros_wkshop1 in the root of the workspace.

mgruhler gravatar image mgruhler  ( 2015-07-28 04:35:04 -0600 )edit

@Asaad Irfaan, can you share what exactly you are typing in the Terminal and also whether you are using the same terminal or trying the command in another.

Nouman Tahir gravatar image Nouman Tahir  ( 2015-08-11 05:26:52 -0600 )edit

THe issue was in the package. It wasnt built using the right commands. I deleted it and built it again as given in the tutorials and it worked.

Asaad Irfan gravatar image Asaad Irfan  ( 2015-08-11 05:48:40 -0600 )edit

Question Tools

1 follower


Asked: 2015-07-28 01:11:24 -0600

Seen: 893 times

Last updated: Jul 28 '15