Follow waypoints for UAV
System object™ follows a set of waypoints for an unmanned aerial vehicle (UAV) using a
lookahead point. The object calculates the lookahead point, desired course, 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:
uavWaypointFollowerobject 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?
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.
UAV type — Type of UAV
'fixed-wing' (default) |
Type of UAV, specified as either
StartFrom — Waypoint start behavior
'first' (default) |
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
n-by-3 matrix of
[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
scalar | n-element column vector |
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 course based on the lookahead point.
TransitionRadius — Transition radius for each waypoint
numeric scalar | n-element column vector
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
MinLookaheadDistance — Minimum lookahead distance
0.1 (default) | positive numeric scalar
Minimum lookahead distance, specified as a positive numeric scalar in meters.
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 course, 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 course in radians.
lookaheadDistance — Lookahead distance along the path
positive numeric scalar
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
desiredCourse — Desired course
Desired course, returned as a numeric scalar in radians in the range of
[-pi, pi]. The UAV course is the direction of the velocity
vector. For fixed-wing type UAV, the values of desired course and desired yaw are
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. The desired yaw is computed using linear
interpolation between the yaw angle for each waypoint. For fixed-wing type UAV, the
values of desired course and desired yaw are equal.
lookaheadDistFlag — Lookahead distance flag
0 (default) |
Lookahead distance flag, returned as
0 indicates lookahead distance is not saturated,
1 indicates lookahead distance is saturated to minimum lookahead
distance value specified.
crossTrackError — Cross track error from UAV position to path
positive numeric scalar
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
System object as the first input argument. For
example, to release system resources of a System object named
Waypoint Hyperplane Condition
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.