- Keeby-Astro (Keeby)
- fantasybarry (Lin Tan)
This project involves designing a vehicle speed control and path-following control system to track a GPS-defined path for a simulated autonomous vehicle. The main objective is to track a predefined GPS path at a target speed of 10 mph, based on provided GPS data of Lloyd Noble Center and Reaves Park. The simulation is implemented in the Python programming language. Features includes enhanced vehicle dynamics based off the 2014 Nissan Leaf, PID speed control, sensor noise filtering using an Extended Kalman Filter and Savitzky-Golay Filter, and path planning with 3rd Derivative Cubic Spline Interpolation.
- Vehicle Speed Control: Ensure the vehicle maintains the target speed using an enhanced PID controller with anti-windup, low-pass filtering, and smoother deceleration.
- Path-Following Control: Develop and simulate a control system utilizing the Stanley method to follow the given GPS path accurately.
- Verification in Simulation: Implement and verify the control models within a Python-based simulation environment.
The system must:
- Track a path defined by GPS data with a target speed of 10 mph.
- Incorporate a dynamic vehicle model with real-world parameters (e.g., 2014 Nissan Leaf) to account for factors like inertia, tire slip, aerodynamic drag, and rolling resistance.
- Handle sensor noise using filtering techniques, specifically an Extended Kalman Filter (EKF), to maintain trajectory accuracy.
The project relies on GPS data contained in the file Loyd_nobel_nav_rosbag2_2024_11_11-11_24_51.csv
. This file provides time-stamped coordinates, vehicle speed, and brake status. Additionally, latitude and longitude tables are used to convert GPS data into local X-Y coordinates.
-
GPS Data File:
- Loyd_nobel_nav_rosbag2_2024_11_11-11_24_51.csv
- Reaves_Park_acc_group_3_2024_11_22-15_49_50.csv
-
Latitude Conversion Table:
- latitude_distance_to_latitude.csv
-
Longitude Conversion Table:
- longitude_distance_to_longitude.csv
- GPS Data: Includes
Latitude
,Longitude
,Speed[mps]
, andBrake_status
. - Latitude and Longitude Conversion Tables:
1deg
,1'
, and1''
conversions for latitude and longitude, in various units (miles, feet, meters).
- Stanley Controller: Utilizes the Stanley method to adjust steering angle and minimize trajectory error.
- PID Controller with Anti-Windup, Low-Pass Filtering, and Smoother Deceleration: Controls the vehicle's speed using proportional, integral, and derivative gains. Implements anti-windup to prevent integrator windup during saturation and includes low-pass filtering for smoother acceleration and deceleration.
- Enhanced Dynamic Bicycle Model: Incorporates real-world parameters of a 2014 Nissan Leaf. Accounts for aerodynamic drag, rolling resistance, and realistic steering limits.
The Extended Kalman Filter smooths GPS data by predicting and correcting the vehicle's position through the uses of a state transition model and observation model, reducing noise and enhancing path accuracy.
To facilitate path tracking, GPS coordinates are converted to local X-Y coordinates using interpolation functions based on latitude and longitude conversion tables.
The path is generated using cubic spline interpolation for smoother and more accurate path tracking.
Demonstrates the structure of a path planning module, includes path evaluation considering distance, obstacles, and smoothness.
To run this project, the following Python libraries are required:
numpy
matplotlib
pandas
scipy
numba
cubic_spline_planner
Install these packages using:
pip install numpy matplotlib pandas scipy numba
-
Place
latitude_distance_to_latitude.csv
,longitude_distance_to_longitude.csv
,Reaves_Park_acc_group_3_2024_11_22-15_49_50.csv
, andLoyd_nobel_nav_rosbag2_2024_11_11-11_24_51.csv
in the same directory as the script. -
Run the script:
python auto_driving_final_project_controller.py
-
Animation Mode: If
show_animation
is set toTrue
, a live plot of the vehicle’s path tracking and speed profile will be displayed. -
Save Mode: If
save_animation
is set toTrue
, the vehicle’s path tracking and speed profile will be saved in a GIF file format.
- Path Tracking Animation: Displays the GPS path with start and end markers, and the vehicle's trajectory as it follows the path.
- Lloyd Noble Plots:
- Reaves Park Plots:
This project provides a comprehensive simulation of autonomous vehicle path tracking and speed control using Python. By integrating advanced control algorithms and data filtering techniques, it achieves a realistic and robust performance suitable for educational and research purposes.
There are future adjustments to be made, such as converting the Stanley Controller to a much more robust MPC algorithm, especially for scenerios involving other vehicles. This code is currently being tested on a real autonomous 2014 Nissan Leaf with considerable testing, tuning, and adjustments being made.
This project is licensed under the MIT License. See LICENSE for more details.
Special thanks to:
- Python developers and the open-source community.
- Dr. Bin Xu, University of Oklahoma professor for Dynamics/Control Auto Driving