Clear Filters
Clear Filters

UAV Toolbox - Reference Frame Definition

3 views (last 30 days)
I am able to attain data using the UAV Toolbox functions waypointTrajectory and lookupPose, but I don't understand the reference frame in which the data is being provided. Take the UAV Toolbox waypointTrajectory function example titled "Create Trajectory using Waypoint and Ground Speed" linked here. The default reference frame for the waypointTrajectory function is said to be "NED", but in either reference frame case ("NED" or "ENU") the position values output are both positive. I assumed that when climbing in altitude the position value output for the "NED" frame would be negative. My assumption, at this point, is the "NED" frame is set at latitude, longitude, and height of 0 and the information being output is given with respect to the body frame. Does this sound correct or does anyone have a better explanation to the frame of reference in which the data is being provided?

Accepted Answer

Paul
Paul on 21 May 2024
Edited: Paul on 21 May 2024
In reference to the example on the linked page, I assume the waypoints are specified in the waypoint trajectory reference frame. So the waypoint at [10 50 10] specifies a waypoint at 10 m down if in NED and 10 m up in ENU. In either case, the trajectory starts at 0 and moves to positive 10. When using plot3, the default direction of the z-axis is to point up on the screen, so even a motion from 0 to 10 m Down looks like the trajectory is going up on the screen (and likewise the East axis looks like it's pointing west).
waypoints = [0 0 0;
10 50 10];
speeds = [0 10];
jerkLimit = 0.5;
trajectory = waypointTrajectory(waypoints,GroundSpeed=speeds,JerkLimit=jerkLimit,ReferenceFrame="NED");
t0 = trajectory.TimeOfArrival(1);
tf = trajectory.TimeOfArrival(end);
sampleTimes = linspace(t0,tf,100);
[position,~,velocity,acceleration,~] = lookupPose(trajectory,sampleTimes);
figure()
plot3(position(:,1),position(:,2),position(:,3))
xlabel("N (m)")
ylabel("E (m)")
zlabel("D (m)")
title("Trajectory")
It's probably possible to muck around with the axis properties to make the axes look closer to physical reality. Alternatively, plot in ENU even when the data in NED.
  1 Comment
Jianxin Sun
Jianxin Sun on 23 May 2024
You can use plotTransforms function with InertialZDirection set to Down to visualize the trajectory along with UAV orientation. When you use NED frame, the waypoints are also in NED frame. But when plotting it, you often need to apply extra transforms to visualize the vehicle properly. In the example below, the plot frame is in North-West-Up, a 180 degree roll relative to the NED frame used by waypoint trajectory. You will observe that the vehicle frame (shown as red-green-blue axes) has its forward direction as body x, and downward direction as body z.
waypoints = [0 0 0;
10 50 10];
speeds = [0 10];
jerkLimit = 0.5;
trajectory = waypointTrajectory(waypoints,GroundSpeed=speeds,JerkLimit=jerkLimit,ReferenceFrame="NED");
t0 = trajectory.TimeOfArrival(1);
tf = trajectory.TimeOfArrival(end);
sampleTimes = linspace(t0,tf,20);
[position,orientation,velocity,acceleration,~] = lookupPose(trajectory,sampleTimes);
figure()
plotTransforms(position, orientation, InertialZDirection="Down")
xlabel("N (m)")
ylabel("W (m)")
zlabel("U (m)")
title("Trajectory")
axis equal

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!