Giter VIP home page Giter VIP logo

simple_f1tenth_drl's Introduction

simple_f1tenth_drl

This is a repo with example implementations of deep reinforcement learning algorithms for F1tenth racing. The aim is to provide a simple implementation that can help people to understand how to use DRL algorithms for autonomous racing.

Use

Installation

git clone https://github.com/BDEvan5/simple_f1tenth_drl
cd simple_f1tenth_drl
mkdir Data/
pip install -e .

Task Description

The train_agents.py file is the main entry point to train agents. Agents can be trained for two tasks:

  1. Trajectory Following: 10 upcoming waypoints (relative positions and speed), and the angluar speed, linear speed and steering angle are given to the agent.
  2. End-to-end: The agent receives 20 beams from the LiDAR scan for the previous and current vehicle positions.

In both cases, the action space is the steering angle and vehicle speed.

The test_agents.py file has functions to test the agents (for each task) on the training maps, or on all of the maps.

The pure pursuit planner is given for comparison and can be tested using the test_pure_pursuit.py file.

Component Description

f1tenth_gym

This is the simulator from www.github.com/f1tenth/f1tenth_gym. It contains minor modifications, e.g. only provides 20 beams, but remains largely the same.

Learning Algorithms

The DDPG, TD3 and SAC learning algorithms from the repo, github.com/BDEvan5/BaselineDRL. They are simple, single file implementations for use in robotic control. They use neural networks in the PlannerUtils/Networks.py file and replay buffers from PlannerUtils/ReplayBuffers.py. Each algorith contains an act and a train method.

Data Saving

Training Agents:

For each agent, the a folder is created inside the Data/ directory with the agent's name. For the training, the model parameters of the actor are saved as a .pth file so that the model can be loaded for testing. The .pth file is a sterilised verion of the actor neural network.

The TrainHistory class is used to store the rewards earned and average progress during training. Durign and after the training, plots of the rewards earned per lap and the average progress during training are saved to the agent's directory.

Testing:

For the tests, a subfolder is created called, TestingMAPNAME, with the test map name in the foldername. Inside, the full vehicle state and actions selected at each timestep is saved for analysis.

The DataTools can analyse this data and make pretty plots.

  • GenerateTrajectoryAnalysis: for each vehicle and test, plots the speed, slip, centre line deviation etc, for the trajectory around the traick.
  • GenerateVelocityProfiles: plots a colour line to represent the velocity profile around the race track.

Improvements:

  • Add experiments to compare algorithms
  • Add experiment to compare path following vs end-to-end
  • Refactor pure pursuit to use a single folder with multiple Testing folders for different maps.

simple_f1tenth_drl's People

Contributors

bdevan5 avatar

Stargazers

Vittorio Cataffo avatar  avatar Rastafouille avatar

Watchers

Kostas Georgiou avatar  avatar

Forkers

banren456

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.