Skip to main content
Controller parts handle user input from joysticks, game controllers, RC receivers, and web interfaces.

Web Controller

Browser-based control interface for driving your Donkey car. Location: donkeycar/parts/web_controller/web.py
Features:
  • Web-based UI accessible from any device
  • Keyboard or on-screen controls
  • Real-time video streaming
  • Mode switching (user/autopilot)
  • Recording control
Usage:
Access at: http://<vehicle-ip>:8887

Physical Joystick Controllers

All joystick controllers follow a common pattern:

Base Joystick Class

Location: donkeycar/parts/controller.py:17 The Joystick class provides low-level access to joystick devices via /dev/input/js0.

JoystickController

Location: donkeycar/parts/controller.py:819 Base class that maps joystick inputs to vehicle actions. Key Methods:
  • set_steering() - Map axis to steering angle
  • set_throttle() - Map axis to throttle value
  • toggle_mode() - Switch between user/autopilot modes
  • toggle_manual_recording() - Start/stop recording
  • increase_max_throttle() / decrease_max_throttle() - Adjust throttle scale
  • emergency_stop() - Immediate stop sequence
  • erase_last_N_records() - Delete recent data

PlayStation Controllers

PS3 Controller

Location: donkeycar/parts/controller.py:1212
Button Mapping:
  • Select: Toggle driving mode (user/local_angle/local)
  • Circle: Toggle manual recording
  • Triangle: Erase last 100 records
  • Cross: Emergency stop
  • D-pad Up: Increase max throttle
  • D-pad Down: Decrease max throttle
  • Start: Toggle constant throttle
  • L1/R1: Chaos monkey (add steering bias for testing)
Stick Mapping:
  • Left Stick Horizontal: Steering
  • Right Stick Vertical: Throttle
Setup:

PS4 Controller

Location: donkeycar/parts/controller.py:1290
Button Mapping:
  • Share: Toggle driving mode
  • Circle: Toggle manual recording
  • Triangle: Erase last records
  • Cross: Emergency stop
  • L1: Increase max throttle
  • R1: Decrease max throttle
  • Options: Toggle constant throttle
Stick Mapping:
  • Left Stick Horizontal: Steering
  • Right Stick Vertical: Throttle
PyGame PS4 Controller (for Windows/cross-platform): Location: donkeycar/parts/controller.py:1333

Xbox Controllers

Xbox One Controller

Location: donkeycar/parts/controller.py:1355
Button Mapping:
  • A: Toggle driving mode
  • B: Toggle manual recording
  • X: Erase last records
  • Y: Emergency stop
  • Right Shoulder: Increase throttle
  • Left Shoulder: Decrease throttle
  • Options: Toggle constant throttle
Stick Mapping:
  • Left Stick Horizontal: Steering
  • Right Stick Vertical: Throttle
  • Right Trigger: Forward (Forza mode)
  • Left Trigger: Reverse (Forza mode)
Bluetooth Setup:

Other Controllers

Logitech Gamepad F710

Location: donkeycar/parts/controller.py:1439
Button Mapping:
  • Start: Toggle mode
  • B: Toggle recording
  • Y: Erase records
  • A: Emergency stop
  • Back: Toggle constant throttle
  • R1/L1: Chaos monkey
  • D-pad Up/Down: Adjust throttle

Nimbus Controller

Location: donkeycar/parts/controller.py:1514 For SteelSeries Nimbus (iOS/Apple TV controller).

WiiU Pro Controller

Location: donkeycar/parts/controller.py:1546

RC Receiver

For traditional RC transmitter/receiver setups using GPIO pins. Location: donkeycar/parts/controller.py:246
Configuration in myconfig.py:
Requires: pigpio library

Configuration

In myconfig.py:

Adding Controllers to Vehicle

Testing Controllers

Test controller connection:
Test in Python:

Creating Custom Controller Mappings

Use the joystick creator tool:
This will:
  1. Detect your controller
  2. Show button/axis codes
  3. Help you create a custom mapping
Location: donkeycar/parts/controller.py:348 (JoystickCreator)

Common Issues

Controller Not Detected

Bluetooth Pairing Issues

Wrong Button Mappings

  • Different controller revisions may have different mappings
  • Use jstest or donkey createjs to identify correct mappings
  • Create custom controller class if needed

Next Steps