A complete interactive drone simulation environment built with MuJoCo, featuring controllable quadrotor with multiple camera views, recording capabilities, and real-time controls.
- 🎮 Interactive 3D Controls - Real-time drone control with WASD keys
- 📹 Multiple Camera Views - External, drone-mounted, FPV, and top-down perspectives
- 🎥 Video Recording - Record flights from all camera angles simultaneously
- 🖥️ WSL Compatible - Works in Windows Subsystem for Linux
- ⚡ Real-time Physics - Realistic quadrotor dynamics and motor mixing
- 🎯 Easy Controls - Intuitive keyboard controls for all flight maneuvers
python3 drone_working.pyThis is the working version with properly functioning controls!
| Key | Action | Description |
|---|---|---|
| W | Forward | Pitch forward |
| S | Backward | Pitch backward |
| A | Left | Roll left |
| D | Right | Roll right |
| Q | Yaw Left | Rotate counterclockwise |
| E | Yaw Right | Rotate clockwise |
| Z | Up | Increase altitude |
| X | Down | Decrease altitude |
| Key | Action | Description |
|---|---|---|
| Space | Hover | Stop all movement (emergency stop) |
| R | Reset | Return drone to starting position |
| T | Toggle | Switch between active/hover mode |
| ESC | Exit | Close simulation |
| Key | Action | Views Available |
|---|---|---|
| [ | Previous Camera | Cycles backward through camera views |
| ] | Next Camera | Cycles forward through camera views |
Camera Views:
- External View - Third-person perspective (default)
- Drone Camera - Camera attached to drone body
- FPV Camera - First-person view (pilot perspective)
- Top-Down View - Bird's eye view for navigation
- Use [ and ] keys to switch between camera views
- Mouse drag to rotate camera view
- Right-click + drag to pan
- Scroll wheel to zoom in/out
- Start simulation:
python3 drone_working.py - Take off: Hold Z to lift off
- Fly around: Use WASD for movement
- Land safely: Use X to descend gently
- Take off in external view first
- Press ] to cycle to "FPV Camera"
- Fly from drone's perspective using WASD
- Switch back with [ or ] if needed
- Hover in place: Press Space for instant stop
- Precise control: Quick taps for small movements, hold for continuous
- Emergency reset: Press R if you crash or get lost
| File | Description | Purpose |
|---|---|---|
drone_working.py |
🌟 MAIN SIMULATOR - Working controls and camera switching | Interactive 3D drone flying |
drone_text_ui.py |
Web-based telemetry interface | Remote monitoring via browser |
record_flight.py |
Pre-programmed flight recording | Creating demo videos |
test_simulation.py |
Basic functionality test | Troubleshooting setup |
- Videos are automatically saved during simulation
- Multiple camera angles recorded simultaneously
- Files saved in
recordings/directory
python3 record_flight.py # Creates demo flight videos- Format: MP4 (H.264)
- Resolution: 640x480
- Frame Rate: 30 FPS
- Cameras: All 4 perspectives included
- Install X11 server: VcXsrv, Xming, or X410
- Install graphics libraries:
sudo apt update sudo apt install libgl1-mesa-glx libglu1-mesa libxrandr2 libxss1 sudo apt install libgtk2.0-dev pkg-config
- Set display:
export DISPLAY=:0 - Enable access control in X11 server settings
If 3D view doesn't work:
python3 drone_text_ui.py
# Then open http://localhost:8080 in browser- Python 3.10+
- MuJoCo 3.x (already installed)
- OpenCV (
pip install opencv-python) - NumPy (already installed)
- Start gentle: Use quick taps before holding keys
- Use hover: Press Space frequently to stabilize
- FPV flying: Start in external view, then switch to FPV
- Emergency reset: Press R if you lose control
- Watch the circles: Bottom indicators show active camera
- Try all views: Each camera offers different perspectives
- FPV for immersion: Best experience for first-person flying
- External for learning: Easiest to see drone orientation
- Close other programs for best performance
- Use fullscreen for immersive experience
- Try different cameras if one view is slow
Start with this command:
python3 drone_working.pyThen:
- Hold Z to take off
- Use WASD to fly around
- Press [ or ] to switch camera views
- Press Space to hover
- Have fun! 🎉
Enjoy your drone simulation! 🚁✨