Main Content

uavWaypointFollower

Follow waypoints for UAV

Description

The uavWaypointFollower 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 thelookAheadDistance 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:

  1. Create the uavWaypointFollower object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

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 corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Properties

expand all

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.

Type of UAV, specified as either 'fixed-wing' or 'multirotor'.

Waypoint start behavior, specified as either 'first' or 'closest'.

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.

Set of waypoints for UAV to follow, specified as a n-by-3 matrix of [x y z] vectors in meters.

Data Types: single | double

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.

Data Types: single | double

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 waypoints.

Data Types: single | double

Minimum lookahead distance, specified as a positive numeric scalar in meters.

Data Types: single | double

Usage

Description

[lookaheadPoint,desiredCourse,desiredYaw,lookaheadDistFlag,crossTrackError,status] = wpFollowerObj(currentPose,lookaheadDistance) 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 returns zero until the UAV has navigated all the waypoints.

Input Arguments

expand all

Current UAV pose, specified as a [x y z chi] vector. This pose is used to calculate the lookahead point based on the input lookaheadDistance. [x y z] is the current position in meters. chi is the current course in radians.

Data Types: single | double

Lookahead distance along the path, specified as a positive numeric scalar in meters.

Data Types: single | double

Output Arguments

expand all

Lookahead point on path, returned as an [x y z] position vector in meters.

Data Types: single | double

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 equal.

Data Types: single | double

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.

Data Types: single | double

Lookahead distance flag, returned as 0 or 1. 0 indicates lookahead distance is not saturated, 1 indicates lookahead distance is saturated to minimum lookahead distance value specified.

Data Types: uint8

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.

Data Types: single | double

Status of waypoint navigation, returned as 0 or 1. When the follower has navigated all waypoints, the object outputs 1. Otherwise, the object outputs 0.

Data Types: uint8

Object Functions

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 obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

More About

expand all

References

[1] Park, Sanghyuk, John Deyst, and Jonathan How. "A New Nonlinear Guidance Logic for Trajectory Tracking." AIAA Guidance, Navigation, and Control Conference and Exhibit, 2004.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2018b