Clear Filters
Clear Filters

I had a question regarding 'transformtraj' function

5 views (last 30 days)
Gal
Gal on 3 Apr 2024
Commented: Gal on 4 May 2024
Hi. i have looked into the function after trying to run the example given inside the function's code.
some how, it looks as the minimum jerk trajectory doesn't meets the set time interval.
is it a bug? or dont i understand the function's intention?

Answers (1)

MULI
MULI on 23 Apr 2024
Edited: MULI on 23 Apr 2024
Hi Gal,
I understand that when you ran one of the examples in documentation provided for ‘transformtraj’ you could not get minimum trajectory function.
  • The “transformtraj” function in MATLAB mainly focuses on creating a smooth interpolation between the initial and final transformations, which includes both position and orientation changes over time.
  • Achieving a "minimum jerk" trajectory involves a specific optimization criterion that minimizes the integral of the square of the jerk over the movement duration.
  • If your application requires a strict minimum jerk trajectory, you can use the “minjerkpolytraj function that generates a minimum jerk polynomial trajectory from given set of input waypoints with their corresponding time points.
  • This function returns positions, velocities, accelerations, and jerks at the given number of samples.
You may refer to this documentation link for more information
Hope this clears your query!
  1 Comment
Gal
Gal on 4 May 2024
Hi Muli,
thanks for your reply.
its not exactly what ia have asked about. i will try to rephrase my question.
at the transformaj.m file there is an example code for how to use the function. (see below)
while i ran it, i had noticed the two trajectories (default time scaling and the "minimum jerk" time scaling) doesnt start and ends at the same time points (tpts at the code).
why doesn't the trajectory, using the "minimum jerk" time scaling, follows the same time interval as the default time scaling (linear)? how can it be fixed?
Cheers Gal
% Define time vector
tvec = 0:0.01:5;
% Define time over which rotation will occur
tpts = [1 4];
% Build transforms from two orientations and positions
T0 = axang2tform([0 1 1 pi/4]);
TF = axang2tform([1 0 1 6*pi/5]);
TF(1:3,4) = [1 -5 23]';
% Interpolate between the points
[tfInterp1, v1, a1] = transformtraj(T0, TF, tpts, tvec);
% Interpolate between the points using a cubic time scaling
[s, sd, sdd] = minjerkpolytraj([0 1], tpts, numel(tvec));
[tfInterp2, v2, a2] = ...
transformtraj(T0, TF, tpts, tvec, 'TimeScaling', [s; sd; sdd]);
% Compare the position interpolation
figure
plot(tvec, reshape(tfInterp1(1:3,4,:),3,size(tfInterp1,3)))
title('Linear (Solid) vs Min Jerk (Dashed) Position Time Scaling')
hold all
plot(tvec, reshape(tfInterp2(1:3,4,:),3,size(tfInterp1,3)), '--')
hold off

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!