interpolate
Interpolate poses along UAV Dubins path segment
Description
interpolates poses along the path segment at the specified path lengths. Transitions between
motion types are always included.poses = interpolate(pathSegObj,lengths)
Examples
This example shows how to connect poses using the uavDubinsConnection object and interpolate the poses along the path segment at the specified path lengths.
Connect Poses Using UAV Dubins Connection Path
Create a uavDubinsConnection object.
connectionObj = uavDubinsConnection;
Define start and goal poses as [x, y, z, headingAngle] vectors.
startPose = [0 0 0 0]; % [meters, meters, meters, radians]
goalPose = [0 0 20 pi];Calculate a valid path segment and connect the poses.
[pathSegObj,pathCost] = connect(connectionObj,startPose,goalPose);
Show the generated path.
show(pathSegObj{1})
Interpolate the Poses
Specify the interval to interpolate along the path.
stepSize = pathSegObj{1}.Length/10;
lengths = 0:stepSize:pathSegObj{1}.Length;Interpolate the poses along the path segment at the specified path lengths.
poses = interpolate(pathSegObj{1},lengths); % [x, y, z, headingAngle, flightPathAngle, rollAngle]Visualize the Transition Poses
Compute the translation and rotation matrix of the transition poses, excluding the start and goal poses. The posesTranslation matrix consists of the first three columns of the poses matrix specifying the position x, y, and z.
posesTranslation = poses(2:end-1,1:3); % [x, y, z]Increment the elements of the fourth column of the poses matrix representing the headingAngle by pi and assign it as the first column of the rotation matrix posesEulRot in ZYX Euler angle representation. A column of pi and a column of zeros forms the second and the third columns of the posesEulRot matrix, respectively. Convert the posesEulRot matrix from Euler angles to quaternion and assign to posesRotation.
N = size(poses,1)-2; posesEulRot = [poses(2:end-1,4)+pi,ones(N,1)*pi,zeros(N,1)]; % [headingAngle + pi, pi, 0] posesRotation = quaternion(eul2quat(posesEulRot,'ZYX'));
Plot transform frame of the transition poses by specifying their translations and rotations using plotTransforms.
hold on plotTransforms(posesTranslation,posesRotation,'MeshFilePath','fixedwing.stl','MeshColor','cyan')

Input Arguments
Path segment, specified as a uavDubinsPathSegment
object.
Lengths along path to interpolate poses, specified as a positive numeric vector in meters.
For example, specify
0:stepSize:pathSegObj{1}.Length to interpolate
at the interval specified by stepSize along the path. Transitions
between motion types are always included.
Data Types: double
Output Arguments
Interpolated poses along the path segment, returned as a six-element numeric matrix [x, y, z, headingAngle, flightPathAngle, rollAngle]. Each row of the matrix corresponds to a different interpolated pose along the path.
x, y, and z specify the position in meters. headingAngle, flightPathAngle, and rollAngle specify the orientation in radians.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2019b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)