Ask Your Question

cannot locate rosdep definition for [custom_msg]

asked 2022-04-11 14:00:31 -0500

Flash gravatar image

updated 2022-04-11 16:37:25 -0500

I had created custom msg pkg in my workspace directory, but when I try to do rosdep install -i --from-path src --rosdistro foxy -y I am getting below error

ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
robot_pkg: Cannot locate rosdep definition for [custom_msg]

custom_msg is the package I used to create my application related msg and robot_pkg is the pkg that using custom_msg.
Below is the folder structure if needed.


When I initially created my workspace haven't had any issues with this but when I transfer my pkg to new workspace I am getting this error msg. Thanks,

edit retag flag offensive close merge delete


It looks like you either don't have custom_msg installed already or in the same workspace?

aprotyas gravatar image aprotyas  ( 2022-04-11 14:42:13 -0500 )edit

Updated question but this is the folder structure. So custom_msg pkg is inside the src folder, not sure how to link custom_msg to robot_pkg

Flash gravatar image Flash  ( 2022-04-11 16:38:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-04-11 16:46:03 -0500

ljaniec gravatar image

Did you modify CMakeLists.txt and package.xml like in this tutorial?

edit flag offensive delete link more


Yes, I used the same link to build it and I am also getting output when I use the command to show the interface ros2 interface show custom_msgs/msg/LocGrid and only if I source my workspace source install/setup.bash. And also program runs without any issues.
I was not getting any errors related to rosdep when I initially build custom_msg pkg. I am only getting it when I moved it to a different workspace or system. Not sure if it's expected behavior or something else.

Flash gravatar image Flash  ( 2022-04-11 16:59:08 -0500 )edit

I would check branches of repositories you have used - I remember I had to change it even with git clone xyz --branch foxy etc. to correct ones. You can try to delete build/ and install/ folders in your ROS workspace too, sometimes it helps after rebuild. I would check your dependencies and if they're installed correctly too. And of course source /opt/foxy/setup.bash and source install/setup.bash in your workspace.

ljaniec gravatar image ljaniec  ( 2022-04-11 17:07:02 -0500 )edit

Tried those things and it seems to be exactly as it is supposed to be (verified using your link). But do we definitely need to source local installs like source ~/ros2_ws/install/setup.bash to see the interface type or is there any other way? I will try to create that package again and see if I end up with the same issue.

Flash gravatar image Flash  ( 2022-04-11 17:13:36 -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



Asked: 2022-04-11 14:00:31 -0500

Seen: 209 times

Last updated: Apr 11