introspection
This file is ai generated. Do not edit this file directly. Instead, edit the node source code and run the generate-node-docs command to update this file.
Description
A comprehensive ROS2 demo combining both a service client and server to demonstrate service introspection capabilities. The node shows how to configure and use service introspection to monitor service calls, enabling developers to observe metadata and contents of service requests and responses through the /_service_event topic.
The demo includes two internal nodes:
IntrospectionServiceNode: Provides the add_two_ints serviceIntrospectionClientNode: Periodically calls the service every 500ms
Services
Service Server:
/add_two_intsType:
example_interfaces/srv/AddTwoIntsDescription: Adds two integers and returns the sum
Service Client:
/add_two_intsType:
example_interfaces/srv/AddTwoIntsDescription: Calls the add_two_ints service every 500ms
Parameters
client_configure_introspection(string, default: “disabled”): Controls client introspectionValid values: “disabled”, “metadata”, “contents”
service_configure_introspection(string, default: “disabled”): Controls service introspectionValid values: “disabled”, “metadata”, “contents”
Example Usage
# Run with introspection disabled (default)
ros2 run demo_nodes_py introspection
# Run with both client and service introspection enabled (metadata mode)
ros2 run demo_nodes_py introspection \
--ros-args \
-p client_configure_introspection:=metadata \
-p service_configure_introspection:=metadata
# Run with contents introspection
ros2 run demo_nodes_py introspection \
--ros-args \
-p client_configure_introspection:=contents \
-p service_configure_introspection:=contents
To dynamically enable introspection at runtime:
# Terminal 1: Run the node
ros2 run demo_nodes_py introspection
# Terminal 2: Enable client introspection
ros2 param set /introspection_client client_configure_introspection metadata
# Terminal 3: Monitor service events
ros2 topic echo /add_two_ints/_service_event
Expected output:
[INFO] [introspection_client]: Result of add_two_ints: 5
[INFO] [introspection_service]: Incoming request
a: 2 b: 3