Follow waypoints for UAV
object™ follows a set of waypoints for an unmanned aerial vehicle (UAV) using a
lookahead point. The object calculates the lookahead point, desired heading, and desired yaw
given a UAV position, a set of waypoints, and a lookahead distance. Specify a set of waypoints
and tune the
lookAheadDistance input argument and
TransitionRadius property for navigating the waypoints. The object
supports both multirotor and fixed-wing UAV types.
To follow a set of waypoints:
uavWaypointFollower object and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects? (MATLAB).
wpFollowerObj = uavWaypointFollower creates a UAV waypoint
follower with default properties.
wpFollowerObj = uavWaypointFollower(Name,Value) creates a UAV
waypoint follower with additional options specified by one or more
Name,Value pair arguments.
Name is a property name and
Value is the
Name must appear inside single quotes
''). You can specify several name-value pair arguments in any order
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects (MATLAB).
UAV type— Type of UAV
Type of UAV, specified as either
StartFrom— Waypoint start behavior
Waypoint start behavior, specified as either
When set to
'first', the UAV flies to the first path segment
between waypoints listed in
Waypoints. When set to
'closest', the UAV flies to the closest path segment between
waypoints listed in
Waypoints. When the waypoints input changes,
the UAV recalculates the closest path segment.
Waypoints— Set of waypoints
[x y z]vectors
Set of waypoints for UAV to follow, specified as a n-by-3 matrix
[x y z] vectors in meters.
YawAngles— Yaw angle for each waypoint
Yaw angle for each waypoint, specified as a scalar or n-element
column vector in radians. A scalar is applied to each waypoint in
Waypoints. An input of
 keeps the yaw
aligned with the desired heading based on the lookahead point.
TransitionRadius— Transition radius for each waypoint
Transition radius for each waypoint, specified as a scalar or
n-element vector in meter. When specified as a scalar, this parameter
is applied to each waypoint in
Waypoints. When the UAV is within
the transition radius, the object transitions to following the next path segment between
follows the set of waypoints specified in the waypoint follower object. The object takes
the current position and lookahead distance to compute the lookahead point on the path.
The desired heading, yaw, and cross track error are also based on this lookahead point
compared to the current position.
status] = wpFollowerObj(
status returns zero until the UAV
has navigated all the waypoints.
currentPose— Current UAV pose
[x y z chi]vector
Current UAV pose, specified as a
[x y z chi] vector. This pose
is used to calculate the lookahead point based on the input
[x y z] is the current
position in meters.
chi is the current heading in radians.
lookaheadDistance— Lookahead distance
Lookahead distance along the path, specified as a positive numeric scalar in meters.
lookaheadPoint— Lookahead point on path
[x y z]position vector
Lookahead point on path, returned as an
[x y z] position vector
desiredHeading— Desired heading
Desired heading, returned as a numeric scalar in radians in the range of
[-pi, pi]. The UAV heading is the direction of the velocity
desiredYaw— Desired yaw
Desired yaw, returned as a numeric scalar in radians in the range of
[-pi, pi]. The UAV yaw is the angle of the forward direction of
the UAV regardless of the velocity vector.
crossTrackError— Cross track error from UAV position to path
Cross track error from UAV position to path, returned as a positive numeric scalar in meters. The error measures the perpendicular distance from the UAV position to the closest point on the path.
status— Status of waypoint navigation
Status of waypoint navigation, returned as
1. When the follower has navigated all waypoints, the object
1. Otherwise, the object outputs
To use an object function, specify the
object as the first input argument. For
example, to release system resources of a System
When following a set of waypoints, the first waypoint may be ignored based on the pose of the UAV. Due to the nature of the lookahead distance used to track the path, the waypoint follower checks if the UAV is near the next waypoint to transition to the next path segment using a transition region. However, there is also a condition where the UAV transitions when outside of this region. A 3-D hyperplane is drawn at the next waypoint. If the UAV pose is inside this hyperplane, the waypoint follower transitions to the next waypoint. This behavior helps to ensure the UAV follows an achievable path.
The hyperplane condition is satisfied if:
(p-w1)T (w2-w1) ≥ 0
p is the UAV position, and w1 and w2 are sequential waypoint positions.
If you find this behavior limiting, consider adding more waypoints based on your initial pose to force the follower to navigate towards your initial waypoint.
 Park, Sanghyuk, John Deyst, and Jonathan How. "A New Nonlinear Guidance Logic for Trajectory Tracking." AIAA Guidance, Navigation, and Control Conference and Exhibit, 2004.