transformtraj
Generate trajectories between two transformations
Syntax
Description
Examples
Interpolate Between Homogenous Transformations
Build transformations from two orientations and positions. Specifiy the time interval and vector of times for interpolating.
t0 = axang2tform([0 1 1 pi/4])*trvec2tform([0 0 0]); tF = axang2tform([1 0 1 6*pi/5])*trvec2tform([1 1 1]); tInterval = [0 1]; tvec = 0:0.01:1;
Interpolate between the points. Plot the trajectory using plotTransforms
. Convert the transformations to quaternion rotations and linear transitions. The figure shows all the intermediate transformations of the coordinate frame.
[tfInterp, v1, a1] = transformtraj(t0,tF,tInterval,tvec); rotations = tform2quat(tfInterp); translations = tform2trvec(tfInterp); plotTransforms(translations,rotations) xlabel('X') ylabel('Y') zlabel('Z')
Input Arguments
T0
— Initial transformation
4-by-4 homogeneous transformation
Initial transformation, specified as a 4-by-4 homogeneous transformation. The
function generates a trajectory that starts at the initial transformation,
T0
, and goes to the final transformation,
TF
.
Data Types: single
| double
TF
— Final transformation
4-by-4 homogeneous transformation
Final transformation, specified as a 4-by-4 homogeneous transformation. The function
generates a trajectory that starts at the initial transformation,
T0
, and goes to the final transformation,
TF
.
Data Types: single
| double
tInterval
— Start and end times for trajectory
two-element vector
Start and end times for the trajectory, specified as a two-element vector in seconds.
Example: [0 10]
Data Types: single
| double
tSamples
— Time samples for trajectory
m-element vector
Time samples for the trajectory, specified as an m-element vector in seconds.
Example: 0:0.01:10
Data Types: single
| double
tSamples
— Time samples for trajectory
m-element vector
Time samples for the trajectory, specified as an m-element vector.
Example: 0:0.01:10
Data Types: single
| double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'TimeScaling',[0 1 2; 0 1 0; 0 0 0]
TimeScaling
— Time scaling vector and first two derivatives
3-by-m vector
Time scaling vector and the first two derivatives, specified as a
3-by-m vector, where m is the length of
tSamples
. By default, the time scaling is a linear time scaling
between the time points in tInterval
.
For a nonlinear time scaling, specify the values of the time points as positions in meters in the first row. The second and third rows are the velocity and acceleration of the time points in m/s and m/s2, respectively. For example, to follow the path with a linear velocity to the halfway point, and then jump to the end, the time-scaling would be:
s(1,:) = [0 0.25 0.5 1 1 1] % Position s(2,:) = [1 1 1 0 0 0] % Velocity s(3,:) = [0 0 0 0 0 0] % Acceleration
Data Types: single
| double
Output Arguments
tforms
— Transformation trajectory
4-by-4-by-m homogeneous transformation matrix array
Transformation trajectory, returned as a 4-by-4-by-m homogeneous
transformation matrix array, where m is the number of points in
tSamples
.
vel
— Transformation velocities
6-by-m matrix
Transformation velocities, returned as a 6-by-m matrix in m/s,
where m is the number of points in tSamples
. The
first three elements are the angular velocities, and the second three elements are the
velocities in time.
acc
— Transformation accelerations
6-by-m matrix
Transformation accelerations, returned as a 6-by-m matrix in
m/s2, where m is the number of points in
tSamples
. The first three elements are the angular accelerations,
and the second three elements are the accelerations in time.
References
[1] Lynch, Kevin M., and Frank C. Park. Modern Robotics: Mechanics, Planning, and Control. Cambridge University Press, 2017.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2019a
See Also
bsplinepolytraj
| contopptraj
| cubicpolytraj
| quinticpolytraj
| rottraj
| transformtraj
| trapveltraj
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)