Skip to content

Pacejka Model

The Pacejka model is a more realistic depiction of reality compared to the kinematic car model. It also models the vehicle's dynamics including several contact forces, most prominently from tire slip.

The front and rear tire forces are modeled by the Pacejka Magic Formula, which gives it its name. The drivetrain is also modeled dynamically and no longer simplified to a first order system. This is why the input torque no longer has the physical meaning of the steady state velocity but is just a number in the range of 0 and 1. In contrast to the kinematic model it also has much more model parameters that need to be estimated.

image

Model Dynamics

\[ \frac{d}{dt} \begin{bmatrix} x \\ y \\ \varphi \\ \dot{x} \\ \dot{y} \\ \dot{\varphi} \end{bmatrix}_{body} = \begin{bmatrix} \dot{x} \\ \dot{y} \\ \dot{\varphi} \\ \frac{1}{m} \left( F_{\mathrm{x,r}} + F_{\mathrm{x,f}}\cos(\delta) - F_{\mathrm{y,f}} \sin(\delta) + m\dot{y} \dot{\varphi} + F_\text{friction}\right) \\ \frac{1}{m} \left( F_{\mathrm{y,r}} + F_{\mathrm{x,f}}\sin(\delta) + F_{\mathrm{y,f}} \cos(\delta) - m\dot{x}\dot{\varphi}\right) \\ \frac{1}{I_\mathrm{z}} \left( F_{\mathrm{y,f}} \cdot l_{\mathrm{f}} \cdot \cos(\delta) + F_{\mathrm{x,f}} \cdot l_f \cdot \sin(\delta) - F_{\mathrm{y,r}} \cdot l_{\mathrm{r}}\right) \end{bmatrix} \]

The motor generates a force \(F_{\mathrm m}\) that is distributed among the front and rear axle, parametrized by the torque split parameter \(\gamma\) (for \(\gamma = 0.5\) we have an all-wheel-drive vehicle, and for \(\gamma = 1\) a real-wheel-drive). The friction force is modeled as a Taylor expansion in \(\dot x\) and affects the longitudinal velocity directly.

\[ \begin{aligned} \delta &= \text{steer input} \\ u_t &= \text{torque input} \\ F_{\mathrm{m}} &= (C_{\mathrm{m,1}}-C_{\mathrm{m,2}} \cdot v_{\mathrm{x}}) \cdot u_t,\\ F_{\mathrm{x,r}} &= \gamma \cdot F_{\mathrm{m}}-C_{\mathrm{roll}},\\ F_{\mathrm{x,f}} &= (1 - \gamma) \cdot F_{\mathrm{m}}-C_{\mathrm{roll}}, \\ F_{\mathrm{y,r}} &= (D_r \cdot \sin(C_r \cdot \text{atan}(B_r \cdot \text{atan2}(-\dot{y} + l_r \cdot \dot{\varphi}, \dot{x}))), \\ F_{\mathrm{y,f}} &= (D_f \cdot \sin(C_f \cdot \text{atan}(B_f \cdot \delta \cdot \text{atan2}(-\dot{y} - l_f \cdot \dot{\varphi}, \dot{x}))) \\ F_\text{friction} &= -C_{d,0} - C_{d, 1} \dot x - C_{f, 2} \dot x^2 \end{aligned} \]

The slip angles are computed as

\[ \begin{aligned} \alpha_{\mathrm{f}} &= \begin{cases} \arctan\left( \frac{-\dot{\varphi} l_{\mathrm{f}} - \dot{y}}{\dot{x}} \right) + \delta,& \text{if } |\dot{x}|\geq \epsilon,\\ b_{\mathrm{f}} \dot{x} + c_{\mathrm{f}} \dot{x}^3, & \text{otherwise}, \end{cases} \\ \alpha_{\mathrm{r}} &= \begin{cases} \arctan\left( \frac{\dot{\varphi} l_{\mathrm{r}} - \dot{y}}{\dot{x}} \right),& \text{if } |\dot{x}|\geq \epsilon,\\ b_{\mathrm{r}} \dot{x} + c_{\mathrm{r}} \dot{x}^3, & \text{otherwise}, \end{cases} \end{aligned} \]

where \(\epsilon\) is a parameter that can be set and determines at which velocity the slip angle computation switches. The coefficients \(b_f, c_f, b_r, c_r\) are given as

\[ \begin{aligned} w_f &= -\dot{\varphi} l_{\mathrm{f}} - \dot{y} \\ w_r &= \dot{\varphi} l_{\mathrm{r}} - \dot{y} \\ b_{f,r} &= \frac{1}{2} \cdot \frac{w_{f,r}}{\epsilon^2+w_{f,r}^2} + \frac{3}{2 \epsilon}\cdot \arctan(\frac{w_{f,r}}{\epsilon}) \\ c_{f,r} &= \frac{-1}{2 \epsilon^3} \cdot \arctan(\frac{w_{f,r}}{\epsilon}) - \frac{w_{f,r}}{2 \epsilon^2} \cdot \frac{1}{w_{f,r}^2 + \epsilon^2} \\ \end{aligned} \]
Parameter Information
Parameters Description
Bf Front tire stiffness factor
Br Rear tire stiffness factor
Cd0 Friction expansion 0th order coefficient
Cd1 Friction expansion 1st order coefficient
Cd2 Friction expansion 2nd order coefficient
Cf Front tire shape factor that controls the ‘stretching’ in the x direction
Cm1 Model parameter
Cm2 Model parameter
Cr Rear tire shape factor that controls the ‘stretching’ in the x direction
Df Peak value for front tire.
Dr Peak value for rear tire.
I Inertia
lf Length from center to front wheel
lr Length from center to rear wheel
m Mass of car
\(\gamma\) Torque split between front and rear axle
\(\epsilon\) Velocity at which the approximated slip angles are used to avoid singularities at zero velocity

Configuration

type: "pacejka_discrete"

# Q (process noise covariance matrix)
Q:
  value:
    [
      [0.001, 0, 0, 0, 0, 0],
      [0, 0.001, 0, 0, 0, 0],
      [0, 0, 0.001, 0, 0, 0],
      [0, 0, 0, 0.01, 0, 0],
      [0, 0, 0, 0, 0.01, 0],
      [0, 0, 0, 0, 0, 0.001],
    ]
  is_diag: false

model_params:
  # size params
  lr: 0.038
  lf: 0.052
  m: 0.201
  I: 0.000705

  wheel_radius: 0.0175
  car_width: 0.12

  # lateral force params
  Df: 0.65
  Cf: 1.5
  Bf: 5.2
  Dr: 1.0
  Cr: 1.45
  Br: 8.5

  # longitudinal force params
  Cm1: 0.98028992
  Cm2: 0.01814131

  # friction force params
  Cd0: 0.08518052
  Cd1: 0.01
  Cd2: 0.02750696

  tau: 0.1 # to make this compatible with kinematic model
  eps: 0.2 # determines at what velocity we switch from atan to the polynomial approximation of arctan(w/x)
  gamma: 0.5