Main Content

Obstacle Avoidance

Compute obstacle-free direction using range sensor data and target position

Since R2021b

  • UAV Obstacle Avoidance Block

Libraries:
UAV Toolbox / Algorithms

Description

The Obstacle Avoidance block computes an obstacle-free direction using range sensor data and target position.

Ports

Input

expand all

Position of the UAV, specified as a vector of the form [x; y; z]. x, y, and z define the xyz-position of the UAV in any right-handed coordinate frame, such as NED and ENU. Units are in meters.

Example: [1; 1; 1]

Data Types: double

Orientation of the UAV in any right-handed coordinate frame, such as NED and ENU, specified as a quaternion vector of the form [w; x; y; z].

Example: [1; 0; 0; 0]

Data Types: double

Obstacle points locations, specified as an N-by-3 matrix with rows of the form [x y z]. x, y, and z define the xyz-position of the obstacle point in the reference frame of the range sensor. N is the number of obstacle points. Units are in meters.

You can obtain the obstacle points using sensors such as the UAV Scenario Lidar which outputs obstacle points as a point cloud data.

Example: [1 1 1; 2 2 2]

Data Types: double

Position of the target, specified as a vector of the form [x; y; z]. x, y, and z define the xyz- position of the target in any right-handed coordinate frame, such as NED and ENU. Units are in meters.

Example: [2; 3; 4]

Data Types: double

Output

expand all

Desired direction, returned as a unit vector of the form [x; y; z]. x, y, and z define the desired direction in the right-handed coordinate frame that you specified in the position input. Units are in meters.

Data Types: double

Desired yaw in the right-handed coordinate frame that you specified in the position input, returned as numeric scalar in radians in the range of [-pi, pi] .

Data Types: double

Status of the obstacle-free direction, returned as 0, 1, 2, or 3.

  • 0 — An obstacle-free direction is found.

  • 1 — No obstacle-free direction is found.

  • 2 — An obstacle-free direction is found but is close to the obstacle.

  • 3 — No obstacle-free direction is found and is close to obstacle.

Data Types: uint8

Parameters

expand all

Main

Specify the minimum and maximum limits of the range sensor as a vector of the form [min max], with values in meters.

Data Types: double

Specify the minimum and maximum horizontal field of view limits of the range sensor as a vector of the form [min max], with values in degrees.

Data Types: double

Specify the minimum and maximum vertical field of view limits of the range sensor as a vector of the form [min max], with values in degrees.

Data Types: double

Specify the mounting location of the sensor on the UAV body frame as a vector of the form [x y z], with values in meters.

The configuration of the UAV body frame orients the x-axis as forward-positive, the y-axis as right-positive, and the z-axis downward-positive.

Data Types: double

Specify the orientation of the sensor on the UAV body frame as a vector of the form [roll pitch yaw], with values in degrees.

Data Types: double

This dimension defines the smallest circle that can circumscribe your vehicle, in meters. The vehicle radius is used to account for vehicle size when computing the obstacle-free direction.

Data Types: double

The safety distance specifies, in meters, the space accounted for between the UAV and obstacles in addition to the vehicle radius. The vehicle radius and safety distance are used to compute the obstacle-free direction.

Data Types: double

Specify whether to simulate the model using Interpreted execution or Code generation.

  • Interpreted execution — Simulate the model using the MATLAB® interpreter. This option reduces startup time, but has a slower simulation speed than Code generation. In this mode, you can debug the source code of the block.

  • Code generation — Simulate the model using generated C code. The first time you run a simulation, Simulink® generates C code for this block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time, but the speed of subsequent simulations is faster than Interpreted execution.

Tunable: No

Histogram

To change the histogram grid resolution, select a value from the list. All values are in degrees.

The histogram window size determines the angular width of an obstacle-free opening in the azimuth and elevation directions. This value is unitless.

Data Types: uint8

The threshold for computing the histogram specifies the minimum number of obstacle points that should be in an histogram cell to be considered as obstacle. If a cell contains fewer than this number of obstacle points, the cell is considered as obstacle-free.

Data Types: uint8

Specifies the maximum age of a remembered obstacle point as a numeric scalar. This value specify the number of previous time steps for which the obstacle points from those time steps is remembered.

Data Types: double

Cost

Specifies the function weight for moving toward the target direction. To follow a target direction, set this weight to be greater than the sum of Current direction weight and Previous direction weight. To ignore the target direction cost, set this weight to 0.

Data Types: double

Specifies the function weight for moving the vehicle in the current heading directions. Higher values of this weight produce more efficient paths. To ignore the current direction cost, set this weight to 0.

Data Types: double

Specifies the function weight for moving in the previously selected steering direction. Higher values of this weight produce smoother paths. To ignore the previous direction cost, set this weight to 0.

Data Types: double

Extended Capabilities

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

Version History

Introduced in R2021b