Template Function gazebo_ros::get_message_or_timeout

Function Documentation

template<typename T>
T::SharedPtr gazebo_ros::get_message_or_timeout(rclcpp::Node::SharedPtr node, const std::string &topic, rclcpp::Duration timeout = rclcpp::Duration(10, 0))

Helper function to get the next message on a ROS topic with a timeout

Parameters:
  • node – Pointer to a node to use to subscribe to the topic

  • topic – Topic to subscribe to for message

  • timeout – Maximum time to wait for message

Template Parameters:

T – Message type to get

Returns:

Shared pointer to new message, or nullptr if none received before timeout