ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ERROR: Service [/spawn] is not available.

asked 2018-04-06 01:31:44 -0500

sonu_patidar gravatar image

I have the following launch file:


<node pkg="turtlesim" name="turtle" type="turtlesim_node"/>
<node pkg="rosservice" type="rosservice" name="spawnturtle1" args="call /spawn 2 2 -1 turtle2"/>   
<node pkg="rosservice" type="rosservice" name="spawnturtle2" args="call /spawn 4 4 0.5 turtle3"/>  
<node pkg="rosservice" type="rosservice" name="spawnturtle3" args="call /spawn 2 5 0.1 turtle4"/>  
<node pkg="rosservice" type="rosservice" name="spawnturtle4" args="call /spawn 5 2 1 turtle5"/> 
<node pkg="rosservice" type="rosservice" name="spawnturtle5" args="call /spawn 3 3 0.5 turtle6"/> 


I am getting the error as given in title, sometimes it spawns 2 turtle, sometimes 3 with the error.

Can anyone explain this weired behavior?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-06 02:37:27 -0500

Delb gravatar image

updated 2018-04-06 02:37:44 -0500

The issue comes from the service not being initialized/available when sending the request /spawn. In the output of the terminal you can see that the first processes always die and the 2 or 3 turtle spawned are the last ones.

You should (for debugging) add the attribute output = "screen" in each node tag to have more informations, you will see which turtles have been spawned and some erros like this :

rosservice: error: no such option: -1
ERROR: Service [/spawn] is not available.
ERROR: Service [/spawn] is not available.

You can directly understand the issue then. And to solve it, you should wait some time before spawning each turtle or wait for the service to be available before caling it.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-04-06 01:31:44 -0500

Seen: 3,215 times

Last updated: Apr 06 '18