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

simpleactionclient send_goal_and_wait problem

asked 2018-11-07 04:49:15 -0500

Sietse gravatar image

updated 2018-11-30 04:38:17 -0500

Hello list,

SECOND EDIT: I still am at a loss why the send_goal_and_wait and wait_for_result functions are NOT waiting until a current trajectory is finished as I think they should!

Trying to send multiple trajectories to a robot simulated in gazebo, but the send_goal_and_wait function does not properly wait for the current trajectory to finish. So the next trajectory is started while the current is still not finished.

Here the relevant lines from my code:

arm_client = actionlib.SimpleActionClient('boot0/joint_trajectory_controller/follow_joint_trajectory', FollowJointTrajectoryAction)
arm_client.wait_for_server()

arm_goal = FollowJointTrajectoryGoal()
  # set an arm_trajectory that takes 5 seconds                                                                                          
arm_goal.trajectory = arm_trajectory
arm_goal.goal_time_tolerance = rospy.Duration(0.0)
arm_client.send_goal_and_wait(arm_goal)

# this call returns almost immediately!

Why doesn't this call take about 5 seconds? Now a next trajectory will start too soon!

EDIT: I now am doing the experiment with the rrbot example from gazebo_ros_demos. The result is the same.

The topic /follow_joint_trajectory/result yields:

header: 
  seq: 5
  stamp: 
    secs: 204
    nsecs: 594000000
  frame_id: ''
status: 
  goal_id: 
    stamp: 
      secs: 204
      nsecs: 543000000
    id: "/trajectory_0-1-204.543"
  status: 4
  text: ''
result: 
  error_code: -4
  error_string: ''
---

Which also contains also the status shown in /follow_joint_trajectory/status.

Does this mean: ABORTED=4 and PATH_TOLERANCE_VIOLATED = -4?

The rrbot always works perfectly, the trajectory is simple, only a single new position is specified, well within its limits. BUT, I have ONCE seen that the send_goal_and_wait function DID NOT immediatly returned, and the status was SUCCEEDED and the result was SUCCESSFUL.

What can PATH_TOLERANCE_VIOLATED mean here?

Thanks in advance, Sietse

edit retag flag offensive close merge delete

Comments

1

Have you checked the topic /follow_joint_trajectory/status to see if the goal is set to succeded/aborted/preempted as soon as you call the function ? Also the topic /follow_joint_trajectory/result is only the error_code of the goal sent, what is its output ?

Delb gravatar image Delb  ( 2018-11-07 07:40:59 -0500 )edit

Thanks, see my edit above.

Sietse gravatar image Sietse  ( 2018-11-09 02:35:59 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-28 05:29:33 -0500

yigit gravatar image

(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)
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-11-07 04:49:15 -0500

Seen: 560 times

Last updated: Apr 28 '20