Deep Reinforcement Learning for Snake Robot Locomotion
- Jack Shi (junyaoshi)
- Tony Dear (tonydear)
- Jesse Redford (Jesse-Redford)
- Brandon Zhang
- Hansen Lin
- Minuk Lee
- Python ≥ 3.5
- keras ≥ 2.2.4 (For own DQN implementation only)
- matplotlib
- numpy
- numba
- scipy
- stable-baselines
- PyBullet
- TensorFlow == 1.15
- pytorch
- scikit-learn
Create a conda virtual environment
conda create -n DeepRobots python=3.7 numpy scipy matplotlib numba
conda activate DeepRobotsInstall with pip
[path-to-conda-pip] install pybullet
[path-to-conda-pip] install torchwhere [path-to-conda-pip] is the path to pip in the conda virtual environment. For example, on Mac OS, it can be ~/opt/anaconda3/envs/DeepRobots/bin/pip, and on Windows, it can be [path-to-anaconda3]/envs/DeepRobots/Scripts/pip. An example of the full pip install command in Mac OS Terminal is:
~/opt/anaconda3/envs/DeepRobots/pip install pybulletThe purpose of using the conda pip is to only install package in the conda virtual environment instead of installing globally
Install stable-baselines by following this guide. Make sure to install the DEVELOPMENT VERSION instead of the stable release or the bleeding-edge version. Make sure the use conda's pip for any pip installation commands. Remove the cloned stable-baselines after the installation, because there is already a custom version of stable-baselines in this repo.
Follow this guide to set up the physical robot using Rasperry Pi.
discrete_rl: code for training RL agent in discrete state and action spaces; no longer maintaineddocs: documentation filesDQN: our implementation of DQN (we are in the process of switching to stable-baselines instead of using this)DQN_agent.py: a general-purpose class that can be easily used to train different kinds of snake robots.DQN_runner.py: a simple interface for running a single trial of DQN with customized parametersDQN_multi_runner.py: a simple interface for running a multiple trials of DQN with customized parameters
DQN_old: some old implementation of DQN algorithm and runnersenvs: high-level OpenAI Gym environments that can directly be used by stable-baselines algorithms in trainingJesses_Folder: scripts used by Jesse RedfordMathematica Notebooks: Mathematica notebooks used for generating animation, plots, and deriving mathematical modelsNotes: old meeting notes; no longer usedOpenAiGym_Old: old code for OpenAI Gym and baselines integration; no longer used or maintainedRobots: different types of low-level snake robot models; need be wrapped in OpenAI Gym environment format to be trained by stable-baselinesstable-baselines: RL algorithms implemented by stable-baselinestraining_scripts: various stable-baselines training/evaluation scriptsutils: various utility scripts
conda activate DeepRobotsThen navigate to DeepRobots/training_scripts, and run a script of your choice.
Take a look at stable-baselines documentation, especially the "Getting Started" and "Tensorboard Integration" sections.
Here is a list of previous documentation that is no longer maintained:
- Usage of our own version of DQN algorithm for training simulated and physical robots