Skip to content

About

Using Quality Diversity for Damage Recovery in Robotics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

Quality-Diversity Reinforcement Learning for Robotics Damage recovery

This repository is built on top of QDax library and Uncertain Quality Diversity.

The goal for the agent(ant) is to run as fast as possible, even when it's damaged.

  • Left: Robot walking without damage
  • Middle: Damage on Front-left leg
  • Right: Recovered walking gait that adapts to the damage

Content

Algorithms

For MAP creation, this project incorporates certain QD algorithms as the following:

For tackling uncertainties in the QD environments, our method uses multi-evaluation sampling where each of the following sampling mechanism is wrapped in a container that can be easily swapped during runtime:

For damage recovery, our method implements Intelligent Trial and Error using Bayesian Optimisation.

Environment

Installation

  • always upgrade pip before running pip install:
    pip install --upgrade pip
  • Jax cuda version is set by default for its efficiency in running evaluations in parallel, install the dependencies using:
    pip install -r requirements.txt
  • Though it's advised to run on gpu, adaptation experiments can be run on cpu (very slow) with the following:
    export JAX_PLATFORMS=cpu
    python main.py

Configurations

  • Default parameters are stored in ./config.json
  • Shell command will override default parameters
  • Must specify running algo by setting the flag --algo_type <op>, <op> currently only supports mapelites or dcrl

Running the code

Before executing any code, make sure one's under the project directory:

cd <path-to-repository>

For batched jobs, it's advised to run on gpu servers using shell commands, please refer to <hpc_train.sh> and <hpc_adapt.sh> under scripts/. All runtime results will be summarised in outputs/<hpc> by default.

Training the MAP

qsub scripts/hpc_train.sh  # local runs: ./scripts/hpc_train.sh

The mode flag needs to be specified using --mode training in hpc_train.sh.

Damage Adaptation

Model path needs to be explicitly set in hpc_adapt.sh for job submission.

qsub scripts/hpc_adapt.sh # local runs: ./scripts/hpc_adapt.sh

Metrics Evaluations

The plot results will be presented under evaluations/.

python utils/evaluations.py

Parameters for Result Evaluations

  • Vanilla MAP-Elites: --container MAP-Elites_Sampling --dropout-rate 0
  • MAP-Elites Sampling: --container MAP-Elites_Sampling --num-samples 10
  • Archive Sampling: --container Archive-Sampling --num-samples 2 --depth 2
  • Extract MAP-Elites: --container Extract-MAP-Elites --num-samples 2 --depth 8

Notes

  • batched_rewards: evaluates all cells in the archive, without any inf/nan values
  • repertoire.fitnesses: with empty cells are portrayed as -inf

About

Using Quality Diversity for Damage Recovery in Robotics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages