ERROR : ROS2 RUN package not found
colcon build --packages-select -build my package with this instruction.
trying to run a publisher node
ros2 run [package_name] talker
ERROR: package not found
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
colcon build --packages-select -build my package with this instruction.
trying to run a publisher node
ros2 run [package_name] talker
ERROR: package not found
In my case I was running colcon build form inside the src directory in my workspace.
Like this:
~/ros2_ws/src$ colcon build
Running colcon build
in the workspace root solved the issue:
cd ~/ros2_ws
colcon build
source install/setup.bash
and finally
ros2 run [package_name] [executable_name]
If you have your ros2 configuration sourced from your shell's rc file (example: source /opt/ros/<your version>/setup.bash
in the .bashrc
file when using bash
), then you need to source the appropriate install script for your application:
When you open a new shell/terminal, source install/setup.bash
for bash
, etc.
If you do not have the line mentioned above in your rc file (for example, you prefer to control this manually), then you need to source both files.
(I find answers easier to digest than comments. All of this info is in the comments.)
Asked: 2020-04-01 04:03:32 -0500
Seen: 20,326 times
Last updated: Jul 05 '22
trying to install Ros2 on Ubuntu 20.04, but it doesn't work
how to organize data transfer between nodes on multiple PCs on ROS2
Waiting for TransformListener with ROS2 and Python?
[ROS2] How to set QoS policy for topic in cpp script
I am getting an error using Ros2 Iron and micro-ROS on RP2040
Using ROS2 for autonomous driving
ROS2 Bag - DB3 CDR Deserialization
Why image not recieved using ROS2 functions in the node?
[ROS2] asyncio await with timeout a service call in a callback
This is very limited information. How is composed your package? Is it a python or cmake package? Does it install an executable named talker ? if yes to what location ?
Please consider profiding more information and relevant bits of code like your CMakeLists or setup.py/cfg
Did you source the setup file generated by the colcon build command? e.g.
install/setup.bash
Getting the same error, followed the tutorial step by step, using Python package on Windows. When I run ros2 run my_package my_node I get
Package 'my_package' not found
The issue was that I called
install/local_setup.bat
(as indicated in the tutorial). Calling '.\install\setup.ps1' fixies the issue.Everytime you build a package, always remember to do (from your ROS2 workspace):
source install/setup.bash
andsource /opt/ros/foxy/setup.bash
@fabbro, why do I need to source two setup.bash files? i.e., source install/setup.bash and source /opt/ros/foxy/setup.bash