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

Interrupting a joint trajectory

asked 2012-07-19 04:43:50 -0500

Teddy gravatar image

updated 2014-01-28 17:13:05 -0500

ngrennan gravatar image

I am using the move_arm package in the arm_navigation stack to control a joint trajectory, and I'd like to be able to interrupt (completely cancel) the trajectory while it's in progress.

Should I be able to do this by cancelling the MoveArmAction containing the arm pose goal? I've tried that, and while the MoveArmAction gets cancelled the trajectory itself does not (I don't get a preempt request on the joint controller action server).

I tried looking at the source for the move_arm node, and in move_arm_simple_action.cpp I found a private method called 'stopTrajectory()' that is never called anywhere in the MoveArm class. Is this a bug, or am I just not supposed to be able to cancel a joint trajectory with a MoveArmAction cancel request?

edit retag flag offensive close merge delete

Comments

1

I guess this is a bug.

Lorenz gravatar image Lorenz  ( 2012-07-19 05:36:05 -0500 )edit

I think, it's the (joint trajectory) controllers job to stop the execution of the trajectory, if the corresponding action goal gets cancelled. Does the controller you use implement this?

bit-pirate gravatar image bit-pirate  ( 2012-07-19 14:44:28 -0500 )edit

The move_arm action started the joint trajectory action. When it is cancelled, it doesn't seem to cancel the joint trajectory action and that is exactly the problem. The node that starts an action should also cancel it if it is cancelled itself.

Lorenz gravatar image Lorenz  ( 2012-07-19 22:16:18 -0500 )edit

Correct. If that doesn't happen, then it seems to be a bug indeed.

bit-pirate gravatar image bit-pirate  ( 2012-07-19 23:07:54 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-09-26 15:03:57 -0500

bit-pirate gravatar image

Finally I ran into this issue myself and started digging.

The existence of this "stopTrajectory()" function you mentioned makes me think, that the authors of move_arm actually had this situation in mind, but might just forgot to finally use/implement it.

Anyway, I found a good place to make use of this function and now when cancelling move_arm's action goal it in turn also cancels the controller's action goal, which makes my robot stop executing the trajectory. Here is the small patch:

--- a/move_arm/src/move_arm_simple_action.cpp   Thu Jun 28 18:29:21 2012 -0700
+++ b/move_arm/src/move_arm_simple_action.cpp   Thu Sep 27 09:40:43 2012 +0900
@@ -1140,6 +1140,7 @@
         else               //if we've been preempted explicitly we need to shut things down
         {
           ROS_DEBUG("The move arm action was preempted by the action client. Preempting this goal.");
+          stopTrajectory();
           revertPlanningScene();
           resetStateMachine();
           action_server_->setPreempted();

I also sent this patch in via this ticket.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-07-19 04:43:50 -0500

Seen: 643 times

Last updated: Sep 26 '12