Robotics StackExchange | Archived questions

roscd: No such package/stack

hi, I am new to ROS and following the tutorials. I am having this problem in the tf2 tutorial step 2

I created a new ws:

$ source /opt/ros/noetic/setup.bash 
$ mkdir -p ~/tutorial_ws/src 
$ cd ~/tutorial_ws 
$ catkin_init_workspace src 
$ catkin_make

Then created the package within the ws:

 ~/Cursos/tutorial_ws
$ catkin_create_pkg learning_tf2 tf2 tf2_ros roscpp rospy turtlesim

redid catkin make and sourced setup.bash

still roscd not finding the package

any help??

Thanks!

Asked by fbliman on 2023-06-14 11:21:27 UTC

Comments

Did you source /opt/ros/noetic/setup.bash or ~/Cursos/tutorial_ws/devel/setup.bash after building?

Asked by ngolombek on 2023-06-14 13:44:06 UTC

Both of them

Asked by fbliman on 2023-06-14 14:00:10 UTC

It's a bit hard to know exactly what is going on without being on your computer, but I would suggest sourcing only the local one (tutorial_ws) since it should be an overlay of the main one. Sourcing both can make a mess of your environment. If that doesn't work check the build folders to see if the package was actually build with the correct configuration / binary.

Asked by ngolombek on 2023-06-14 14:05:07 UTC

Answers

You have a couple issues:

  1. The commands you show us are not consistent about the path to tutorial_ws/ directory (~/Cursos/tutorial_ws/ is not the same as ~/tutorial_ws/)
  2. You must cd to tutorial_ws/src/ before you run the catkin_create_pkg command. After you run the command, the directory tutorial_ws/src/learning_tf2/ should exist.
  3. catkin_make must be re-run from tutorial_ws/ directory after you create or modify any files below tutorial_ws/src/
  4. The catkin_init_workspace command is unnecessary. I'm not sure what it does and I've never had to use it.

So your problems are caused by inconsistent path names and using wrong directory for package create.

Asked by Mike Scheutzow on 2023-06-17 14:17:01 UTC

Comments