# GzDRL: Reproducible and Scalable Deep Reinforcement Learning with Gazebo

Robotics.world

> Most reinforcement learning setups for Gazebo run the policy and the simulator as separate processes that exchange actions and observations through middleware such as ROS or Gazebo Transport.

**arXiv**: 2609.13243 · Preprint · not peer-reviewed

**Published**: 2026-09-03

**Authors**: Amal Dev Haridevan, Junjie Kang, Jinjun Shan

## In plain words

Most reinforcement learning setups for Gazebo run the policy and the simulator as separate processes that exchange actions and observations through middleware such as ROS or Gazebo Transport. Message serialization and scheduling delays mean an action can be applied to an observation that is already out of date, which breaks the pairing the learning algorithm assumes and makes runs hard to repeat.

## AI summary

## Overview

**Research area:** Robotics simulation infrastructure for deep reinforcement learning (DRL), with a focus on unmanned aerial vehicles (UAVs) and sim-to-real transfer.

**Technical level:** Intermediate. The paper assumes familiarity with reinforcement learning loops, physics simulation, and basic software architecture (threads, processes, middleware), but its core argument is accessible to anyone who has trained an RL agent in a simulator.

**Scope (one sentence):** The paper presents GzDRL, a single-process framework that embeds Gazebo directly inside the RL loop to deliver deterministic, high-throughput, reproducible training and evaluation, validated through benchmarks against four other simulators and a zero-shot deployment on a physical quadrotor.

## What This Paper Is About

Most reinforcement learning setups for Gazebo run the policy and the simulator as separate processes that exchange actions and observations through middleware such as ROS or Gazebo Transport. Message serialization and scheduling delays mean an action can be applied to an observation that is already out of date, which breaks the pairing the learning algorithm assumes and makes runs hard to repeat. GzDRL removes the middleware entirely, putting the simulator, the control interface, and the data-collection loop in one process so that every action is applied at a precisely known physics step, and it adds batched vectorization so many simulated robots can run in parallel.

## Key Contributions

1. **A systematic environment-stepping mechanism for Gazebo.** Actions are written as direct entity-component-system (ECS) commands, physics is advanced under explicit control, and observations are read back at a fixed point in the update cycle, giving middleware-free synchronization between agent and simulator.
2. **Batched vectorization adapted from EnvPool for Gazebo.** The `GazeboPool` backend supports efficient multi-instance simulation with partial batches and zero-copy C++/NumPy observation sharing, alongside a Python-side `AsyncDRLServerPool` that runs a C++ worker thread per server and releases the Global Interpreter Lock.
3. **A broad experimental validation.** The paper measures state-transition and training reproducibility, single- and multi-agent scalability on two hardware platforms, multiple control abstractions, runtime model randomization, and zero-shot physical deployment. CPU throughput reaches 78.6 × 10³ environment steps/s.
4. **A unified multirotor control stack.** Seven control modes (RPM, SRT, CTBT, CTBR, Wrench, Velocity/Angular Velocity, and High-Level Guidance) let policies interface at different abstraction levels, from raw rotor speeds up to state references for integrated controllers.

## Main Findings

- **Deterministic transitions versus ROS 2:** Across 100 trials, GzDRL applied each policy action at the immediately succeeding physics update, while ROS 2–Gazebo showed variable multi-step delays in action-to-physics latency, observation delay, and intervening physics steps. Trajectories across runs were effectively identical under GzDRL and accumulated measurable divergence under ROS 2.
- **Training reproducibility with identical seeds:** Five process-isolated PPO runs on the `GazeboPool` hover task with the same seed produced a final return of 18.43 ± 0.00, a coefficient of variation of 0.00%, a mean checkpoint standard deviation of 0.00, and 100% identical policy checkpoint parameter hashes.
- **Training variability with different seeds:** Five runs with seeds {1, 5, 25, 42, 125} produced 18.08 ± 1.27, a coefficient of variation of 7.05%, a mean checkpoint standard deviation of 1.32, and 0% identical checkpoints — showing the spread comes from the learning seed, not the simulator.
- **Highest workstation throughput among evaluated frameworks:** At N_E = 128, GzDRL reached 78.6 × 10³ steps/s versus PyBullet-Drones at 22.0 × 10³, OmniDrones at 21.2 × 10³, and Aerial Gym at 21.0 × 10³ — roughly a 3.6× advantage over the fastest baseline, at 78.1% CPU and 0.0% GPU utilization.
- **Competitive on laptop hardware:** GzDRL peaked at 43.4 × 10³ steps/s at N_E = 32 on the laptop, close to GPU-accelerated Aerial Gym at 44.6 × 10³ and above OmniDrones and PyBullet-Drones.
- **Large advantage over middleware-based vectorization:** Conventional ROS 2–Gazebo peaked at 2.6 × 10³ steps/s on the workstation with process-based vectorization, giving GzDRL a 30× throughput advantage.
- **Internal backend comparison:** Among GzDRL's own variants on the workstation, `GazeboPool` (78.58 ± 2.08) beat Multiprocessing (23.80 ± 0.42), AsyncDRLServerPool (19.10 ± 1.79), Serial (3.63 ± 0.06), and Threading (3.03 ± 0.03), showing that Python/GIL overhead and process overhead are the limiting factors.
- **Multi-agent scaling depends on agent count:** On the workstation GzDRL achieved 35.5 × 10³, 17.8 × 10³, and 8.1 × 10³ steps/s at N_A = 2, 5, and 10 agents, leading all baselines (2.6× faster than PyBullet-Drones at N_A = 2). At N_A = 20, Aerial Gym reached 5.5 × 10³ versus GzDRL's 3.2 × 10³. On the laptop GzDRL led at N_A = 2 (32.9 × 10³) but Aerial Gym led for N_A ≥ 5. The paper notes no fixed crossover point exists; the CPU/GPU balance depends jointly on agent count and hardware.
- **Both control abstractions learn the tasks:** PPO policies trained with Stable-Baselines3 on trajectory tracking and payload transport, for end-to-end (rotor speed) and modular (3D force vector to an integrated attitude controller) interfaces, all learned successfully. Modular hierarchical control accelerated early learning on the trajectory task. All 90 parallel environments finished within 220 minutes of wall-clock time.
- **Randomization improves robustness:** On the inverted-pendulum-on-quadrotor task, a policy trained with parameter randomization every 10 episodes scored 642.97 ± 232.07 over 1,000 randomized episodes, versus 439.89 ± 175.97 for the fixed-parameter policy. The randomized agent learned more conservatively in training (398.45 ± 130.33 versus 427.98 ± 138.62) but generalized better.
- **Zero-shot hardware transfer:** A frozen trajectory-tracking policy deployed on a Quanser QDrone2 without fine-tuning, running onboard at 100 Hz on an NVIDIA Jetson Xavier NX, achieved a mean Euclidean error of 20.2 ± 3.4 cm and 3D RMS error of 26.2 ± 7.4 cm over nine trials, with vertical RMSE of 2.9 ± 0.4 cm and a 95th-percentile error of 50.4 ± 19.2 cm. Peak reference speeds and accelerations were 0.72 ± 0.14 m/s and 0.37 ± 0.12 m/s², and no safety events or actuator saturations occurred.

## Methodology in Plain English

The core idea is to stop treating the simulator as an external service. Each RL environment owns its own Gazebo server and world inside the same process. For one policy action, the framework runs a fixed number of physics iterations (K = f_physics / f_control). Before each iteration it reads the current state, converts the policy output into a control command through whichever abstraction is selected, writes that command directly into the simulation's ECS, advances the simulation by exactly one step, and then reads poses, velocities, sensors, and contacts during the post-update phase. Because nothing is transmitted over a network, the action-to-observation pairing is exact.

Resets and domain randomization are handled through a request queue: the framework edits a cached model description (mass, inertia, plugin parameters), respawns the affected entity, and updates filter constants directly, avoiding a full world rebuild. On the vectorization side, `GazeboPool` borrows EnvPool's design — a pool of environments, a pool of worker threads, an action queue, and rotating state buffers. Threads pull whatever environment is ready rather than being pinned to one, a batch can return after any number of completions up to the pool size, and Python gets a zero-copy NumPy view of the result.

The evaluation compares against PyBullet-Drones, OmniDrones, Aerial Gym, and ROS 2–Gazebo, on a workstation (AMD Ryzen Threadripper 3960X, 256 GB RAM, dual RTX A6000) and a laptop (AMD Ryzen 9 7940HS, 32 GB RAM, RTX 4060), all in headless mode with a 1 ms physics timestep, five trials per configuration, a 1,000-step warmup, and 10,000 measured steps. Sim-to-real validation used a policy trained only in simulation, with position feedback from a 120 Hz OptiTrack motion capture system.

## Why This Matters

**Impact on research:** Irreproducibility is a known problem in deep RL, and part of it originates below the algorithm — in how the simulator delivers data. GzDRL shows that determinism can be engineered at the simulator interface, with a quantitative demonstration that identical seeds give bit-identical checkpoints and zero variance in final return. That makes it possible to attribute differences between training runs to the algorithm rather than to timing jitter, which is a prerequisite for trustworthy benchmarking.

**Real-world applications:**

- **Multirotor flight control**, including aggressive flight and trajectory tracking, where policies trained at 1 kHz physics can be moved to onboard hardware without retraining.
- **Cooperative payload transport**, demonstrated in the paper as a multi-agent task with joint observations and a team reward.
- **Drone racing and agile maneuvering**, shown as one of the representative scenarios.
- **Inspection, logistics, and autonomous navigation**, where Gazebo's existing robot models, sensor plugins, and ROS compatibility reduce the cost of building training environments that resemble deployed systems.

**Industry relevance:** Many robotics teams already have Gazebo and ROS-based software-in-the-loop pipelines. GzDRL preserves that investment — native ROS support, existing sensor models, standard physics engines (DART, Bullet, TPE) — while adding training throughput that previously required switching to a GPU simulator with different asset pipelines. The result that a CPU-only framework can reach 78.6 × 10³ steps/s on a workstation, and stay near GPU simulators on a laptop, matters for teams without large GPU allocations.

## Future Directions

- **Extending determinism guarantees to rendered sensors.** The paper explicitly limits its transition-determinism claim to state observations, noting that rendered sensors depend on Gazebo's rendering pipeline. Whether camera and depth observations can be made equally reproducible is left open.
- **Characterizing the CPU/GPU crossover.** The multi-agent results show no fixed crossover point between GzDRL and GPU simulators; mapping how agent count, per-agent workload, and hardware jointly determine the better choice would guide practitioners.
- **Scaling beyond the tested envelope.** The largest tested configuration was 128 parallel environments on the workstation; behavior at larger pools, across multiple machines, or with heavier per-environment sensor loads is not reported.
- **Broader sim-to-real validation.** Transfer was demonstrated on one vehicle (Quanser QDrone2) with one task family (trajectory tracking) and external motion-capture feedback. Extending this to onboard perception, different airframes, and contact-rich or manipulation tasks would test the framework's generality.

## Target Audience

RL researchers and graduate students who train agents in robotics simulators and care about reproducibility; robotics engineers maintaining Gazebo and ROS-based software-in-the-loop pipelines who want higher training throughput without abandoning their existing models; UAV guidance, navigation, and control researchers interested in control-abstraction choices for learned policies; and industry teams evaluating whether a CPU-based simulation stack can meet their data-collection needs before committing to GPU simulation infrastructure.

## Authors’ abstract

We present GzDRL, a novel single-process reinforcement learning (RL) framework for Gazebo that overcomes longstanding bottlenecks in scalable, reproducible robotics experimentation. Unlike conventional middleware-based RL-Gazebo integrations that suffer from nondeterminism and irreproducibility, GzDRL introduces a systematic, middleware-free environment-stepping mechanism that directly synchronizes agent actions and physics updates. This design enables deterministic,…

[The full abstract on arXiv](https://arxiv.org/abs/2609.13243)

[Read the original paper](https://arxiv.org/abs/2609.13243)

## Related papers

- [Safe and Scalable Multi-Drone Payload Transport via CBF-based Reinforcement Learning with Zero-Shot Sim-to-Real Transfer](https://robotics.world/paper/safe-and-scalable-multi-drone-payload-transport-via-cbf-based-2607.20665) 2026-07-22 · cs.RO · Key terms of the title in common

---

Canonical: https://robotics.world/paper/gzdrl-reproducible-and-scalable-deep-reinforcement-learning-with-gazebo-2609.13243
