Skip to content

mbdalpha/ft_grandprix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ft-grandprix

This is the code I wrote in preparation for Formula Trinity X OpenAI's AI GP. The simulator is FT-Autonomous/ft_grandprix.

drivers

  • rr_reactive.py — PID wall-follower. estimates the car's angle relative to the walls using two pairs of lidar beams and uses a PID controller to stay centered. speed is based on distance to the wall ahead. this is the driver I used in the competition.
  • rr_follow_the_gap.py — follow-the-gap with wall avoidance and corner anticipation. tracks which direction the gap is shifting over time to steer into corners early.
  • follow_the_gap.py — basic follow-the-gap with a dead-reckoning map built from lidar. plots the walls and trajectory with matplotlib.
  • rl_driver.py — numpy inference driver for the SAC-trained policy network, with a gap-follow fallback if no weights are loaded.

rl_training

SAC reinforcement learning pipeline for training a racing driver in a headless MuJoCo environment.

  • racing_env.py — single-env gymnasium wrapper around the ft_grandprix sim. handles raceline progress tracking, reward shaping, and lap detection.
  • racing_env_warp.py — GPU-batched version using MuJoCo Warp. runs hundreds of parallel physics worlds on one GPU. implements the SB3 VecEnv interface.
  • train.py — training script using stable-baselines3 SAC/PPO with eval and checkpoint callbacks.
  • train_warp.py — same but for the GPU-batched env, with multi-track rotation support.
  • export_weights.py — exports the trained policy network weights to a .npz file for numpy inference in rl_driver.py.
  • generate_training_model.py — strips icon textures from the sim's MJCF model so it loads headlessly.
  • generate_tracks.py — prepares multiple tracks for multi-track training.

I couldn't get the rl_driver.py working in time for the competition so I went with rr_reactive.py instead.

potential TODO

  • figure out why the rl didnt work
  • make a decent rl racer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages