A ROS Package is the atomic unit of software organization in ROS, containing all the files—executables, libraries, configuration files, and datasets—necessary to provide a specific piece of functionality, such as a driver, algorithm, or utility. Every package is defined by a mandatory package.xml manifest file that declares its metadata, dependencies, and exported resources. This modular structure enables developers to share, reuse, and build upon discrete components within the larger ROS ecosystem.
Glossary
ROS Package

What is a ROS Package?
The fundamental unit of organization and software distribution in the Robot Operating System (ROS).
Packages are built and managed using ROS-specific tools like catkin (ROS 1) or colcon (ROS 2), which handle dependency resolution and compilation. They are typically organized within a workspace, where the build system creates an isolated development and installation environment. This encapsulation allows complex robotic systems to be decomposed into manageable, interoperable units, facilitating collaborative development, version control, and system integration.
Core Components of a ROS Package
A ROS Package is the fundamental unit of software organization in the Robot Operating System. It is a directory with a prescribed structure and a manifest file that enables the ROS build and runtime tools to identify, build, and manage dependencies.
The Package Manifest (package.xml)
The package.xml file is the mandatory metadata file that defines the package's identity and dependencies. It is an XML file that must be present in the root of every package.
- Declares package properties: Name, version, description, maintainer, and license.
- Specifies dependencies: Categorizes required packages as build dependencies (needed at compile time), execution dependencies (needed at runtime), test dependencies, and build tool dependencies.
- Enables tooling: The ROS build system (
catkin,colcon) and package managers (rosdep) read this file to resolve and install dependencies automatically.
Example essential tags:
xml<package format="3"> <name>my_robot_driver</name> <version>1.0.0</version> <description>A driver for my custom robot.</description> <maintainer email="[email protected]">Jane Developer</maintainer> <license>Apache 2.0</license> <depend>roscpp</depend> <depend>sensor_msgs</depend> </package>
The CMakeLists.txt File
The CMakeLists.txt file is the build instruction manual for C++ (or mixed-language) packages. It uses the CMake build system, extended with ROS-specific macros, to define how the package's executables and libraries are compiled and linked.
- Finds dependencies: Uses
find_package()to locate other ROS packages and system libraries. - Declares build targets: Defines executables (nodes) and libraries with
add_executable()andadd_library(). - Links dependencies: Specifies link libraries and include directories with
target_link_libraries()andinclude_directories(). - Installs artifacts: Uses
install()commands to specify where built binaries, libraries, and launch files should be placed for system-wide use. - ROS Macros: Utilizes convenience macros like
ament_package()(ROS 2) orcatkin_package()(ROS 1) to finalize package configuration.
A pure Python package may omit this file, relying solely on package.xml and a setup.py or setup.cfg.
Source Code Directories (src/, include/)
These directories contain the package's core logic. Their structure follows standard software conventions.
src/(source): Contains the.cppsource files for C++ nodes and libraries. For Python packages, this often contains a Python module directory (e.g.,src/my_package/).include/<package_name>/(headers): Contains the.hor.hppheader files for C++ libraries. The subdirectory named after the package prevents header filename collisions across the system.
Example Node: A simple publisher node might be located at src/talker.cpp. Its corresponding header, if part of a library, would be in include/my_package/talker.hpp.
This separation enforces clean interfaces and allows other packages to include this package's headers correctly using the #include <my_package/talker.hpp> syntax.
Launch and Configuration Directories (launch/, config/)
These directories hold files that configure and orchestrate the system at runtime, separating configuration from core logic.
launch/: Contains launch files (.launch.pyin ROS 2,.launchor.launch.pyin ROS 1). These files are scripts that:- Start multiple nodes simultaneously.
- Set ROS parameters.
- Remap topic names.
- Define node namespaces.
- Group nodes into composable containers (ROS 2).
config/(orparams/): Contains YAML configuration files used to set node parameters. This allows parameters (e.g., controller gains, sensor settings) to be easily modified without recompiling code.
Key Benefit: This structure enables reproducible system bring-up. A complex robot can be started with a single command like ros2 launch my_robot_bringup robot.launch.py, which references launch and config files from multiple packages.
Message, Service, and Action Definitions (msg/, srv/, action/)
These optional directories define custom communication interfaces, making the package's APIs explicit and reusable.
msg/: Contains.msgfiles that define the structure of custom messages published on topics.- Example
Pose2D.msg:float64 x\nfloat64 y\nfloat64 theta
- Example
srv/: Contains.srvfiles that define the request and response structures for custom services.- Example
AddTwoInts.srv:int64 a\nint64 b\n---\nint64 sum
- Example
action/: Contains.actionfiles that define the goal, feedback, and result structures for custom long-running actions (ROS 1 & 2).- Example
NavigateToPose.action:geometry_msgs/PoseStamped goal_pose\n---\ngeometry_msgs/PoseStamped result\n---\ngeometry_msgs/PoseStamped feedback
- Example
Build Process: During compilation, the ROS build system automatically generates language-specific code (C++, Python, etc.) from these definition files, creating the classes and functions used to send and receive this data.
Test and Documentation Directories (test/, doc/)
These directories support package quality, verification, and usability.
test/: Contains unit, integration, and system tests.- C++ Tests: Use the Google Test (
gtest) framework, integrated via CMake'scatkin_add_gtest()orament_add_gtest(). - Python Tests: Use the pytest framework.
- Launch Tests: Test the correct startup and interaction of nodes using ROS launch testing frameworks.
- Running
colcon testfrom the workspace root executes all package tests.
- C++ Tests: Use the Google Test (
doc/orpackage.xmltags: While adoc/folder can hold manual documentation, the primary documentation mechanism is the<export>tag inpackage.xml, which can point to a URI for online API documentation (e.g., hosted by Doxygen or Sphinx).
Importance: A well-tested package with clear documentation is essential for integration into larger, reliable robotic systems and for use by other developers in the community.
How ROS Packages Work: Build, Dependency, and Discovery
A ROS Package is the atomic unit of software organization and distribution in the Robot Operating System (ROS). It encapsulates a specific piece of functionality, such as a driver, algorithm, or dataset, and is defined by its manifest file and directory structure.
A ROS Package is the fundamental unit for organizing, building, and distributing software in ROS, defined by a directory containing a mandatory package.xml manifest file and, typically, a CMakeLists.txt build file. The package.xml file declares metadata, dependencies (build, run, test), and export information, enabling the ROS build system (colcon) and runtime tools to discover, compile, and resolve inter-package relationships. This modular structure allows developers to share, version, and reuse discrete robotic capabilities—from sensor drivers to perception algorithms—within a larger system.
During the build process, tools like colcon parse the package.xml to create a dependency graph, ensuring packages are compiled in the correct order. At runtime, ROS tools like ros2 pkg use this manifest to locate package resources via the ROS_PACKAGE_PATH. This strict packaging convention enforces modularity and explicit dependency management, which are critical for managing the complexity of large-scale robotic software stacks composed of hundreds of interoperating components.
Frequently Asked Questions
A ROS Package is the fundamental unit of organization and distribution in the Robot Operating System (ROS). This FAQ addresses common developer questions about its structure, purpose, and lifecycle.
A ROS Package is the primary unit for organizing and distributing software in the Robot Operating System (ROS). It is a directory containing a specific collection of files—including source code, libraries, datasets, configuration files, and a mandatory manifest file (package.xml)—that together provide a discrete piece of functionality for a robotic system.
Every package must contain a package.xml file, which is the package manifest. This XML file defines metadata about the package, such as its name, version, description, author, license, and, most critically, its dependencies on other ROS packages and external libraries. This structure enables the ROS build system (catkin for ROS 1, colcon for ROS 2) to discover, compile, and manage dependencies across the entire workspace. A typical package might contain nodes for perception, a library for custom message types, launch files for starting the system, and configuration parameters.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
A ROS Package is the fundamental organizational unit, but it operates within a larger ecosystem of tools and concepts. These related terms define the components that interact with and depend on the package structure.
Package Manifest (package.xml)
The package.xml file is the metadata declaration for a ROS package. It is an XML file located at the package root that defines:
- Dependencies on other ROS packages (build, build_export, exec, test).
- Metadata like the package name, version, description, maintainer, and license.
- Export information, such as build tool flags and message dependencies.
This file is critical for the build system (
colcon) to resolve dependencies and for the ROS tooling to understand the package's identity and requirements.
CMakeLists.txt
For C++-based packages, the CMakeLists.txt file is the build instruction script. It uses the ROS-provided CMake macros to:
- Declare the project and find required ROS 2 packages (
find_package). - Define message, service, and action interfaces.
- Specify libraries and executables to build (
ament_target_dependencies). - Install targets to the appropriate locations (
install). It works in tandem withpackage.xml, where dependencies are declared in the manifest and then located in the CMake file for the build process.
Workspace (ROS 2 Workspace)
A workspace is a directory (typically named src) where you clone or create multiple ROS packages. It is the top-level environment for development. The standard workflow involves:
- Source Space: The
src/directory containing all package source code. - Build System: Using
colcon buildfrom the workspace root to compile all packages, respecting their inter-dependencies. - Install & Overlay: The build process creates
install/,build/, andlog/directories. Sourcing theinstall/setup.bashfile overlays these built packages into your ROS environment, making them discoverable.
Build Tool (Colcon)
Colcon is the canonical build tool for ROS 2, succeeding catkin_make. It orchestrates the build process for a workspace containing multiple packages by:
- Dependency Analysis: Parsing
package.xmlfiles to determine a build order. - Parallel Building: Compiling independent packages in parallel for speed.
- Isolated Builds: By default, building each package in its own isolated environment to prevent cross-contamination.
- Unified Interface: Invoking the underlying build system (CMake, Python setuptools) for each package type. Common commands are
colcon build,colcon test, andcolcon list.
Package Types (Ament Packages)
ROS 2 packages are formally Ament packages, adhering to the Ament build system specifications. The primary types are:
- CMake (ament_cmake): For C/C++ packages, using
CMakeLists.txt. - Python (ament_python): For pure Python packages, using
setup.pyandsetup.cfg. - Hybrid: A package can contain both CMake and Python components. The Ament infrastructure provides the common tooling for building, testing, and installing these packages, ensuring consistency across the ROS 2 ecosystem.
Metapackage
A metapackage is a specialized, virtual ROS package used to group related packages for easier distribution and installation. Its key characteristics are:
- No Code: It contains no libraries, nodes, or significant source code of its own.
- Grouping Function: Its
package.xmlfile declares run dependencies (exec_depend) on a set of other packages. - Common Use Case: Used to install all packages for a specific robot or application suite with a single command (e.g.,
ros-humble-desktopis a metapackage). It serves as an organizational convenience layer on top of the standard package structure.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us