## Motion Planning using RML?

Typically: "How do I... ", "How can I... " questions
mgdbgj
Posts: 7
Joined: 08 Sep 2014, 22:44

### Motion Planning using RML?

I've been trying to make sense out of the motion of execution code in the motion and grasping demo (jaco and mico).

I've read up a little bit on the Reflexxes library before I run the demo and my expectations were a bit different, but so far I've been unable to make the code that matches my expectation to work in a reasonable way.

Once a safe path is calculated, I expected the code to run RML iteratively for 6 DOFs and change the target constraint and/or velocity constraints based on the path waypoints and the maximum velocities of each of the actual 6 DOFS. As per, Online Trajectory Generation: Basic Concepts for Instantaneous Reactions to Unforeseen Events, by Kroger, T. and Wahl, F.M. ( http://ieeexplore.ieee.org/xpl/articleD ... er=5350749 ).

Instead (and as far as I can tell) the code uses RML to first iterate through a motion of a single joint with some specified VMax, AccMax, etc. to see if the calculated trajectory ever has velocity higher than that of any of DOF and that it scales VMax based on the slowest joint. Then using this scaled value of VMax, AccMax, etc., it creates a new RML context and iterates through the motion, but this time it uses the calculated values for that single DOF to derive the next position of the actual 6 DOFs.

I've been unable to figure out how to extend this odd approach to take into account different characteristics of the DOFs or even to make sense of how projecting a velocity/acceleration profile of a single dof onto a trajectory for unrealated dofs with different targets, etc. makes sense mathematically. I'm clearly missing something.

When I try for the expected approach, the first problem to be addressed is the velocity of joint at each of the waypoints. Also, I have to call simRMLremove every time I set the new target per documentation which I'm not sure is what I actually want to get the desired effect. Anyway, I can set velocities to zero (totally not optimal) and while this works, path between points is totally random and odd for some reason ... If I set velocity a slightly higher value, I get an error -100 (which I cannot find explanation for), but I'm guessing that it means that the waypoint is not reachable because points are too close or something.

Any help or explanation of the RML usage in V-REP would be appreciated.

coppelia
Posts: 7605
Joined: 14 Dec 2012, 00:25

### Re: Motion Planning using RML?

Hello,

I think I understand what you want to achieve: basically follow a path by having the Reflexxes library figure out the joint positions in time, in order to respect individual joint properties such as max velocity, accel. or jerk., while travelling through the path points (in the configuration space). So basically use the RML functions for the n DoFs of your robot.

This is something that is not supported, I am reproducing here a reply from Torsten Kroeger, the person behind the Reflexxes library. The translation (done by me) comes from a German email that is also reproduced afterwards:

English translation:
with the current implementation of Reflexxes this is not possible. The difficulty lies in calculating the velocity vectors to the given waypoints. A suboptimal method would be calculating this manually or heuristically (for example: the direction can be calculated based on the points in front and behind, and the velocity (i.e. the length of the vector) based on the maximum values and the distances between points)

Mit der derzeitigen Implementierung von Reflexxes ist dies so nicht moeglich. Die Schwierigkeit liegt im Berechnen von den Geschwindigkeitsvektoren an den gegebenen Wegpunkten. Ein suboptimale Methode waere diese haendisch oder heuristisch zu berechnen (zum Beispiel: die Richtung laesst sich auf Basis des davorliegenden und des dahinterliegenden Punktes berechnen, und die Geschwindigkeit, also die Laenge des Vektors, auf Basis der gegebenen Maximalwerte und den Abstaenden zwischen Punkten).

What the demo motionPlanningAndGraspingDemo.ttt does is following:
• The length of the path (e.g. in configuration space) is computed. Let's say it is L.
• Then we decide of a maximum velocity, acceleration and jerk, at which we will follow this one-dimensional L.
• We have a one dimensional problem (i.e. follow the path, starting at velocity 0, position 0, and arriving at velocity 0, position L.
• We feed the RML with the desired motion characteristics, and execute the movement only in numbers (i.e. we do not send the data to the robot model)
• At each motion step, we inspect the individual joint velocities. If one velocity is too high, then we re-run the RML algorithm from start, with an adjusted maximum velocity
• If the RML allows us to respect the individual joint velocities, then we execute the movement on the robot model
So basically, instead of working in n dimensions with the RML, we work in 1 dimension with the RML.

Cheers

mgdbgj
Posts: 7
Joined: 08 Sep 2014, 22:44

### Re: Motion Planning using RML?

So first, the question regarding the existing solution ...

I'm still having trouble understanding the part of the existing algorithm (your last bullet) that seems to map a trajectory of length L with acceptable joint velocities onto a paths of length, M where M >= L or M < L depending on the dof.
Does the approach assume a specific metric weights in the configuration space ? Maybe that's what I'm failing to understand.
Does the approach assume that changes to joint positions are monotonic? Or simplified trajectories tend to be monotonic?

If path calculations returned length of path for each dof, than couldn't you at least use RML to calculate synchronized trajectories for the individual DOFs given their velocity and acceleration specifications, i.e. call RML for 6 dofs with target vector of {M1, M2, M3, M4, M5, M6, ...}.

And going back to the RML solution ...

What flags are used to initialize the RML object? Or a default Flags object is used to initialize the object?
If the API allowed to changes to target state without destroying the RML motion, would there be a difference in behavior?
Is there a way to not specify the target velocity (that would be one heuristic) and depend only on Motion Constraint variables (VMax, etc.)?

Thanks for your patience while I wrap my head around these two concepts.

coppelia