package.xml, CMakeLists.txt, and Python Package Structure¶
Source: ros2-copilot-skills package configuration skill
Why This Matters¶
Many ROS 2 debugging sessions start in the wrong place because the real problem is packaging. If a package does not declare dependencies correctly or does not install launch, config, URDF, or Python entry points properly, the runtime failure often looks unrelated to the actual mistake.
Distilled Takeaways¶
package.xmland the build file are part of the package API, not ceremony.- Installation rules matter as much as compilation rules because ROS 2 tools find runtime assets in the install space.
ament_cmakeandament_pythonpackages have different failure modes, but both need careful asset installation.- Interface packages deserve explicit structure because generated messages, services, and actions affect downstream builds.
- A surprising number of launch-time file lookup errors are packaging errors in disguise.
Practical Guidance¶
- Install launch, config, URDF, and related data directories deliberately.
- Use the narrowest dependency tags that remain readable.
- Keep Python package entry points and installed script locations aligned with ROS 2 expectations.
- Treat package structure as an onboarding surface for future contributors.
Corroborating References¶
When to Read the Original Source¶
Go to the original skill when you want complete example files for C++ packages, Python packages, and interface packages, including install rules and dependency-tag guidance.