Overview
Donkey Gym enables:- Virtual racing on generated tracks and real-world courses
- Safe training without hardware wear
- Rapid iteration with instant resets
- Latency simulation to test real-world conditions
- Multi-environment support including warehouse and AVC tracks
Installation
Download the simulator binary for your platform:Configuration
Edit yourmyconfig.py to enable the simulator:
DonkeyGymEnv Part
TheDonkeyGymEnv part connects your vehicle to the simulator:
donkeycar/parts/dgym.py:67-71:
Recording Telemetry
Capture additional telemetry from the simulator:Latency Simulation
The simulator supports artificial latency to test control algorithms under realistic network conditions:donkeycar/parts/dgym.py:47-62:
Running the Simulator
Local Mode
Start your car in simulator mode:Remote Mode
Start the simulator manually, then connect:Training
Train models using simulator data:Virtual Race League
Race against others online:Resource Management
The simulator uses GPU resources. To avoid conflicts:donkeycar/templates/simulator.py:47-50.
Troubleshooting
Connection Issues
Performance
- Lower image resolution in GYM_CONF
- Disable unnecessary telemetry recording
- Close other GPU-intensive applications
Path Not Found
Best Practices
- Start with generated tracks - Test algorithms on varied terrain
- Use artificial latency - Prepare for real-world network delays
- Record telemetry - Analyze car behavior and track position
- Transfer learning - Fine-tune simulator models with real-world data
- Test edge cases - Use simulator to safely test failure scenarios
Next Steps
- Configure telemetry to monitor performance
- Add path following for waypoint navigation
- Explore kinematics models for physics simulation
