-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Services: list, call, response #10
Comments
An example implementation of calling ROS 2 services from a bridge can be found here: https://github.com/v-kiniv/rws/blob/main/src/client_handler.cpp#L406-L450. The method is straightforward, most of the work is in JSON<->CDR serde. We can avoid this by using our client binary serialization already used for topic publishing. ROS 2 listing services: ROS 2 calling a service: auto client = node_->create_generic_client(serviceName, serviceType, rmw_qos_profile_services_default, nullptr);
// if we include an immediate response back to clients calling a service, we can skip
// the wait_for_service() call and just return a failure if the service isn't available
while (!client->wait_for_service(1s)) { ... }
using ServiceResponseFuture = rws::GenericClient::SharedFuture;
auto callback = [&](ServiceResponseFuture future) {
ConstSharedMessage msg = future.get();
// send this message back to the client
};
client->async_send_request(msgFromClient, callback);
// send a confirmation to the client their service call was initiated? |
Based on the ROS 2 notes above, I think the bridge protocol for services could roughly look like this:
|
What is this for? Acknowledging a client's service call request? |
Let's drop |
**Public-Facing Changes** - Add ROS1 support for calling server-advertised services **Description** - Adds ROS1 support for advertising/unadvertising services and allowing clients to call them - Implements the services spec that was added in foxglove/ws-protocol#344 Implementation details: - The service type is unfortunately not stored on the ROS master, so for every new service, a connection to the service server has to be opened to fetch the service type from the connection header - For ROS1, one can call services with a custom type (here `GenericService`) when one defines the `ros::service_traits` and `ros::serialization` traits Fixes #10 (together with #142)
No description provided.
The text was updated successfully, but these errors were encountered: