Introduction
Reinforcement learning (RL) agents often struggle when transitioning from simulation to real hardware, a phenomenon known as the "sim2real gap." While physical discrepancies like friction or mass errors are common targets for system identification, the REX (Robotic Environments with jaX) framework identifies latency as a primary driver of instability. Real-world robotic systems are inherently asynchronous, with delays in sensing, computation, and actuation that standard simulators often ignore. When a policy trained in an "instantaneous" simulation meets a real robot with even a 50ms lag, the result is frequently failure.
The REX Framework
REX leverages JAX for high-performance, GPU-accelerated simulation while maintaining a modular, graph-based architecture similar to ROS. This allows for massive parallelization—achieving simulation speeds of ~400,000 steps per second on a standard laptop—enabling both rapid training and complex system identification.
Explicit Delay Modeling
Unlike naive simulators that assume instantaneous feedback, REX explicitly models communication, computation, sensing, and actuation delays. By treating these as non-negative distributions (Gaussian Mixture Models), the simulator can replicate the "messy" timing of real hardware. This ensures that the agent learns to be robust to the specific temporal characteristics of the target platform.
Joint System Identification and Compensation
A key insight of REX is that physical dynamics and system delays must be estimated jointly. You cannot accurately identify a robot's mass if you do not know exactly when the force was applied. REX uses the CMA-ES algorithm to simultaneously estimate these parameters by replaying real-world data through its differentiable graph.
To mitigate the impact of identified delays during deployment, REX employs a predictive Unscented Kalman Filter (UKF). Instead of just filtering noise, this UKF forecasts the robot's state forward in time to the exact moment a command will reach the actuators, effectively "canceling out" the latency.
Experimental Validation and Results
The framework was validated using two challenging real-world setups:
- Pendulum Swing-Up: A vision-based task where high-latency image processing often causes standard policies to fail. REX-trained policies achieved reliable performance by accounting for these delays.
- Quadrotor Path Following: Using a Crazyflie drone, REX identified a hidden 34ms delay between the controller and motors. While "no-delay" policies became unstable during tight maneuvers, the REX-compensated policy maintained stable flight across all tested radii.
Conclusion
REX demonstrates that modeling asynchronicity is as vital as modeling physics for successful sim2real transfer. By combining JAX-powered parallel simulation with robust delay estimation and compensation, REX provides a scalable path for deploying RL on complex, high-speed robotic hardware.
Summary updated