Is it bad practice to create and shutdown services during runtime?
Hi all!
I'm trying to connect my robot to a webserver using a node communication node.
This node creates the service "/get_webdata" when the connection is established and authenticated. When the connection is lost, the service is destroyed again.
This allows me to use wait_for_service in other nodes, which is pretty useful for waiting without ugly sleep-loops.
So my question is: is this a common ros practice to use:
webdata = rospy.Service("/get/webdata", Webdata, self.web_cb)
and
webdata.shutdown("Connection lost")
to signal other nodes if the connection is up?
I didn't read anywhere that it's bad practice, but it feels like I'm abusing this feature.
Would it be a better solution to keep the service running all the time and instead return a status variable, indicating that the connection is unavailable?