Lateral pathtracking controller
Vehicle Dynamics Blockset / Vehicle Scenarios / Driver
The Lateral Driver block implements a control model to generate normalized steering commands that track a lateral reference displacement. The normalized steering commands can vary between 1 to 1. To model the dynamics, the block uses a linear single track (bicycle) model. Use the Lateral Driver block to:
Close the loop between a predefined path and actual vehicle motion.
Generate steering commands that track predefined paths. You can connect the Lateral Driver block output to steering block inputs.
Use the External Actions parameters to create input ports for signals that can disable, hold, or override the closedloop steering command. The block uses this priority order for the input commands: disable (highest), hold, override. The block uses this priority order for the input commands: disable (highest), hold, override.
This table summarizes the external action parameters.
Goal  External Action Parameter  Input Ports  Data Type 

Override the steering command with an input steering command.  Steering override 
 Boolean 
 double  
Hold the steering command at the current value.  Steering hold  SteerHld  Boolean 
Disable the steering command.  Steering disable  SteerZero  Boolean 
Use the Output handwheel angle parameter to specify the units for the steering ports.
Setting  Block Implementation  Port  

 Commanded steer angle, normalized from 1 through 1. The block uses the tire wheel angle saturation limit Tire wheel angle limit, theta parameter to normalize the command. 
 
Overrides the steering command with an input steering command normalized from 1 through 1. 
 
 Commanded steer angle, in units specified by Angular units, angUnits. 
 
Overrides the steering command with an input steering command, in units specified by Angular units, angUnits. 

Also, you can specify a tire wheel angle saturation limit using the Tire wheel angle limit, theta parameter.
Use the Lateral control type, controlTypeLat parameter to specify the type of lateral control. The table specifies the block implementation.
Setting  Block Implementation  

 Optimal singlepoint preview (look ahead) control model developed by C. C. MacAdam^{1, 2, 3}. The model represents driver steering control behavior during pathfollowing and obstacle avoidance maneuvers. Drivers preview (look ahead) to follow a predefined path.  
 Controller that uses the Stanley^{4} method to minimize the position error and the angle error of the current pose with respect to the reference pose. On the Reference Control pane, use the:

Use the Angular units, angUnits parameter to specify the angular units for the input and output ports.
If you set Lateral control type, controlTypeLat to
Predictive
, the Lateral Driver block
implements an optimal singlepoint preview (look ahead) control model developed by C. C.
MacAdam^{1, 2, 3}. The model represents driver steering control
behavior during pathfollowing and obstacle avoidance maneuvers. Drivers preview (look
ahead) to follow a predefined path. To implement the MacAdam model, the block:
Represents the dynamics as a linear single track (bicycle) vehicle
Minimizes the previewed error signal at a single point T* seconds ahead in time
Accounts for the driver lag deriving from perceptual and neuromuscular mechanisms
This figure illustrates the block implementation of the singlepoint version of the driver model.
For lateral and yaw motion, the block implements these linear dynamic equations.
$\begin{array}{l}\dot{y}=v+U\psi \\ \\ \dot{v}=\left[\frac{2\left({C}_{\alpha F}+{C}_{\alpha R}\right)}{mU}\right]v+\left[\frac{2\left(b{C}_{\alpha R}a{C}_{\alpha F}\right)}{mU}U\right]r+\left(\frac{2{C}_{\alpha F}}{m}\right){\delta}_{F}\\ \\ \dot{r}=\left[\frac{2\left(b{C}_{\alpha R}a{C}_{\alpha F}\right)}{IU}\right]v+\left[\frac{2\left({a}^{2}{C}_{\alpha F}+{b}^{2}{C}_{\alpha R}\right)}{IU}\right]r+\left(\frac{2a{C}_{\alpha F}}{I}\right){\delta}_{F}\\ \\ \dot{\psi}=r\end{array}$
In matrix notation:
$$\begin{array}{l}\dot{x}=Fx+g{\delta}_{F}\\ \\ \text{where:}\\ \\ x=\left[\begin{array}{l}y\\ v\\ r\\ \psi \end{array}\right]\\ F=\left[\begin{array}{cccc}0& 1& 0& U\\ 0& \text{2}\frac{{C}_{\alpha F}+{C}_{\alpha R}}{mU}& \text{2}\frac{b{C}_{\alpha R}a{C}_{\alpha F}}{mU}U& 0\\ 0& \text{2}\frac{b{C}_{\alpha R}a{C}_{\alpha F}}{IU}& \text{2}\frac{{a}^{2}{C}_{\alpha F}+{b}^{2}{C}_{\alpha R}}{IU}& 0\\ 0& 0& 1& 0\end{array}\right]\\ x=\left[\begin{array}{l}0\\ \frac{2{C}_{\alpha F}}{m}\\ \frac{2a{C}_{\alpha F}}{I}\\ 0\end{array}\right]\end{array}$$
The singlepoint model assumes a minimum previewed error signal at a single point T* seconds ahead in time. a* is the driver ability to predict the future vehicle response based on the current steering control input. b* is the driver ability to predict the future vehicle response based on the current vehicle state. The block uses these equations.
$$\begin{array}{l}a*=T*{m}^{T}\left[I+{\displaystyle \sum _{n=1}^{\infty}\frac{{F}^{n}{(T*)}^{n}}{(n+1)!}}\right]g\\ \\ b*={m}^{T}\left[I+{\displaystyle \sum _{n=1}^{\infty}\frac{{F}^{n}{(T*)}^{n}}{n!}}\right]\\ \\ \text{where:}\\ \\ {m}^{T}=\left[\begin{array}{cccc}1& 0& 0& 0\end{array}\right]\end{array}$$
The equations use these variables.
a, b 
Forward and rearward tire location, respectively 
m 
Vehicle mass 
I 
Vehicle rotational inertia 
C_{ɑF} 
Front tire cornering coefficient 
C_{ɑR} 
Rear tire cornering coefficient 
a*, b* 
Driver prediction scalar and vector gain, respectively 
x 
Predicted vehicle state vector 
v  Lateral velocity 
r 
Yaw rate 
Ψ 
Front wheel heading angle 
y 
Lateral displacement 
F 
System matrix 
δ, δ_{F}  Steer angle and front axle steer angle, respectively 
g 
Control coefficient vector 
U  Forward (longitudinal) vehicle velocity 
T* 
Preview time window 
ƒ(t+T*) 
Previewed path input T* seconds ahead 
U 
Forward vehicle velocity 
m^{T} 
Constant observer vector; provides vehicle lateral position 
The singlepoint model implemented by the block finds the steering command that minimizes a local performance index, J, over the current preview interval, (t, t+T).
$$J=\frac{1}{T}{\displaystyle {\int}_{t}^{t+T}{[f(\eta )y(\eta )]}^{2}}d\eta $$
To minimize J with respect to the steering command, this condition must be met.
$$\frac{dJ}{du}=0$$
You can express the optimal control solution in terms of a current nonoptimal and corresponding nonzero preview output error T* seconds ahead^{1, 2, 3}.
$${u}^{o}(t)=u(t)+\frac{e(t+{T}^{*})}{{a}^{*}}$$
The block uses the preview distance and vehicle longitudinal velocity to determine the preview time window.
$${T}^{*}=\frac{L}{U}$$
The equations use these variables.
T*  Preview time window 
ƒ(t+T*)  Previewed path input T* sec ahead 
y(t+T*)  Previewed plant output T* sec ahead 
e(t+T*)  Previewed error signal T* sec ahead 
u(t), u^{o}(t)  Steer angle and optimal steer angle, respectively 
L  Preview distance 
J  Performance index 
U  Forward (longitudinal) vehicle velocity 
The singlepoint model implemented by the block introduces a driver lag. The driver lag accounts for the delay when the driver is tracking tasks. Specifically, it is the transport delay deriving from perceptual and neuromuscular mechanisms. To calculate the driver transport delay, the block implements this equation.
$$H(s)={e}^{s\tau}$$
The equations use these variables.
τ  Driver transport delay 
y(t+T*)  Previewed plant output T* sec ahead 
e(t+T*)  Previewed error signal T* sec ahead 
u(t), u^{o}(t)  Steer angle and optimal steer angle, respectively 
J  Performance index 
If you set Lateral control type, controlTypeLat to
Stanley
, the block implements the Stanley
method^{4}. To compute the steering angle command, the Stanley
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.
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 position error is the lateral distance from the vehicle centerofgravity (CG) to the reference point on the path.
The angle error is the angle of the vehicle with respect to reference path.
[1] MacAdam, C. C. "An Optimal Preview Control for Linear Systems". Journal of Dynamic Systems, Measurement, and Control. Vol. 102, Number 3, Sept. 1980.
[2] MacAdam, C. C. "Application of an Optimal Preview Control for Simulation of ClosedLoop Automobile Driving ". IEEE Transactions on Systems, Man, and Cybernetics. Vol. 11, Issue 6, June 1981.
[3] MacAdam, C. C. Development of Driver/Vehicle Steering Interaction Models for Dynamic Analysis. Final Technical Report UMTRI8853. Ann Arbor, Michigan: The University of Michigan Transportation Research Institute, Dec. 1988.
[4] Hoffmann, Gabriel M., Claire J. Tomlin, Michael Montemerlo, and Sebastian Thrun. "Autonomous Automobile Trajectory Tracking for OffRoad Driving: Controller Design, Experimental Validation and Racing." American Control Conference. 2007, pp. 2296–2301. doi:10.1109/ACC.2007.4282788