Ask Your Question

maverik's profile - activity

2014-08-13 14:31:49 -0500 received badge  Taxonomist
2013-12-12 15:25:39 -0500 received badge  Famous Question (source)
2013-06-06 06:09:43 -0500 received badge  Scholar (source)
2013-06-04 22:01:19 -0500 received badge  Notable Question (source)
2013-06-03 23:45:59 -0500 received badge  Supporter (source)
2013-06-03 23:45:48 -0500 commented answer Many to many service communication

Thanks! What you said makes sense from a theoretical point of view! However I tried to create two nodes that advertise the same service and when I lunched them I didn't see any error. However the services were always provided by the same node, probably the second I lunched.

2013-06-03 15:10:44 -0500 received badge  Popular Question (source)
2013-06-03 05:08:41 -0500 received badge  Editor (source)
2013-06-03 00:21:46 -0500 asked a question 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");

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?