This quick start assumes you have already built your Donkeycar hardware. If not, refer to the hardware build guide.
Prerequisites
Before starting, ensure you have:- A Raspberry Pi, Jetson Nano, or PC/Mac with Donkeycar installed
- Basic familiarity with the command line terminal
- Your hardware assembled (for physical car)
Installation
Create Your Car Application
~/mycar/
├── config.py # Default configuration
├── myconfig.py # Your custom configuration
├── manage.py # Main car application
├── train.py # Training script
├── calibrate.py # Calibration script
├── data/ # Recorded driving data
├── models/ # Trained models
└── logs/ # Log files
The
config.py file contains all default settings. The myconfig.py file is where you override settings for your specific car.Donkeycar provides several templates for different use cases. The default template is
complete, which includes all features.Basic Configuration
# Camera Configuration
CAMERA_TYPE = "PICAM" # Options: PICAM, WEBCAM, CVCAM, MOCK
IMAGE_W = 160
IMAGE_H = 120
IMAGE_DEPTH = 3
CAMERA_FRAMERATE = 20
# Drive Train Type
DRIVE_TRAIN_TYPE = "PWM_STEERING_THROTTLE" # Standard RC car
# Controller Type
CONTROLLER_TYPE = 'xbox' # Options: ps3, ps4, xbox, nimbus, wiiu
USE_JOYSTICK_AS_DEFAULT = True
JOYSTICK_MAX_THROTTLE = 0.5 # Limit speed for beginners
# Drive Loop
DRIVE_LOOP_HZ = 20 # How fast the main loop runs
# Web Control
WEB_CONTROL_PORT = 8887 # Port for web interface
Start with
JOYSTICK_MAX_THROTTLE = 0.5 if you’re a beginner. You can increase it as you get comfortable.DRIVE_TRAIN_TYPE = "PWM_STEERING_THROTTLE"
# Configure your pins (Raspberry Pi GPIO)
PWM_STEERING_THROTTLE = {
"PWM_STEERING_PIN": "RPI_GPIO.BOARD.33",
"PWM_STEERING_SCALE": 1.0,
"PWM_STEERING_INVERTED": False,
"STEERING_LEFT_PWM": 460,
"STEERING_RIGHT_PWM": 290,
"PWM_THROTTLE_PIN": "RPI_GPIO.BOARD.32",
"PWM_THROTTLE_SCALE": 1.0,
"PWM_THROTTLE_INVERTED": False,
"THROTTLE_FORWARD_PWM": 500,
"THROTTLE_STOPPED_PWM": 370,
"THROTTLE_REVERSE_PWM": 220,
}
Calibrate Your Car
Before your first drive, you need to calibrate the steering and throttle.myconfig.py:STEERING_LEFT_PWM = 460 # Your calibrated left value
STEERING_RIGHT_PWM = 290 # Your calibrated right value
myconfig.py:Your First Drive
Game Controller
If you configured a joystick (Xbox, PS4, etc.):
- Left stick: Steering
- Right trigger: Forward throttle
- Left trigger: Reverse throttle
- Button mapping varies by controller type
Web Interface
Click and drag on the web UI or use keyboard:
- Arrow keys: Steering and throttle
- Space: Stop
- R: Toggle recording
Train Your First Model
Once you have recorded driving data, you can train an autopilot model:Training can take 5-30 minutes depending on your hardware and dataset size. For Raspberry Pi, it’s recommended to train on a more powerful PC and transfer the model.
Drive on Autopilot
Test your trained model:- Switch mode to Autopilot or Local Pilot
- The car will now drive itself using the trained model
- You can take over control at any time
Next Steps
Installation Details
Detailed installation for your specific platform
Configuration Guide
Deep dive into all configuration options
Training Guide
Advanced training techniques and model tuning
Hardware Build
Build your own Donkeycar from scratch
Troubleshooting
Camera not working
Camera not working
- Check that the camera is properly connected
- For Raspberry Pi Camera: Ensure it’s enabled in
raspi-config - For USB camera: Try
CAMERA_INDEX = 0orCAMERA_INDEX = 1 - Test camera:
raspistill -o test.jpg(Pi Camera) orv4l2-ctl --list-devices(USB)
Car not responding to controls
Car not responding to controls
- Verify your
DRIVE_TRAIN_TYPEis correct - Check pin connections match your configuration
- Run calibration script to verify PWM output
- Check that motors are receiving power
Can't connect to web interface
Can't connect to web interface
- Verify car’s IP address:
hostname -I - Check firewall settings
- Try connecting from the same WiFi network
- Ensure
WEB_CONTROL_PORTis not blocked
Import errors when starting
Import errors when starting
- Verify Donkeycar is installed:
pip list | grep donkey - Ensure you’re using Python 3.11:
python --version - Reinstall with correct extras:
pip install donkeycar[pi]
Getting Help
If you run into issues:- Check the official documentation
- Join the Discord community
- Search GitHub issues
- Ask questions in the #help channel on Discord
