matched_event_detect

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 ROS2 demonstration node that shows how to detect and respond to publisher-subscriber matching events. When publishers and subscribers connect or disconnect, the node reports connection status changes. This is useful for monitoring network topology and connection health.

The demo includes three internal nodes:

  • MatchedEventDetectNode: Monitors connection events for its publisher and subscriber

  • MultiSubNode: Creates/destroys subscriptions to test publisher matching

  • MultiPubNode: Creates/destroys publishers to test subscriber matching

Publishers

  • Topic: /pub_topic_matched_event_detect

    • Type: example_interfaces/msg/String

    • QoS: Queue size of 10

    • Description: Publisher that reports when subscriptions connect/disconnect

Subscribers

  • Topic: /sub_topic_matched_event_detect

    • Type: example_interfaces/msg/String

    • QoS: Queue size of 10

    • Description: Subscriber that reports when publishers connect/disconnect

Example Usage

# Run the matched event detection demo
ros2 run demo_nodes_py matched_event_detect

The node will automatically run through a sequence demonstrating:

  1. First subscription connection

  2. Additional subscription connections

  3. Subscription disconnections

  4. First publisher connection

  5. Additional publisher connections

  6. Publisher disconnections

Expected output:

[INFO] [multi_sub_node]: Create a new subscription.
[INFO] [matched_event_detection_node]: First subscription is connected.
[INFO] [multi_sub_node]: Create a new subscription.
[INFO] [matched_event_detection_node]: The changed number of connected subscription is 1 and current number of connected subscription is 2
[INFO] [multi_sub_node]: Destroy a subscription.
[INFO] [matched_event_detection_node]: The changed number of connected subscription is -1 and current number of connected subscription is 1
[INFO] [multi_sub_node]: Destroy a subscription.
[INFO] [matched_event_detection_node]: Last subscription is disconnected.
...

This demo is self-contained and requires no external nodes to run.