Skip to content

Latest commit

 

History

History
123 lines (81 loc) · 6.93 KB

readme.md

File metadata and controls

123 lines (81 loc) · 6.93 KB

License Python LinkedIn

Table of Contents
  1. About This Project
  2. Gameplay Mode
  3. Sandbox Mode
  4. Setup
  5. Contact

About This Project

This over-engineered game is my attempt to brush up on vehicle dynamics and path tracking algorithms by coding them from scratch. The game conceals an underlying framework of tunable path tracking controllers (Pure-Pursuit, Stanley, Kinematic/Dynamic LQR), customizable vehicle dynamics models, spline-based path generation, etc.

(back to top)

Gameplay Mode

The game involves the user drawing a path (B-spline) with their mouse that the autonomous vehicle will follow using one of several path tracking algorithms. The goal is to guide the AV safely to the end of each level, avoiding collisions with the walls.

(back to top)

Sandbox Mode

Sandbox mode allows the user to interactively experiment and tune a variety of parameters, controlling everything from the vehicle dynamics model to the path tracking algorithms and tuning parameters. The code is written following several OOP software design patterns (Composite, Factory, Bridge, etc.) to enable abstraction (e.g. any controller can be run with any vehicle model and any path generation type) and maintainability.

(back to top)

Path Tracking Controllers

Users can tune (in realtime) and experiment with several path tracking controllers of varying complexity. See below video for example:

Brief comparison of the various path tracking controllers implemented:

Description Model Used Robustness Stability Linearity
Pure Pursuit Geometric method that follows a look-ahead point on the path based on vehicle speed Kinematic, simple bicycle model Less robust to dynamic changes, struggles with sharp turns Generally stable but can lose stability in sharp turns, high speeds, or small lookahead Non-linear
Stanley Controller Minimizes cross-track error and heading error through a proportional control strategy, used in DARPA's Grand Challenge by Standford's team Kinematic, bicycle model Robust to small disturbances, but may oscillate in certain conditions Lyapunov stable, particularly for straight paths Non-linear
Kinematic LQR Uses linear quadratic regulator to minimize deviations in position and velocity using a kinematic model Kinematic, linearized model Moderately robust with careful tuning Stable within the Region of Attraction (ROA) Linearized around operating point
Dynamic LQR Uses linear quadratic regulator to minimize deviations including dynamic effects like forces and acceleration Dynamic, linearized model Highly robust, especially in dynamic and high-speed environments Stable within the Region of Attraction (ROA) Linearized around operating point

Users can also click the Docs button to go to a Jupyter Notebook page containing derivations of some of the control strategies as well as sample code calling the controllers:

(back to top)

Vehicle Model

The user can switch between kinematic vs dynamic vehicle models as well as different integration schemes. The user can also update the vehicle model parameters (mass, length, etc) in real time which will also update the parameters used by the path tracking algorithm (where relevant).

Users can also click the Docs button to go to a Jupyter Notebook page containing derivations of the dynamic/kinematic bicycle model equations-of-motion as well as sample code calling the models:

(back to top)

Path Generation

Paths are generated with B-Splines for $C^2$ continuity. There are 2 path generation modes:

  1. Manual Gen: path spawns from the mouse cursor which the user controls
  2. Auto Gen: path is generated by some parameterizable function generator (e.g. sine wave)

(back to top)

Setup

First time only:

pip install --user pipenv
pip install --user pipenv-shebang
pipenv sync
pipenv run ipykernel_setup

Start game:

./TheTrolleyProblemGame.py

(back to top)

Contact

Jesse Miller - [email protected]

Project Link: https://github.com/jam643/TheTrolleyProblemGame

(back to top)