Skip to content

Dynamics Modeling

Our dynamics model takes in state and control input and outputs the next state after a given timestep. We make a Markov assumption that the future state depends only on the current state and control input.

  • x⃗\vec{x}: state vector

  • u⃗\vec{u}: control action vector

  • Δt\Delta t: model timestep

  • xnext⃗\vec{x_{next}}: state vector after timestep

  • f⃗\vec{f}: dynamics function

  • xx: x position in inertial frame

  • yy: y position in inertial frame

  • ψ\psi: yaw angle from x-axis

  • vv: scalar speed of the car

  • δ\delta: steering angle

  • τmotor\tau_{motor}: total motor torque

  • mm: mass of the car

  • RR: wheel radius

  • δ^\hat{\delta}: kinematic steering angle (explained later)

  • κ\kappa: understeer gradient

  • α\alpha: slip angle (angle between velocity vector and car body)

  • ω\omega: angular velocity of the car

  • rr: turning radius

  • rrearr_{rear}: distance from rear wheel to center of turning circle

  • rfrontr_{front}: distance from front wheel to center of turning circle

  • LfrontL_{front}: distance between front wheel and center of mass

  • LrearL_{rear}: distance between rear wheel and center of mass

  • τfront\tau_{front}: torque on front wheel

  • τrear\tau_{rear}: torque on rear wheel

  • FfrontF_{front}: force on front wheel

  • FrearF_{rear}: force on rear wheel

  • FdragF_{drag}: drag force (rolling and air resistance)

  • FnetF_{net}: net force on car

Given x⃗=[xyψv] and u⃗=[δτmotor] \text{Given } \vec{x} = \begin{bmatrix} x \\ y \\ \psi \\ v \\ \end{bmatrix} \text{ and } \vec{u} = \begin{bmatrix} \delta \\ \tau_{motor} \\ \end{bmatrix} \\ Define the dynamics function f⃗ such that:  \text{Define the dynamics function } \vec{f} \text{ such that: } xnext⃗=f⃗(x⃗,u⃗,Δt) \vec{x_{next}} = \vec{f}(\vec{x}, \vec{u}, \Delta t) \\ where xnext⃗=[xnextynextψnextvnext] \text{where } \vec{x_{next}} = \begin{bmatrix} x_{next} \\ y_{next} \\ \psi_{next} \\ v_{next} \\ \end{bmatrix}

We use a modified bicycle model that introduces a couple of assumptions:

  1. There is no lateral slip on the tires.
  2. Between model timesteps, the car moves in approximately uniform circular motion.
  3. There is no longitudinal slip on the tires.
  4. The angular inertia of the wheels is negligible compared to the inertia of the car and the torque being applied.

This assumption holds true unless the car is cornering very fast.

We will refer to the assumptions as [1], [2], [3] and [4].

During cornering, the car is modeled as such:

Dynamics Model

From [1], both tires move parallel to themselves with no sideway slip. Thus, given solely by the steering angle, the turning radius and center should be calculable.

However, as speed increases, the car understeers more. The steering wheel needs to be turned more to achieve the same turning radius. This is a consequence of our slipless assumption.

We characterize this with a tunable parameter called the understeer gradient κ\kappa, and define the kinematic steering angle δ^=δ1+κv\hat{\delta} = \frac{\delta}{1 + \kappa v}, which is used to determine turning radius and center.

Calculate the slip angle α\alpha, which is the angle between the car’s velocity vector and the car’s body.

rrear=(Lfront+Lrear)/tan(δ^)α=tan−1(Lrearrrear) r_{rear} = (L_{front} + L_{rear}) / tan(\hat{\delta}) \alpha = tan^{-1}(\frac{L_{rear}}{r_{rear}})

We calculate the higher order terms of xnext⃗\vec{x_{next}} first - speed.

From [2], the car’s velocity is perpendicular to the turning axis. Thus, to find δv\delta v, we need to find the net force on the car in the direction of v⃗\vec{v}.

τfront and τrear are derived from τmotor, gear ratio and drive mode.Because of [3] and [4], all torque goes into force on the wheelsFfront=τfrontR and Frear=τrearRFnet=Ffrontcos(δ−α)+Frearcos(α)−Fdragδv=FnetmΔtvnext=∣v⃗+δv∣, since the car can’t go backwards(negative torque is regenerative braking) \begin{gathered} \tau_{front} \text{ and } \tau_{rear} \text{ are derived from } \tau_{motor}, \text{ gear ratio and drive mode.} \\ \text{Because of [3] and [4], all torque goes into force on the wheels} \\ F_{front} = \frac{\tau_{front}}{R} \text{ and } F_{rear} = \frac{\tau_{rear}}{R} \\ F_{net} = F_{front}cos(\delta - \alpha) + F_{rear}cos(\alpha) - F_{drag} \\ \delta v = \frac{F_{net}}{m} \Delta t \\ v_{next} = | \vec{v} + \delta v |, \text{ since the car can't go backwards} \\ \text{(negative torque is regenerative braking)} \end{gathered}

Actual steering angle is used here since that determines the direction of the forces.

Over the model timestep, the average speed vˉ=v+vnext2\bar{v} = \frac{v + v_{next}}{2}. Use this to recalculate δ^,r,α\hat{\delta}, r, \alpha.

Angular speed ω=vˉr\omega = \frac{\bar{v}}{r}, and because of [2], dψdt=ω\frac{d\psi}{dt} = \omega.

Thus, the new yaw angle ψnext=ψ+ωΔt\psi_{next} = \psi + \omega \Delta t.

Finally, calculate the new position of the car. Because of [2], instead of extrapolating vˉ\bar{v} into the future, we can find its position by moving it along the circular path.

xnext=x+rrear(sin(ψnext)−sin(ψ))+Lrear(cos(ψnext)−cos(ψ))ynext=y−rrear(cos(ψnext)−cos(ψ))+Lrear(sin(ψnext)−sin(ψ)) x_{next} = x + r_{rear}(sin(\psi_{next}) - sin(\psi)) + L_{rear}(cos(\psi_{next}) - cos(\psi)) \\ y_{next} = y - r_{rear}(cos(\psi_{next}) - cos(\psi)) + L_{rear}(sin(\psi_{next}) - sin(\psi))

We use rrearr_{rear} instead of rr because the car body is perpendicular not to the turning axis, but the line connecting the rear wheel to the center of the turning circle.

The model is now complete.

f⃗(x⃗,u⃗,Δt)=[xnextynextψnextvnext]=[x+rrear(sin(ψnext)−sin(ψ))+Lrear(cos(ψnext)−cos(ψ))y−rrear(cos(ψnext)−cos(ψ))+Lrear(sin(ψnext)−sin(ψ))ψ+ωΔt∣v⃗+δvΔt∣] \vec{f}(\vec{x}, \vec{u}, \Delta t) = \begin{bmatrix} x_{next} \\ y_{next} \\ \psi_{next} \\ v_{next} \\ \end{bmatrix} = \\ \quad \\ \begin{bmatrix} x + r_{rear}(sin(\psi_{next}) - sin(\psi)) + L_{rear}(cos(\psi_{next}) - cos(\psi)) \\ y - r_{rear}(cos(\psi_{next}) - cos(\psi)) + L_{rear}(sin(\psi_{next}) - sin(\psi)) \\ \psi + \omega \Delta t \\ | \vec{v} + \delta v \Delta t | \end{bmatrix}