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

Not really, there's documentation for the pieces, but no overarching documentation. The best option is to see how it is used in something like wait_for_service:

https://github.com/ros2/rclcpp/blob/bf89dc0797fa967e801688c2e80573902dc74ebf/rclcpp/src/rclcpp/client.cpp#L103-L153

You basically:

  • create an event ("graph event" object)
  • call Node::wait_for_graph_event(event, timeout)
  • when it returns check what you're watching for, e.g. if a service is ready or if the topic_names_and_types are different

The event just tells you that something changed, but it's up to you to detect what actually changed. In the future this might change, but for now that's the best we can offer. We didn't have event contain the source of the change because that would require us to queue up events and until now our code doesn't have any queueing (the middleware handles that for us).