[Bug] can't run "my_package" with launch file

This is an error report.


Screenshot of the error


Error details

I believe that I follow all instructions carefully but can't figure out what happen why I can't run "my_package" with launch file I create based on the instruction steps.

Hi @tonlhing ,

Welcome to this Community!

I think you have forgotten to add the launch folder path to your setup.py file.
That is the reason why ROS2 is unable to find your launch file even after compiling.

You will add a line like the one below, under data_files in your setup.py file:

(os.path.join('share', package_name), glob('launch/*.launch.py'))

If you did add the above line to your setup.py file and you are still getting this error, then you might have to compile from scratch, using the following commands:

cd ~/ros2_ws                     # go to ROS2 workspace directory
rm -rf ./build ./install ./log   # delete build, install, log folders
colcon build                     # compile ROS2 workspace
source install/setup.bash        # source your ROS2 workspace
ros2 launch my_package my_package_launch_file.launch.py

The above steps should solve your issue.

Regards
Girish

Big thank for your suggestion. In fact, I put file in the wrong directory so that it show some error about the path. Anyway, really appreciated for this help.

Ton

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.