[ROS2] call service :"waiting for service to become available"
Hi,
I'm using the std_srvs/srv/Trigger service:
rclcpp::Client<std_srvs::srv::Trigger>::SharedPtr init = node->create_client<std_srvs::srv::Trigger>("/init");
auto trig = std::make_shared<std_srvs::srv::Trigger::Request>();
auto trig_result = init->async_send_request(trig);
if (rclcpp::spin_until_future_complete(node, trig_result) ==
rclcpp::executor::FutureReturnCode::SUCCESS)
{
RCLCPP_INFO(node->get_logger(),"Init motor succesfull.");
rclcpp::sleep_for(sec);
state++;
break;
}
First I check if the service is live:
ros2 service list
I can find the /init service so I want to call it like in following tutorial : https://index.ros.org/doc/ros2/Tutori...
ros2 service call /init std_srvs/srv/Trigger
The only response I get is:
> waiting for service to become available ...
What am I doing wrong calling or creating this service ?
Thanks