ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I too am at the point of needing an automated test for a complex node. Here is what I plan to try in my test node:

  • use rclpy.get_node_names_and_namespaces() to be sure node is running (and to get the namespace for subsequent calls)

  • use rclpy.get_publisher_names_and_types_by_node(node_name, node_namespace) to verify node is publishing expected topics.

  • use rclpy.get_subscriber_names_and_types_by_node(node_name, node_namespace) to verify node is subscribed to expected topics.

  • Establish a publisher for each node subscriber, and a subscriber for each node publisher

  • Publish a topic to cause the node to act, then watch appropriate subscriber to verify the node acted correctly - e.g. send /cmd_vel with angular rate, and check /MotorStatus which will list "speed" of each wheel.

My node does not have parameters yet but there are calls for that.

Check https://docs.ros2.org/latest/api/rclpy/api.html for what is possible.