Skip to main content
Controller parts provide manual input for steering, throttle, mode switching, and recording control.

Web Controllers

LocalWebController

Web-based controller using browser interface. Import:
Constructor:
int
default:"8887"
Port for web server
Outputs:
  • angle: Steering angle (-1 to 1)
  • throttle: Throttle value (-1 to 1)
  • mode: Drive mode (user, local_angle, local)
  • recording: Recording state (True/False)

Physical Joystick Controllers

JoystickController

Base class for physical joystick controllers. Constructor:
float
default:"0.0"
Delay in seconds between joystick polls
float
default:"1.0"
Scale factor for throttle (0.0 to 1.0)
float
default:"1.0"
Scale factor for steering (0.0 to 1.0)
float
default:"-1.0"
Direction multiplier for throttle (1.0 or -1.0)
str
default:"/dev/input/js0"
Device path for joystick
bool
default:"true"
Automatically start recording when throttle is applied
Methods:
(img_arr, mode, recording) -> (angle, throttle, mode, recording)
Returns control outputs based on joystick state
(img_arr, mode, recording) -> (angle, throttle, mode, recording)
Returns control outputs in threaded mode
() -> None
Polls joystick for input events (runs in separate thread)
() -> None
Stops the controller thread
(tub) -> None
Sets the tub for record deletion functionality
Button Mappings: Common button functions across controllers:
  • Mode toggle: Switch between user, local_angle, and local modes
  • Record toggle: Start/stop manual recording
  • Erase records: Delete last N records from tub
  • Emergency stop: Immediately stop the vehicle
  • Increase/Decrease throttle: Adjust max throttle scale
  • Constant throttle: Toggle constant throttle mode

PS3JoystickController

PlayStation 3 controller support. Constructor:
Default Button Mapping:
  • Select: Toggle mode
  • Circle: Toggle manual recording
  • Triangle: Erase last 100 records
  • Cross: Emergency stop
  • D-Pad Up/Down: Increase/decrease max throttle
  • Start: Toggle constant throttle
  • L1/R1: Chaos monkey (test mode)
  • Left stick horizontal: Steering
  • Right stick vertical: Throttle

PS4JoystickController

PlayStation 4 controller support. Constructor:
Default Button Mapping:
  • Share: Toggle mode
  • Circle: Toggle manual recording
  • Triangle: Erase last 100 records
  • Cross: Emergency stop
  • L1/R1: Increase/decrease max throttle
  • Options: Toggle constant throttle
  • Left stick horizontal: Steering
  • Right stick vertical: Throttle

XboxOneJoystickController

Xbox One controller support. Constructor:
Default Button Mapping:
  • A button: Toggle mode
  • B button: Toggle manual recording
  • X button: Erase last 100 records
  • Y button: Emergency stop
  • Right/Left shoulder: Increase/decrease max throttle
  • Options: Toggle constant throttle
  • Left stick horizontal: Steering
  • Right stick vertical: Throttle
  • Right trigger: Forward throttle (Forza mode)
  • Left trigger: Reverse throttle (Forza mode)

LogitechJoystickController

Logitech F710 gamepad support. Constructor:
Default Button Mapping:
  • Start: Toggle mode
  • B: Toggle manual recording
  • Y: Erase last 100 records
  • A: Emergency stop
  • Back: Toggle constant throttle
  • L1/R1: Chaos monkey
  • D-Pad Up/Down: Increase/decrease max throttle
  • Left stick horizontal: Steering
  • Right stick vertical: Throttle

RC Receiver

RCReceiver

Read RC receiver PWM signals via pigpio. Constructor:
object
Configuration object with RC GPIO pin settings
Required Config:
Methods:
(mode, recording) -> (steering, throttle, mode, recording)
Returns RC control values

Usage Examples

Web Controller

PS4 Controller

RC Receiver

Configuration

Typical joystick configuration in myconfig.py: