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

Check to see if a service is running?

asked 2013-12-12 17:21:19 -0600

Chengarda gravatar image

updated 2014-04-20 14:06:45 -0600

ngrennan gravatar image


I'm trying to use a service that will only ever need to be called once. I'd like to destroy the service server object as soon as the service is completed, allowing the service name to be reused.

I've tried sending a call to Shutdown() as the last part of the service callback, but of course this starts destroying the service while it's in use. Can anyone suggest a way to check if a service is currently in use?

I'd prefer not to use another service or topic to signal the completion of the service from the client.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-12-12 20:04:46 -0600

tfoote gravatar image

You can have the server destroy itself using a flag after finishing servicing the call. And the Master API for the client to know if the service is there. roscpp and rospy both have methods to expose this capability.

I'd suggest you review your program design. Requiring the server to start up and shutdown is an odd requirement which add a lot of overhead. You could probably find a simpler solution.

edit flag offensive delete link more


Thanks, good advice, both parts. I think you might be right about a simpler solution.

Chengarda gravatar image Chengarda  ( 2013-12-15 10:40:35 -0600 )edit

Question Tools

1 follower


Asked: 2013-12-12 17:21:19 -0600

Seen: 2,035 times

Last updated: Dec 12 '13