The vector field histogram (VFH) algorithm computes obstacle-free steering directions for a robot based on range sensor readings. Range sensor readings are used to compute polar density histograms to identify obstacle location and proximity. Based on the specified parameters and thresholds, these histograms are converted to binary histograms to indicate valid steering directions for the robot. The VFH algorithm factors in robot size and turning radius to output a steering direction for the robot to avoid obstacles and follow a target direction.
To calculate steering directions, you must specify information
about the robot size and its driving capabilities. The VFH algorithm
requires only four input parameters for the robot. These parameters
are properties of the
RobotRadius specifies the radius
of the smallest circle that can encircle all parts of the robot. This
radius ensures that the robot avoids obstacles based on its size.
SafetyDistance optionally specifies
an added distance on top of the
You can use this property to add a factor of safety when navigating
MinTurningRadius specifies the
minimum turning radius for the robot traveling at the desired velocity.
The robot may not be able to make sharp turns at high velocities.
This property factors in navigating around obstacles and gives it
enough space to maneuver.
DistanceLimits specifies the
distance range that you want to consider for obstacle avoidance. You
specify the limits in a two-element vector,
lower limit is used to ignore sensor readings
that intersect with parts on the robot, sensor inaccuracies at short
distances, or sensor noise. The
upper limit is
the effective range of the sensor or is based on your application.
You might not want to consider all obstacles in the full sensor range.
All information about the range sensor readings assumes that your range finder is mounted in the center of your robot. If the range sensor is mounted elsewhere, transform your range sensor readings from the laser coordinate frame to the robot base frame. See Transform Laser Scan Data From A ROS Network for an example.
Cost function weights are used to calculate the final steering
directions. The VFH algorithm considers multiple steering directions
based on your current, previous, and target directions. By setting
TargetDirectionWeight properties, you can
modify the steering behavior of your robot. Changing these weights
affects the responsiveness of the robot and how it reacts to obstacles.
To make the robot head towards its goal location, set
than the sum of the other weights. This high
helps to ensure the computed steering direction is close to the target
direction. Depending on your application, you might need to tune these
The VFH algorithm calculates a histogram based on the given
range sensor data. It takes all directions around the robot and converts
them to angular sectors that are specified by the
This property is non-tunable and remains fixed once the
is called. The range sensor data is used to calculate a polar density
histogram over these angular sectors.
Using a small
NumAngularSectors value can
cause the VFH algorithm to miss smaller obstacles. Missed obstacles
do not appear on the histogram.
This histogram displays the angular sectors in blue and the
histogram thresholds in pink. The
is a two-element vector that determines the values of the masked histogram,
[lower upper]. Polar obstacle density
values higher than the upper threshold are represented as occupied
space (1) in the masked histogram. Values smaller than the lower threshold
are represented as free space (0). Values that fall between the limits
are set to the values in the previous binary histogram, with the default
being free space (0). The masked histogram also factors in the
The polar density plot has the following corresponding masked histogram plot. This plot shows the target and steering directions, range readings, and distance limits.
When working with a
robotics.VectorFieldHistogram object, you can visualize
the properties and parameters of the algorithm using the
robotics.VectorFieldHistogram.show method. This method displays the polar
density plot and masked binary histogram. It also displays the algorithm
parameters and the output steering direction for the VFH.
You can then tune parameters to help you prototype your obstacle avoidance application. For example, if you see that certain obstacles do not appear in the Masked Polar Histogram plot (right), then in the Polar Obstacle Density plot, consider adjusting the histogram thresholds to appropriate values. After you make the adjustments in the Masked Polar Histogram plot, the range sensor readings, shown in red, should match up with locations in the masked histogram (blue). Also, you can see the target and steering directions. You specify the target direction. The steering direction is the main output from the VFH algorithm. Adjusting the Cost Function Weights can help you tune the output of the final steering direction.
Although you can use the
show method in a
loop, it slows computation speed due to the graphical plotting. If
you are running this algorithm for real-time applications, get and
display the VFH data in separate operations.