f1tenth_ws
This a repository that contains ready-to-run autonomous racing packages for the F1TENTH on ROS2 Foxy. It can be directly be deployed on the physical car. We've also included launch and config files for the simulation environment, which uses slightly different topics for odometry.
Below is a demo of the car running the code from this repository in the E7 building at the University of Waterloo at a top speed of ~25km/h, record on March 13th 2023.
0.96x.1.1.1.mp4
Software Stack Overview
Our current software stack consists of
- slam_toolbox for mapping (reference the following slides for running it on the physical car)
-
Particle Filter for localization
$\rightarrow$ src/particle_filter
-
Pure Pursuit for waypoint following (planning + control)
$\rightarrow$ src/pure_pursuit
-
RRT for a pure pursuit algorithm that includes dynamic obstacle avoidance (slightly slower)
$\rightarrow$ src/rrt
Racing lines are generated through the Cl2-UWaterloo/Raceline-Optimization repository.
Other algorithms that are not used, but are in this repository include
-
Waypoint Generator for manually generating waypoints in simulation
$\rightarrow$ src/waypoint_generator
(this has been replaced with a script that automatically generates optimal racelines given a map) - A PID controller for staying at a constant distance to the wall
$\rightarrow$ src/wall_follow
-
Scan matching
$\rightarrow$ src/scan_matching
(To be completed) -
gap_follow
$\rightarrow$ src/gap_follow
(To be completed)
High-Level Usage Guide
These are the high level steps followed to get the F1TENTH driving in a new location:
- Run SLAM on the physical car to generate a map with
slam_toolbox
- Clean up map in Photoshop, and generate a racing line using the Cl2-UWaterloo/Raceline-Optimization repository.
- Store the racing lines under
src/pure_pursuit/racelines/
andsrc/rrt/racelines/
(for dynamic obstacle avoidance) - Run
particle_filter
with the new map to localize the car properly - Run
pure_pursuit
orrrt
to follow the racing line. Make sure to incrementally increase thevelocity_profile
inside the config.yaml file.
You can consult these accompanying notes: https://stevengong.co/notes/F1TENTH-Field-Usage, which shows every command used to get code working the physical car. Note that they are mainly written for our own personal reference, so the paths will be different in your setup.
If you feel confused / stuck by all of this, you might want to start with following the F1TENTH Course, where they actually teach why these algorithms are needed, and how they are implemented. The official documentation describes how to setup the hardware and basic software for the car.
Running Simulation
If you want to run these nodes inside the simulation environment, you need to clone the simulation repository. Then, you should mount this repository's packages to the docker-compose.yml
file:
- INSERT_PATH_HERE/f1tenth_ws/src:/sim_ws/src
Each package can then be built inside the simulation environment.
Next Steps
A non-exhaustive list of things we want to do in the future, include
- Running SLAM + pure pursuit on the fly, without having to do the offline computation. Something like this would be incredible
About Us
The Control, Learning and Logic (CL2) group at the University of Waterloo works on research that aims to develop methods for reliable decision-making of autonomous systems in the wild, led by professor Yash Vardhan Pant. Current members working on the F1TENTH is composed of Steven Gong, Oluwatofolafun Damilola Opeoluwa-Calebs, and Soham Lakhi.