ROS2: Troubleshooting 'colcon build' for python packages?

Question:

I’m working in a ROS2 workspace ‘home_ws’ with 5 of my packages:

  • home_core
  • home_devices
  • home_extras
  • home_launch
  • home_ui

All packages are python, all built following the same example from the ROS2 doc. After ‘colcon_build’ I only see 3 of the 5 packages.

Output of ros2 pkg list:

...
geometry
geometry_msgs
home_core
home_devices
home_extras
image_geometry
...

The "home_launch" only contains launch files, no ‘main’ entry points, so I’m not totally surprised I can’t see it in the list.

I’m having issues troubleshooting why I don’t see "home_ui" in the list.

When I run colcon build, everything looks ok, very similar to the three packages that are corrrectly listed:

colcon build --packages-select home_ui --symlink-install --event-handlers 
console_cohesion+
Starting >>> home_ui 
--- output: home_ui                   
running develop
running egg_info
writing home_ui.egg-info/PKG-INFO
writing dependency_links to home_ui.egg-info/dependency_links.txt
writing entry points to home_ui.egg-info/entry_points.txt
writing requirements to home_ui.egg-info/requires.txt
writing top-level names to home_ui.egg-info/top_level.txt
reading manifest file 'home_ui.egg-info/SOURCES.txt'
writing manifest file 'home_ui.egg-info/SOURCES.txt'
running build_ext
Creating /home/matt/Projects/home_ws/install/home_ui/lib/python3.10/site- 
packages/home-ui.egg-link (link to .)
Installing rqt_home script to /home/matt/Projects/home_ws/install/home_ui/lib/home_ui

Installed /home/matt/Projects/home_ws/build/home_ui
running install_data
---
Finished <<< home_ui [1.11s]
Summary: 1 package finished [1.85s]

I can see the installed executable:

matt@molokai:~/Projects/home_ws$ ls -l install/home_ui/lib/home_ui/
total 4
-rwxrwxr-x 1 matt matt 939 Oct 24 12:09 rqt_home
matt@molokai:~/Projects/home_ws$

However, ros2 can’t see the package:

matt@molokai:~/Projects/home_ws$ ros2 run home_ui rqt_home
Package 'home_ui' not found
matt@molokai:~/Projects/home_ws$ 

So, I’ve screwed up somehow, but can’t really see much. Anybody know where to look for colcon build issues?

Asked By: Matt

||

Answers:

I found my issue by reviewing the very, very detailed colcon build logs, which I didn’t know about.

matt@molokai:~/Projects/home_ws$ colcon build --symlink-install
Starting >>> home_core
Starting >>> home_devices
Starting >>> home_extras
Starting >>> home_ui
Finished <<< home_devices [2.11s]
Finished <<< home_extras [2.13s]
Finished <<< home_ui [2.14s]
Finished <<< home_core [2.19s]
Starting >>> home_launch
Finished <<< home_launch [1.40s]
...

[0.183s] DEBUG:colcon.colcon_core.package_identification:Failed to parse potential 
ROS package manifest in'src/home_ui': Error(s) in package 'src/home_ui/package.xml':
The manifest contains invalid XML:
not well-formed (invalid token): line 7, column 22
...

So, colcon build for ROS2 Python packages fails silently at the command line, but the logs are very useful for troubleshooting.

Answered By: Matt
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.