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

Revision history [back]

click to hide/show revision 1
initial version

(I know this is an old one, but for future reference here is my answer.)


The OP was aiming to use send_goal_and_wait method that has the following signature:

actionlib::simple_action_client::SimpleActionClient::send_goal_and_wait(self, goal, execute_timeout = rospy.Duration(), preempt_timeout = rospy.Duration())

Looking at the source code, I see that the default value for the optional timeout parameters is 0 seconds since rospy.Duration() initializes the duration objects with 0 seconds.

Moreover, it is pointed out in the class reference that calling this method would make ActionServer forget about any previous goal, if there exists any.

Therefore, calling this method several times without any given timeout is expected to behave just as OP described. To my understanding, this is the expected behavior.


So the more appropriate way would be to use this method with the necessary timeout values. For example:

exec_timeout = rospy.Duration(10)
prmpt_timeout = rospy.Duration(5)
client.send_goal_and_wait(goal, exec_timeout, prmpt_timeout)