Skip to main content

Overview

Once your car is assembled and calibrated, you’re ready to drive! Donkeycar provides a web interface and optional joystick control for driving your car manually and collecting training data for autonomous operation.

Starting Your Car

Basic Drive Command

You’ll see output like:

With a Trained Model

With Joystick

Or set in myconfig.py:

Web Interface

Accessing the Interface

Open your browser to:
Examples:
  • http://donkeypi.local:8887
  • http://raspberrypi.local:8887
  • Or use IP address: http://192.168.1.100:8887
Bookmark this URL on your phone or laptop for quick access. The web interface works great on mobile devices!

Web Interface Features

Live camera feed
  • Shows real-time view from your car’s camera
  • Updates as you drive
Control sliders
  • Steering: Left/right control (-1.0 to 1.0)
  • Throttle: Forward/reverse control (-1.0 to 1.0)
Mode selector
  • Switch between User, Local Angle, and Local (autopilot) modes
Recording indicator
  • Shows when data is being saved
  • Displays number of recorded frames
Status information
  • Current steering/throttle values
  • FPS (frames per second)
  • Model information (when using autopilot)

Driving with Web Interface

Keyboard Controls

When focused on the web interface: Steering:
  • A / Left Arrow: Steer left
  • D / Right Arrow: Steer right
Throttle:
  • W / Up Arrow: Forward
  • S / Down Arrow: Reverse/Brake
  • Space: Quick stop
Recording:
  • R: Toggle recording
Mode:
  • 1: User mode
  • 2: Local Angle mode
  • 3: Local mode (full autopilot)

Driving Modes

Donkeycar has three primary driving modes:

User Mode

What it is: Full manual control Who’s in control:
  • Steering: Human
  • Throttle: Human
When to use:
  • Collecting training data
  • Testing car setup
  • Learning the track
Configuration:

Local Angle Mode

What it is: AI steering, human throttle Who’s in control:
  • Steering: AI/Autopilot
  • Throttle: Human
When to use:
  • Testing steering model safely
  • Learning how the AI steers
  • Maintaining speed control during testing
Advantages:
  • You control the speed
  • Easier to stop if AI makes mistakes
  • Good for initial autopilot testing

Local Mode (Full Autopilot)

What it is: Full autonomous control Who’s in control:
  • Steering: AI/Autopilot
  • Throttle: AI/Autopilot
When to use:
  • After successful Local Angle testing
  • Racing
  • Demonstrating autonomous driving
Safety tip: Always be ready to switch back to User mode!

Mode Comparison

Recording Training Data

Auto-Record on Throttle

Most common setup - automatically records when you’re moving:
How it works:
  • Recording starts automatically when throttle > 0
  • Recording stops when throttle returns to 0
  • Prevents recording while stationary

Manual Recording

Control recording explicitly:
Toggle recording:
  • Web interface: Recording switch
  • Keyboard: R key
  • Joystick: Assigned button

Recording During AI

Record while autopilot is driving (use with caution):
Do not train on data recorded during AI driving! This creates circular training and degrades performance.

Tub Management

Auto-create new tubs:
Append to existing tub:
Tub locations:

What Gets Recorded

Each frame captures:
  • Camera image (cam/image_array)
  • Steering angle (user/angle) - range: -1.0 to 1.0
  • Throttle value (user/throttle) - range: -1.0 to 1.0
  • Drive mode (user/mode) - “user”, “local_angle”, “local”
  • Timestamp
  • Optional: IMU data, LIDAR data, speed, behaviors

Joystick Control

Supported Controllers

Donkeycar supports many game controllers:
  • PlayStation 3 (PS3)
  • PlayStation 4 (PS4)
  • Xbox One/360
  • Nintendo Switch Pro
  • Logitech F710
  • Custom controllers (via donkey createjs)

Enabling Joystick

Xbox Controller Mapping

Driving:
  • Left Stick: Steering
  • Right Trigger: Forward throttle
  • Left Trigger: Reverse throttle
Modes:
  • A button: User mode
  • B button: Local Angle mode
  • X button: Local (autopilot) mode
Recording:
  • Y button: Toggle recording
  • RB (Right Bumper): Increase max throttle
  • LB (Left Bumper): Decrease max throttle

PS4 Controller Mapping

Driving:
  • Left Stick: Steering
  • R2: Forward throttle
  • L2: Reverse throttle
Modes:
  • Cross (X): User mode
  • Circle: Local Angle mode
  • Square: Local mode
Recording:
  • Triangle: Toggle recording
  • R1: Increase max throttle
  • L1: Decrease max throttle

Joystick Configuration

Driving Tips for Good Training Data

Track/Environment

  • Consistent lighting: Avoid shadows and changing light
  • Clear boundaries: Well-defined edges (tape, walls, etc.)
  • Simple at first: Start with straight paths, add complexity later
  • Repeatable: Same track for all training laps

Driving Technique

Smooth inputs:
  • Avoid jerky steering corrections
  • Gradual throttle changes
  • Consistent speed throughout track
Center of lane:
  • Stay in middle of track/path
  • Consistent positioning
  • Recovery when needed
Multiple laps:
  • 5-10 laps minimum
  • Both directions if possible
  • Variety of speeds (if training for different speeds)

Data Quality

Good training data:
  • Smooth, centered driving
  • Consistent speed
  • Clear, well-lit images
  • 1000-3000 frames minimum
Bad training data (avoid):
  • Erratic steering
  • Off-track excursions
  • Stopped/stationary frames
  • Blurry or dark images
Quality matters more than quantity. 1000 frames of smooth, centered driving beats 10,000 frames of erratic driving.

Checking Your Data

View Recorded Images

Images are numbered sequentially: 0_cam_image_array_.jpg, 1_cam_image_array_.jpg, etc.

Tub Statistics

View tub information:
Shows distribution of steering angles and throttle values.

Make a Movie

Create a video from your tub:
Great for reviewing your driving and sharing progress!

Safety Guidelines

Before Driving

  • Car is properly calibrated
  • Emergency stop is accessible (switch to User mode)
  • Clear area with no obstacles
  • Battery charged
  • Camera view is clear

During Driving

  • Start at low throttle (30-50%)
  • Keep hand near controller for quick stop
  • Watch for unexpected behavior
  • Stop if car acts erratically
  • Avoid driving near people or pets

Autopilot Testing

  • Test in large, clear area first
  • Start with Local Angle mode
  • Be ready to take over instantly
  • Gradually increase trust in AI
  • Never use untested models in competitions
Always be ready to take manual control. Even well-trained models can make mistakes.

Throttle Control

Limiting Speed

User mode (manual driving):
AI mode (autopilot):

Launch Control

Boost throttle at start of autonomous mode (useful for racing):

Troubleshooting

Web interface won’t load

Check:
  • Pi is powered on and booted
  • Connected to same network as Pi
  • Correct hostname or IP address
  • Port 8887 is not blocked by firewall
Try:

Camera feed not showing

Check:
  • Camera is connected properly (CSI or USB)
  • Camera is enabled: sudo raspi-config → Interface Options → Camera
  • Correct CAMERA_TYPE in myconfig.py
Test:

Car doesn’t respond to controls

Check:
  • Motors/servos are powered (check battery)
  • Calibration values are set in myconfig.py
  • Correct DRIVE_TRAIN_TYPE
  • PCA9685 is connected (if using)
Test:

Recording not working

Check:
  • Recording toggle is enabled in web UI
  • Throttle > 0 (if AUTO_RECORD_ON_THROTTLE=True)
  • Sufficient disk space: df -h
  • Write permissions in data/ directory
Test:

Steering/throttle reversed

Fix in myconfig.py:

Joystick not detected

Check connection:
Fix permissions:

Performance Tuning

Increase Frame Rate

Trade-offs:
  • Higher CPU usage
  • More frames for AI to process
  • Better for fast-moving cars

Reduce Latency

Show Performance Info

Next Steps

Additional Resources