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 -0600
Seen: 27,562 times
Last updated: Jul 05 '22
Is there a release date of ros 2 or more informations about it?
Is the planned ROS1 to ROS2/DDS bridge available yet?
ROS2: content-based topic subscriptions?
Building Ros 2.0 without OpenCV?
ros2 rttest example build error
ROS 2 Alpha 2 ros1_bridge using DDS between two computers
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