-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Before proceeding, is there an existing issue or discussion for this?
- I have done a search for similar issues and discussions.
OS and version
24.04
Open-RMF installation type
Binaries
Other Open-RMF installation methods
No response
Open-RMF version or commit hash
latest commit
ROS distribution
Rolling
ROS installation type
Binaries
Other ROS installation methods
No response
Package or library, if applicable
No response
Description of the bug
Hi, I am running ros2 doctor --report and encountered the following warning:
opt/ros/rolling/lib/python3.12/site-packages/ros2doctor/api/__init__.py: 262: UserWarning: Fail to call PackageReport class functions.
After some investigation, I found that the issue appears to be related to several RMF-related packages that do not properly install their package.xml files. The affected packages include (but may not be limited to):
- https://github.com/open-rmf/rmf_task
- https://github.com/open-rmf/rmf_utils
- https://github.com/open-rmf/rmf_battery
- https://github.com/open-rmf/rmf_traffic
Steps to reproduce the bug
- Install any of the packages listed above
- Run ros2 doctor --report
Expected behavior
Able to list versions
Actual behavior
opt/ros/rolling/lib/python3.12/site-packages/ros2doctor/api/init.py: 262: UserWarning: Fail to call PackageReport class functions.
Fails to report version information for any of the packages
Additional information or screenshots
As described in the tutorial https://docs.ros.org/en/rolling/How-To-Guides/Ament-CMake-Documentation.html
The project setup is done by ament_package() and this call must occur exactly once per package. ament_package() installs the package.xml, registers the package with the ament index, and installs configuration (and possibly target) files for CMake so that it can be found by other packages using find_package. Since ament_package() gathers a lot of information from the CMakeLists.txt it should be the last call in your CMakeLists.txt.
Adding ament_package() at the end of the CMakeLists.txt resolves the issue. However, I noticed that the package currently exports the ament index manually, which can alternatively be handled by ament_package() or other ament_* commands. Is there a specific reason for avoiding the ament_* syntax in these repos?
rmf_traffic/rmf_traffic/CMakeLists.txt
Lines 163 to 168 in 5c5a13c
| # Export ament index path | |
| file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME} "") | |
| install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME} DESTINATION share/ament_index/resource_index/packages) | |
| file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/ament_prefix_path.dsv "prepend-non-duplicate;AMENT_PREFIX_PATH;") | |
| install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/ament_prefix_path.dsv DESTINATION share/${PROJECT_NAME}/hook) |