Ask Your Question
0

Check to see if a service is running?

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

Chengarda gravatar image

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

ngrennan gravatar image

Hi,

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
1

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

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. http://wiki.ros.org/ROS/Master_API 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

Comments

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 -0500 )edit

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: 2013-12-12 17:21:19 -0500

Seen: 1,149 times

Last updated: Dec 12 '13