CMU Buggy Control Project
Introduction
As the implementation component of Carnegie Mellon’s 24-677 Modern Control Theory, students were required to design Proportional–Integral–Derivative (PID), state feedback, Linear–Quadratic Regulator (LQR) and Model Predictive Control (MPC) controllers and extended Kalman filter (EKF) for Simultaneous Localization And Mapping (SLAM) for a self-driving vehicle in a series of projects. This project uses CMU’s annual Buggy racing competition track, which involves engineers and atheletes to race a .84 mile track around Schenley Park’s Flagstaff Hill during the Spring Carnival.
Each project tackled implementation of concepts from the course.
Project 1: Linearization of the state space system equations. Develop a PID controller for the system.
Project 2: Check the controllability and stabilizability of the system. Design a full-state feedback controller using pole placement.
Project 3: Design an optimal controller.
Project 4: Implement an EKF SLAM
Model
System Model. Bicycle model
The car in our simulation is modeled as a two wheeled vehicle with longitudinal and lateral dynamics. The system equations are as follows if $\dot{x} \geq 0.5$ m/s. Otherwise, since the lateral tire forces are zeros, we only consider the longitudinal model.
\[\dot{y} = -\psi \dot{x} + \frac{2C_{\alpha}}{m} \left( \cos \delta \left( \delta - \frac{\dot{y} + l_r \dot{\psi}}{\dot{x}} \right) - \frac{\dot{y} - l_r \dot{\psi}}{\dot{x}} \right)\] \[\dot{x} = \psi \dot{y} + \frac{1}{m} (F - fm g)\] \[\dot{\psi} = \frac{2l_f C_{\alpha}}{I_z} \left( \delta - \frac{\dot{y} + l_r \dot{\psi}}{\dot{x}} \right) - \frac{2l_r C_{\alpha}}{I_z} \left( \frac{\dot{y} - l_r \dot{\psi}}{\dot{x}} \right)\] \[\dot{X} = \dot{x} \cos \psi - \dot{y} \sin \psi\] \[\dot{Y} = \dot{x} \sin \psi + \dot{y} \cos \psi\]The observable states are given as:
\[y = \begin{bmatrix} \dot{x} \\ \dot{y} \\ \psi \\ X \\ Y \\ \dot{\psi} \end{bmatrix}\]The system satisfies physical constraints that are defined as:
\[|\delta| \leq \frac{\pi}{6} \text{rad}\] \[F \geq 0 \quad \text{and} \quad F \leq 16000 \text{N}\] \[\dot{x} \geq 10^{-5} \text{m/s}\]for the model parameters defined in table below.
Name | Description | Unit | Value |
---|---|---|---|
$\left(\dot{x}, \dot{y}\right)$ | Vehicle’s velocity along the direction of the vehicle frame | m/s | State |
$\left(X, Y\right)$ | Vehicle’s coordinates in the world frame | m | State |
$\psi$, $\dot{\psi}$ | Body yaw angle, angular speed | rad, rad/s | State |
$\delta$ or $\delta_f$ | Front wheel angle | rad | Input |
$F$ | Total input force | N | Input |
$m$ | Vehicle mass | kg | 1000 |
$l_r$ | Length from rear tire to the center of mass | m | 0.82 |
$l_f$ | Length from front tire to the center of mass | m | 1.18 |
$C_\alpha$ | Cornering stiffness of each tire | N | 20000 |
$I_z$ | Yaw inertia | kg·m² | 3004.5 |
$F_pq$ | Tire force, p ∈ {x, y}, q ∈ {f, r} | N | Depends on input force |
f | Rolling resistance coefficient | N/A | 0.025 |
delT | Simulation timestep | sec | 0.032 |
The trajectory of the vehicle was provided to students as a csv file that the contains (x, y) of the track as shown below.
![]() | ![]() |
Buggy track trajectory. Left: Satellite image, Right: Webots simulation
Methodology
In this project, we used Python to develop our controllers and observers and Webots to run our simulations. We also used Matlab to perform calculations for controller design as needed. The simulation code flow is shown below.
Simulation code flow
The driver functions that control the car take the desired steering angle δ and a throttle input ranging from 0 to 1 derived from the desired longitudinal force F.
Results
The controllers were tuned to meet several performance requirements for each controller in the simulation track. Criteria for a successful race were
- lap time
- maximum deviation from reference trajectory
- average deviation from reference trajectory
The best simulation run used an LQR controller with EKF SLAM to complete the track in less than 180 seconds and had a minimum deviation less than 5 meters from the trajectory; the results are also shown in the summary plot below.
Simulation plots for tuned EKF SLAM
References
24-677 Project Manuals
Rajamani Rajesh. Vehicle Dynamics and Control. Springer Science & Business Media, 2011.
Kong Jason, et al. “Kinematic and dynamic vehicle models for autonomous driving control design.” Intelligent Vehicles Symposium, 2015.
cmubuggy.org, https://cmubuggy.org/reference/File:Course_hill1.png
“PID Controller- Manual Tuning.” Wikipedia, Wikimedia Foundation, August 30th, 2020. https://en.wikipedia.org/wiki/PID_controller#Manual_tuning