Main Content

Lateral Controller Stanley

Control steering angle of vehicle for path following by using Stanley method

  • Library:
  • Automated Driving Toolbox / Vehicle Control

  • Lateral Controller Stanley block

Description

TheLateral Controller Stanleyblock computes the steering angle command, in degrees, that adjusts the current pose of a vehicle to match a reference pose, given the vehicle's current velocity and direction. The controller computes this command using the Stanley method[1], whose control law is based on both a kinematic and dynamic bicycle model. To change between models, use theVehicle modelparameter.

  • The kinematic bicycle model is suitable for path following in low-speed environments such as parking lots, where inertial effects are minimal.

  • The dynamic bicycle model is suitable for path following in high-speed environments such as highways, where inertial effects are more pronounced. This vehicle model provides additional parameters that describe the dynamics of the vehicle.

Ports

Input

expand all

Reference pose, specified as an [x,y,Θ)向量。xandyare in meters, andΘis in degrees.

xandyspecify the reference point to steer the vehicle toward.Θspecifies the orientation angle of the path at this reference point and is positive in the counterclockwise direction.

  • For a vehicle in forward motion, the reference point is the point on the path that is closest to the center of the vehicle's front axle.

    Vehicle in forward motion with reference point on path marked. Units are in world coordinates.

  • For a vehicle in reverse motion, the reference point is the point on the path that is closest to the center of the vehicle's rear axle.

    Vehicle in reverse motion with reference point on path marked. Units are in world coordinates.

Data Types:single|double

Current pose of the vehicle, specified as an [x,y,Θ)向量。xandyare in meters, andΘis in degrees.

xandyspecify the location of the vehicle, which is defined as the center of the vehicle's rear axle.

Θspecifies the orientation angle of the vehicle at location (x,y) and is positive in the counterclockwise direction.

Vehicle with pose marked. Units are in world coordinates.

For more details on vehicle pose, seeCoordinate Systems in Automated Driving Toolbox.

Data Types:single|double

Current longitudinal velocity of the vehicle, specified as a real scalar. Units are in meters per second.

  • If the vehicle is in forward motion, then this value must be greater than 0.

  • If the vehicle is in reverse motion, then this value must be less than 0.

  • A value of 0 represents a vehicle that is not in motion.

Data Types:single|double

Driving direction of the vehicle, specified as1for forward motion or-1for reverse motion. The driving direction determines the position error and angle error used to compute the steering angle command. For more details, seeAlgorithms.

Curvature of the path at the reference point, in radians per meter, specified as a real scalar.

  • For a vehicle in forward motion, the reference point is the point on the path that is closest to the center of the vehicle's front axle.

    Vehicle in forward motion with reference point on path marked. Units are in world coordinates.

  • For a vehicle in reverse motion, the reference point is the point on the path that is closest to the center of the vehicle's rear axle.

    Vehicle in reverse motion with reference point on path marked. Units are in world coordinates.

You can obtain the curvature of a path from theCurvaturesoutput port of aPath Smoother Splineblock. You can also obtain curvatures of lane boundaries from the output lane boundary structures of aScenario Readerblock.

Dependencies

To enable this port, setVehicle modeltoDynamic bicycle model.

Current yaw rate of the vehicle, in degrees per second, specified as a real scalar. The current yaw rate is the rate of change in the angular velocity of the vehicle.

Dependencies

To enable this port, setVehicle modeltoDynamic bicycle model.

Current steering angle of the vehicle, in degrees, specified as a real scalar. This value is positive in the counterclockwise direction.

Vehicle with front wheels turned and steering angle marked

For more details, seeCoordinate Systems in Automated Driving Toolbox.

Dependencies

To enable this port, setVehicle modeltoDynamic bicycle model.

Output

expand all

Steering angle command, in degrees, returned as a real scalar. This value is positive in the counterclockwise direction.

Vehicle with front wheels turned and steering angle marked

For more details, seeCoordinate Systems in Automated Driving Toolbox.

Parameters

expand all

Select the type of vehicle model to set the Stanley method control law used by the block.

  • Kinematic bicycle model— Kinematic bicycle model for path following in low-speed environments such as parking lots, where inertial effects are minimal

  • Dynamic bicycle model— Dynamic bicycle model for path following in high-speed environments such as highways, where inertial effects are more pronounced

Position gain of the vehicle when it is in forward motion, specified as a positive scalar. This value determines how much the position error affects the steering angle. Typical values are in the range [1, 5]. Increase this value to increase the magnitude of the steering angle.

Position gain of the vehicle when it is in reverse motion, specified as a positive scalar. This value determines how much the position error affects the steering angle. Typical values are in the range [1, 5]. Increase this value to increase the magnitude of the steering angle.

Yaw rate feedback gain, specified as a nonnegative real scalar. This value determines how much weight is given to the current yaw rate of the vehicle when the block computes the steering angle command.

Dependencies

To enable this parameter, setVehicle modeltoDynamic bicycle model.

Steering angle feedback gain, specified as a nonnegative real scalar. This value determines how much the difference between the current steering angle command,SteerCmd, and the current steering angle,CurrSteer, affects the next steering angle command.

Dependencies

To enable this parameter, setVehicle modeltoDynamic bicycle model.

Distance between the front and rear axle of the vehicle, in meters, specified as a real scalar. This value applies only when the vehicle is in forward motion, that is, when theDirectioninput port is1.

Dependencies

To enable this parameter, setVehicle modeltoKinematic bicycle model.

Vehicle mass, in kilograms, specified as a positive real scalar.

Dependencies

To enable this parameter, setVehicle modeltoDynamic bicycle model.

Longitudinal distance from the vehicle's center of mass to its front wheel axle, in meters, specified as a positive real scalar.

Dependencies

To enable this parameter, setVehicle modeltoDynamic bicycle model.

Longitudinal distance from the vehicle's center of mass to its rear wheel axle, in meters, specified as a positive real scalar.

Dependencies

To enable this parameter, setVehicle modeltoDynamic bicycle model.

Cornering stiffness of front tires, in Newtons per radian, specified as a positive real scalar.

Dependencies

To enable this parameter, setVehicle modeltoDynamic bicycle model.

Maximum allowed steering angle of the vehicle, in degrees, specified as a real scalar in the range (0, 180).

The output from theSteerCmdport is saturated to the range [–M,M], whereMis the value of theMaximum steering angle (deg)parameter.

  • Values below –Mare set to –M.

  • Values aboveMare set toM.

Tips

  • 你可以在自行车模型作为vehic之间进行切换le environment changes. Add twoLateral Controller Stanleyblocks to a variant subsystem and specify a different bicycle model for each block. For an example, see横向控制教程.

Algorithms

To compute the steering angle command, the controller minimizes the position error and the angle error of the current pose with respect to the reference pose. The driving direction of the vehicle determines these error values.

When the vehicle is in forward motion (Directionparameter is1):

  • Theposition erroris the lateral distance from the center of the front axle to the reference point on the path.

  • Theangle erroris the angle of the front wheel with respect to reference path.

When the vehicle is in reverse motion (Directionparameter is-1):

  • Theposition erroris the lateral distance from the center of the rear axle to the reference point on the path.

  • Theangle erroris the angle of the rear wheel with respect to reference path.

For details on how the controller minimizes these errors for kinematic and dynamic bicycle models, see[1].

References

[1] Hoffmann, Gabriel M., Claire J. Tomlin, Michael Montemerlo, and Sebastian Thrun. "Autonomous Automobile Trajectory Tracking for Off-Road Driving: Controller Design, Experimental Validation and Racing."American Control Conference. 2007, pp. 2296–2301. doi:10.1109/ACC.2007.4282788

Extended Capabilities

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

Version History

Introduced in R2018b

Baidu
map