|
Package Summary
Tags | No category tags. |
Version | 0.20.5 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | humble |
Last Updated | 2024-07-26 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Audrow Nash
- Michael Jeronimo
Authors
- Dirk Thomas
- Mabel Zhang
What Is This?
This demo provides examples of three different ways to use the rclcpp_components API to compose multiple nodes in a single process.
This ROS 2 package consists of the following demo applications:
dlopen_composition
linktime_composition
manual_composition
Build
Run the commands below to build the ROS 2 package:
colcon build --packages-up-to composition
Run
Manual Composition
Running manual_composition
compiles an executable that runs the following 4 components:
- Talker: A ROS 2 component that publishes a string
- Listener: A ROS 2 component that prints the received string from Talker
- Server: A ROS 2 component that adds two integers and outputs its result to Client
- Client: A ROS 2 component that sends two integers to Server and prints the received result from Server
ros2 run composition manual_composition
DlOpen Composition
This runs dlopen_composition
which is an alternative to run-time composition by creating a generic container process and explicitly passing the libraries to load without using ROS interfaces.
The process will open each library and create one instance of each “rclcpp::Node” class in the library.
ros2 run composition dlopen_composition `ros2 pkg prefix composition`/lib/libtalker_component.so `ros2 pkg prefix composition`/lib/liblistener_component.so
Linktime Composition
Similar to previous, this runs linktime_composition
which links all classes from libraries that are registered under the library_path with the linker.
ros2 run composition linktime_composition
Composition Using Launch Actions
Rather than using the command line tool to run each composition, we can automate this action with ros2 launch
functionality:
ros2 launch composition composition_demo.launch.py
Verify
Manual Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [1674528188.026468320] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674528188.027043857] [listener]: I heard: [Hello World: 1]
[INFO] [1674528189.026414368] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674528189.026742015] [listener]: I heard: [Hello World: 2]
[INFO] [1674528189.032512995] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528189.032815843] [Client]: Got result: [5]
[INFO] [1674528190.026455807] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674528190.026795770] [listener]: I heard: [Hello World: 3]
[INFO] [1674528191.026457639] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674528191.026801926] [listener]: I heard: [Hello World: 4]
[INFO] [1674528191.032377264] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528191.032604427] [Client]: Got result: [5]
[INFO] [1674528192.026428269] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674528192.026537974] [listener]: I heard: [Hello World: 5]
[INFO] [1674528193.026437034] [talker]: Publishing: 'Hello World: 6'
[INFO] [1674528193.026767708] [listener]: I heard: [Hello World: 6]
[INFO] [1674528193.032377748] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528193.032603036] [Client]: Got result: [5]
#...
:warning:
Note that manually-composed components will not be reflected in the
ros2 component list
command line tool output.
DlOpen Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
INFO] [1674529118.496557668] [dlopen_composition]: Load library /opt/ros/humble/lib/libtalker_component.so
[INFO] [1674529118.496774575] [dlopen_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [1674529118.503388909] [dlopen_composition]: Load library /opt/ros/humble/lib/liblistener_component.so
[INFO] [1674529118.503739855] [dlopen_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [1674529119.503505873] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674529119.503770137] [listener]: I heard: [Hello World: 1]
[INFO] [1674529120.503572362] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674529120.503888374] [listener]: I heard: [Hello World: 2]
[INFO] [1674529121.503503459] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674529121.503628269] [listener]: I heard: [Hello World: 3]
[INFO] [1674529122.503557862] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674529122.503894772] [listener]: I heard: [Hello World: 4]
[INFO] [1674529123.503574524] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674529123.503884894] [listener]: I heard: [Hello World: 5]
#...
:warning:
Note that dlopen-composed components will not be reflected in the
ros2 component list
command line tool output.
Linktime Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [1674528568.091949637] [linktime_composition]: Load library
[INFO] [1674528568.091995119] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Client>
[INFO] [1674528568.098833910] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [1674528568.100669644] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Server>
[INFO] [1674528568.102665704] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [1674528569.104717098] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674528569.105206993] [listener]: I heard: [Hello World: 1]
[INFO] [1674528570.099206827] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528570.099376432] [Client]: Got result: [5]
[INFO] [1674528570.104656875] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674528570.105069514] [listener]: I heard: [Hello World: 2]
[INFO] [1674528571.104710545] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674528571.105150094] [listener]: I heard: [Hello World: 3]
[INFO] [1674528572.099350955] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528572.099628903] [Client]: Got result: [5]
[INFO] [1674528572.104631322] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674528572.104911174] [listener]: I heard: [Hello World: 4]
[INFO] [1674528573.104596009] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674528573.104751214] [listener]: I heard: [Hello World: 5]
#...
:warning:
Note that linktime-composed components will not be reflected in the
ros2 component list
command line tool output.
Composition Using Launch Actions
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-05-04-23-37-06-363020-d8ff93e471d7-9387
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [9402]
[component_container-1] [INFO] [1714865826.695090046] [my_container]: Load Library: /opt/ros/jazzy/lib/libtalker_component.so
[component_container-1] [INFO] [1714865826.696388047] [my_container]: Found class: rclcpp_components::NodeFactoryTemplate<composition::Talker>
[component_container-1] [INFO] [1714865826.696435882] [my_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/talker' in container '/my_container'
[component_container-1] [INFO] [1714865826.702958710] [my_container]: Load Library: /opt/ros/jazzy/lib/liblistener_component.so
[component_container-1] [INFO] [1714865826.703401061] [my_container]: Found class: rclcpp_components::NodeFactoryTemplate<composition::Listener>
[component_container-1] [INFO] [1714865826.703414344] [my_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/listener' in container '/my_container'
[component_container-1] [INFO] [1714865827.701941449] [talker]: Publishing: 'Hello World: 1'
[component_container-1] [INFO] [1714865827.702047599] [listener]: I heard: [Hello World: 1]
[component_container-1] [INFO] [1714865828.701984118] [talker]: Publishing: 'Hello World: 2'
[component_container-1] [INFO] [1714865828.702154523] [listener]: I heard: [Hello World: 2]
[component_container-1] [INFO] [1714865829.702004471] [talker]: Publishing: 'Hello World: 3'
[component_container-1] [INFO] [1714865829.702176059] [listener]: I heard: [Hello World: 3]
[component_container-1] [INFO] [1714865830.701876733] [talker]: Publishing: 'Hello World: 4'
[component_container-1] [INFO] [1714865830.701965546] [listener]: I heard: [Hello World: 4]
[component_container-1] [INFO] [1714865831.701885355] [talker]: Publishing: 'Hello World: 5'
[component_container-1] [INFO] [1714865831.701984823] [listener]: I heard: [Hello World: 5]
FAQ
Q
: Why use node composition?
A
: Node composition avoids the overhead of marshalling and unmarshaling messages by allowing nodes to be instantiated within the same process.
References
Changelog for package composition
0.20.5 (2024-07-26)
0.20.4 (2024-05-15)
- [composition] add launch action console output in the verify section (#677) (#682)
- Contributors: mergify[bot]
0.20.3 (2023-01-10)
0.20.2 (2022-05-10)
0.20.1 (2022-04-08)
0.20.0 (2022-03-01)
0.19.0 (2022-01-14)
0.18.0 (2021-12-17)
- Update maintainers to Audrow Nash and Michael Jeronimo (#543)
- Additional fixes for documentation in demos. (#538)
- Contributors: Audrow Nash, Chris Lalancette
0.17.0 (2021-10-18)
- Fixing deprecated subscriber callback warnings (#532)
- Contributors: Abrar Rahman Protyasha
0.16.0 (2021-08-11)
0.15.0 (2021-05-14)
0.14.2 (2021-04-26)
0.14.1 (2021-04-19)
0.14.0 (2021-04-06)
0.13.0 (2021-03-25)
0.12.1 (2021-03-18)
0.12.0 (2021-01-25)
0.11.0 (2020-12-10)
- Update the package.xml files with the latest Open Robotics maintainers (#466)
- Contributors: Michael Jeronimo
0.10.1 (2020-09-21)
0.10.0 (2020-06-17)
0.9.3 (2020-06-01)
0.9.2 (2020-05-26)
0.9.1 (2020-05-12)
0.9.0 (2020-04-30)
- Replace deprecated launch_ros usage (#437)
- Update launch_ros action usage (#431)
- code style only: wrap after open parenthesis if not in one line (#429)
- Contributors: Dirk Thomas, Jacob Perron
0.8.4 (2019-11-19)
0.8.3 (2019-11-11)
0.8.2 (2019-11-08)
0.8.1 (2019-10-23)
- Replace ready_fn with ReadyToTest action (#404)
- Contributors: Peter Baughman
0.8.0 (2019-09-26)
- Add an demo component not inherited from rclcpp::Node (#393)
- Contributors: Michael Carroll
0.7.6 (2019-05-30)
0.7.5 (2019-05-29)
0.7.4 (2019-05-20)
0.7.3 (2019-05-10)
0.7.2 (2019-05-08)
- changes to avoid deprecated API's (#332)
- Corrected publish calls with shared_ptr signature (#327)
- Migrate launch tests to new launch_testing features & API (#318)
- Contributors: Michel Hidalgo, William Woodall, ivanpauno
0.7.1 (2019-04-26)
- Renamed launch file, updated to avoid redundant default actions, and set output to screen. (#326)
- Updated constructor to const ref to NodeOptions. (#323)
- Added basic composition launch demo. (#324)
- Contributors: Michael Carroll, William Woodall
0.7.0 (2019-04-14)
- Updated for new rclcpp_components package. (#319)
- Added launch along with launch_testing as test dependencies. (#313)
- Dropped legacy launch API usage. (#311)
- Contributors: Michael Carroll, Michel Hidalgo
0.6.2 (2019-01-15)
0.6.1 (2018-12-13)
0.6.0 (2018-12-07)
- Added semicolons to all RCLCPP and RCUTILS macros. (#278)
- Contributors: Chris Lalancette
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
test_launch_ros | |
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.27.2 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | iron |
Last Updated | 2024-07-11 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Aditya Pande
- Audrow Nash
- Michael Jeronimo
Authors
- Dirk Thomas
- Mabel Zhang
What Is This?
This demo provides examples of three different ways to use the rclcpp_components API to compose multiple nodes in a single process.
This ROS 2 package consists of the following demo applications:
dlopen_composition
linktime_composition
manual_composition
Build
Run the commands below to build the ROS 2 package:
colcon build --packages-up-to composition
Run
Manual Composition
Running manual_composition
compiles an executable that runs the following 4 components:
- Talker: A ROS 2 component that publishes a string
- Listener: A ROS 2 component that prints the received string from Talker
- Server: A ROS 2 component that adds two integers and outputs its result to Client
- Client: A ROS 2 component that sends two integers to Server and prints the received result from Server
ros2 run composition manual_composition
DlOpen Composition
This runs dlopen_composition
which is an alternative to run-time composition by creating a generic container process and explicitly passing the libraries to load without using ROS interfaces.
The process will open each library and create one instance of each “rclcpp::Node” class in the library.
ros2 run composition dlopen_composition `ros2 pkg prefix composition`/lib/libtalker_component.so `ros2 pkg prefix composition`/lib/liblistener_component.so
Linktime Composition
Similar to previous, this runs linktime_composition
which links all classes from libraries that are registered under the library_path with the linker.
ros2 run composition linktime_composition
Composition Using Launch Actions
Rather than using the command line tool to run each composition, we can automate this action with ros2 launch
functionality:
ros2 launch composition composition_demo_launch.py
Verify
Manual Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [1674528188.026468320] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674528188.027043857] [listener]: I heard: [Hello World: 1]
[INFO] [1674528189.026414368] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674528189.026742015] [listener]: I heard: [Hello World: 2]
[INFO] [1674528189.032512995] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528189.032815843] [Client]: Got result: [5]
[INFO] [1674528190.026455807] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674528190.026795770] [listener]: I heard: [Hello World: 3]
[INFO] [1674528191.026457639] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674528191.026801926] [listener]: I heard: [Hello World: 4]
[INFO] [1674528191.032377264] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528191.032604427] [Client]: Got result: [5]
[INFO] [1674528192.026428269] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674528192.026537974] [listener]: I heard: [Hello World: 5]
[INFO] [1674528193.026437034] [talker]: Publishing: 'Hello World: 6'
[INFO] [1674528193.026767708] [listener]: I heard: [Hello World: 6]
[INFO] [1674528193.032377748] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528193.032603036] [Client]: Got result: [5]
#...
:warning:
Note that manually-composed components will not be reflected in the
ros2 component list
command line tool output.
DlOpen Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
INFO] [1674529118.496557668] [dlopen_composition]: Load library /opt/ros/rolling/lib/libtalker_component.so
[INFO] [1674529118.496774575] [dlopen_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [1674529118.503388909] [dlopen_composition]: Load library /opt/ros/rolling/lib/liblistener_component.so
[INFO] [1674529118.503739855] [dlopen_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [1674529119.503505873] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674529119.503770137] [listener]: I heard: [Hello World: 1]
[INFO] [1674529120.503572362] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674529120.503888374] [listener]: I heard: [Hello World: 2]
[INFO] [1674529121.503503459] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674529121.503628269] [listener]: I heard: [Hello World: 3]
[INFO] [1674529122.503557862] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674529122.503894772] [listener]: I heard: [Hello World: 4]
[INFO] [1674529123.503574524] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674529123.503884894] [listener]: I heard: [Hello World: 5]
#...
:warning:
Note that dlopen-composed components will not be reflected in the
ros2 component list
command line tool output.
Linktime Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [1674528568.091949637] [linktime_composition]: Load library
[INFO] [1674528568.091995119] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Client>
[INFO] [1674528568.098833910] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [1674528568.100669644] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Server>
[INFO] [1674528568.102665704] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [1674528569.104717098] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674528569.105206993] [listener]: I heard: [Hello World: 1]
[INFO] [1674528570.099206827] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528570.099376432] [Client]: Got result: [5]
[INFO] [1674528570.104656875] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674528570.105069514] [listener]: I heard: [Hello World: 2]
[INFO] [1674528571.104710545] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674528571.105150094] [listener]: I heard: [Hello World: 3]
[INFO] [1674528572.099350955] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528572.099628903] [Client]: Got result: [5]
[INFO] [1674528572.104631322] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674528572.104911174] [listener]: I heard: [Hello World: 4]
[INFO] [1674528573.104596009] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674528573.104751214] [listener]: I heard: [Hello World: 5]
#...
:warning:
Note that linktime-composed components will not be reflected in the
ros2 component list
command line tool output.
Composition Using Launch Actions
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-05-04-23-37-06-363020-d8ff93e471d7-9387
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [9402]
[component_container-1] [INFO] [1714865826.695090046] [my_container]: Load Library: /opt/ros/iron/lib/libtalker_component.so
[component_container-1] [INFO] [1714865826.696388047] [my_container]: Found class: rclcpp_components::NodeFactoryTemplate<composition::Talker>
[component_container-1] [INFO] [1714865826.696435882] [my_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/talker' in container '/my_container'
[component_container-1] [INFO] [1714865826.702958710] [my_container]: Load Library: /opt/ros/iron/lib/liblistener_component.so
[component_container-1] [INFO] [1714865826.703401061] [my_container]: Found class: rclcpp_components::NodeFactoryTemplate<composition::Listener>
[component_container-1] [INFO] [1714865826.703414344] [my_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/listener' in container '/my_container'
[component_container-1] [INFO] [1714865827.701941449] [talker]: Publishing: 'Hello World: 1'
[component_container-1] [INFO] [1714865827.702047599] [listener]: I heard: [Hello World: 1]
[component_container-1] [INFO] [1714865828.701984118] [talker]: Publishing: 'Hello World: 2'
[component_container-1] [INFO] [1714865828.702154523] [listener]: I heard: [Hello World: 2]
[component_container-1] [INFO] [1714865829.702004471] [talker]: Publishing: 'Hello World: 3'
[component_container-1] [INFO] [1714865829.702176059] [listener]: I heard: [Hello World: 3]
[component_container-1] [INFO] [1714865830.701876733] [talker]: Publishing: 'Hello World: 4'
[component_container-1] [INFO] [1714865830.701965546] [listener]: I heard: [Hello World: 4]
[component_container-1] [INFO] [1714865831.701885355] [talker]: Publishing: 'Hello World: 5'
[component_container-1] [INFO] [1714865831.701984823] [listener]: I heard: [Hello World: 5]
FAQ
Q
: Why use node composition?
A
: Node composition avoids the overhead of marshalling and unmarshaling messages by allowing nodes to be instantiated within the same process.
References
Changelog for package composition
0.27.2 (2024-07-10)
- Add launch action console output in the verify section (#683)
- Contributors: Mikael Arguedas
0.27.1 (2023-05-11)
0.27.0 (2023-04-13)
- Change all ROS2 -> ROS 2. (#610)
- Contributors: Chris Lalancette
0.26.0 (2023-04-11)
- update launch file name format to match documentation (#588)
- Contributors: Patrick Wspanialy
0.25.0 (2023-03-01)
0.24.1 (2023-02-24)
0.24.0 (2023-02-14)
- Added README.md for composition (#598)
- Update the demos to C++17. (#594)
- [rolling] Update maintainers - 2022-11-07 (#589)
- Contributors: Audrow Nash, Chris Lalancette, Gary Bey
0.23.0 (2022-11-02)
- fix memory leak (#585)
- Contributors: Chen Lihui
0.22.0 (2022-09-13)
0.21.0 (2022-04-29)
0.20.1 (2022-04-08)
0.20.0 (2022-03-01)
0.19.0 (2022-01-14)
0.18.0 (2021-12-17)
- Update maintainers to Audrow Nash and Michael Jeronimo (#543)
- Additional fixes for documentation in demos. (#538)
- Contributors: Audrow Nash, Chris Lalancette
0.17.0 (2021-10-18)
- Fixing deprecated subscriber callback warnings (#532)
- Contributors: Abrar Rahman Protyasha
0.16.0 (2021-08-11)
0.15.0 (2021-05-14)
0.14.2 (2021-04-26)
0.14.1 (2021-04-19)
0.14.0 (2021-04-06)
0.13.0 (2021-03-25)
0.12.1 (2021-03-18)
0.12.0 (2021-01-25)
0.11.0 (2020-12-10)
- Update the package.xml files with the latest Open Robotics maintainers (#466)
- Contributors: Michael Jeronimo
0.10.1 (2020-09-21)
0.10.0 (2020-06-17)
0.9.3 (2020-06-01)
0.9.2 (2020-05-26)
0.9.1 (2020-05-12)
0.9.0 (2020-04-30)
- Replace deprecated launch_ros usage (#437)
- Update launch_ros action usage (#431)
- code style only: wrap after open parenthesis if not in one line (#429)
- Contributors: Dirk Thomas, Jacob Perron
0.8.4 (2019-11-19)
0.8.3 (2019-11-11)
0.8.2 (2019-11-08)
0.8.1 (2019-10-23)
- Replace ready_fn with ReadyToTest action (#404)
- Contributors: Peter Baughman
0.8.0 (2019-09-26)
- Add an demo component not inherited from rclcpp::Node (#393)
- Contributors: Michael Carroll
0.7.6 (2019-05-30)
0.7.5 (2019-05-29)
0.7.4 (2019-05-20)
0.7.3 (2019-05-10)
0.7.2 (2019-05-08)
- changes to avoid deprecated API's (#332)
- Corrected publish calls with shared_ptr signature (#327)
- Migrate launch tests to new launch_testing features & API (#318)
- Contributors: Michel Hidalgo, William Woodall, ivanpauno
0.7.1 (2019-04-26)
- Renamed launch file, updated to avoid redundant default actions, and set output to screen. (#326)
- Updated constructor to const ref to NodeOptions. (#323)
- Added basic composition launch demo. (#324)
- Contributors: Michael Carroll, William Woodall
0.7.0 (2019-04-14)
- Updated for new rclcpp_components package. (#319)
- Added launch along with launch_testing as test dependencies. (#313)
- Dropped legacy launch API usage. (#311)
- Contributors: Michael Carroll, Michel Hidalgo
0.6.2 (2019-01-15)
0.6.1 (2018-12-13)
0.6.0 (2018-12-07)
- Added semicolons to all RCLCPP and RCUTILS macros. (#278)
- Contributors: Chris Lalancette
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
test_launch_ros | |
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.33.5 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | jazzy |
Last Updated | 2024-11-27 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Aditya Pande
- Audrow Nash
Authors
- Dirk Thomas
- Mabel Zhang
What Is This?
This demo provides examples of three different ways to use the rclcpp_components API to compose multiple nodes in a single process.
This ROS 2 package consists of the following demo applications:
dlopen_composition
linktime_composition
manual_composition
Build
Run the commands below to build the ROS 2 package:
colcon build --packages-up-to composition
Run
Manual Composition
Running manual_composition
compiles an executable that runs the following 4 components:
- Talker: A ROS 2 component that publishes a string
- Listener: A ROS 2 component that prints the received string from Talker
- Server: A ROS 2 component that adds two integers and outputs its result to Client
- Client: A ROS 2 component that sends two integers to Server and prints the received result from Server
ros2 run composition manual_composition
DlOpen Composition
This runs dlopen_composition
which is an alternative to run-time composition by creating a generic container process and explicitly passing the libraries to load without using ROS interfaces.
The process will open each library and create one instance of each “rclcpp::Node” class in the library.
ros2 run composition dlopen_composition `ros2 pkg prefix composition`/lib/libtalker_component.so `ros2 pkg prefix composition`/lib/liblistener_component.so
Linktime Composition
Similar to previous, this runs linktime_composition
which links all classes from libraries that are registered under the library_path with the linker.
ros2 run composition linktime_composition
Composition Using Launch Actions
Rather than using the command line tool to run each composition, we can automate this action with ros2 launch
functionality:
ros2 launch composition composition_demo_launch.py
Verify
Manual Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [1674528188.026468320] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674528188.027043857] [listener]: I heard: [Hello World: 1]
[INFO] [1674528189.026414368] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674528189.026742015] [listener]: I heard: [Hello World: 2]
[INFO] [1674528189.032512995] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528189.032815843] [Client]: Got result: [5]
[INFO] [1674528190.026455807] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674528190.026795770] [listener]: I heard: [Hello World: 3]
[INFO] [1674528191.026457639] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674528191.026801926] [listener]: I heard: [Hello World: 4]
[INFO] [1674528191.032377264] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528191.032604427] [Client]: Got result: [5]
[INFO] [1674528192.026428269] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674528192.026537974] [listener]: I heard: [Hello World: 5]
[INFO] [1674528193.026437034] [talker]: Publishing: 'Hello World: 6'
[INFO] [1674528193.026767708] [listener]: I heard: [Hello World: 6]
[INFO] [1674528193.032377748] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528193.032603036] [Client]: Got result: [5]
#...
:warning:
Note that manually-composed components will not be reflected in the
ros2 component list
command line tool output.
DlOpen Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
INFO] [1674529118.496557668] [dlopen_composition]: Load library /opt/ros/rolling/lib/libtalker_component.so
[INFO] [1674529118.496774575] [dlopen_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [1674529118.503388909] [dlopen_composition]: Load library /opt/ros/rolling/lib/liblistener_component.so
[INFO] [1674529118.503739855] [dlopen_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [1674529119.503505873] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674529119.503770137] [listener]: I heard: [Hello World: 1]
[INFO] [1674529120.503572362] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674529120.503888374] [listener]: I heard: [Hello World: 2]
[INFO] [1674529121.503503459] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674529121.503628269] [listener]: I heard: [Hello World: 3]
[INFO] [1674529122.503557862] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674529122.503894772] [listener]: I heard: [Hello World: 4]
[INFO] [1674529123.503574524] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674529123.503884894] [listener]: I heard: [Hello World: 5]
#...
:warning:
Note that dlopen-composed components will not be reflected in the
ros2 component list
command line tool output.
Linktime Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [1674528568.091949637] [linktime_composition]: Load library
[INFO] [1674528568.091995119] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Client>
[INFO] [1674528568.098833910] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [1674528568.100669644] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Server>
[INFO] [1674528568.102665704] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [1674528569.104717098] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674528569.105206993] [listener]: I heard: [Hello World: 1]
[INFO] [1674528570.099206827] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528570.099376432] [Client]: Got result: [5]
[INFO] [1674528570.104656875] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674528570.105069514] [listener]: I heard: [Hello World: 2]
[INFO] [1674528571.104710545] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674528571.105150094] [listener]: I heard: [Hello World: 3]
[INFO] [1674528572.099350955] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528572.099628903] [Client]: Got result: [5]
[INFO] [1674528572.104631322] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674528572.104911174] [listener]: I heard: [Hello World: 4]
[INFO] [1674528573.104596009] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674528573.104751214] [listener]: I heard: [Hello World: 5]
#...
:warning:
Note that linktime-composed components will not be reflected in the
ros2 component list
command line tool output.
Composition Using Launch Actions
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-05-04-23-37-06-363020-d8ff93e471d7-9387
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [9402]
[component_container-1] [INFO] [1714865826.695090046] [my_container]: Load Library: /opt/ros/jazzy/lib/libtalker_component.so
[component_container-1] [INFO] [1714865826.696388047] [my_container]: Found class: rclcpp_components::NodeFactoryTemplate<composition::Talker>
[component_container-1] [INFO] [1714865826.696435882] [my_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/talker' in container '/my_container'
[component_container-1] [INFO] [1714865826.702958710] [my_container]: Load Library: /opt/ros/jazzy/lib/liblistener_component.so
[component_container-1] [INFO] [1714865826.703401061] [my_container]: Found class: rclcpp_components::NodeFactoryTemplate<composition::Listener>
[component_container-1] [INFO] [1714865826.703414344] [my_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/listener' in container '/my_container'
[component_container-1] [INFO] [1714865827.701941449] [talker]: Publishing: 'Hello World: 1'
[component_container-1] [INFO] [1714865827.702047599] [listener]: I heard: [Hello World: 1]
[component_container-1] [INFO] [1714865828.701984118] [talker]: Publishing: 'Hello World: 2'
[component_container-1] [INFO] [1714865828.702154523] [listener]: I heard: [Hello World: 2]
[component_container-1] [INFO] [1714865829.702004471] [talker]: Publishing: 'Hello World: 3'
[component_container-1] [INFO] [1714865829.702176059] [listener]: I heard: [Hello World: 3]
[component_container-1] [INFO] [1714865830.701876733] [talker]: Publishing: 'Hello World: 4'
[component_container-1] [INFO] [1714865830.701965546] [listener]: I heard: [Hello World: 4]
[component_container-1] [INFO] [1714865831.701885355] [talker]: Publishing: 'Hello World: 5'
[component_container-1] [INFO] [1714865831.701984823] [listener]: I heard: [Hello World: 5]
FAQ
Q
: Why use node composition?
A
: Node composition avoids the overhead of marshalling and unmarshaling messages by allowing nodes to be instantiated within the same process.
References
Changelog for package composition
0.33.5 (2024-09-06)
0.33.4 (2024-06-27)
0.33.3 (2024-05-13)
- [composition] add launch action console output in the verify section (#677) (#681) (cherry picked from commit 34d29db73e78a84a174ad8699a2d646b0eeb1cdf) Co-authored-by: Mikael Arguedas <<mikael.arguedas@gmail.com>>
- Contributors: mergify[bot]
0.33.2 (2024-03-28)
- Update maintainer list in package.xml files (#665)
- Contributors: Michael Jeronimo
0.33.1 (2024-02-07)
0.33.0 (2024-01-24)
- Migrate std::bind calls to lambda expressions (#659)
- Contributors: Felipe Gomes de Melo
0.32.1 (2023-12-26)
0.32.0 (2023-11-06)
0.31.1 (2023-09-07)
0.31.0 (2023-08-21)
0.30.1 (2023-07-11)
0.30.0 (2023-06-12)
0.29.0 (2023-06-07)
0.28.1 (2023-05-11)
0.28.0 (2023-04-27)
0.27.0 (2023-04-13)
- Change all ROS2 -> ROS 2. (#610)
- Contributors: Chris Lalancette
0.26.0 (2023-04-11)
- update launch file name format to match documentation (#588)
- Contributors: Patrick Wspanialy
0.25.0 (2023-03-01)
0.24.1 (2023-02-24)
0.24.0 (2023-02-14)
- Added README.md for composition (#598)
- Update the demos to C++17. (#594)
- [rolling] Update maintainers - 2022-11-07 (#589)
- Contributors: Audrow Nash, Chris Lalancette, Gary Bey
0.23.0 (2022-11-02)
- fix memory leak (#585)
- Contributors: Chen Lihui
0.22.0 (2022-09-13)
0.21.0 (2022-04-29)
0.20.1 (2022-04-08)
0.20.0 (2022-03-01)
0.19.0 (2022-01-14)
0.18.0 (2021-12-17)
- Update maintainers to Audrow Nash and Michael Jeronimo (#543)
- Additional fixes for documentation in demos. (#538)
- Contributors: Audrow Nash, Chris Lalancette
0.17.0 (2021-10-18)
- Fixing deprecated subscriber callback warnings (#532)
- Contributors: Abrar Rahman Protyasha
0.16.0 (2021-08-11)
0.15.0 (2021-05-14)
0.14.2 (2021-04-26)
0.14.1 (2021-04-19)
0.14.0 (2021-04-06)
0.13.0 (2021-03-25)
0.12.1 (2021-03-18)
0.12.0 (2021-01-25)
0.11.0 (2020-12-10)
- Update the package.xml files with the latest Open Robotics maintainers (#466)
- Contributors: Michael Jeronimo
0.10.1 (2020-09-21)
0.10.0 (2020-06-17)
0.9.3 (2020-06-01)
0.9.2 (2020-05-26)
0.9.1 (2020-05-12)
0.9.0 (2020-04-30)
- Replace deprecated launch_ros usage (#437)
- Update launch_ros action usage (#431)
- code style only: wrap after open parenthesis if not in one line (#429)
- Contributors: Dirk Thomas, Jacob Perron
0.8.4 (2019-11-19)
0.8.3 (2019-11-11)
0.8.2 (2019-11-08)
0.8.1 (2019-10-23)
- Replace ready_fn with ReadyToTest action (#404)
- Contributors: Peter Baughman
0.8.0 (2019-09-26)
- Add an demo component not inherited from rclcpp::Node (#393)
- Contributors: Michael Carroll
0.7.6 (2019-05-30)
0.7.5 (2019-05-29)
0.7.4 (2019-05-20)
0.7.3 (2019-05-10)
0.7.2 (2019-05-08)
- changes to avoid deprecated API's (#332)
- Corrected publish calls with shared_ptr signature (#327)
- Migrate launch tests to new launch_testing features & API (#318)
- Contributors: Michel Hidalgo, William Woodall, ivanpauno
0.7.1 (2019-04-26)
- Renamed launch file, updated to avoid redundant default actions, and set output to screen. (#326)
- Updated constructor to const ref to NodeOptions. (#323)
- Added basic composition launch demo. (#324)
- Contributors: Michael Carroll, William Woodall
0.7.0 (2019-04-14)
- Updated for new rclcpp_components package. (#319)
- Added launch along with launch_testing as test dependencies. (#313)
- Dropped legacy launch API usage. (#311)
- Contributors: Michael Carroll, Michel Hidalgo
0.6.2 (2019-01-15)
0.6.1 (2018-12-13)
0.6.0 (2018-12-07)
- Added semicolons to all RCLCPP and RCUTILS macros. (#278)
- Contributors: Chris Lalancette
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
test_launch_ros | |
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.35.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2024-11-26 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Aditya Pande
- Audrow Nash
Authors
- Dirk Thomas
- Mabel Zhang
What Is This?
This demo provides examples of three different ways to use the rclcpp_components API to compose multiple nodes in a single process.
This ROS 2 package consists of the following demo applications:
dlopen_composition
linktime_composition
manual_composition
Build
Run the commands below to build the ROS 2 package:
colcon build --packages-up-to composition
Run
Manual Composition
Running manual_composition
compiles an executable that runs the following 4 components:
- Talker: A ROS 2 component that publishes a string
- Listener: A ROS 2 component that prints the received string from Talker
- Server: A ROS 2 component that adds two integers and outputs its result to Client
- Client: A ROS 2 component that sends two integers to Server and prints the received result from Server
ros2 run composition manual_composition
DlOpen Composition
This runs dlopen_composition
which is an alternative to run-time composition by creating a generic container process and explicitly passing the libraries to load without using ROS interfaces.
The process will open each library and create one instance of each “rclcpp::Node” class in the library.
ros2 run composition dlopen_composition `ros2 pkg prefix composition`/lib/libtalker_component.so `ros2 pkg prefix composition`/lib/liblistener_component.so
Linktime Composition
Similar to previous, this runs linktime_composition
which links all classes from libraries that are registered under the library_path with the linker.
ros2 run composition linktime_composition
Composition Using Launch Actions
Rather than using the command line tool to run each composition, we can automate this action with ros2 launch
functionality:
ros2 launch composition composition_demo_launch.py
Verify
Manual Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [1674528188.026468320] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674528188.027043857] [listener]: I heard: [Hello World: 1]
[INFO] [1674528189.026414368] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674528189.026742015] [listener]: I heard: [Hello World: 2]
[INFO] [1674528189.032512995] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528189.032815843] [Client]: Got result: [5]
[INFO] [1674528190.026455807] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674528190.026795770] [listener]: I heard: [Hello World: 3]
[INFO] [1674528191.026457639] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674528191.026801926] [listener]: I heard: [Hello World: 4]
[INFO] [1674528191.032377264] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528191.032604427] [Client]: Got result: [5]
[INFO] [1674528192.026428269] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674528192.026537974] [listener]: I heard: [Hello World: 5]
[INFO] [1674528193.026437034] [talker]: Publishing: 'Hello World: 6'
[INFO] [1674528193.026767708] [listener]: I heard: [Hello World: 6]
[INFO] [1674528193.032377748] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528193.032603036] [Client]: Got result: [5]
#...
:warning:
Note that manually-composed components will not be reflected in the
ros2 component list
command line tool output.
DlOpen Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
INFO] [1674529118.496557668] [dlopen_composition]: Load library /opt/ros/rolling/lib/libtalker_component.so
[INFO] [1674529118.496774575] [dlopen_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [1674529118.503388909] [dlopen_composition]: Load library /opt/ros/rolling/lib/liblistener_component.so
[INFO] [1674529118.503739855] [dlopen_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [1674529119.503505873] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674529119.503770137] [listener]: I heard: [Hello World: 1]
[INFO] [1674529120.503572362] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674529120.503888374] [listener]: I heard: [Hello World: 2]
[INFO] [1674529121.503503459] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674529121.503628269] [listener]: I heard: [Hello World: 3]
[INFO] [1674529122.503557862] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674529122.503894772] [listener]: I heard: [Hello World: 4]
[INFO] [1674529123.503574524] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674529123.503884894] [listener]: I heard: [Hello World: 5]
#...
:warning:
Note that dlopen-composed components will not be reflected in the
ros2 component list
command line tool output.
Linktime Composition
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [1674528568.091949637] [linktime_composition]: Load library
[INFO] [1674528568.091995119] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Client>
[INFO] [1674528568.098833910] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [1674528568.100669644] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Server>
[INFO] [1674528568.102665704] [linktime_composition]: Instantiate class rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [1674528569.104717098] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674528569.105206993] [listener]: I heard: [Hello World: 1]
[INFO] [1674528570.099206827] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528570.099376432] [Client]: Got result: [5]
[INFO] [1674528570.104656875] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674528570.105069514] [listener]: I heard: [Hello World: 2]
[INFO] [1674528571.104710545] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674528571.105150094] [listener]: I heard: [Hello World: 3]
[INFO] [1674528572.099350955] [Server]: Incoming request: [a: 2, b: 3]
[INFO] [1674528572.099628903] [Client]: Got result: [5]
[INFO] [1674528572.104631322] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674528572.104911174] [listener]: I heard: [Hello World: 4]
[INFO] [1674528573.104596009] [talker]: Publishing: 'Hello World: 5'
[INFO] [1674528573.104751214] [listener]: I heard: [Hello World: 5]
#...
:warning:
Note that linktime-composed components will not be reflected in the
ros2 component list
command line tool output.
Composition Using Launch Actions
When executed correctly, strings should be printed to terminal similar to what is shown below:
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-05-04-23-37-06-363020-d8ff93e471d7-9387
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [9402]
[component_container-1] [INFO] [1714865826.695090046] [my_container]: Load Library: /opt/ros/rolling/lib/libtalker_component.so
[component_container-1] [INFO] [1714865826.696388047] [my_container]: Found class: rclcpp_components::NodeFactoryTemplate<composition::Talker>
[component_container-1] [INFO] [1714865826.696435882] [my_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<composition::Talker>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/talker' in container '/my_container'
[component_container-1] [INFO] [1714865826.702958710] [my_container]: Load Library: /opt/ros/rolling/lib/liblistener_component.so
[component_container-1] [INFO] [1714865826.703401061] [my_container]: Found class: rclcpp_components::NodeFactoryTemplate<composition::Listener>
[component_container-1] [INFO] [1714865826.703414344] [my_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<composition::Listener>
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/listener' in container '/my_container'
[component_container-1] [INFO] [1714865827.701941449] [talker]: Publishing: 'Hello World: 1'
[component_container-1] [INFO] [1714865827.702047599] [listener]: I heard: [Hello World: 1]
[component_container-1] [INFO] [1714865828.701984118] [talker]: Publishing: 'Hello World: 2'
[component_container-1] [INFO] [1714865828.702154523] [listener]: I heard: [Hello World: 2]
[component_container-1] [INFO] [1714865829.702004471] [talker]: Publishing: 'Hello World: 3'
[component_container-1] [INFO] [1714865829.702176059] [listener]: I heard: [Hello World: 3]
[component_container-1] [INFO] [1714865830.701876733] [talker]: Publishing: 'Hello World: 4'
[component_container-1] [INFO] [1714865830.701965546] [listener]: I heard: [Hello World: 4]
[component_container-1] [INFO] [1714865831.701885355] [talker]: Publishing: 'Hello World: 5'
[component_container-1] [INFO] [1714865831.701984823] [listener]: I heard: [Hello World: 5]
FAQ
Q
: Why use node composition?
A
: Node composition avoids the overhead of marshalling and unmarshaling messages by allowing nodes to be instantiated within the same process.
References
Changelog for package composition
0.35.1 (2024-11-20)
0.35.0 (2024-10-03)
- Fix typo in composition comment (#703)
- Contributors: Christophe Bedard
0.34.2 (2024-07-29)
0.34.1 (2024-06-17)
- Change references from "jazzy" to "rolling" on the rolling branch. (#687)
- [composition] add launch action console output in the verify section (#677)
- Contributors: Chris Lalancette, Mikael Arguedas
0.34.0 (2024-04-26)
0.33.2 (2024-03-28)
- Update maintainer list in package.xml files (#665)
- Contributors: Michael Jeronimo
0.33.1 (2024-02-07)
0.33.0 (2024-01-24)
- Migrate std::bind calls to lambda expressions (#659)
- Contributors: Felipe Gomes de Melo
0.32.1 (2023-12-26)
0.32.0 (2023-11-06)
0.31.1 (2023-09-07)
0.31.0 (2023-08-21)
0.30.1 (2023-07-11)
0.30.0 (2023-06-12)
0.29.0 (2023-06-07)
0.28.1 (2023-05-11)
0.28.0 (2023-04-27)
0.27.0 (2023-04-13)
- Change all ROS2 -> ROS 2. (#610)
- Contributors: Chris Lalancette
0.26.0 (2023-04-11)
- update launch file name format to match documentation (#588)
- Contributors: Patrick Wspanialy
0.25.0 (2023-03-01)
0.24.1 (2023-02-24)
0.24.0 (2023-02-14)
- Added README.md for composition (#598)
- Update the demos to C++17. (#594)
- [rolling] Update maintainers - 2022-11-07 (#589)
- Contributors: Audrow Nash, Chris Lalancette, Gary Bey
0.23.0 (2022-11-02)
- fix memory leak (#585)
- Contributors: Chen Lihui
0.22.0 (2022-09-13)
0.21.0 (2022-04-29)
0.20.1 (2022-04-08)
0.20.0 (2022-03-01)
0.19.0 (2022-01-14)
0.18.0 (2021-12-17)
- Update maintainers to Audrow Nash and Michael Jeronimo (#543)
- Additional fixes for documentation in demos. (#538)
- Contributors: Audrow Nash, Chris Lalancette
0.17.0 (2021-10-18)
- Fixing deprecated subscriber callback warnings (#532)
- Contributors: Abrar Rahman Protyasha
0.16.0 (2021-08-11)
0.15.0 (2021-05-14)
0.14.2 (2021-04-26)
0.14.1 (2021-04-19)
0.14.0 (2021-04-06)
0.13.0 (2021-03-25)
0.12.1 (2021-03-18)
0.12.0 (2021-01-25)
0.11.0 (2020-12-10)
- Update the package.xml files with the latest Open Robotics maintainers (#466)
- Contributors: Michael Jeronimo
0.10.1 (2020-09-21)
0.10.0 (2020-06-17)
0.9.3 (2020-06-01)
0.9.2 (2020-05-26)
0.9.1 (2020-05-12)
0.9.0 (2020-04-30)
- Replace deprecated launch_ros usage (#437)
- Update launch_ros action usage (#431)
- code style only: wrap after open parenthesis if not in one line (#429)
- Contributors: Dirk Thomas, Jacob Perron
0.8.4 (2019-11-19)
0.8.3 (2019-11-11)
0.8.2 (2019-11-08)
0.8.1 (2019-10-23)
- Replace ready_fn with ReadyToTest action (#404)
- Contributors: Peter Baughman
0.8.0 (2019-09-26)
- Add an demo component not inherited from rclcpp::Node (#393)
- Contributors: Michael Carroll
0.7.6 (2019-05-30)
0.7.5 (2019-05-29)
0.7.4 (2019-05-20)
0.7.3 (2019-05-10)
0.7.2 (2019-05-08)
- changes to avoid deprecated API's (#332)
- Corrected publish calls with shared_ptr signature (#327)
- Migrate launch tests to new launch_testing features & API (#318)
- Contributors: Michel Hidalgo, William Woodall, ivanpauno
0.7.1 (2019-04-26)
- Renamed launch file, updated to avoid redundant default actions, and set output to screen. (#326)
- Updated constructor to const ref to NodeOptions. (#323)
- Added basic composition launch demo. (#324)
- Contributors: Michael Carroll, William Woodall
0.7.0 (2019-04-14)
- Updated for new rclcpp_components package. (#319)
- Added launch along with launch_testing as test dependencies. (#313)
- Dropped legacy launch API usage. (#311)
- Contributors: Michael Carroll, Michel Hidalgo
0.6.2 (2019-01-15)
0.6.1 (2018-12-13)
0.6.0 (2018-12-07)
- Added semicolons to all RCLCPP and RCUTILS macros. (#278)
- Contributors: Chris Lalancette
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
test_launch_ros | |
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.4.0 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | ardent |
Last Updated | 2017-12-09 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Dirk Thomas
Authors
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.5.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | bouncy |
Last Updated | 2018-10-30 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Dirk Thomas
Authors
Changelog for package composition
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.6.2 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | crystal |
Last Updated | 2019-01-15 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Dirk Thomas
Authors
Changelog for package composition
0.6.2 (2019-01-15)
0.6.1 (2018-12-13)
0.6.0 (2018-12-07)
- Added semicolons to all RCLCPP and RCUTILS macros. (#278)
- Contributors: Chris Lalancette
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.8.4 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | eloquent |
Last Updated | 2020-11-04 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Mabel Zhang
- Michael Jeronimo
Authors
- Dirk Thomas
Changelog for package composition
0.8.4 (2019-11-19)
0.8.3 (2019-11-11)
0.8.2 (2019-11-08)
0.8.1 (2019-10-23)
- Replace ready_fn with ReadyToTest action (#404)
- Contributors: Peter Baughman
0.8.0 (2019-09-26)
- Add an demo component not inherited from rclcpp::Node (#393)
- Contributors: Michael Carroll
0.7.6 (2019-05-30)
0.7.5 (2019-05-29)
0.7.4 (2019-05-20)
0.7.3 (2019-05-10)
0.7.2 (2019-05-08)
- changes to avoid deprecated API's (#332)
- Corrected publish calls with shared_ptr signature (#327)
- Migrate launch tests to new launch_testing features & API (#318)
- Contributors: Michel Hidalgo, William Woodall, ivanpauno
0.7.1 (2019-04-26)
- Renamed launch file, updated to avoid redundant default actions, and set output to screen. (#326)
- Updated constructor to const ref to NodeOptions. (#323)
- Added basic composition launch demo. (#324)
- Contributors: Michael Carroll, William Woodall
0.7.0 (2019-04-14)
- Updated for new rclcpp_components package. (#319)
- Added launch along with launch_testing as test dependencies. (#313)
- Dropped legacy launch API usage. (#311)
- Contributors: Michael Carroll, Michel Hidalgo
0.6.2 (2019-01-15)
0.6.1 (2018-12-13)
0.6.0 (2018-12-07)
- Added semicolons to all RCLCPP and RCUTILS macros. (#278)
- Contributors: Chris Lalancette
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.7.9 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | dashing |
Last Updated | 2020-10-28 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Mabel Zhang
- Michael Jeronimo
Authors
- Dirk Thomas
Changelog for package composition
0.7.6 (2019-05-30)
0.7.5 (2019-05-29)
0.7.4 (2019-05-20)
0.7.3 (2019-05-10)
0.7.2 (2019-05-08)
- changes to avoid deprecated API's (#332)
- Corrected publish calls with shared_ptr signature (#327)
- Migrate launch tests to new launch_testing features & API (#318)
- Contributors: Michel Hidalgo, William Woodall, ivanpauno
0.7.1 (2019-04-26)
- Renamed launch file, updated to avoid redundant default actions, and set output to screen. (#326)
- Updated constructor to const ref to NodeOptions. (#323)
- Added basic composition launch demo. (#324)
- Contributors: Michael Carroll, William Woodall
0.7.0 (2019-04-14)
- Updated for new rclcpp_components package. (#319)
- Added launch along with launch_testing as test dependencies. (#313)
- Dropped legacy launch API usage. (#311)
- Contributors: Michael Carroll, Michel Hidalgo
0.6.2 (2019-01-15)
0.6.1 (2018-12-13)
0.6.0 (2018-12-07)
- Added semicolons to all RCLCPP and RCUTILS macros. (#278)
- Contributors: Chris Lalancette
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.14.4 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | galactic |
Last Updated | 2022-12-07 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Mabel Zhang
- Michael Jeronimo
Authors
- Dirk Thomas
Changelog for package composition
0.14.4 (2022-12-06)
0.14.3 (2021-05-10)
0.14.2 (2021-04-26)
0.14.1 (2021-04-19)
0.14.0 (2021-04-06)
0.13.0 (2021-03-25)
0.12.1 (2021-03-18)
0.12.0 (2021-01-25)
0.11.0 (2020-12-10)
- Update the package.xml files with the latest Open Robotics maintainers (#466)
- Contributors: Michael Jeronimo
0.10.1 (2020-09-21)
0.10.0 (2020-06-17)
0.9.3 (2020-06-01)
0.9.2 (2020-05-26)
0.9.1 (2020-05-12)
0.9.0 (2020-04-30)
- Replace deprecated launch_ros usage (#437)
- Update launch_ros action usage (#431)
- code style only: wrap after open parenthesis if not in one line (#429)
- Contributors: Dirk Thomas, Jacob Perron
0.8.4 (2019-11-19)
0.8.3 (2019-11-11)
0.8.2 (2019-11-08)
0.8.1 (2019-10-23)
- Replace ready_fn with ReadyToTest action (#404)
- Contributors: Peter Baughman
0.8.0 (2019-09-26)
- Add an demo component not inherited from rclcpp::Node (#393)
- Contributors: Michael Carroll
0.7.6 (2019-05-30)
0.7.5 (2019-05-29)
0.7.4 (2019-05-20)
0.7.3 (2019-05-10)
0.7.2 (2019-05-08)
- changes to avoid deprecated API's (#332)
- Corrected publish calls with shared_ptr signature (#327)
- Migrate launch tests to new launch_testing features & API (#318)
- Contributors: Michel Hidalgo, William Woodall, ivanpauno
0.7.1 (2019-04-26)
- Renamed launch file, updated to avoid redundant default actions, and set output to screen. (#326)
- Updated constructor to const ref to NodeOptions. (#323)
- Added basic composition launch demo. (#324)
- Contributors: Michael Carroll, William Woodall
0.7.0 (2019-04-14)
- Updated for new rclcpp_components package. (#319)
- Added launch along with launch_testing as test dependencies. (#313)
- Dropped legacy launch API usage. (#311)
- Contributors: Michael Carroll, Michel Hidalgo
0.6.2 (2019-01-15)
0.6.1 (2018-12-13)
0.6.0 (2018-12-07)
- Added semicolons to all RCLCPP and RCUTILS macros. (#278)
- Contributors: Chris Lalancette
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
test_launch_ros | |
desktop |
Launch files
Messages
Services
Plugins
Recent questions tagged composition at Robotics Stack Exchange
|
Package Summary
Tags | No category tags. |
Version | 0.9.4 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros2/demos.git |
VCS Type | git |
VCS Version | foxy |
Last Updated | 2022-07-25 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Mabel Zhang
- Michael Jeronimo
Authors
- Dirk Thomas
Changelog for package composition
0.9.4 (2022-07-25)
- Update maintainer list for Foxy (#471)
- Contributors: Michael Jeronimo
0.9.3 (2020-06-01)
0.9.2 (2020-05-26)
0.9.1 (2020-05-12)
0.9.0 (2020-04-30)
- Replace deprecated launch_ros usage (#437)
- Update launch_ros action usage (#431)
- code style only: wrap after open parenthesis if not in one line (#429)
- Contributors: Dirk Thomas, Jacob Perron
0.8.4 (2019-11-19)
0.8.3 (2019-11-11)
0.8.2 (2019-11-08)
0.8.1 (2019-10-23)
- Replace ready_fn with ReadyToTest action (#404)
- Contributors: Peter Baughman
0.8.0 (2019-09-26)
- Add an demo component not inherited from rclcpp::Node (#393)
- Contributors: Michael Carroll
0.7.6 (2019-05-30)
0.7.5 (2019-05-29)
0.7.4 (2019-05-20)
0.7.3 (2019-05-10)
0.7.2 (2019-05-08)
- changes to avoid deprecated API's (#332)
- Corrected publish calls with shared_ptr signature (#327)
- Migrate launch tests to new launch_testing features & API (#318)
- Contributors: Michel Hidalgo, William Woodall, ivanpauno
0.7.1 (2019-04-26)
- Renamed launch file, updated to avoid redundant default actions, and set output to screen. (#326)
- Updated constructor to const ref to NodeOptions. (#323)
- Added basic composition launch demo. (#324)
- Contributors: Michael Carroll, William Woodall
0.7.0 (2019-04-14)
- Updated for new rclcpp_components package. (#319)
- Added launch along with launch_testing as test dependencies. (#313)
- Dropped legacy launch API usage. (#311)
- Contributors: Michael Carroll, Michel Hidalgo
0.6.2 (2019-01-15)
0.6.1 (2018-12-13)
0.6.0 (2018-12-07)
- Added semicolons to all RCLCPP and RCUTILS macros. (#278)
- Contributors: Chris Lalancette
0.5.1 (2018-06-28)
0.5.0 (2018-06-27)
- Updated launch files to account for the "old launch" getting
renamespaced as
launch
->launch.legacy
. (#239) - Updated to avoid newly deprecated class loader headers. (#229)
- Added a periodic log message while waiting for a service response.
- Contributors: Dirk Thomas, Michael Carroll, Mikael Arguedas, William Woodall
Wiki Tutorials
Package Dependencies
System Dependencies
Dependant Packages
Name | Deps |
---|---|
depthai_ros_driver | |
test_launch_ros | |
desktop |