~ 9/18/24
Intro
![]()
A package is an organizational unit for your ROS 2 code. If you want to be able to install your code or share it with others, then youβll need it organized in a package. With packages, you can release your ROS 2 work and allow others to build and use it easily.
Package creation in ROS 2 uses ament as its build system and colcon as its build tool. You can create a package using either CMake or Python, which are officially supported, though other build types do exist.
ROS2 Python packages
my_package/ βββ package.xml # File containing meta-information about the package βββ resource/ β βββ my_package # Marker file for the package. βββ setup.cfg # Required when a package has executables, so `ros2 run` can locate them. βββ setup.py # Contains instructions for how to install the package. βββ my_package/ # A directory with the same name as your package, used by ROS 2 tools to locate your package; it # contains `__init__.py`.
ROS2 CMake Packages
my_package/ βββ CMakeLists.txt # Describes how to build the code within the package βββ include/ β βββ my_package/ # Directory containing the public headers for the package βββ package.xml # File containing meta-information about the package βββ src/ # Directory containing the source code for the package




