rosgraph_monitor_test.test_utils package

Submodules

Module contents

Testing utilities for rosgraph_monitor package.

rosgraph_monitor_test.test_utils.create_random_node_name()

Generate a random node name for testing.

rosgraph_monitor_test.test_utils.find_node(graph_msg, node_name)

Find a node in the graph message by name.

Args:

graph_msg: Graph message from rosgraph_monitor node_name: Name of the node to find (with or without leading ‘/’)

Returns

Node object if found, None otherwise

rosgraph_monitor_test.test_utils.wait_for_message_sync(node, message_type, topic, condition_func, timeout_sec=5.0)

Wait for a message that meets a condition or timeout.

Args:

node: ROS2 node to use for spinning message_type: The message type to subscribe to topic: Topic name to listen on condition_func: Function that takes a message and returns True if condition is met timeout_sec: Maximum time to wait in seconds

Returns

tuple: (success: bool, messages: list) - success indicates if condition was met