-
 

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

C++ nodes which were previously in the ros2/examples repository but are now just used for demo purposes.

Additional Links

No additional links.

Maintainers

  • Audrow Nash
  • Michael Jeronimo

Authors

  • Mabel Zhang
  • William Woodall
README
No README found. No README in repository either.
CHANGELOG

Changelog for package demo_nodes_cpp

0.20.5 (2024-07-26)

0.20.4 (2024-05-15)

0.20.3 (2023-01-10)

0.20.2 (2022-05-10)

  • add a demo of content filter listener (#557) (#559)
  • Contributors: mergify[bot]

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)
  • Add how to fix the most vexing parse problem (#541)
    • use uniform initialization
  • Contributors: Audrow Nash, Tomoya Fujita

0.17.0 (2021-10-18)

  • Fixing deprecated subscriber callback warnings (#532)
  • Contributors: Abrar Rahman Protyasha

0.16.0 (2021-08-11)

  • Update talker_loaned_message.cpp (#518)
  • Contributors: Zongbao Feng

0.15.0 (2021-05-14)

  • Revert "Use sizeof(char) in place for sizeof(void) (#515)" (#516)
  • change how serialized message works with subscription (#497)
  • Use sizeof(char) in place for sizeof(void) (#515)
  • Fix small print issue in allocator tutorial. (#509)
  • Contributors: Chris Lalancette, Michel Hidalgo, William Woodall

0.14.2 (2021-04-26)

  • Small fixes for even_parameters_node. (#500)
  • Contributors: Chris Lalancette

0.14.1 (2021-04-19)

0.14.0 (2021-04-06)

  • change ParameterEventHandler to take events as const ref instead of shared pointer (#494)
  • Fix integer type in RCLCPP_* macro printf. (#492)
  • Contributors: Chris Lalancette, William Woodall

0.13.0 (2021-03-25)

  • Add a demo for the new ParameterEventHandler class (#486)
  • Contributors: Michael Jeronimo

0.12.1 (2021-03-18)

  • Filter qos overrides in paramter events demos (#491)
  • Update code now that parameter types are static by default (#487)
  • Contributors: Ivan Santiago Paunovic

0.12.0 (2021-01-25)

  • Update logging macros (#476)
  • Contributors: Audrow Nash

0.11.0 (2020-12-10)

  • Make sure to wait for the service before declaring events. (#473)
  • Update the package.xml files with the latest Open Robotics maintainers (#466)
  • Contributors: Chris Lalancette, 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)

  • avoid new deprecations (#442)
  • use serialized message (#441)
  • Replace deprecated launch_ros usage (#437)
  • code style only: wrap after open parenthesis if not in one line (#429)
  • Use [spin_until_future_complete]{.title-ref} instead of [spin_some]{.title-ref} in parameters_event demo (#427)
  • change the logging demo test for updated console format (#421)
  • [demo_nodes_cpp] Add XML launch demos (#419)
  • Contributors: Dirk Thomas, Ivan Santiago Paunovic, Jacob Perron, Karsten Knese, Steven Macenski, William Woodall, Yutaka Kondo

0.8.4 (2019-11-19)

  • Add in a more helpful usage message to allocator_tutorial. (#409)
  • Contributors: Chris Lalancette

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

  • Don't redefine add_dependencies (#408)
  • Contributors: Dan Rose

0.8.1 (2019-10-23)

  • rename return functions for loaned messages (#403)
  • Replace ready_fn with ReadyToTest action (#404)
  • remove intra-process manager impl (#382)
  • zero copy api (#394)
  • Remove command line parsing from C++ demos (#401)
  • Need to specify NodeOption explicitly to allow declaration. (#389)
  • Contributors: Alberto Soragna, Jacob Perron, Karsten Knese, Peter Baughman, tomoya

0.8.0 (2019-09-26)

  • Adding visibility macros to demos (#381)
  • Demos using composition (#375)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

  • Update to use new parameter option names (#355)
  • Contributors: William Woodall

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

  • Added the parameter_blackboard demo to demo_nodes_cpp to make some tutorials easier. (#333)
  • Contributors: William Woodall

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)

  • Updated to declare parameters. (#241)
  • Contributors: Shane Loretz

0.7.0 (2019-04-14)

  • Moved away from deprecated rclcpp APIs. (#321)
  • Added launch along with launch_testing as test dependencies. (#313)
  • Updated for NodeOptions Node constructor. (#308)
  • Contributors: Emerson Knapp, 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)
  • Removed parameter node, all nodes take parameter by default now (#265)
  • Added example of registering custom parameter validation callbacks (#273)
  • Removed imu_listener node (#272)
  • Refined demo_nodes_cpp source codes (#269)
  • Fixed typo in comment (#268)
  • Removed rosidl deps as this package doesnt generate any messages (#264)
  • Fixed no return code for main() in several files (#266)
  • Contributors: Chris Lalancette, Mikael Arguedas, Yutaka Kondo, testkit

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

  • Reduced the publishing of the allocator_tutorial to 100Hz. (#257)
    • Signed-off-by: Chris Lalancette <<clalancette@openrobotics.org>>
  • Removed the now obsolete ros2param executable, use ros2 param instead. (#251)
  • Fixed a potiential nullptr dereference issue in demo_nodes_cpp. (#242)
  • Added demo nodes which use the new serialized message typed publishers and subscriptions. (#185)
  • Added a new-style launch file for the talker and listener demo nodes, called talker_listener.launch.py. (#244)
  • Updated launch files to account for the "old launch" getting renamespaced as launch -> launch.legacy. (#239)
  • Updated to handle refactor of the ParameterVariant class. (#237)
  • Updated to account for the fact that the ROS Parameter services starts automatically now. (#236)
  • Added some uses of parameter arrays to the set_and_get_parameters demo. (#235)
  • Contributors: Chris Lalancette, Dirk Thomas, Karsten Knese, Mikael Arguedas, Shane Loretz, William Woodall, cshen

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Recent questions tagged demo_nodes_cpp 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

C++ nodes which were previously in the ros2/examples repository but are now just used for demo purposes.

Additional Links

No additional links.

Maintainers

  • Aditya Pande
  • Audrow Nash
  • Michael Jeronimo

Authors

  • Mabel Zhang
  • William Woodall

What Is This?

This package provides several examples that demonstrate various inter-node communcations in ROS 2.

This package consists of the following examples:

  1. add_two_ints_client
  2. listener_serialized_message
  3. reuse_timer
  4. add_two_ints_client_async
  5. list_parameters
  6. set_and_get_parameters
  7. add_two_ints_server
  8. list_parameters_async
  9. set_and_get_parameters_async
  10. allocator_tutorial
  11. one_off_timer
  12. set_parameters_callback
  13. content_filtering_publisher
  14. parameter_blackboard
  15. talker
  16. content_filtering_subscriber
  17. parameter_event_handler
  18. talker_loaned_message
  19. even_parameters_node
  20. parameter_events
  21. talker_serialized_message
  22. listener
  23. parameter_events_async
  24. listener_best_effort
  25. matched_event_detect

Build

Run the command below to compile the demo_nodes_cpp ROS 2 package:

colcon build --packages-up-to demo_nodes_cpp

Run

Basic Talker & Listener

This runs a basic ROS 2 publisher and subscriber that exchanges the following string message with an incrementing integer:

Hello World:

Talker

# Open new terminal
ros2 run demo_nodes_cpp talker

Listener [Default]

# Open new terminal
ros2 run demo_nodes_cpp listener

Listener [Best Effort]

Compared to Listener [Default], listener_best_effort runs a ROS 2 subscriber node that sets the Quality of Service (QoS) Reliability setting to Best Effort via the use of rclcpp::SensorDataQoS, as opposed to the default Reliable.

Messages sent using this policy configuration attempts to deliver samples but may lose them if the network is not robust.

# Open new terminal
ros2 run demo_nodes_cpp listener_best_effort

Basic Server & Client

This runs a ROS 2 server that provides a service to process two integers, outputting the sum back to ROS 2 client node.

Server

# Open new terminal
ros2 run demo_nodes_cpp add_two_ints_server

Client [Synchronous]

# Open new terminal
ros2 run demo_nodes_cpp add_two_ints_client

Client [Asynchronous]

# Open new terminal
ros2 run demo_nodes_cpp add_two_ints_client_async

One-Off Timer

This runs one_off_timer that runs a periodic timer callback that cancels and creates a Wall Timer every 3 callbacks.

ros2 run demo_nodes_cpp one_off_timer

Reuse Timer

Similar to the previous demo, reuse_timer runs a periodic timer callback that reuses the same Wall Timer every 3 callbacks.

ros2 run demo_nodes_cpp reuse_timer

Serialized Messaging

This runs talker_serialized_message ROS 2 node that publishes a manual CDR serialization of the same string message.

# Open new terminal
ros2 run demo_nodes_cpp talker_serialized_message

This runs listener_serialized_message ROS 2 node that subscribes and prints out the serialized string message published by talker_serialized_message.

# Open new terminal
ros2 run demo_nodes_cpp listener_serialized_message

Content-Filter Messaging

This runs content_filtering_subscriber and content_filtering_publisher ROS 2 nodes which exchanges temperature data on the /temperature topic.

However the subscriber requests that data is only sent if the temperature is less than -30 C or greater than 100 C, saving bandwidth.

# Open new terminal
ros2 run demo_nodes_cpp content_filtering_subscriber

# Open new terminal
ros2 run demo_nodes_cpp content_filtering_publisher

List Parameters

This runs list_parameters ROS 2 node which simply programmatically list example parameter names and prefixes:

Synchronous

# Open new terminal
ros2 run demo_nodes_cpp list_parameters

Asynchronous

# Open new terminal
ros2 run demo_nodes_cpp list_parameters_async

Set & Get Parameters

This runs set_and_get_parameters ROS 2 node which programmatically sets and gets parameters.

Synchronous

# Open new terminal
ros2 run demo_nodes_cpp set_and_get_parameters

Asynchronous

# Open new terminal
ros2 run demo_nodes_cpp set_and_get_parameters_async

Allocator Tutorial

This runs allocator_tutorial ROS 2 node that publishes a std_msgs/msg/UInt32 message that contains an integer representing the number of allocations and deallocations that happened during the program.

# Open new terminal
ros2 run demo_nodes_cpp allocator_tutorial

Parameter Events

This runs parameter_events/parameters_events_async ROS 2 node(s) which initiates 10 parameter events which changes an example string parameter.

foo -> bar -> baz -> foobar -> foo -> bar -> baz -> foobar -> foo -> bar

Synchronous

# Open new terminal
ros2 run demo_nodes_cpp parameter_events

Asynchronous

# Open new terminal
ros2 run demo_nodes_cpp parameters_events_async

Even Parameters Node

This runs even_parameters_node ROS 2 node which shows a parameter callback that rejects all parameter updates except those that set an even integer.

# Open new terminal
ros2 run demo_nodes_cpp even_parameters_node

Set Parameters Callback

This runs set_parameters_callback ROS 2 node which triggers a callback when ROS 2 double parameter param1 is set.

The callback then sets ROS 2 double parameter param2 to a fixed 4.0.

# Open new terminal
ros2 run demo_nodes_cpp set_parameters_callback

Parameter Blackboard

This runs parameter_blackboard ROS 2 node which instantiates a ROS 2 parameter server which acts as a global “blackboard” for all nodes to get and set parameters.

# Open new terminal
ros2 run demo_nodes_cpp parameters_blackboard

Parameter Event Handler

This runs parameter_event_handler ROS 2 node which monitors changes to the following parameters:

node: “this_node” parameter: “an_int_param”

node: "/a_namespace/a_remote_node"
parameter: "a_string_param"
# Open new terminal
ros2 run demo_nodes_cpp parameter_event_handler

Loaned Messager Talker

This runs loaned_message_talker ROS 2 node that publishes unique messages which eliminates unnecessary copies throughout the ROS 2 stack to maximize performance.

# Open new terminal
ros2 run demo_nodes_cpp talker_loaned_message

Matched Event Detect

This runs 3 ROS 2 nodes. matched_event_detect_node node that set matched event callback for publisher and subscription separately to output connection or disconnection information. multi_sub_node create/destroy subscriptions which connect the publisher of matched_event_detect_node. multi_pub_node create/destroy publishers which connect the subscription of matched_event_detect_node.

# Open new terminal
ros2 run demo_nodes_cpp matched_event_detect

Verify

Basic Talker & Listener

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running talker
[INFO] [1674551635.122315831] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674551636.122275756] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674551637.122274384] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674551638.122235965] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674551639.122277484] [talker]: Publishing: 'Hello World: 5'
#...

# In terminal running listener/listener_best_effort
[INFO] [1674551636.122881229] [listener]: I heard: [Hello World: 1]
[INFO] [1674551637.122832606] [listener]: I heard: [Hello World: 2]
[INFO] [1674551638.122675099] [listener]: I heard: [Hello World: 3]
[INFO] [1674551639.122788087] [listener]: I heard: [Hello World: 4]
[INFO] [1674551640.122850575] [listener]: I heard: [Hello World: 5]
#...

Basic Server & Client

When executed correctly, strings should be printed to terminal similar to what is shown below:

Server

# In terminal running add_two_ints_server
[INFO] [1674553268.912391774] [add_two_ints_server]: Incoming request
a: 2 b: 3

Client [Synchronous]

# In terminal running add_two_ints_client
[INFO] [1674553268.912602310] [add_two_ints_client]: Result of add_two_ints: 5

Client [Asynchronous]

# In terminal running add_two_ints_client_async
[INFO] [1674553718.598690033] [add_two_ints_client]: Result of add_two_ints: 5

One-Off Timer

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running one_off_timer
[INFO] [1674552840.400680444] [one_off_timer]: in periodic_timer callback
[INFO] [1674552840.400915092] [one_off_timer]:   resetting one off timer
[INFO] [1674552841.401204072] [one_off_timer]: in one_off_timer callback
[INFO] [1674552842.400698264] [one_off_timer]: in periodic_timer callback
[INFO] [1674552842.400819311] [one_off_timer]:   not resetting one off timer
[INFO] [1674552844.400695640] [one_off_timer]: in periodic_timer callback
[INFO] [1674552844.400819933] [one_off_timer]:   not resetting one off timer
[INFO] [1674552846.400684373] [one_off_timer]: in periodic_timer callback
[INFO] [1674552846.400799868] [one_off_timer]:   resetting one off timer
[INFO] [1674552847.400948238] [one_off_timer]: in one_off_timer callback
[INFO] [1674552848.400703699] [one_off_timer]: in periodic_timer callback
[INFO] [1674552848.400828811] [one_off_timer]:   not resetting one off timer
[INFO] [1674552850.400680424] [one_off_timer]: in periodic_timer callback
[INFO] [1674552850.400775977] [one_off_timer]:   not resetting one off timer
[INFO] [1674552852.400690511] [one_off_timer]: in periodic_timer callback
[INFO] [1674552852.400815404] [one_off_timer]:   resetting one off timer
[INFO] [1674552853.401060139] [one_off_timer]: in one_off_timer callback
#...

Notice how the timer is reset only after two callback iterations.

Reuse Timer

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674554333.056000613] [reuse_timer]: in periodic_timer callback
[INFO] [1674554333.056432269] [reuse_timer]:   resetting one off timer
[INFO] [1674554334.056732370] [reuse_timer]: in one_off_timer callback
[INFO] [1674554335.055978249] [reuse_timer]: in periodic_timer callback
[INFO] [1674554335.056111777] [reuse_timer]:   not resetting one off timer
[INFO] [1674554337.055978910] [reuse_timer]: in periodic_timer callback
[INFO] [1674554337.056108925] [reuse_timer]:   not resetting one off timer
[INFO] [1674554339.055966108] [reuse_timer]: in periodic_timer callback
[INFO] [1674554339.056083983] [reuse_timer]:   resetting one off timer
[INFO] [1674554340.056295399] [reuse_timer]: in one_off_timer callback
#...

Same as One-Off Timer.

Serialized Messaging

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running talker_serialized_message
ROS message:
Hello World:1
serialized message:
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 31 00
ROS message:
Hello World:2
serialized message:
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 32 00
ROS message:
Hello World:3
serialized message:
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 33 00

# In terminal running listerner_serialized_message
I heard data of length: 24
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 32 00 00 00
serialized data after deserialization: Hello World:2
I heard data of length: 24
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 33 00 00 00
serialized data after deserialization: Hello World:3
I heard data of length: 24
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 34 00 00 00
serialized data after deserialization: Hello World:4
#...

Content-Filtering Messaging

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running content_filtering_publisher
[INFO] [1674563203.567530898] [content_filtering_publisher]: Publishing: '-100.000000'
[INFO] [1674563204.567508197] [content_filtering_publisher]: Publishing: '-90.000000'
[INFO] [1674563205.567517142] [content_filtering_publisher]: Publishing: '-80.000000'
#...

# In terminal running content_filtering_subscriber
[INFO] [1674563182.873825084] [content_filtering_subscriber]: subscribed to topic "/temperature" with content filter options "data < %0 OR data > %1, {-30.000000, 100.000000}"
[INFO] [1674563203.568310361] [content_filtering_subscriber]: I receive an emergency temperature data: [-100.000000]
[INFO] [1674563204.568128370] [content_filtering_subscriber]: I receive an emergency temperature data: [-90.000000]
[INFO] [1674563205.568082783] [content_filtering_subscriber]: I receive an emergency temperature data: [-80.000000]
#...

List Parameters [Synchronous/Asynchronous]

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674563905.346022942] [list_paramters]: Setting parameters...
[INFO] [1674563905.347158439] [list_paramters]: Listing parameters...
[INFO] [1674563905.347570888] [list_paramters]:
Parameter names:
 bar
 foo
 foo.first
 foo.second
Parameter prefixes:
 foo

Set & Get Parameters [Synchronous/Asynchronous]

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674564137.057616328] [set_and_get_parameters]:
Parameter name: foo
Parameter value (integer): 2
Parameter name: baz
Parameter value (double): 1.450000
Parameter name: foobarbaz
Parameter value (bool_array): [true, false]
Parameter name: toto
Parameter value (byte_array): [0xff, 0x7f]

Allocator Tutorial

When executed correctly, strings should be printed to terminal similar to what is shown below:

This simple demo shows off a custom memory allocator to count all
instances of new/delete in the program.  It can be run in either regular
mode (no arguments), or in intra-process mode (by passing 'intra' as a
command-line argument).  It will then publish a message to the
'/allocator_tutorial' topic every 10 milliseconds until Ctrl-C is pressed.
At that time it will print a count of the number of allocations and
deallocations that happened during the program.

Intra-process pipeline is OFF.

Run ros2 topic echo /allocator_tutorial to see the output in the ROS 2 topic, /allocator_tutorial:

# Open new terminal
data: 224
---
data: 228
---
data: 230
---
data: 231
---
data: 233
---
data: 234
---
data: 235
---

Parameter Events [Synchronous/Asynchronous]

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674565202.370104660] [parameter_events]:
Parameter event:
 new parameters:
  foo
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370241604] [parameter_events]:
Parameter event:
 new parameters:
  bar
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370303487] [parameter_events]:
Parameter event:
 new parameters:
  baz
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370355113] [parameter_events]:
Parameter event:
 new parameters:
  foobar
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370398069] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  foo
 deleted parameters:

[INFO] [1674565202.370424143] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  bar
 deleted parameters:

[INFO] [1674565202.370447765] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  baz
 deleted parameters:

[INFO] [1674565202.370470405] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  foobar
 deleted parameters:

[INFO] [1674565202.370492871] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  foo
 deleted parameters:

[INFO] [1674565202.370515168] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  bar
 deleted parameters:

Even Parameters Node

Run ros2 param set /even_parameters_node myint 2 to set the parameter to a valid even integer and produce a similar result like below:

[INFO] [1674566014.892688389] [even_parameters_node]: parameter 'myint' has changed and is now: 2

Run ros2 param set /even_parameters_node myint 3 to set the parameter to an invalid odd integer and produce a similar result like below:

[INFO] [1674566088.870030436] [even_parameters_node]: Requested value '3' for parameter 'myint' is not an even number: rejecting change...

Set Parameters Callback

[Before]

Run ros2 param get /set_parameters_callback param1 should print the following to terminal:

Double value is: 0.0

Run ros2 param get /set_parameters_callback param2 should print the following to terminal:

Double value is 0.0

[Change]

Run ros2 param set /set_parameters_callback param1 28.0 should print the following to terminal:

Set parameter successful

[After]

Run ros2 param get /set_parameters_callback param1 should print the following to terminal:

Double value is: 28.0

Run ros2 param get /set_parameters_callback param2 should print the following to terminal:

Double value is 4.0

Parameter Blackboard

When executed correctly, strings should be printed to terminal similar to what is shown below:

INFO] [1674568261.762813104] [parameter_blackboard]: Parameter blackboard node named '/parameter_blackboard' ready, and serving '5' parameters already!

Running ros2 param list should reveal the 5 parameters served:

/parameter_blackboard:
  qos_overrides./parameter_events.publisher.depth
  qos_overrides./parameter_events.publisher.durability
  qos_overrides./parameter_events.publisher.history
  qos_overrides./parameter_events.publisher.reliability
  use_sim_time
/rqt_gui_py_node_33886:
  use_sim_time

Parameter Event Handler

Run ros2 param set this_node an_int_param 21 in a new terminal will produce the following results:

# In terminal running parameter_event_handler
[INFO] [1674569608.306038487] [this_node]: cb1: Received an update to parameter "an_int_param" of type integer: "21"
[INFO] [1674569608.306356753] [this_node]: cb3: Received an update to parameter "an_int_param" of type: integer: "21"

Run ros2 param set /a_namespace/a_remote_node a_string_param "string value to set" in a new terminal will produce the following results:

[INFO] [1674569622.728945232] [this_node]: cb2: Received an update to parameter "a_string_param" of type: string: "string value to set"
[INFO] [1674569622.729143396] [this_node]: cb3: Received an update to parameter "a_string_param" of type: string: "string value to set"
[INFO] [1674569622.729246614] [this_node]: cb3: Received an update to parameter "a_string_param" of type: string: "string value to set"

Loaned Message Talker

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running loaned_message_talker
[INFO] [1674570146.112222368] [loaned_message_talker]: Publishing: 'Hello World: 1'
[INFO] [1674570147.111670599] [loaned_message_talker]: Publishing: '2.000000'
[INFO] [1674570147.111853637] [loaned_message_talker]: Publishing: 'Hello World: 2'
[INFO] [1674570148.111662758] [loaned_message_talker]: Publishing: '3.000000'
[INFO] [1674570148.111804226] [loaned_message_talker]: Publishing: 'Hello World: 3'
[INFO] [1674570149.111651863] [loaned_message_talker]: Publishing: '4.000000'
[INFO] [1674570149.111819520] [loaned_message_talker]: Publishing: 'Hello World: 4'


Note that Fast-DDS does not support the loaned messages. The loaned message API is used in iceoryx right now, which workes with CycloneDDS.

Matched Event Detect

When executed correctly, strings should be printed to terminal similar to what is shown below:

#  In terminal running matched_event_detect
[INFO] [1679887690.127684740] [multi_sub_node]: Create a new subscription.
[INFO] [1679887690.128090105] [matched_event_detect_node]: First subscription is connected.
[INFO] [1679887690.128836774] [multi_sub_node]: Create a new subscription.
[INFO] [1679887690.129157780] [matched_event_detect_node]: The changed number of connected subscription is 1 and current number of connected subscription is 2.
[INFO] [1679887690.129193220] [multi_sub_node]: Destroy a subscription.
[INFO] [1679887690.130552475] [matched_event_detect_node]: The changed number of connected subscription is -1 and current number of connected subscription is 1.
[INFO] [1679887690.130588555] [multi_sub_node]: Destroy a subscription.
[INFO] [1679887690.131355128] [matched_event_detect_node]: Last subscription is disconnected.
[INFO] [1679887690.132014952] [multi_pub_node]: Create a new publisher.
[INFO] [1679887690.132262901] [matched_event_detect_node]: First publisher is connected.
[INFO] [1679887690.132898522] [multi_pub_node]: Create a new publisher.
[INFO] [1679887690.133143624] [matched_event_detect_node]: The changed number of connected publisher is 1 and current number of connected publisher is 2.
[INFO] [1679887690.133178687] [multi_pub_node]: Destroy a publisher.
[INFO] [1679887690.134139929] [matched_event_detect_node]: The changed number of connected publisher is -1 and current number of connected publisher is 1.
[INFO] [1679887690.134176647] [multi_pub_node]: Destroy a publisher.
[INFO] [1679887690.134887946] [matched_event_detect_node]: Last publisher is disconnected.

FAQ

Q: Encountered the following error in terminal when running Loaned Message Talker:

[INFO] [1674570146.112148792] [rclcpp]: Currently used middleware can't loan messages. Local allocator will be used.

A: Ensure that CycloneDDS RMW is used by running export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp.

References

  1. Zero-Copy via Loaned Messages
  2. ROS 2 Quality of Service Policies
  3. Creating a content filtering subscription
CHANGELOG

Changelog for package demo_nodes_cpp

0.27.2 (2024-07-10)

0.27.1 (2023-05-11)

0.27.0 (2023-04-13)

  • Change all ROS2 -> ROS 2. (#610)
  • Add matched event demo for rclcpp and rclpy (#607)
  • Contributors: Barry Xu, Chris Lalancette

0.26.0 (2023-04-11)

  • Fix the set_parameters_callback example program. (#608)
  • [demo_nodes_cpp] Add YAML launch demos for topics (#605)
  • update launch file name format to match documentation (#588)
  • Contributors: Chris Lalancette, Damien LaRocque, Patrick Wspanialy

0.25.0 (2023-03-01)

  • Service introspection (#602)
    • Add in a rclcpp and rclpy demo of introspection.
  • Contributors: Chris Lalancette

0.24.1 (2023-02-24)

  • Added README.md for demo_cpp_nodes (#599)
  • Contributors: Gary Bey

0.24.0 (2023-02-14)

  • Update the demos to C++17. (#594)
  • [rolling] Update maintainers - 2022-11-07 (#589)
  • Contributors: Audrow Nash, Chris Lalancette

0.23.0 (2022-11-02)

  • Demo for pre and post set parameter callback support (#565)
    • local parameter callback support
  • Contributors: Deepanshu Bansal

0.22.0 (2022-09-13)

  • counter starts from 1, not 2. (#562)
  • add a demo of content filter listener (#557)
  • Contributors: Chen Lihui, Tomoya Fujita

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)
  • Add how to fix the most vexing parse problem (#541)
    • use uniform initialization
  • Contributors: Audrow Nash, Tomoya Fujita

0.17.0 (2021-10-18)

  • Fixing deprecated subscriber callback warnings (#532)
  • Contributors: Abrar Rahman Protyasha

0.16.0 (2021-08-11)

  • Update talker_loaned_message.cpp (#518)
  • Contributors: Zongbao Feng

0.15.0 (2021-05-14)

  • Revert "Use sizeof(char) in place for sizeof(void) (#515)" (#516)
  • change how serialized message works with subscription (#497)
  • Use sizeof(char) in place for sizeof(void) (#515)
  • Fix small print issue in allocator tutorial. (#509)
  • Contributors: Chris Lalancette, Michel Hidalgo, William Woodall

0.14.2 (2021-04-26)

  • Small fixes for even_parameters_node. (#500)
  • Contributors: Chris Lalancette

0.14.1 (2021-04-19)

0.14.0 (2021-04-06)

  • change ParameterEventHandler to take events as const ref instead of shared pointer (#494)
  • Fix integer type in RCLCPP_* macro printf. (#492)
  • Contributors: Chris Lalancette, William Woodall

0.13.0 (2021-03-25)

  • Add a demo for the new ParameterEventHandler class (#486)
  • Contributors: Michael Jeronimo

0.12.1 (2021-03-18)

  • Filter qos overrides in paramter events demos (#491)
  • Update code now that parameter types are static by default (#487)
  • Contributors: Ivan Santiago Paunovic

0.12.0 (2021-01-25)

  • Update logging macros (#476)
  • Contributors: Audrow Nash

0.11.0 (2020-12-10)

  • Make sure to wait for the service before declaring events. (#473)
  • Update the package.xml files with the latest Open Robotics maintainers (#466)
  • Contributors: Chris Lalancette, 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)

  • avoid new deprecations (#442)
  • use serialized message (#441)
  • Replace deprecated launch_ros usage (#437)
  • code style only: wrap after open parenthesis if not in one line (#429)
  • Use [spin_until_future_complete]{.title-ref} instead of [spin_some]{.title-ref} in parameters_event demo (#427)
  • change the logging demo test for updated console format (#421)
  • [demo_nodes_cpp] Add XML launch demos (#419)
  • Contributors: Dirk Thomas, Ivan Santiago Paunovic, Jacob Perron, Karsten Knese, Steven Macenski, William Woodall, Yutaka Kondo

0.8.4 (2019-11-19)

  • Add in a more helpful usage message to allocator_tutorial. (#409)
  • Contributors: Chris Lalancette

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

  • Don't redefine add_dependencies (#408)
  • Contributors: Dan Rose

0.8.1 (2019-10-23)

  • rename return functions for loaned messages (#403)
  • Replace ready_fn with ReadyToTest action (#404)
  • remove intra-process manager impl (#382)
  • zero copy api (#394)
  • Remove command line parsing from C++ demos (#401)
  • Need to specify NodeOption explicitly to allow declaration. (#389)
  • Contributors: Alberto Soragna, Jacob Perron, Karsten Knese, Peter Baughman, tomoya

0.8.0 (2019-09-26)

  • Adding visibility macros to demos (#381)
  • Demos using composition (#375)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

  • Update to use new parameter option names (#355)
  • Contributors: William Woodall

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

  • Added the parameter_blackboard demo to demo_nodes_cpp to make some tutorials easier. (#333)
  • Contributors: William Woodall

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)

  • Updated to declare parameters. (#241)
  • Contributors: Shane Loretz

0.7.0 (2019-04-14)

  • Moved away from deprecated rclcpp APIs. (#321)
  • Added launch along with launch_testing as test dependencies. (#313)
  • Updated for NodeOptions Node constructor. (#308)
  • Contributors: Emerson Knapp, 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)
  • Removed parameter node, all nodes take parameter by default now (#265)
  • Added example of registering custom parameter validation callbacks (#273)
  • Removed imu_listener node (#272)
  • Refined demo_nodes_cpp source codes (#269)
  • Fixed typo in comment (#268)
  • Removed rosidl deps as this package doesnt generate any messages (#264)
  • Fixed no return code for main() in several files (#266)
  • Contributors: Chris Lalancette, Mikael Arguedas, Yutaka Kondo, testkit

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

  • Reduced the publishing of the allocator_tutorial to 100Hz. (#257)
    • Signed-off-by: Chris Lalancette <<clalancette@openrobotics.org>>
  • Removed the now obsolete ros2param executable, use ros2 param instead. (#251)
  • Fixed a potiential nullptr dereference issue in demo_nodes_cpp. (#242)
  • Added demo nodes which use the new serialized message typed publishers and subscriptions. (#185)
  • Added a new-style launch file for the talker and listener demo nodes, called talker_listener.launch.py. (#244)
  • Updated launch files to account for the "old launch" getting renamespaced as launch -> launch.legacy. (#239)
  • Updated to handle refactor of the ParameterVariant class. (#237)
  • Updated to account for the fact that the ROS Parameter services starts automatically now. (#236)
  • Added some uses of parameter arrays to the set_and_get_parameters demo. (#235)
  • Contributors: Chris Lalancette, Dirk Thomas, Karsten Knese, Mikael Arguedas, Shane Loretz, William Woodall, cshen

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Recent questions tagged demo_nodes_cpp 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-09-06
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

C++ nodes which were previously in the ros2/examples repository but are now just used for demo purposes.

Additional Links

No additional links.

Maintainers

  • Aditya Pande
  • Audrow Nash

Authors

  • Mabel Zhang
  • William Woodall

What Is This?

This package provides several examples that demonstrate various inter-node communcations in ROS 2.

This package consists of the following examples:

  1. add_two_ints_client
  2. listener_serialized_message
  3. reuse_timer
  4. add_two_ints_client_async
  5. list_parameters
  6. set_and_get_parameters
  7. add_two_ints_server
  8. list_parameters_async
  9. set_and_get_parameters_async
  10. allocator_tutorial
  11. one_off_timer
  12. set_parameters_callback
  13. content_filtering_publisher
  14. parameter_blackboard
  15. talker
  16. content_filtering_subscriber
  17. parameter_event_handler
  18. talker_loaned_message
  19. even_parameters_node
  20. parameter_events
  21. talker_serialized_message
  22. listener
  23. parameter_events_async
  24. listener_best_effort
  25. matched_event_detect

Build

Run the command below to compile the demo_nodes_cpp ROS 2 package:

colcon build --packages-up-to demo_nodes_cpp

Note: By default, the demo executables will spin up the SingleThreaded executor if run in separate processes, i.e., not composed in the same component container. To configure the demo executables to run with a different executor, build the package with the custom DEMO_EXECUTOR flag set to the fully qualified name of the executor. For example, to run with the experimental EventsExecutor,

colcon build --packages-select demo_nodes_cpp --cmake-args -DDEMO_EXECUTOR:STRING=rclcpp::experimental::executors::EventsExecutor

Run

Basic Talker & Listener

This runs a basic ROS 2 publisher and subscriber that exchanges the following string message with an incrementing integer:

Hello World:

Talker

# Open new terminal
ros2 run demo_nodes_cpp talker

Listener [Default]

# Open new terminal
ros2 run demo_nodes_cpp listener

Listener [Best Effort]

Compared to Listener [Default], listener_best_effort runs a ROS 2 subscriber node that sets the Quality of Service (QoS) Reliability setting to Best Effort via the use of rclcpp::SensorDataQoS, as opposed to the default Reliable.

Messages sent using this policy configuration attempts to deliver samples but may lose them if the network is not robust.

# Open new terminal
ros2 run demo_nodes_cpp listener_best_effort

Basic Server & Client

This runs a ROS 2 server that provides a service to process two integers, outputting the sum back to ROS 2 client node.

Server

# Open new terminal
ros2 run demo_nodes_cpp add_two_ints_server

Client [Synchronous]

# Open new terminal
ros2 run demo_nodes_cpp add_two_ints_client

Client [Asynchronous]

# Open new terminal
ros2 run demo_nodes_cpp add_two_ints_client_async

One-Off Timer

This runs one_off_timer that runs a periodic timer callback that cancels and creates a Wall Timer every 3 callbacks.

ros2 run demo_nodes_cpp one_off_timer

Reuse Timer

Similar to the previous demo, reuse_timer runs a periodic timer callback that reuses the same Wall Timer every 3 callbacks.

ros2 run demo_nodes_cpp reuse_timer

Serialized Messaging

This runs talker_serialized_message ROS 2 node that publishes a manual CDR serialization of the same string message.

# Open new terminal
ros2 run demo_nodes_cpp talker_serialized_message

This runs listener_serialized_message ROS 2 node that subscribes and prints out the serialized string message published by talker_serialized_message.

# Open new terminal
ros2 run demo_nodes_cpp listener_serialized_message

Content-Filter Messaging

This runs content_filtering_subscriber and content_filtering_publisher ROS 2 nodes which exchanges temperature data on the /temperature topic.

However the subscriber requests that data is only sent if the temperature is less than -30 C or greater than 100 C, saving bandwidth.

# Open new terminal
ros2 run demo_nodes_cpp content_filtering_subscriber

# Open new terminal
ros2 run demo_nodes_cpp content_filtering_publisher

List Parameters

This runs list_parameters ROS 2 node which simply programmatically list example parameter names and prefixes:

Synchronous

# Open new terminal
ros2 run demo_nodes_cpp list_parameters

Asynchronous

# Open new terminal
ros2 run demo_nodes_cpp list_parameters_async

Set & Get Parameters

This runs set_and_get_parameters ROS 2 node which programmatically sets and gets parameters.

Synchronous

# Open new terminal
ros2 run demo_nodes_cpp set_and_get_parameters

Asynchronous

# Open new terminal
ros2 run demo_nodes_cpp set_and_get_parameters_async

Allocator Tutorial

This runs allocator_tutorial ROS 2 node that publishes a std_msgs/msg/UInt32 message that contains an integer representing the number of allocations and deallocations that happened during the program.

# Open new terminal
ros2 run demo_nodes_cpp allocator_tutorial

Parameter Events

This runs parameter_events/parameter_events_async ROS 2 node(s) which initiates 10 parameter events which changes an example string parameter.

foo -> bar -> baz -> foobar -> foo -> bar -> baz -> foobar -> foo -> bar

Synchronous

# Open new terminal
ros2 run demo_nodes_cpp parameter_events

Asynchronous

# Open new terminal
ros2 run demo_nodes_cpp parameters_events_async

Even Parameters Node

This runs even_parameters_node ROS 2 node which shows a parameter callback that rejects all parameter updates except those that set an even integer.

# Open new terminal
ros2 run demo_nodes_cpp even_parameters_node

Set Parameters Callback

This runs set_parameters_callback ROS 2 node which triggers a callback when ROS 2 double parameter param1 is set.

The callback then sets ROS 2 double parameter param2 to a fixed 4.0.

# Open new terminal
ros2 run demo_nodes_cpp set_parameters_callback

Parameter Blackboard

This runs parameter_blackboard ROS 2 node which instantiates a ROS 2 parameter server which acts as a global “blackboard” for all nodes to get and set parameters.

# Open new terminal
ros2 run demo_nodes_cpp parameter_blackboard

Parameter Event Handler

This runs parameter_event_handler ROS 2 node which monitors changes to the following parameters:

node: “this_node” parameter: “an_int_param”

node: "/a_namespace/a_remote_node"
parameter: "a_string_param"
# Open new terminal
ros2 run demo_nodes_cpp parameter_event_handler

Loaned Messager Talker

This runs loaned_message_talker ROS 2 node that publishes unique messages which eliminates unnecessary copies throughout the ROS 2 stack to maximize performance.

# Open new terminal
ros2 run demo_nodes_cpp talker_loaned_message

Matched Event Detect

This runs 3 ROS 2 nodes. matched_event_detect_node node that set matched event callback for publisher and subscription separately to output connection or disconnection information. multi_sub_node create/destroy subscriptions which connect the publisher of matched_event_detect_node. multi_pub_node create/destroy publishers which connect the subscription of matched_event_detect_node.

# Open new terminal
ros2 run demo_nodes_cpp matched_event_detect

Verify

Basic Talker & Listener

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running talker
[INFO] [1674551635.122315831] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674551636.122275756] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674551637.122274384] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674551638.122235965] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674551639.122277484] [talker]: Publishing: 'Hello World: 5'
#...

# In terminal running listener/listener_best_effort
[INFO] [1674551636.122881229] [listener]: I heard: [Hello World: 1]
[INFO] [1674551637.122832606] [listener]: I heard: [Hello World: 2]
[INFO] [1674551638.122675099] [listener]: I heard: [Hello World: 3]
[INFO] [1674551639.122788087] [listener]: I heard: [Hello World: 4]
[INFO] [1674551640.122850575] [listener]: I heard: [Hello World: 5]
#...

Basic Server & Client

When executed correctly, strings should be printed to terminal similar to what is shown below:

Server

# In terminal running add_two_ints_server
[INFO] [1674553268.912391774] [add_two_ints_server]: Incoming request
a: 2 b: 3

Client [Synchronous]

# In terminal running add_two_ints_client
[INFO] [1674553268.912602310] [add_two_ints_client]: Result of add_two_ints: 5

Client [Asynchronous]

# In terminal running add_two_ints_client_async
[INFO] [1674553718.598690033] [add_two_ints_client]: Result of add_two_ints: 5

One-Off Timer

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running one_off_timer
[INFO] [1674552840.400680444] [one_off_timer]: in periodic_timer callback
[INFO] [1674552840.400915092] [one_off_timer]:   resetting one off timer
[INFO] [1674552841.401204072] [one_off_timer]: in one_off_timer callback
[INFO] [1674552842.400698264] [one_off_timer]: in periodic_timer callback
[INFO] [1674552842.400819311] [one_off_timer]:   not resetting one off timer
[INFO] [1674552844.400695640] [one_off_timer]: in periodic_timer callback
[INFO] [1674552844.400819933] [one_off_timer]:   not resetting one off timer
[INFO] [1674552846.400684373] [one_off_timer]: in periodic_timer callback
[INFO] [1674552846.400799868] [one_off_timer]:   resetting one off timer
[INFO] [1674552847.400948238] [one_off_timer]: in one_off_timer callback
[INFO] [1674552848.400703699] [one_off_timer]: in periodic_timer callback
[INFO] [1674552848.400828811] [one_off_timer]:   not resetting one off timer
[INFO] [1674552850.400680424] [one_off_timer]: in periodic_timer callback
[INFO] [1674552850.400775977] [one_off_timer]:   not resetting one off timer
[INFO] [1674552852.400690511] [one_off_timer]: in periodic_timer callback
[INFO] [1674552852.400815404] [one_off_timer]:   resetting one off timer
[INFO] [1674552853.401060139] [one_off_timer]: in one_off_timer callback
#...

Notice how the timer is reset only after two callback iterations.

Reuse Timer

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674554333.056000613] [reuse_timer]: in periodic_timer callback
[INFO] [1674554333.056432269] [reuse_timer]:   resetting one off timer
[INFO] [1674554334.056732370] [reuse_timer]: in one_off_timer callback
[INFO] [1674554335.055978249] [reuse_timer]: in periodic_timer callback
[INFO] [1674554335.056111777] [reuse_timer]:   not resetting one off timer
[INFO] [1674554337.055978910] [reuse_timer]: in periodic_timer callback
[INFO] [1674554337.056108925] [reuse_timer]:   not resetting one off timer
[INFO] [1674554339.055966108] [reuse_timer]: in periodic_timer callback
[INFO] [1674554339.056083983] [reuse_timer]:   resetting one off timer
[INFO] [1674554340.056295399] [reuse_timer]: in one_off_timer callback
#...

Same as One-Off Timer.

Serialized Messaging

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running talker_serialized_message
ROS message:
Hello World:1
serialized message:
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 31 00
ROS message:
Hello World:2
serialized message:
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 32 00
ROS message:
Hello World:3
serialized message:
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 33 00

# In terminal running listerner_serialized_message
I heard data of length: 24
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 32 00 00 00
serialized data after deserialization: Hello World:2
I heard data of length: 24
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 33 00 00 00
serialized data after deserialization: Hello World:3
I heard data of length: 24
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 34 00 00 00
serialized data after deserialization: Hello World:4
#...

Content-Filtering Messaging

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running content_filtering_publisher
[INFO] [1674563203.567530898] [content_filtering_publisher]: Publishing: '-100.000000'
[INFO] [1674563204.567508197] [content_filtering_publisher]: Publishing: '-90.000000'
[INFO] [1674563205.567517142] [content_filtering_publisher]: Publishing: '-80.000000'
#...

# In terminal running content_filtering_subscriber
[INFO] [1674563182.873825084] [content_filtering_subscriber]: subscribed to topic "/temperature" with content filter options "data < %0 OR data > %1, {-30.000000, 100.000000}"
[INFO] [1674563203.568310361] [content_filtering_subscriber]: I receive an emergency temperature data: [-100.000000]
[INFO] [1674563204.568128370] [content_filtering_subscriber]: I receive an emergency temperature data: [-90.000000]
[INFO] [1674563205.568082783] [content_filtering_subscriber]: I receive an emergency temperature data: [-80.000000]
#...

List Parameters [Synchronous/Asynchronous]

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674563905.346022942] [list_parameters]: Setting parameters...
[INFO] [1674563905.347158439] [list_parameters]: Listing parameters...
[INFO] [1674563905.347570888] [list_parameters]:
Parameter names:
 bar
 foo
 foo.first
 foo.second
Parameter prefixes:
 foo

Set & Get Parameters [Synchronous/Asynchronous]

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674564137.057616328] [set_and_get_parameters]:
Parameter name: foo
Parameter value (integer): 2
Parameter name: baz
Parameter value (double): 1.450000
Parameter name: foobarbaz
Parameter value (bool_array): [true, false]
Parameter name: toto
Parameter value (byte_array): [0xff, 0x7f]

Allocator Tutorial

When executed correctly, strings should be printed to terminal similar to what is shown below:

This simple demo shows off a custom memory allocator to count all
instances of new/delete in the program.  It can be run in either regular
mode (no arguments), or in intra-process mode (by passing 'intra' as a
command-line argument).  It will then publish a message to the
'/allocator_tutorial' topic every 10 milliseconds until Ctrl-C is pressed.
At that time it will print a count of the number of allocations and
deallocations that happened during the program.

Intra-process pipeline is OFF.

Run ros2 topic echo /allocator_tutorial to see the output in the ROS 2 topic, /allocator_tutorial:

# Open new terminal
data: 224
---
data: 228
---
data: 230
---
data: 231
---
data: 233
---
data: 234
---
data: 235
---

Parameter Events [Synchronous/Asynchronous]

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674565202.370104660] [parameter_events]:
Parameter event:
 new parameters:
  foo
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370241604] [parameter_events]:
Parameter event:
 new parameters:
  bar
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370303487] [parameter_events]:
Parameter event:
 new parameters:
  baz
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370355113] [parameter_events]:
Parameter event:
 new parameters:
  foobar
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370398069] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  foo
 deleted parameters:

[INFO] [1674565202.370424143] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  bar
 deleted parameters:

[INFO] [1674565202.370447765] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  baz
 deleted parameters:

[INFO] [1674565202.370470405] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  foobar
 deleted parameters:

[INFO] [1674565202.370492871] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  foo
 deleted parameters:

[INFO] [1674565202.370515168] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  bar
 deleted parameters:

Even Parameters Node

Run ros2 param set /even_parameters_node myint 2 to set the parameter to a valid even integer and produce a similar result like below:

[INFO] [1674566014.892688389] [even_parameters_node]: parameter 'myint' has changed and is now: 2

Run ros2 param set /even_parameters_node myint 3 to set the parameter to an invalid odd integer and produce a similar result like below:

[INFO] [1674566088.870030436] [even_parameters_node]: Requested value '3' for parameter 'myint' is not an even number: rejecting change...

Set Parameters Callback

[Before]

Run ros2 param get /set_param_callback_node param1 should print the following to terminal:

Double value is: 0.0

Run ros2 param get /set_param_callback_node param2 should print the following to terminal:

Double value is 0.0

[Change]

Run ros2 param set set_param_callback_node param1 10.0 and see it fail with

Setting parameter failed: cannot set 'param1' > 5.0

Run ros2 param set set_param_callback_node param1 3.0

Set parameter successful

[After]

Run ros2 param get /set_param_callback_node param1 should print the following to terminal:

Double value is: 28.0

Run ros2 param get /set_param_callback_node param2 should print the following to terminal:

Double value is 4.0

Parameter Blackboard

When executed correctly, strings should be printed to terminal similar to what is shown below:

INFO] [1674568261.762813104] [parameter_blackboard]: Parameter blackboard node named '/parameter_blackboard' ready, and serving '5' parameters already!

Running ros2 param list should reveal the 6 parameters served:

/parameter_blackboard:
  qos_overrides./parameter_events.publisher.depth
  qos_overrides./parameter_events.publisher.durability
  qos_overrides./parameter_events.publisher.history
  qos_overrides./parameter_events.publisher.reliability
  start_type_description_service
  use_sim_time

Parameter Event Handler

Run ros2 param set this_node an_int_param 21 in a new terminal will produce the following results:

# In terminal running parameter_event_handler
[INFO] [1674569608.306038487] [this_node]: cb1: Received an update to parameter "an_int_param" of type integer: "21"
[INFO] [1674569608.306356753] [this_node]: cb3: Received an update to parameter "an_int_param" of type: integer: "21"

Run ros2 param set /a_namespace/a_remote_node a_string_param "string value to set" in a new terminal will produce the following results:

[INFO] [1674569622.728945232] [this_node]: cb2: Received an update to parameter "a_string_param" of type: string: "string value to set"
[INFO] [1674569622.729143396] [this_node]: cb3: Received an update to parameter "a_string_param" of type: string: "string value to set"
[INFO] [1674569622.729246614] [this_node]: cb3: Received an update to parameter "a_string_param" of type: string: "string value to set"

Loaned Message Talker

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running loaned_message_talker
[INFO] [1674570146.112222368] [loaned_message_talker]: Publishing: 'Hello World: 1'
[INFO] [1674570147.111670599] [loaned_message_talker]: Publishing: '2.000000'
[INFO] [1674570147.111853637] [loaned_message_talker]: Publishing: 'Hello World: 2'
[INFO] [1674570148.111662758] [loaned_message_talker]: Publishing: '3.000000'
[INFO] [1674570148.111804226] [loaned_message_talker]: Publishing: 'Hello World: 3'
[INFO] [1674570149.111651863] [loaned_message_talker]: Publishing: '4.000000'
[INFO] [1674570149.111819520] [loaned_message_talker]: Publishing: 'Hello World: 4'


Note that Fast-DDS does not support the loaned messages. The loaned message API is used in iceoryx right now, which workes with CycloneDDS.

Matched Event Detect

When executed correctly, strings should be printed to terminal similar to what is shown below:

#  In terminal running matched_event_detect
[INFO] [1679887690.127684740] [multi_sub_node]: Create a new subscription.
[INFO] [1679887690.128090105] [matched_event_detect_node]: First subscription is connected.
[INFO] [1679887690.128836774] [multi_sub_node]: Create a new subscription.
[INFO] [1679887690.129157780] [matched_event_detect_node]: The changed number of connected subscription is 1 and current number of connected subscription is 2.
[INFO] [1679887690.129193220] [multi_sub_node]: Destroy a subscription.
[INFO] [1679887690.130552475] [matched_event_detect_node]: The changed number of connected subscription is -1 and current number of connected subscription is 1.
[INFO] [1679887690.130588555] [multi_sub_node]: Destroy a subscription.
[INFO] [1679887690.131355128] [matched_event_detect_node]: Last subscription is disconnected.
[INFO] [1679887690.132014952] [multi_pub_node]: Create a new publisher.
[INFO] [1679887690.132262901] [matched_event_detect_node]: First publisher is connected.
[INFO] [1679887690.132898522] [multi_pub_node]: Create a new publisher.
[INFO] [1679887690.133143624] [matched_event_detect_node]: The changed number of connected publisher is 1 and current number of connected publisher is 2.
[INFO] [1679887690.133178687] [multi_pub_node]: Destroy a publisher.
[INFO] [1679887690.134139929] [matched_event_detect_node]: The changed number of connected publisher is -1 and current number of connected publisher is 1.
[INFO] [1679887690.134176647] [multi_pub_node]: Destroy a publisher.
[INFO] [1679887690.134887946] [matched_event_detect_node]: Last publisher is disconnected.

FAQ

Q: Encountered the following error in terminal when running Loaned Message Talker:

[INFO] [1674570146.112148792] [rclcpp]: Currently used middleware can't loan messages. Local allocator will be used.

A: Ensure that CycloneDDS RMW is used by running export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp.

References

  1. Zero-Copy via Loaned Messages
  2. ROS 2 Quality of Service Policies
  3. Creating a content filtering subscription
CHANGELOG

Changelog for package demo_nodes_cpp

0.33.5 (2024-09-06)

0.33.4 (2024-06-27)

0.33.3 (2024-05-13)

  • [demo_nodes_cpp] some readme and executable name fixups (#678) (#688) (cherry picked from commit aa8df8904b864d063e31fd5b953ffe561c7a9fe0) Co-authored-by: Mikael Arguedas <<mikael.arguedas@gmail.com>>
  • Fix gcc warnings when building with optimizations. (#672) (#673) * Fix gcc warnings when building with optimizations. When building the allocator_tutorial_pmr demo with -O2, gcc is throwing an error saying that new and delete are mismatched. This is something of a misnomer, however; the real problem is that the global new override we have in that demo is actually implemented incorrectly. In particular, the documentation at https://en.cppreference.com/w/cpp/memory/new/operator_new very clearly specifies that operator new either has to return a valid pointer, or throw an exception on error. Our version wasn't throwing the exception, so change it to throw std::bad_alloc if std::malloc fails. While we are in here, also fix another small possible is where std::malloc could return nullptr on a zero-sized object, thus throwing an exception it shouldn't. * Always inline the new and delete operators. That's because gcc 13 has a bug where it can sometimes inline one or the other, and then it detects that they mismatch. For gcc and clang, just force them to always be inline in this demo. * Switch to NOINLINE instead. Both clang and MSVC don't like inlining these, so instead ensure that they are not inlined. This also works because the problem is when new is inlined but not delete (or vice-versa). As long as they are both not inlined, this should fix the warning. (cherry picked from commit 957ddbb9f04f55cabd8496e8d74eb35ee4d29105) Co-authored-by: Chris Lalancette <<clalancette@gmail.com>>

  • Contributors: mergify[bot]

0.33.2 (2024-03-28)

  • A few uncrustify fixes for 0.78. (#667)
  • Allow users to configure the executor for executables in [demo_nodes_cpp]{.title-ref} (#666)
  • Update maintainer list in package.xml files (#665)
  • Contributors: Chris Lalancette, Michael Jeronimo, Yadu

0.33.1 (2024-02-07)

0.33.0 (2024-01-24)

0.32.1 (2023-12-26)

  • Added extra documentation and clarifications. (#651)
  • Contributors: jrutgeer

0.32.0 (2023-11-06)

  • Add in support for both the PMR and custom allocator tutorials. (#655)
  • Replacing old-style C++ allocator with a polymorphic memory resource (PMR) (#653)
  • Contributors: Ali Ashkani Nia, Chris Lalancette

0.31.1 (2023-09-07)

  • Remove unnecessary captures in the various demos. (#647)
  • Contributors: Chris Lalancette

0.31.0 (2023-08-21)

  • Dramatically speed up the demo_nodes_cpp tests (#641)
  • Switch to using RCLCPP logging macros in the lifecycle package. (#644)
  • Contributors: Chris Lalancette

0.30.1 (2023-07-11)

  • failed to call introspection_client (#643)
  • Contributors: Chen Lihui

0.30.0 (2023-06-12)

  • Small cleanups to the demos when running through them. (#639)
  • Cleanup demo_nodes_cpp CMake and dependencies (#638)
  • Change the service introspection parameter off value to 'disabled' (#634)
  • Contributors: Chris Lalancette

0.29.0 (2023-06-07)

  • Add demos for using logger service (#611)
  • Contributors: Barry Xu

0.28.1 (2023-05-11)

0.28.0 (2023-04-27)

0.27.0 (2023-04-13)

  • Change all ROS2 -> ROS 2. (#610)
  • Add matched event demo for rclcpp and rclpy (#607)
  • Contributors: Barry Xu, Chris Lalancette

0.26.0 (2023-04-11)

  • Fix the set_parameters_callback example program. (#608)
  • [demo_nodes_cpp] Add YAML launch demos for topics (#605)
  • update launch file name format to match documentation (#588)
  • Contributors: Chris Lalancette, Damien LaRocque, Patrick Wspanialy

0.25.0 (2023-03-01)

  • Service introspection (#602)
    • Add in a rclcpp and rclpy demo of introspection.
  • Contributors: Chris Lalancette

0.24.1 (2023-02-24)

  • Added README.md for demo_cpp_nodes (#599)
  • Contributors: Gary Bey

0.24.0 (2023-02-14)

  • Update the demos to C++17. (#594)
  • [rolling] Update maintainers - 2022-11-07 (#589)
  • Contributors: Audrow Nash, Chris Lalancette

0.23.0 (2022-11-02)

  • Demo for pre and post set parameter callback support (#565)
    • local parameter callback support
  • Contributors: Deepanshu Bansal

0.22.0 (2022-09-13)

  • counter starts from 1, not 2. (#562)
  • add a demo of content filter listener (#557)
  • Contributors: Chen Lihui, Tomoya Fujita

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)
  • Add how to fix the most vexing parse problem (#541)
    • use uniform initialization
  • Contributors: Audrow Nash, Tomoya Fujita

0.17.0 (2021-10-18)

  • Fixing deprecated subscriber callback warnings (#532)
  • Contributors: Abrar Rahman Protyasha

0.16.0 (2021-08-11)

  • Update talker_loaned_message.cpp (#518)
  • Contributors: Zongbao Feng

0.15.0 (2021-05-14)

  • Revert "Use sizeof(char) in place for sizeof(void) (#515)" (#516)
  • change how serialized message works with subscription (#497)
  • Use sizeof(char) in place for sizeof(void) (#515)
  • Fix small print issue in allocator tutorial. (#509)
  • Contributors: Chris Lalancette, Michel Hidalgo, William Woodall

0.14.2 (2021-04-26)

  • Small fixes for even_parameters_node. (#500)
  • Contributors: Chris Lalancette

0.14.1 (2021-04-19)

0.14.0 (2021-04-06)

  • change ParameterEventHandler to take events as const ref instead of shared pointer (#494)
  • Fix integer type in RCLCPP_* macro printf. (#492)
  • Contributors: Chris Lalancette, William Woodall

0.13.0 (2021-03-25)

  • Add a demo for the new ParameterEventHandler class (#486)
  • Contributors: Michael Jeronimo

0.12.1 (2021-03-18)

  • Filter qos overrides in paramter events demos (#491)
  • Update code now that parameter types are static by default (#487)
  • Contributors: Ivan Santiago Paunovic

0.12.0 (2021-01-25)

  • Update logging macros (#476)
  • Contributors: Audrow Nash

0.11.0 (2020-12-10)

  • Make sure to wait for the service before declaring events. (#473)
  • Update the package.xml files with the latest Open Robotics maintainers (#466)
  • Contributors: Chris Lalancette, 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)

  • avoid new deprecations (#442)
  • use serialized message (#441)
  • Replace deprecated launch_ros usage (#437)
  • code style only: wrap after open parenthesis if not in one line (#429)
  • Use [spin_until_future_complete]{.title-ref} instead of [spin_some]{.title-ref} in parameters_event demo (#427)
  • change the logging demo test for updated console format (#421)
  • [demo_nodes_cpp] Add XML launch demos (#419)
  • Contributors: Dirk Thomas, Ivan Santiago Paunovic, Jacob Perron, Karsten Knese, Steven Macenski, William Woodall, Yutaka Kondo

0.8.4 (2019-11-19)

  • Add in a more helpful usage message to allocator_tutorial. (#409)
  • Contributors: Chris Lalancette

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

  • Don't redefine add_dependencies (#408)
  • Contributors: Dan Rose

0.8.1 (2019-10-23)

  • rename return functions for loaned messages (#403)
  • Replace ready_fn with ReadyToTest action (#404)
  • remove intra-process manager impl (#382)
  • zero copy api (#394)
  • Remove command line parsing from C++ demos (#401)
  • Need to specify NodeOption explicitly to allow declaration. (#389)
  • Contributors: Alberto Soragna, Jacob Perron, Karsten Knese, Peter Baughman, tomoya

0.8.0 (2019-09-26)

  • Adding visibility macros to demos (#381)
  • Demos using composition (#375)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

  • Update to use new parameter option names (#355)
  • Contributors: William Woodall

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

  • Added the parameter_blackboard demo to demo_nodes_cpp to make some tutorials easier. (#333)
  • Contributors: William Woodall

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)

  • Updated to declare parameters. (#241)
  • Contributors: Shane Loretz

0.7.0 (2019-04-14)

  • Moved away from deprecated rclcpp APIs. (#321)
  • Added launch along with launch_testing as test dependencies. (#313)
  • Updated for NodeOptions Node constructor. (#308)
  • Contributors: Emerson Knapp, 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)
  • Removed parameter node, all nodes take parameter by default now (#265)
  • Added example of registering custom parameter validation callbacks (#273)
  • Removed imu_listener node (#272)
  • Refined demo_nodes_cpp source codes (#269)
  • Fixed typo in comment (#268)
  • Removed rosidl deps as this package doesnt generate any messages (#264)
  • Fixed no return code for main() in several files (#266)
  • Contributors: Chris Lalancette, Mikael Arguedas, Yutaka Kondo, testkit

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

  • Reduced the publishing of the allocator_tutorial to 100Hz. (#257)
    • Signed-off-by: Chris Lalancette <<clalancette@openrobotics.org>>
  • Removed the now obsolete ros2param executable, use ros2 param instead. (#251)
  • Fixed a potiential nullptr dereference issue in demo_nodes_cpp. (#242)
  • Added demo nodes which use the new serialized message typed publishers and subscriptions. (#185)
  • Added a new-style launch file for the talker and listener demo nodes, called talker_listener.launch.py. (#244)
  • Updated launch files to account for the "old launch" getting renamespaced as launch -> launch.legacy. (#239)
  • Updated to handle refactor of the ParameterVariant class. (#237)
  • Updated to account for the fact that the ROS Parameter services starts automatically now. (#236)
  • Added some uses of parameter arrays to the set_and_get_parameters demo. (#235)
  • Contributors: Chris Lalancette, Dirk Thomas, Karsten Knese, Mikael Arguedas, Shane Loretz, William Woodall, cshen

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Recent questions tagged demo_nodes_cpp 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-20
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

C++ nodes which were previously in the ros2/examples repository but are now just used for demo purposes.

Additional Links

No additional links.

Maintainers

  • Aditya Pande
  • Audrow Nash

Authors

  • Mabel Zhang
  • William Woodall

What Is This?

This package provides several examples that demonstrate various inter-node communcations in ROS 2.

This package consists of the following examples:

  1. add_two_ints_client
  2. listener_serialized_message
  3. reuse_timer
  4. add_two_ints_client_async
  5. list_parameters
  6. set_and_get_parameters
  7. add_two_ints_server
  8. list_parameters_async
  9. set_and_get_parameters_async
  10. allocator_tutorial
  11. one_off_timer
  12. set_parameters_callback
  13. content_filtering_publisher
  14. parameter_blackboard
  15. talker
  16. content_filtering_subscriber
  17. parameter_event_handler
  18. talker_loaned_message
  19. even_parameters_node
  20. parameter_events
  21. talker_serialized_message
  22. listener
  23. parameter_events_async
  24. listener_best_effort
  25. matched_event_detect

Build

Run the command below to compile the demo_nodes_cpp ROS 2 package:

colcon build --packages-up-to demo_nodes_cpp

Note: By default, the demo executables will spin up the SingleThreaded executor if run in separate processes, i.e., not composed in the same component container. To configure the demo executables to run with a different executor, build the package with the custom DEMO_EXECUTOR flag set to the fully qualified name of the executor. For example, to run with the experimental EventsExecutor,

colcon build --packages-select demo_nodes_cpp --cmake-args -DDEMO_EXECUTOR:STRING=rclcpp::experimental::executors::EventsExecutor

Run

Basic Talker & Listener

This runs a basic ROS 2 publisher and subscriber that exchanges the following string message with an incrementing integer:

Hello World:

Talker

# Open new terminal
ros2 run demo_nodes_cpp talker

Listener [Default]

# Open new terminal
ros2 run demo_nodes_cpp listener

Listener [Best Effort]

Compared to Listener [Default], listener_best_effort runs a ROS 2 subscriber node that sets the Quality of Service (QoS) Reliability setting to Best Effort via the use of rclcpp::SensorDataQoS, as opposed to the default Reliable.

Messages sent using this policy configuration attempts to deliver samples but may lose them if the network is not robust.

# Open new terminal
ros2 run demo_nodes_cpp listener_best_effort

Basic Server & Client

This runs a ROS 2 server that provides a service to process two integers, outputting the sum back to ROS 2 client node.

Server

# Open new terminal
ros2 run demo_nodes_cpp add_two_ints_server

Client [Synchronous]

# Open new terminal
ros2 run demo_nodes_cpp add_two_ints_client

Client [Asynchronous]

# Open new terminal
ros2 run demo_nodes_cpp add_two_ints_client_async

One-Off Timer

This runs one_off_timer that runs a periodic timer callback that cancels and creates a Wall Timer every 3 callbacks.

ros2 run demo_nodes_cpp one_off_timer

Reuse Timer

Similar to the previous demo, reuse_timer runs a periodic timer callback that reuses the same Wall Timer every 3 callbacks.

ros2 run demo_nodes_cpp reuse_timer

Serialized Messaging

This runs talker_serialized_message ROS 2 node that publishes a manual CDR serialization of the same string message.

# Open new terminal
ros2 run demo_nodes_cpp talker_serialized_message

This runs listener_serialized_message ROS 2 node that subscribes and prints out the serialized string message published by talker_serialized_message.

# Open new terminal
ros2 run demo_nodes_cpp listener_serialized_message

Content-Filter Messaging

This runs content_filtering_subscriber and content_filtering_publisher ROS 2 nodes which exchanges temperature data on the /temperature topic.

However the subscriber requests that data is only sent if the temperature is less than -30 C or greater than 100 C, saving bandwidth.

# Open new terminal
ros2 run demo_nodes_cpp content_filtering_subscriber

# Open new terminal
ros2 run demo_nodes_cpp content_filtering_publisher

List Parameters

This runs list_parameters ROS 2 node which simply programmatically list example parameter names and prefixes:

Synchronous

# Open new terminal
ros2 run demo_nodes_cpp list_parameters

Asynchronous

# Open new terminal
ros2 run demo_nodes_cpp list_parameters_async

Set & Get Parameters

This runs set_and_get_parameters ROS 2 node which programmatically sets and gets parameters.

Synchronous

# Open new terminal
ros2 run demo_nodes_cpp set_and_get_parameters

Asynchronous

# Open new terminal
ros2 run demo_nodes_cpp set_and_get_parameters_async

Allocator Tutorial

This runs allocator_tutorial ROS 2 node that publishes a std_msgs/msg/UInt32 message that contains an integer representing the number of allocations and deallocations that happened during the program.

# Open new terminal
ros2 run demo_nodes_cpp allocator_tutorial

Parameter Events

This runs parameter_events/parameter_events_async ROS 2 node(s) which initiates 10 parameter events which changes an example string parameter.

foo -> bar -> baz -> foobar -> foo -> bar -> baz -> foobar -> foo -> bar

Synchronous

# Open new terminal
ros2 run demo_nodes_cpp parameter_events

Asynchronous

# Open new terminal
ros2 run demo_nodes_cpp parameters_events_async

Even Parameters Node

This runs even_parameters_node ROS 2 node which shows a parameter callback that rejects all parameter updates except those that set an even integer.

# Open new terminal
ros2 run demo_nodes_cpp even_parameters_node

Set Parameters Callback

This runs set_parameters_callback ROS 2 node which triggers a callback when ROS 2 double parameter param1 is set.

The callback then sets ROS 2 double parameter param2 to a fixed 4.0.

# Open new terminal
ros2 run demo_nodes_cpp set_parameters_callback

Parameter Blackboard

This runs parameter_blackboard ROS 2 node which instantiates a ROS 2 parameter server which acts as a global “blackboard” for all nodes to get and set parameters.

# Open new terminal
ros2 run demo_nodes_cpp parameter_blackboard

Parameter Event Handler

This runs parameter_event_handler ROS 2 node which monitors changes to the following parameters:

node: “this_node” parameter: “an_int_param”

node: "/a_namespace/a_remote_node"
parameter: "a_string_param"
# Open new terminal
ros2 run demo_nodes_cpp parameter_event_handler

Loaned Messager Talker

This runs loaned_message_talker ROS 2 node that publishes unique messages which eliminates unnecessary copies throughout the ROS 2 stack to maximize performance.

# Open new terminal
ros2 run demo_nodes_cpp talker_loaned_message

Matched Event Detect

This runs 3 ROS 2 nodes. matched_event_detect_node node that set matched event callback for publisher and subscription separately to output connection or disconnection information. multi_sub_node create/destroy subscriptions which connect the publisher of matched_event_detect_node. multi_pub_node create/destroy publishers which connect the subscription of matched_event_detect_node.

# Open new terminal
ros2 run demo_nodes_cpp matched_event_detect

Verify

Basic Talker & Listener

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running talker
[INFO] [1674551635.122315831] [talker]: Publishing: 'Hello World: 1'
[INFO] [1674551636.122275756] [talker]: Publishing: 'Hello World: 2'
[INFO] [1674551637.122274384] [talker]: Publishing: 'Hello World: 3'
[INFO] [1674551638.122235965] [talker]: Publishing: 'Hello World: 4'
[INFO] [1674551639.122277484] [talker]: Publishing: 'Hello World: 5'
#...

# In terminal running listener/listener_best_effort
[INFO] [1674551636.122881229] [listener]: I heard: [Hello World: 1]
[INFO] [1674551637.122832606] [listener]: I heard: [Hello World: 2]
[INFO] [1674551638.122675099] [listener]: I heard: [Hello World: 3]
[INFO] [1674551639.122788087] [listener]: I heard: [Hello World: 4]
[INFO] [1674551640.122850575] [listener]: I heard: [Hello World: 5]
#...

Basic Server & Client

When executed correctly, strings should be printed to terminal similar to what is shown below:

Server

# In terminal running add_two_ints_server
[INFO] [1674553268.912391774] [add_two_ints_server]: Incoming request
a: 2 b: 3

Client [Synchronous]

# In terminal running add_two_ints_client
[INFO] [1674553268.912602310] [add_two_ints_client]: Result of add_two_ints: 5

Client [Asynchronous]

# In terminal running add_two_ints_client_async
[INFO] [1674553718.598690033] [add_two_ints_client]: Result of add_two_ints: 5

One-Off Timer

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running one_off_timer
[INFO] [1674552840.400680444] [one_off_timer]: in periodic_timer callback
[INFO] [1674552840.400915092] [one_off_timer]:   resetting one off timer
[INFO] [1674552841.401204072] [one_off_timer]: in one_off_timer callback
[INFO] [1674552842.400698264] [one_off_timer]: in periodic_timer callback
[INFO] [1674552842.400819311] [one_off_timer]:   not resetting one off timer
[INFO] [1674552844.400695640] [one_off_timer]: in periodic_timer callback
[INFO] [1674552844.400819933] [one_off_timer]:   not resetting one off timer
[INFO] [1674552846.400684373] [one_off_timer]: in periodic_timer callback
[INFO] [1674552846.400799868] [one_off_timer]:   resetting one off timer
[INFO] [1674552847.400948238] [one_off_timer]: in one_off_timer callback
[INFO] [1674552848.400703699] [one_off_timer]: in periodic_timer callback
[INFO] [1674552848.400828811] [one_off_timer]:   not resetting one off timer
[INFO] [1674552850.400680424] [one_off_timer]: in periodic_timer callback
[INFO] [1674552850.400775977] [one_off_timer]:   not resetting one off timer
[INFO] [1674552852.400690511] [one_off_timer]: in periodic_timer callback
[INFO] [1674552852.400815404] [one_off_timer]:   resetting one off timer
[INFO] [1674552853.401060139] [one_off_timer]: in one_off_timer callback
#...

Notice how the timer is reset only after two callback iterations.

Reuse Timer

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674554333.056000613] [reuse_timer]: in periodic_timer callback
[INFO] [1674554333.056432269] [reuse_timer]:   resetting one off timer
[INFO] [1674554334.056732370] [reuse_timer]: in one_off_timer callback
[INFO] [1674554335.055978249] [reuse_timer]: in periodic_timer callback
[INFO] [1674554335.056111777] [reuse_timer]:   not resetting one off timer
[INFO] [1674554337.055978910] [reuse_timer]: in periodic_timer callback
[INFO] [1674554337.056108925] [reuse_timer]:   not resetting one off timer
[INFO] [1674554339.055966108] [reuse_timer]: in periodic_timer callback
[INFO] [1674554339.056083983] [reuse_timer]:   resetting one off timer
[INFO] [1674554340.056295399] [reuse_timer]: in one_off_timer callback
#...

Same as One-Off Timer.

Serialized Messaging

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running talker_serialized_message
ROS message:
Hello World:1
serialized message:
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 31 00
ROS message:
Hello World:2
serialized message:
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 32 00
ROS message:
Hello World:3
serialized message:
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 33 00

# In terminal running listerner_serialized_message
I heard data of length: 24
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 32 00 00 00
serialized data after deserialization: Hello World:2
I heard data of length: 24
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 33 00 00 00
serialized data after deserialization: Hello World:3
I heard data of length: 24
00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 34 00 00 00
serialized data after deserialization: Hello World:4
#...

Content-Filtering Messaging

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running content_filtering_publisher
[INFO] [1674563203.567530898] [content_filtering_publisher]: Publishing: '-100.000000'
[INFO] [1674563204.567508197] [content_filtering_publisher]: Publishing: '-90.000000'
[INFO] [1674563205.567517142] [content_filtering_publisher]: Publishing: '-80.000000'
#...

# In terminal running content_filtering_subscriber
[INFO] [1674563182.873825084] [content_filtering_subscriber]: subscribed to topic "/temperature" with content filter options "data < %0 OR data > %1, {-30.000000, 100.000000}"
[INFO] [1674563203.568310361] [content_filtering_subscriber]: I receive an emergency temperature data: [-100.000000]
[INFO] [1674563204.568128370] [content_filtering_subscriber]: I receive an emergency temperature data: [-90.000000]
[INFO] [1674563205.568082783] [content_filtering_subscriber]: I receive an emergency temperature data: [-80.000000]
#...

List Parameters [Synchronous/Asynchronous]

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674563905.346022942] [list_parameters]: Setting parameters...
[INFO] [1674563905.347158439] [list_parameters]: Listing parameters...
[INFO] [1674563905.347570888] [list_parameters]:
Parameter names:
 bar
 foo
 foo.first
 foo.second
Parameter prefixes:
 foo

Set & Get Parameters [Synchronous/Asynchronous]

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674564137.057616328] [set_and_get_parameters]:
Parameter name: foo
Parameter value (integer): 2
Parameter name: baz
Parameter value (double): 1.450000
Parameter name: foobarbaz
Parameter value (bool_array): [true, false]
Parameter name: toto
Parameter value (byte_array): [0xff, 0x7f]

Allocator Tutorial

When executed correctly, strings should be printed to terminal similar to what is shown below:

This simple demo shows off a custom memory allocator to count all
instances of new/delete in the program.  It can be run in either regular
mode (no arguments), or in intra-process mode (by passing 'intra' as a
command-line argument).  It will then publish a message to the
'/allocator_tutorial' topic every 10 milliseconds until Ctrl-C is pressed.
At that time it will print a count of the number of allocations and
deallocations that happened during the program.

Intra-process pipeline is OFF.

Run ros2 topic echo /allocator_tutorial to see the output in the ROS 2 topic, /allocator_tutorial:

# Open new terminal
data: 224
---
data: 228
---
data: 230
---
data: 231
---
data: 233
---
data: 234
---
data: 235
---

Parameter Events [Synchronous/Asynchronous]

When executed correctly, strings should be printed to terminal similar to what is shown below:

[INFO] [1674565202.370104660] [parameter_events]:
Parameter event:
 new parameters:
  foo
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370241604] [parameter_events]:
Parameter event:
 new parameters:
  bar
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370303487] [parameter_events]:
Parameter event:
 new parameters:
  baz
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370355113] [parameter_events]:
Parameter event:
 new parameters:
  foobar
 changed parameters:
 deleted parameters:

[INFO] [1674565202.370398069] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  foo
 deleted parameters:

[INFO] [1674565202.370424143] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  bar
 deleted parameters:

[INFO] [1674565202.370447765] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  baz
 deleted parameters:

[INFO] [1674565202.370470405] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  foobar
 deleted parameters:

[INFO] [1674565202.370492871] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  foo
 deleted parameters:

[INFO] [1674565202.370515168] [parameter_events]:
Parameter event:
 new parameters:
 changed parameters:
  bar
 deleted parameters:

Even Parameters Node

Run ros2 param set /even_parameters_node myint 2 to set the parameter to a valid even integer and produce a similar result like below:

[INFO] [1674566014.892688389] [even_parameters_node]: parameter 'myint' has changed and is now: 2

Run ros2 param set /even_parameters_node myint 3 to set the parameter to an invalid odd integer and produce a similar result like below:

[INFO] [1674566088.870030436] [even_parameters_node]: Requested value '3' for parameter 'myint' is not an even number: rejecting change...

Set Parameters Callback

[Before]

Run ros2 param get /set_param_callback_node param1 should print the following to terminal:

Double value is: 0.0

Run ros2 param get /set_param_callback_node param2 should print the following to terminal:

Double value is 0.0

[Change]

Run ros2 param set set_param_callback_node param1 10.0 and see it fail with

Setting parameter failed: cannot set 'param1' > 5.0

Run ros2 param set set_param_callback_node param1 3.0

Set parameter successful

[After]

Run ros2 param get /set_param_callback_node param1 should print the following to terminal:

Double value is: 28.0

Run ros2 param get /set_param_callback_node param2 should print the following to terminal:

Double value is 4.0

Parameter Blackboard

When executed correctly, strings should be printed to terminal similar to what is shown below:

INFO] [1674568261.762813104] [parameter_blackboard]: Parameter blackboard node named '/parameter_blackboard' ready, and serving '5' parameters already!

Running ros2 param list should reveal the 6 parameters served:

/parameter_blackboard:
  qos_overrides./parameter_events.publisher.depth
  qos_overrides./parameter_events.publisher.durability
  qos_overrides./parameter_events.publisher.history
  qos_overrides./parameter_events.publisher.reliability
  start_type_description_service
  use_sim_time

Parameter Event Handler

Run ros2 param set this_node an_int_param 21 in a new terminal will produce the following results:

# In terminal running parameter_event_handler
[INFO] [1674569608.306038487] [this_node]: cb1: Received an update to parameter "an_int_param" of type integer: "21"
[INFO] [1674569608.306356753] [this_node]: cb3: Received an update to parameter "an_int_param" of type: integer: "21"

Run ros2 param set /a_namespace/a_remote_node a_string_param "string value to set" in a new terminal will produce the following results:

[INFO] [1674569622.728945232] [this_node]: cb2: Received an update to parameter "a_string_param" of type: string: "string value to set"
[INFO] [1674569622.729143396] [this_node]: cb3: Received an update to parameter "a_string_param" of type: string: "string value to set"
[INFO] [1674569622.729246614] [this_node]: cb3: Received an update to parameter "a_string_param" of type: string: "string value to set"

Loaned Message Talker

When executed correctly, strings should be printed to terminal similar to what is shown below:

# In terminal running loaned_message_talker
[INFO] [1674570146.112222368] [loaned_message_talker]: Publishing: 'Hello World: 1'
[INFO] [1674570147.111670599] [loaned_message_talker]: Publishing: '2.000000'
[INFO] [1674570147.111853637] [loaned_message_talker]: Publishing: 'Hello World: 2'
[INFO] [1674570148.111662758] [loaned_message_talker]: Publishing: '3.000000'
[INFO] [1674570148.111804226] [loaned_message_talker]: Publishing: 'Hello World: 3'
[INFO] [1674570149.111651863] [loaned_message_talker]: Publishing: '4.000000'
[INFO] [1674570149.111819520] [loaned_message_talker]: Publishing: 'Hello World: 4'


Note that Fast-DDS does not support the loaned messages. The loaned message API is used in iceoryx right now, which workes with CycloneDDS.

Matched Event Detect

When executed correctly, strings should be printed to terminal similar to what is shown below:

#  In terminal running matched_event_detect
[INFO] [1679887690.127684740] [multi_sub_node]: Create a new subscription.
[INFO] [1679887690.128090105] [matched_event_detect_node]: First subscription is connected.
[INFO] [1679887690.128836774] [multi_sub_node]: Create a new subscription.
[INFO] [1679887690.129157780] [matched_event_detect_node]: The changed number of connected subscription is 1 and current number of connected subscription is 2.
[INFO] [1679887690.129193220] [multi_sub_node]: Destroy a subscription.
[INFO] [1679887690.130552475] [matched_event_detect_node]: The changed number of connected subscription is -1 and current number of connected subscription is 1.
[INFO] [1679887690.130588555] [multi_sub_node]: Destroy a subscription.
[INFO] [1679887690.131355128] [matched_event_detect_node]: Last subscription is disconnected.
[INFO] [1679887690.132014952] [multi_pub_node]: Create a new publisher.
[INFO] [1679887690.132262901] [matched_event_detect_node]: First publisher is connected.
[INFO] [1679887690.132898522] [multi_pub_node]: Create a new publisher.
[INFO] [1679887690.133143624] [matched_event_detect_node]: The changed number of connected publisher is 1 and current number of connected publisher is 2.
[INFO] [1679887690.133178687] [multi_pub_node]: Destroy a publisher.
[INFO] [1679887690.134139929] [matched_event_detect_node]: The changed number of connected publisher is -1 and current number of connected publisher is 1.
[INFO] [1679887690.134176647] [multi_pub_node]: Destroy a publisher.
[INFO] [1679887690.134887946] [matched_event_detect_node]: Last publisher is disconnected.

FAQ

Q: Encountered the following error in terminal when running Loaned Message Talker:

[INFO] [1674570146.112148792] [rclcpp]: Currently used middleware can't loan messages. Local allocator will be used.

A: Ensure that CycloneDDS RMW is used by running export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp.

References

  1. Zero-Copy via Loaned Messages
  2. ROS 2 Quality of Service Policies
  3. Creating a content filtering subscription
CHANGELOG

Changelog for package demo_nodes_cpp

0.35.1 (2024-11-20)

0.35.0 (2024-10-03)

0.34.2 (2024-07-29)

0.34.1 (2024-06-17)

  • [demo_nodes_cpp] some readme and executable name fixups (#678)
  • Fix gcc warnings when building with optimizations. (#672)
  • Contributors: Chris Lalancette, Mikael Arguedas

0.34.0 (2024-04-26)

0.33.2 (2024-03-28)

  • A few uncrustify fixes for 0.78. (#667)
  • Allow users to configure the executor for executables in [demo_nodes_cpp]{.title-ref} (#666)
  • Update maintainer list in package.xml files (#665)
  • Contributors: Chris Lalancette, Michael Jeronimo, Yadu

0.33.1 (2024-02-07)

0.33.0 (2024-01-24)

0.32.1 (2023-12-26)

  • Added extra documentation and clarifications. (#651)
  • Contributors: jrutgeer

0.32.0 (2023-11-06)

  • Add in support for both the PMR and custom allocator tutorials. (#655)
  • Replacing old-style C++ allocator with a polymorphic memory resource (PMR) (#653)
  • Contributors: Ali Ashkani Nia, Chris Lalancette

0.31.1 (2023-09-07)

  • Remove unnecessary captures in the various demos. (#647)
  • Contributors: Chris Lalancette

0.31.0 (2023-08-21)

  • Dramatically speed up the demo_nodes_cpp tests (#641)
  • Switch to using RCLCPP logging macros in the lifecycle package. (#644)
  • Contributors: Chris Lalancette

0.30.1 (2023-07-11)

  • failed to call introspection_client (#643)
  • Contributors: Chen Lihui

0.30.0 (2023-06-12)

  • Small cleanups to the demos when running through them. (#639)
  • Cleanup demo_nodes_cpp CMake and dependencies (#638)
  • Change the service introspection parameter off value to 'disabled' (#634)
  • Contributors: Chris Lalancette

0.29.0 (2023-06-07)

  • Add demos for using logger service (#611)
  • Contributors: Barry Xu

0.28.1 (2023-05-11)

0.28.0 (2023-04-27)

0.27.0 (2023-04-13)

  • Change all ROS2 -> ROS 2. (#610)
  • Add matched event demo for rclcpp and rclpy (#607)
  • Contributors: Barry Xu, Chris Lalancette

0.26.0 (2023-04-11)

  • Fix the set_parameters_callback example program. (#608)
  • [demo_nodes_cpp] Add YAML launch demos for topics (#605)
  • update launch file name format to match documentation (#588)
  • Contributors: Chris Lalancette, Damien LaRocque, Patrick Wspanialy

0.25.0 (2023-03-01)

  • Service introspection (#602)
    • Add in a rclcpp and rclpy demo of introspection.
  • Contributors: Chris Lalancette

0.24.1 (2023-02-24)

  • Added README.md for demo_cpp_nodes (#599)
  • Contributors: Gary Bey

0.24.0 (2023-02-14)

  • Update the demos to C++17. (#594)
  • [rolling] Update maintainers - 2022-11-07 (#589)
  • Contributors: Audrow Nash, Chris Lalancette

0.23.0 (2022-11-02)

  • Demo for pre and post set parameter callback support (#565)
    • local parameter callback support
  • Contributors: Deepanshu Bansal

0.22.0 (2022-09-13)

  • counter starts from 1, not 2. (#562)
  • add a demo of content filter listener (#557)
  • Contributors: Chen Lihui, Tomoya Fujita

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)
  • Add how to fix the most vexing parse problem (#541)
    • use uniform initialization
  • Contributors: Audrow Nash, Tomoya Fujita

0.17.0 (2021-10-18)

  • Fixing deprecated subscriber callback warnings (#532)
  • Contributors: Abrar Rahman Protyasha

0.16.0 (2021-08-11)

  • Update talker_loaned_message.cpp (#518)
  • Contributors: Zongbao Feng

0.15.0 (2021-05-14)

  • Revert "Use sizeof(char) in place for sizeof(void) (#515)" (#516)
  • change how serialized message works with subscription (#497)
  • Use sizeof(char) in place for sizeof(void) (#515)
  • Fix small print issue in allocator tutorial. (#509)
  • Contributors: Chris Lalancette, Michel Hidalgo, William Woodall

0.14.2 (2021-04-26)

  • Small fixes for even_parameters_node. (#500)
  • Contributors: Chris Lalancette

0.14.1 (2021-04-19)

0.14.0 (2021-04-06)

  • change ParameterEventHandler to take events as const ref instead of shared pointer (#494)
  • Fix integer type in RCLCPP_* macro printf. (#492)
  • Contributors: Chris Lalancette, William Woodall

0.13.0 (2021-03-25)

  • Add a demo for the new ParameterEventHandler class (#486)
  • Contributors: Michael Jeronimo

0.12.1 (2021-03-18)

  • Filter qos overrides in paramter events demos (#491)
  • Update code now that parameter types are static by default (#487)
  • Contributors: Ivan Santiago Paunovic

0.12.0 (2021-01-25)

  • Update logging macros (#476)
  • Contributors: Audrow Nash

0.11.0 (2020-12-10)

  • Make sure to wait for the service before declaring events. (#473)
  • Update the package.xml files with the latest Open Robotics maintainers (#466)
  • Contributors: Chris Lalancette, 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)

  • avoid new deprecations (#442)
  • use serialized message (#441)
  • Replace deprecated launch_ros usage (#437)
  • code style only: wrap after open parenthesis if not in one line (#429)
  • Use [spin_until_future_complete]{.title-ref} instead of [spin_some]{.title-ref} in parameters_event demo (#427)
  • change the logging demo test for updated console format (#421)
  • [demo_nodes_cpp] Add XML launch demos (#419)
  • Contributors: Dirk Thomas, Ivan Santiago Paunovic, Jacob Perron, Karsten Knese, Steven Macenski, William Woodall, Yutaka Kondo

0.8.4 (2019-11-19)

  • Add in a more helpful usage message to allocator_tutorial. (#409)
  • Contributors: Chris Lalancette

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

  • Don't redefine add_dependencies (#408)
  • Contributors: Dan Rose

0.8.1 (2019-10-23)

  • rename return functions for loaned messages (#403)
  • Replace ready_fn with ReadyToTest action (#404)
  • remove intra-process manager impl (#382)
  • zero copy api (#394)
  • Remove command line parsing from C++ demos (#401)
  • Need to specify NodeOption explicitly to allow declaration. (#389)
  • Contributors: Alberto Soragna, Jacob Perron, Karsten Knese, Peter Baughman, tomoya

0.8.0 (2019-09-26)

  • Adding visibility macros to demos (#381)
  • Demos using composition (#375)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

  • Update to use new parameter option names (#355)
  • Contributors: William Woodall

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

  • Added the parameter_blackboard demo to demo_nodes_cpp to make some tutorials easier. (#333)
  • Contributors: William Woodall

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)

  • Updated to declare parameters. (#241)
  • Contributors: Shane Loretz

0.7.0 (2019-04-14)

  • Moved away from deprecated rclcpp APIs. (#321)
  • Added launch along with launch_testing as test dependencies. (#313)
  • Updated for NodeOptions Node constructor. (#308)
  • Contributors: Emerson Knapp, 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)
  • Removed parameter node, all nodes take parameter by default now (#265)
  • Added example of registering custom parameter validation callbacks (#273)
  • Removed imu_listener node (#272)
  • Refined demo_nodes_cpp source codes (#269)
  • Fixed typo in comment (#268)
  • Removed rosidl deps as this package doesnt generate any messages (#264)
  • Fixed no return code for main() in several files (#266)
  • Contributors: Chris Lalancette, Mikael Arguedas, Yutaka Kondo, testkit

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

  • Reduced the publishing of the allocator_tutorial to 100Hz. (#257)
    • Signed-off-by: Chris Lalancette <<clalancette@openrobotics.org>>
  • Removed the now obsolete ros2param executable, use ros2 param instead. (#251)
  • Fixed a potiential nullptr dereference issue in demo_nodes_cpp. (#242)
  • Added demo nodes which use the new serialized message typed publishers and subscriptions. (#185)
  • Added a new-style launch file for the talker and listener demo nodes, called talker_listener.launch.py. (#244)
  • Updated launch files to account for the "old launch" getting renamespaced as launch -> launch.legacy. (#239)
  • Updated to handle refactor of the ParameterVariant class. (#237)
  • Updated to account for the fact that the ROS Parameter services starts automatically now. (#236)
  • Added some uses of parameter arrays to the set_and_get_parameters demo. (#235)
  • Contributors: Chris Lalancette, Dirk Thomas, Karsten Knese, Mikael Arguedas, Shane Loretz, William Woodall, cshen

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Recent questions tagged demo_nodes_cpp at Robotics Stack Exchange

No version for distro noetic. Known supported distros are highlighted in the buttons above.

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

C++ nodes which were previously in the ros2/examples repository but are now just used for demo purposes.

Additional Links

No additional links.

Maintainers

  • Mabel Zhang
  • Michael Jeronimo

Authors

  • William Woodall
README
No README found. No README in repository either.
CHANGELOG

Changelog for package demo_nodes_cpp

0.14.4 (2022-12-06)

0.14.3 (2021-05-10)

  • Fix small print issue in allocator tutorial. (#509) (#512)
  • Contributors: Chris Lalancette

0.14.2 (2021-04-26)

  • Small fixes for even_parameters_node. (#500)
  • Contributors: Chris Lalancette

0.14.1 (2021-04-19)

0.14.0 (2021-04-06)

  • change ParameterEventHandler to take events as const ref instead of shared pointer (#494)
  • Fix integer type in RCLCPP_* macro printf. (#492)
  • Contributors: Chris Lalancette, William Woodall

0.13.0 (2021-03-25)

  • Add a demo for the new ParameterEventHandler class (#486)
  • Contributors: Michael Jeronimo

0.12.1 (2021-03-18)

  • Filter qos overrides in paramter events demos (#491)
  • Update code now that parameter types are static by default (#487)
  • Contributors: Ivan Santiago Paunovic

0.12.0 (2021-01-25)

  • Update logging macros (#476)
  • Contributors: Audrow Nash

0.11.0 (2020-12-10)

  • Make sure to wait for the service before declaring events. (#473)
  • Update the package.xml files with the latest Open Robotics maintainers (#466)
  • Contributors: Chris Lalancette, 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)

  • avoid new deprecations (#442)
  • use serialized message (#441)
  • Replace deprecated launch_ros usage (#437)
  • code style only: wrap after open parenthesis if not in one line (#429)
  • Use [spin_until_future_complete]{.title-ref} instead of [spin_some]{.title-ref} in parameters_event demo (#427)
  • change the logging demo test for updated console format (#421)
  • [demo_nodes_cpp] Add XML launch demos (#419)
  • Contributors: Dirk Thomas, Ivan Santiago Paunovic, Jacob Perron, Karsten Knese, Steven Macenski, William Woodall, Yutaka Kondo

0.8.4 (2019-11-19)

  • Add in a more helpful usage message to allocator_tutorial. (#409)
  • Contributors: Chris Lalancette

0.8.3 (2019-11-11)

0.8.2 (2019-11-08)

  • Don't redefine add_dependencies (#408)
  • Contributors: Dan Rose

0.8.1 (2019-10-23)

  • rename return functions for loaned messages (#403)
  • Replace ready_fn with ReadyToTest action (#404)
  • remove intra-process manager impl (#382)
  • zero copy api (#394)
  • Remove command line parsing from C++ demos (#401)
  • Need to specify NodeOption explicitly to allow declaration. (#389)
  • Contributors: Alberto Soragna, Jacob Perron, Karsten Knese, Peter Baughman, tomoya

0.8.0 (2019-09-26)

  • Adding visibility macros to demos (#381)
  • Demos using composition (#375)
  • Contributors: Siddharth Kucheria

0.7.6 (2019-05-30)

0.7.5 (2019-05-29)

  • Update to use new parameter option names (#355)
  • Contributors: William Woodall

0.7.4 (2019-05-20)

0.7.3 (2019-05-10)

  • Added the parameter_blackboard demo to demo_nodes_cpp to make some tutorials easier. (#333)
  • Contributors: William Woodall

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)

  • Updated to declare parameters. (#241)
  • Contributors: Shane Loretz

0.7.0 (2019-04-14)

  • Moved away from deprecated rclcpp APIs. (#321)
  • Added launch along with launch_testing as test dependencies. (#313)
  • Updated for NodeOptions Node constructor. (#308)
  • Contributors: Emerson Knapp, 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)
  • Removed parameter node, all nodes take parameter by default now (#265)
  • Added example of registering custom parameter validation callbacks (#273)
  • Removed imu_listener node (#272)
  • Refined demo_nodes_cpp source codes (#269)
  • Fixed typo in comment (#268)
  • Removed rosidl deps as this package doesnt generate any messages (#264)
  • Fixed no return code for main() in several files (#266)
  • Contributors: Chris Lalancette, Mikael Arguedas, Yutaka Kondo, testkit

0.5.1 (2018-06-28)

0.5.0 (2018-06-27)

  • Reduced the publishing of the allocator_tutorial to 100Hz. (#257)
    • Signed-off-by: Chris Lalancette <<clalancette@openrobotics.org>>
  • Removed the now obsolete ros2param executable, use ros2 param instead. (#251)
  • Fixed a potiential nullptr dereference issue in demo_nodes_cpp. (#242)
  • Added demo nodes which use the new serialized message typed publishers and subscriptions. (#185)
  • Added a new-style launch file for the talker and listener demo nodes, called talker_listener.launch.py. (#244)
  • Updated launch files to account for the "old launch" getting renamespaced as launch -> launch.legacy. (#239)
  • Updated to handle refactor of the ParameterVariant class. (#237)
  • Updated to account for the fact that the ROS Parameter services starts automatically now. (#236)
  • Added some uses of parameter arrays to the set_and_get_parameters demo. (#235)
  • Contributors: Chris Lalancette, Dirk Thomas, Karsten Knese, Mikael Arguedas, Shane Loretz, William Woodall, cshen

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Recent questions tagged demo_nodes_cpp at Robotics Stack Exchange

No version for distro melodic. Known supported distros are highlighted in the buttons above.