qcr/ros_trees

ActionLeaf will raise exception rather than wait for server is not already up

Opened this issue · 0 comments

leave_ros.py

# Get a client & type for the Action Server
try:
    self._action_class = roslib.message.get_message_class(re.sub('Goal$', '', rostopic.get_topic_type(self.action_namespace + '/goal')[0]))
    self._action_client = actionlib.SimpleActionClient(self.action_namespace, self._action_class)
except:
    raise Exception(
        'Failed to set up action client for server: {}'.format(
            self.action_namespace))

# Confirm the action client is actually there
if not self._action_client.wait_for_server(rospy.Duration(timeout)):

In the case that the action server does not yet have the goal subscriber up, the result of get_topic_type will be None and the leaf setup will fail.

I propose not attempting to do this automatically and simply having the user specify the action message class. This would allow wait_for_server to allow time for the server to come up as intended.