Software
safe-control-gym
By Learning Systems and Robotics Lab (LSY), Germany (checked on github.com/learnsyslab (opens in a new tab)), from github.com/learnsyslab/safe-control-gym (opens in a new tab)
- Drones and boats
- Simulator
- MIT
A benchmark suite of physics-based CartPole and Quadrotor Gym environments built on PyBullet, with symbolic CasADi dynamics, for learning-based control and reinforcement learning research.
Facts
- GitHub stars
- 938read on 29 Nov 2026
- Last update
- 29 Apr 2026Newest commit on main
- Maintenance
- Maintaineda commit in the last 12 months
- Difficulty
- Intermediate
- Hardware it needs, as the project states it
- Installing the MPC interface requires acados, and PyBullet and Python 3.10 are used.
Checked on GitHub on 29 Nov 2026.
Licenses
- Code
- MIT (opens in a new tab)
Read by Robotheca from LICENSE (opens in a new tab) (MIT) at commit 6b5391d (opens in a new tab), on 16 Oct 2026.
- Commercial use
- Yes
At a glance
- What it is
- Provides CartPole and Quadrotor environments simulated with PyBullet, using symbolic a priori dynamics from CasADi.
- Includes symbolic safety constraints and input, parameter, and dynamics disturbances to test robustness and generalizability.
- Implements controllers including PID, LQR, iLQR, linear MPC, GP-MPC, and model-free RL methods SAC, PPO, and DDPG.
- Offers safety filters such as MPSC, control barrier functions, and a neural network CBF.
- Runnable example scripts cover quadrotor trajectory tracking, cartpole stabilization, and RL training, configured through YAML overrides.
- Ships tests and pre-commit linting, and the project is maintained by the University of Toronto's Dynamic Systems Lab.
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 website (opens in a new tab)
- Maintenance
- Maintained, last commit on 29 Apr 2026.
Use it
How to install it, in the creator's words: The project's website (opens in a new tab)
Robotheca doesn't review code. Read it before running it.
Files and versions
- Repository on GitHubgithub.com/learnsyslab/safe-control-gym (opens in a new tab)
- The version Robotheca read6b5391d (opens in a new tab)
- Latest releasev1.0.0 (21 Oct 2024)
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 Learning Systems and Robotics Lab (LSY), at commit 6b5391d, under MIT (opens in a new tab). The original on GitHub (opens in a new tab).
Read the README here
safe-control-gym
Physics-based CartPole and Quadrotor Gym (opens in a new tab) environments (using PyBullet (opens in a new tab)) with symbolic a priori dynamics (using CasADi (opens in a new tab)) for learning-based control, and model-free and model-based reinforcement learning (RL).
These environments include (and evaluate) symbolic safety constraints and implement input, parameter, and dynamics disturbances to test the robustness and generalizability of control approaches. [PDF] (opens in a new tab)

@article{brunke2021safe,
title={Safe Learning in Robotics: From Learning-Based Control to Safe Reinforcement Learning},
author={Lukas Brunke and Melissa Greeff and Adam W. Hall and Zhaocong Yuan and Siqi Zhou and Jacopo Panerati and Angela P. Schoellig},
journal = {Annual Review of Control, Robotics, and Autonomous Systems},
year={2021},
url = {https://arxiv.org/abs/2108.06266}}
To reproduce the results in the article, see branch ar (opens in a new tab).
@article{yuan2021safecontrolgym,
author={Yuan, Zhaocong and Hall, Adam W. and Zhou, Siqi and Brunke, Lukas and Greeff, Melissa and Panerati, Jacopo and Schoellig, Angela P.},
journal={IEEE Robotics and Automation Letters},
title={Safe-Control-Gym: A Unified Benchmark Suite for Safe Learning-Based Control and Reinforcement Learning in Robotics},
year={2022},
volume={7},
number={4},
pages={11142-11149},
doi={10.1109/LRA.2022.3196132}}
To reproduce the results in the article, see branch submission (opens in a new tab).
Install on Ubuntu/macOS
Clone repo
git clone https://github.com/learnsyslab/safe-control-gym.git
cd safe-control-gym
(optional) Create a conda environment
Create and access a Python 3.10 environment using
conda (opens in a new tab)
conda create -n safe python=3.10
conda activate safe
Install
Install the safe-control-gym repository
python -m pip install --upgrade pip
python -m pip install -e .
Note
You may need to separately install gmp, a dependency of pycddlib:
conda install -c anaconda gmp
or
sudo apt-get install libgmp-dev
(optional) Additional requirements for MPC
You may need to separately install acados (opens in a new tab) for fast MPC implementations.
- To build and install acados, see their installation guide (opens in a new tab).
- To set up the acados python interface, check out these installation steps (opens in a new tab).
Architecture
Overview of safe-control-gym (opens in a new tab)'s API:

Configuration

Getting Started
Familiarize with APIs and environments with the scripts in examples/ (opens in a new tab)
3D Quadrotor Lemniscate Trajectory Tracking with PID
cd ./examples/ # Navigate to the examples folder
python3 pid/pid_experiment.py \
--algo pid \
--task quadrotor \
--overrides \
./pid/config_overrides/quadrotor_3D/quadrotor_3D_track.yaml

Cartpole Stabilization with LQR
cd ./examples/ # Navigate to the examples folder
python3 lqr/lqr_experiment.py \
--algo lqr \
--task cartpole \
--overrides \
./lqr/config_overrides/cartpole/cartpole_stab.yaml \
./lqr/config_overrides/cartpole/lqr_cartpole_stab.yaml
2D Quadrotor Trajectory Tracking with PPO
cd ./examples/rl/ # Navigate to the RL examples folder
python3 rl_experiment.py \
--algo ppo \
--task quadrotor \
--overrides \
./config_overrides/quadrotor_2D/quadrotor_2D_track.yaml \
./config_overrides/quadrotor_2D/ppo_quadrotor_2D.yaml \
--kv_overrides \
algo_config.training=False
Verbose API Example
cd ./examples/ # Navigate to the examples folder
python3 no_controller/verbose_api.py \
--task cartpole \
--overrides no_controller/verbose_api.yaml

List of Implemented Controllers
- PID (opens in a new tab)
- LQR (opens in a new tab)
- iLQR (opens in a new tab)
- Linear MPC (opens in a new tab)
- GP-MPC (opens in a new tab)
- SAC (opens in a new tab)
- PPO (opens in a new tab)
- DDPG (opens in a new tab)
- Safety Layer (opens in a new tab)
- RARL (opens in a new tab)
- RAP (opens in a new tab)
List of Implemented Safety Filters
Performance
We compare the sample efficiency of safe-control-gym with the original OpenAI Cartpole (opens in a new tab) and PyBullet Gym's Inverted Pendulum (opens in a new tab), as well as gym-pybullet-drones (opens in a new tab).
We choose the default physic simulation integration step of each project.
We report performance results for open-loop, random action inputs.
Note that the Bullet engine frequency reported for safe-control-gym is typically much finer grained for improved fidelity.
safe-control-gym quadrotor environment is not as light-weight as gym-pybullet-drones (opens in a new tab) but provides the same order of magnitude speed-up and several more safety features/symbolic models.
| Environment | GUI | Control Freq. | PyBullet Freq. | Constraints & Disturbances^ | Speed-Up^^ |
|---|---|---|---|---|---|
| Gym cartpole (opens in a new tab) | True | 50Hz | N/A | No | 1.16x |
| InvPenPyBulletEnv (opens in a new tab) | False | 60Hz | 60Hz | No | 158.29x |
| cartpole (opens in a new tab) | True | 50Hz | 50Hz | No | 0.85x |
| cartpole (opens in a new tab) | False | 50Hz | 1000Hz | No | 24.73x |
| cartpole (opens in a new tab) | False | 50Hz | 1000Hz | Yes | 22.39x |
| gym-pyb-drones (opens in a new tab) | True | 48Hz | 240Hz | No | 2.43x |
| gym-pyb-drones (opens in a new tab) | False | 50Hz | 1000Hz | No | 21.50x |
| quadrotor (opens in a new tab) | True | 60Hz | 240Hz | No | 0.74x |
| quadrotor (opens in a new tab) | False | 50Hz | 1000Hz | No | 9.28x |
| quadrotor (opens in a new tab) | False | 50Hz | 1000Hz | Yes | 7.62x |
^ Whether the environment includes a default set of constraints and disturbances
^^ Speed-up = Elapsed Simulation Time / Elapsed Wall Clock Time; on a 2.30GHz Quad-Core i7-1068NG7 with 32GB 3733MHz LPDDR4X; no GPU
Run Tests and Linting
Tests can be run locally by executing:
python3 -m pytest ./tests/ # Run all tests
Linting can be run locally with:
pre-commit install # Install the pre-commit hooks
pre-commit autoupdate # Auto-update the version of the hooks
pre-commit run --all # Run the hooks on all files
References
- Brunke, L., Greeff, M., Hall, A. W., Yuan, Z., Zhou, S., Panerati, J., & Schoellig, A. P. (2022). Safe learning in robotics: From learning-based control to safe reinforcement learning (opens in a new tab). Annual Review of Control, Robotics, and Autonomous Systems, 5, 411-444.
- Yuan, Z., Hall, A. W., Zhou, S., Brunke, L., Greeff, M., Panerati, J., & Schoellig, A. P. (2022). safe-control-gym: A unified benchmark suite for safe learning-based control and reinforcement learning in robotics (opens in a new tab). IEEE Robotics and Automation Letters, 7(4), 11142-11149.
Related Open-source Projects
gym-pybullet-drones(opens in a new tab): single and multi-quadrotor environmentsstable-baselines3(opens in a new tab): PyTorch reinforcement learning algorithmsbullet3(opens in a new tab): multi-physics simulation enginegym(opens in a new tab): OpenAI reinforcement learning toolkitcasadi(opens in a new tab): symbolic framework for numeric optimizationsafety-gym(opens in a new tab): environments for safe exploration in RLrealworldrl_suite(opens in a new tab): real-world RL challenge frameworkgym-marl-reconnaissance(opens in a new tab): multi-agent heterogeneous (UAV/UGV) environments
University of Toronto's Dynamic Systems Lab (opens in a new tab) / Vector Institute for Artificial Intelligence (opens in a new tab)
Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.