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

Ok, I did a little bit more of research and had a look into the node class reference here: http://docs.ros2.org/dashing/api/rclcpp/classrclcpp_1_1Node.html

I found the function get_node_base_interface() which is what spin_some and spin_until_future_complete need.

example:

auto request = std::make_shared<std_srvs::srv::SetBool::Request>();
request->data = true;

auto result = client_->async_send_request(request);
if (rclcpp::spin_until_future_complete(this->get_node_base_interface(), result) 
    != rclcpp::executor::FutureReturnCode::SUCCESS)
{
  RCLCPP_ERROR(this->get_logger(), "Failed");
}