# MoveIt! - How to execute trajectories backwards

Hello guys,

I was wondering if it is possible to execute a trajectory backwards in MoveIt!. So, for example, let's say that I have a manipulator and I want to go from point 1 to point 2 and MoveIt! calculates a plan for a trajectory with 5 waypoints. When the trajectory is executed, the manipulator goes to the first waypoint, then to the second, and so on until it reaches the 5th waypoint.

If I want to go from point 2 to point 1 right after I reach point 2, I shouldn't necessarily have to calculate a new trajectory again, right? I should simply have use the trajectory calculated from point1 to point 2 and go from waypoint 5 to waypoint 4 till I reach waypoint 1, right? So, is there any way to reuse the first trajectory calculated in order to follow its path backwards?

Best regards, José Brito

edit retag close merge delete

Sort by » oldest newest most voted

This is not supported right now.

A semi-manual way could be to write a short function that takes in a JointTrajectory, reverses the order of the JointTrajectoryPoints in it and then re-runs the time parameterisation.

One reason I can come up with for why this isn't directly supported (apart from 'no one' needing this sort of functionality badly enough to add it) would be that it's quite an assumption to make that the environment hasn't changed between planning & executing the "to" motion and the time you'd want to make the "return" motion. As MoveIt is primarily intended to perform motion planning in dynamic (or at least not in completely static) scenes, reusing trajectories does not seem like something that would be often done.

more

Thanks a lot @gvdhoorn! I found a possible way to do it in this link: https://groups.google.com/forum/#!top...

I will try to spend some time with this! Thanks a lot :)

( 2018-06-25 05:32:29 -0500 )edit