Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Many to many service communication

Hi all,

as far as I understood a service can be used by different clients as long as in the source code the ServiceServer and the ServiceClient are declared with the same service name (see code below, each line belongs to a different node).

ros::ServiceServer service = n.advertiseService("add_two_ints", add);
ros::ServiceClient client1 = n.serviceClient<beginner_tutorials::AddTwoInts>("add_two_ints");
ros::ServiceClient client2 = n.serviceClient<beginner_tutorials::AddTwoInts>("add_two_ints");

In the case in which the source code provides different service names, is it possible to change the name of a service by means of the remapping tag in the launch file?

How are multiple concurrent requests managed? As far as I understood they are processed in a synchronous way according to a FIFO policy, right?

I'm also wondering if it is possible to have a many-to-many connection (multiple servers)

ros::ServiceServer service = n.advertiseService("add_two_ints", add);
ros::ServiceServer service2 = n.advertiseService("add_two_ints", add);
    ros::ServiceClient client1 = n.serviceClient<beginner_tutorials::AddTwoInts>("add_two_ints");
    ros::ServiceClient client2 = n.serviceClient<beginner_tutorials::AddTwoInts>("add_two_ints");

How are requests managed in this case?

Finally, are these concepts valid also for actions?

Many to many service communication

Hi all,

as far as I understood a service can be used by different clients as long as in the source code the ServiceServer and the ServiceClient are declared with the same service name (see code below, each line belongs to a different node).

ros::ServiceServer service = n.advertiseService("add_two_ints", add);
ros::ServiceClient client1 = n.serviceClient<beginner_tutorials::AddTwoInts>("add_two_ints");
ros::ServiceClient client2 = n.serviceClient<beginner_tutorials::AddTwoInts>("add_two_ints");

In the case in which the source code provides different service names, is it possible to change the name of a service by means of the remapping tag in the launch file?

How are multiple concurrent requests managed? As far as I understood they are processed in a synchronous way according to a FIFO policy, right?

I'm also wondering if it is possible to have a many-to-many connection (multiple servers)

ros::ServiceServer service = n.advertiseService("add_two_ints", add);
ros::ServiceServer service2 = n.advertiseService("add_two_ints", add);
    ros::ServiceClient client1 = n.serviceClient<beginner_tutorials::AddTwoInts>("add_two_ints");
    ros::ServiceClient client2 = n.serviceClient<beginner_tutorials::AddTwoInts>("add_two_ints");

How are requests managed in this case?

Finally, are these concepts valid also for actions?