Skip to content

Software

gym-donkeycar

From github.com/tawnkramer/gym-donkeycar (opens in a new tab)

  • Cars
  • Simulator
  • MIT

A Gymnasium reinforcement-learning environment wrapper that lets agents drive simulated Donkey Car robots on several race tracks through the Donkey simulator.

Facts

GitHub stars
229read on 28 Nov 2026
Last update
1 Mar 2026Newest commit on master
Maintenance
Maintaineda commit in the last 12 months
Difficulty
Beginner

Checked on GitHub on 28 Nov 2026.

Licenses

Code
MIT (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (MIT) at commit a1f4ca6 (opens in a new tab), on 16 Oct 2026.

Commercial use
Yes

At a glance

What it is
  • Provides Gymnasium environments such as donkey-generated-track-v0 and donkey-warren-track-v0 for driving a simulated car.
  • Actions are two values: steering and throttle, passed as a numpy array.
  • Each step returns a reward combining game over, distance from the center line and speed, plus info such as cross-track error, speed and lap time.
  • Can launch the simulator executable itself via a config, or connect to an already running simulator on a port.
  • Offers ten environments, including warehouse, generated roads, Sparkfun AVC, Waveshare and Thunderhill tracks.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
MIT. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Maintained, last commit on 1 Mar 2026.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit a1f4ca6

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by @tawnkramer, at commit a1f4ca6, under MIT (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

Gymnasium Environments for Donkey Car

(opens in a new tab) (opens in a new tab) Image: Documentation Status (opens in a new tab) (opens in a new tab)

Donkey Car Gymnasium (formerly OpenAI Gym)

Installation

Download simulator binaries: https://github.com/tawnkramer/gym-donkeycar/releases (opens in a new tab)

Install master version of gym donkey car:

pip install git+https://github.com/tawnkramer/gym-donkeycar
Example Usage

A short and compact introduction for people who know gym/gymnasium environments, but want to understand this one. Simple example code:

import os
import gymnasium as gym
import gym_donkeycar
import numpy as np

# SET UP ENVIRONMENT
# You can also launch the simulator separately
# in that case, you don't need to pass a `conf` object
exe_path = f"{PATH_TO_APP}/donkey_sim.exe"
port = 9091

conf = { "exe_path" : exe_path, "port" : port }

env = gym.make("donkey-generated-track-v0", conf=conf)

# PLAY
obs, info = env.reset()
for t in range(100):
  action = np.array([0.0, 0.5]) # drive straight with small speed
  # execute the action
  obs, reward, terminated, truncated, info = env.step(action)

# Exit the scene
env.close()

or if you already launched the simulator:

import gymnasium as gym
import numpy as np

import gym_donkeycar

env = gym.make("donkey-warren-track-v0")

obs, info = env.reset()
try:
    for _ in range(100):
        # drive straight with small speed
        action = np.array([0.0, 0.5])  
        # execute the action
        obs, reward, terminated, truncated, info = env.step(action)
except KeyboardInterrupt:
    # You can kill the program using ctrl+c
    pass

    # Exit the scene
env.close()
Action space

A permissable action is a numpy array of length two with first steering and throttle, respectively. E.g. np.array([0,1]) goes straight at full speed, np.array([-5,1]) turns left etc.

Action Space: Box(2,)

Action names: ['steer', 'throttle']

What you receive back on step:

  • obs: The image that the donkey is seeing (np.array shape (120,160,3))
  • reward: a reward that combines game over, how far from center and speed (max=1, min approx -2)
  • done: Boolean. Game over if cte > max_cte or hit != "none"
  • info contains:
    • cte: Cross track error (how far from center line)
    • positions: x,y,z
    • speed: positive forward, negative backward
    • hit: 'none' if all is good.
    • last_lap_time: time of last successful lap in seconds, 0.0 if there isn't one

Example info:

{'pos': (51.49209, 0.7399381, 117.3004),
 'cte': -5.865292,
 'speed': 9.319956,
 'hit': 'none',
 'last_lap_time': 34.93437361717224}
Environments
  • "donkey-warehouse-v0"
  • "donkey-generated-roads-v0"
  • "donkey-avc-sparkfun-v0"
  • "donkey-generated-track-v0"
  • "donkey-roboracingleague-track-v0"
  • "donkey-waveshare-v0"
  • "donkey-minimonaco-track-v0"
  • "donkey-warren-track-v0"
  • "donkey-thunderhill-track-v0"
  • "donkey-circuit-launch-track-v0"
Codestyle

We are using black codestyle (opens in a new tab) (max line length of 127 characters) together with isort (opens in a new tab) to sort the imports.

Please run make format to reformat your code. You can check the codestyle using make check-codestyle and make lint.

Tests

Type checking with pytype:

make type

Codestyle check with black, isort and ruff:

make check-codestyle
make lint

To run pytype, format and lint in one command:

make commit-checks

Build the documentation:

make docs
Credits

Original Source Code

Tawn Kramer - https://github.com/tawnkramer/gym-donkeycar (opens in a new tab)

Roma Sokolkov - https://github.com/r7vme/gym-donkeycar (opens in a new tab) cloned with permission from https://github.com/tawnkramer/sdsandbox (opens in a new tab)

Maintainer

Maxime Ellerbach - https://github.com/Maximellerbach/gym-donkeycar (opens in a new tab)

Release Engineer Leigh Johnson: https://github.com/leigh-johnson (opens in a new tab)

This package was created with Cookiecutter (opens in a new tab) and the audreyr/cookiecutter-pypackage (opens in a new tab) project template.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.