# UAV Toolbox - Reference Frame Definition

26 visualizaciones (últimos 30 días)
Eryn Jaramillo el 20 de Mayo de 2024 a las 23:20
Comentada: Jianxin Sun el 23 de Mayo de 2024 a las 18:57
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?
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Paul el 21 de Mayo de 2024 a las 3:18
Editada: Paul el 21 de Mayo de 2024 a las 3:27
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 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Jianxin Sun el 23 de Mayo de 2024 a las 18:57
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

Iniciar sesión para comentar.

### Categorías

Más información sobre Scenario Simulation en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by