lookupPose
Syntax
Description
[
returns the pose information of the waypoint trajectory at the specified sample times. If
any sample time is beyond the duration of the trajectory, the corresponding pose information
is returned as position
,orientation
,velocity
,acceleration
,angularVelocity
,ecef2ref
] = lookupPose(traj
,sampleTimes
)NaN
.
[___] = lookupPose(
additionally enables you to specify the format of the traj
,sampleTimes
,coordinateSystem
)position
output.
Examples
Create geoTrajectory
and Look Up Pose
Create a geoTrajectory
with starting LLA at [15 15 0] and ending LLA at [75 75 100]. Set the flight time to ten hours. Sample the trajectory every 1000 seconds.
startLLA = [15 15 0];
endLLA = [75 75 100];
timeOfTravel = [0 3600*10];
sampleRate = 0.001;
trajectory = geoTrajectory([startLLA;endLLA],timeOfTravel,'SampleRate',sampleRate);
Output the LLA waypoints of the trajectory.
positionsLLA = startLLA; while ~isDone(trajectory) positionsLLA = [positionsLLA;trajectory()]; end positionsLLA
positionsLLA = 37×3
15.0000 15.0000 0
16.6667 16.6667 2.7778
18.3333 18.3333 5.5556
20.0000 20.0000 8.3333
21.6667 21.6667 11.1111
23.3333 23.3333 13.8889
25.0000 25.0000 16.6667
26.6667 26.6667 19.4444
28.3333 28.3333 22.2222
30.0000 30.0000 25.0000
⋮
Look up the Cartesian waypoints of the trajectory in the ECEF frame by using the lookupPose
function.
sampleTimes = 0:1000:3600*10;
n = length(sampleTimes);
positionsCart = lookupPose(trajectory,sampleTimes,'ECEF');
Visualize the results in the ECEF frame.
figure() km = 1000; plot3(positionsCart(1,1)/km,positionsCart(1,2)/km,positionsCart(1,3)/km, 'b*'); hold on; plot3(positionsCart(end,1)/km,positionsCart(end,2)/km,positionsCart(end,3)/km, 'bo'); plot3(positionsCart(:,1)/km,positionsCart(:,2)/km,positionsCart(:,3)/km,'b'); plot3([0 positionsCart(1,1)]/km,[0 positionsCart(1,2)]/km,[0 positionsCart(1,3)]/km,'k:'); plot3([0 positionsCart(end,1)]/km,[0 positionsCart(end,2)]/km,[0 positionsCart(end,3)]/km,'k:'); xlabel('x (km)'); ylabel('y (km)'); zlabel('z (km)'); legend('Start position','End position', 'Trajectory')
Input Arguments
traj
— Geodetic trajectory
geoTrajectory
object
Geodetic trajectory, specified as a geoTrajectory
object.
sampleTimes
— Sample times
K-element vector of nonnegative scalar
Sample times in seconds, specified as an K-element vector of nonnegative scalars.
coordinateSystem
— Coordinate system to report positions
'LLA'
(default) | 'ECEF'
Coordinate system to report positions, specified as:
'LLA'
— Report positions as latitude in degrees, longitude in degrees, and altitude above the WGS84 reference ellipsoid in meters.'ECEF'
— Report positions as Cartesian coordinates in the ECEF (Earth-Centered-Earth-Fixed) coordinate frame in meters.
.
Output Arguments
position
— Positions in local reference coordinate system (deg deg m)
K-by-3 matrix
Geodetic positions in local reference coordinate system, returned as a
K-by-3 matrix. K is the number of
SampleTimes
.
When the
coordinateSystem
input is specified as'LLA'
, the three elements in each row represent the latitude in degrees, longitude in degrees, and altitude above the WGS84 reference ellipsoid in meters of the geodetic waypoint.When the
coordinateSystem
input is specified as'ECEF'
, the three elements in each row represent the Cartesian position coordinates in the ECEF (Earth-Centered-Earth-Fixed) coordinate frame in meters.
Data Types: double
orientation
— Orientation in local reference coordinate system
K-element quaternion column vector | 3-by-3-by-K real array
Orientation in the local reference coordinate system, returned as a
K-by-1 quaternion
column vector
or as a 3-by-3-by-K real array in which each 3-by-3 matrix is a
rotation matrix.
Each quaternion or rotation matrix is a frame rotation from the local reference frame (NED or ENU) at the waypoint to the body frame of the target on the trajectory.
K is the number of SampleTimes
.
Data Types: double
velocity
— Velocity in local reference coordinate system (m/s)
K-by-3 matrix
Velocity in the local reference coordinate system in meters per second, returned as an M-by-3 matrix.
K is specified by the SamplesPerFrame
property.
Data Types: double
acceleration
— Acceleration in local reference coordinate system (m/s2)
K-by-3 matrix
Acceleration in the local reference coordinate system in meters per second squared, returned as an M-by-3 matrix.
K is the number of SampleTimes
.
Data Types: double
angularVelocity
— Angular velocity in local reference coordinate system (rad/s)
K-by-3 matrix
Angular velocity in the local reference coordinate system in radians per second, returned as a K-by-3 matrix.
K is the number of SampleTimes
.
Data Types: double
ecef2ref
— Orientation of reference frame with respect to ECEF frame
K-element quaternion column vector | 3-by-3-by-M real array
Orientation of the reference frame with respect to the ECEF
(Earth-Centered-Earth-Fixed) frame, returned as a K-by-1 quaternion
column vector
or as a 3-by-3-by-K real array, in which each 3-by-3 matrix is a
rotation matrix.
Each quaternion or 3-by-3 rotation matrix is a frame rotation from the ECEF frame to the local reference frame (NED or ENU) at the current trajectory position.
K is the number of SampleTimes
.
Data Types: double
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2024a
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.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)