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

I would like to know why does not the command roscd beginners_tutorials work ?

asked 2022-01-24 10:12:44 -0600

Gorri gravatar image

I created a folder with catkin_create_pkg beginner_tutorials rospy and the folder was created

edit retag flag offensive close merge delete

Comments

Have you tried roscd after to building and sourcing the workspace?

aarsh_t gravatar image aarsh_t  ( 2022-01-24 10:27:26 -0600 )edit

No but it shouldn't influece in the command isn't it?

Gorri gravatar image Gorri  ( 2022-01-24 10:39:15 -0600 )edit

What OS are you using ?

osilva gravatar image osilva  ( 2022-01-24 12:21:25 -0600 )edit

noetic in linux 20.04

Gorri gravatar image Gorri  ( 2022-01-24 13:27:17 -0600 )edit

Thank you. I thought you were using Windows but @cst0 has given you right answer

osilva gravatar image osilva  ( 2022-01-24 15:27:00 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-01-24 12:30:09 -0600

cst0 gravatar image

@aarsh_t is correct: you need to have built and sourced the workspace. You mention not having done this, but that's a required step: without it, the roscd command doesn't know about the packages in that workspace and therefore can't change to that directory (you also won't be able to rosrun or roslaunch on that package). Check out the wiki page for creating a workspace, which also describes how to correctly build and source your workspace.

edit flag offensive delete link more

Comments

I'll check it but in my workspace I have folders of src build devel. Because if I make a publisher.py and do it ejecutable with chmod u+x i can use rosrun

Gorri gravatar image Gorri  ( 2022-01-24 13:34:39 -0600 )edit

Unless you are already in the workspace (and therefore providing a path to the executable and not referencing the package), rosrun will require the workspace to be sourced in order to reference the package.

cst0 gravatar image cst0  ( 2022-01-24 13:50:25 -0600 )edit

I think that this is the step for this roscd didn't work ~/catkin_ws/devel/setup.bash Although I had to write source devel/setup.bash is it right?

Gorri gravatar image Gorri  ( 2022-01-24 14:20:47 -0600 )edit

Yes, but it will depend on the path to your workspace and on your shell (by default this is the bash shell, so if you haven't changed your shell that's the one you've got). Your goal is to point the source command to a file that holds the information about your workspace, so if your workspace is ~/catkin_ws then the command should be source ~/catkin_ws/devel/setup.bash. You may need to adjust that path based off of your workspace.

cst0 gravatar image cst0  ( 2022-01-24 14:25:29 -0600 )edit

Thank you for the information

Gorri gravatar image Gorri  ( 2022-01-24 15:53:15 -0600 )edit

Question Tools

Stats

Asked: 2022-01-24 10:12:44 -0600

Seen: 166 times

Last updated: Jan 24 '22