Linear and angular velocity control commands
Robotics System Toolbox / Mobile Robot Algorithms
The Pure Pursuit block computes linear and angular velocity commands for following a path using a set of waypoints and the current pose of a differential drive robot. The block takes updated poses to update velocity commands for the robot to follow a path along a desired set of waypoints. Use the Max angular velocity and Desired linear velocity parameters to update the velocities based on the performance of the robot.
The Lookahead distance parameter computes a look-ahead point on the path, which is an instantaneous local goal for the robot. The angular velocity command is computed based on this point. Changing Lookahead distance has a significant impact on the performance of the algorithm. A higher look-ahead distance results in a smoother trajectory for the robot, but can cause the robot to cut corners along the path. Too low of a look-ahead distance can result in oscillations in tracking the path, causing unstable behavior. For more information on the pure pursuit algorithm, see Pure Pursuit Controller.
Pose— Current robot pose
[x y theta]vector
Current robot pose, specified as an
[x y theta] vector,
which corresponds to the x-y position and orientation
angle, theta. Positive angles are measured counterclockwise
from the positive x-axis.
Waypoints, specified as an n-by-2 array of
y] pairs, where n is the number of waypoints.
You can generate the waypoints from the
robotics.PRM class or specify
them as an array in Simulink®.
LinVel— Linear velocity
Linear velocity, specified as a scalar in meters per second.
AngVel— Angular velocity
Angular velocity, specified as a scalar in radians per second.
TargetDir— Target direction for robot
Target direction for the robot, specified as a scalar in radians. The forward direction of the robot is considered zero radians, with positive angles measured counterclockwise. This output can be used as the input to the TargetDir port for the Vector Field Histogram block.
To enable this port, select the Show TargetDir output port parameter.
Desired linear velocity (m/s)— Linear velocity
0.1(default) | scalar
Desired linear velocity, specified as a scalar in meters per second. The controller assumes that the robot drives at a constant linear velocity and that the computed angular velocity is independent of the linear velocity.
Maximum angular velocity (rad/s)— Angular velocity
1.0(default) | scalar
Maximum angular velocity, specified as a scalar in radians per second. The controller saturates the absolute angular velocity output at the given value.
Lookahead distance (m)— Look-ahead distance
1.0(default) | scalar
Look-ahead distance, specified as a scalar in meters. The look-ahead distance changes the response of the controller. A robot with a higher look-ahead distance produces smooth paths but takes larger turns at corners. A robot with a smaller look-ahead distance follows the path closely and takes sharp turns, but oscillate along the path. For more information on the effects of look-ahead distance, see Pure Pursuit Controller.
Show TargetDir output port— Target direction indicator
Select this parameter to enable the TargetDir out port. This port gives the target direction as an angle in radians from the forward position, with positive angles measured counterclockwise.