Ask Your Question
0

Calling a (Gazebo) service parallelly from multiple nodes/ Remapping a (Gazebo) service to a particular namespace

asked 2018-04-17 08:41:24 -0500

nf gravatar image

I have a multi robot setting (with different namespaces which work totally independent of each other, in the same empty_world) in Gazebo. I have to reset the manipulated objects after a certain time interval. I have different ROS nodes controlling the robots and the resetting objects. So I want to use gazebo/set_model_state service parallelly in all the nodes. Spawning one robot works fine as it is the only node using the service. But as soon as I launch the second node it gives me the following error from the first simulation and the second simulation starts running fine.

rospy.service.ServiceException: service [/gazebo/set_model_state] returned no response

I'm aware that the service call executes commands in a serial manner. But I would like to call the service parallelly from all the nodes at the same time. Is this possible? I suppose this can be done if I can somehow "remap" the service like I do for the topics. That way I can specifically call the service belonging to the robot of that particular namespace. Or if I somehow clone the existing service into multiple unique services each node can call these unique nodes parallelly. But I'm not sure how this can be done. Any suggestions?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-04-18 03:41:28 -0500

nf gravatar image

updated 2018-04-18 03:44:22 -0500

Since the service call takes very less time to execute the command. I added an extra line for rospy to wait till the service is again available but just this line without adding a time like around 5 sec wasnt working.

rospy.wait_for_service('/gazebo/set_model_state', 5.0)

After adding this line my error vanished and am able to execute things as I want them to. To prevent future errors i also added a try, except statements while doing the service call.

Though this doesn't answer the asked question this provided me with a quick fix to work with.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-04-17 08:41:24 -0500

Seen: 82 times

Last updated: Apr 18 '18