Overview
The donkey createcar command creates a new Donkeycar application with all the necessary files, configuration, and directory structure for your autonomous vehicle.
Creating Your Car
Basic Command
This creates a new car application in the ~/mycar directory.
Command Options
Options:
--path: Directory path where car folder will be created (default: ~/mycar)
--template: Car template to use (default: complete)
--overwrite: Replace existing files if they exist
Available Templates
Donkeycar provides several templates for different use cases:
complete (Default)
- Full-featured template with all capabilities
- Web controller + joystick support
- Image transformations and augmentations
- Telemetry and logging
- Recommended for most users
basic
- Minimal setup for simple driving
- Good for learning the basics
- Less configuration overhead
path_follow
- GPS or odometry-based path following
- For outdoor navigation
cv_control
- Computer vision-based control
- Uses OpenCV for line detection
- No neural network training required
simulator
- Configured for Donkey Gym simulator
- Test without physical hardware
Template Examples
Directory Structure
After running createcar, you’ll have this structure:
Key Files Explained
manage.py
The main application script that runs your car.
Usage:
Command Line Options:
--model=<model>: Path to trained model file
--type=<type>: Model architecture (linear, categorical, resnet18)
--js: Use physical joystick controller
--myconfig=<filename>: Specify custom config file (default: myconfig.py)
config.py
Default configuration file with all available settings. Do not edit this file directly - it will be overwritten when you update Donkeycar.
Key sections:
- Hardware setup (camera, drive train, sensors)
- AI and training parameters
- Driving modes and behaviors
- Web controller settings
myconfig.py
Your personal configuration overrides. Edit this file to customize your car.
How it works:
config.py is loaded first with defaults
myconfig.py overrides any settings you specify
- Only uncomment and set the values you want to change
Example myconfig.py:
Only include the settings you want to change in myconfig.py. This keeps your configuration clean and makes it easier to upgrade Donkeycar later.
calibrate.py
A dedicated calibration script for fine-tuning your steering and throttle.
This starts a web server where you can adjust PWM values in real-time at:
train.py
Script for training AI models on your collected data.
Data and Models Directories
data/
Stores recorded driving sessions (called “tubs”).
Structure:
Each tub contains:
- Camera images
- Steering/throttle values
- Timestamps
- Metadata
models/
Stores trained AI models.
Common formats:
.h5: Keras model (TensorFlow)
.tflite: TensorFlow Lite (optimized for Pi)
.pth: PyTorch model
.savedmodel: TensorFlow SavedModel format
Configuration Overview
Essential Settings
Camera:
Drive Train:
Controller:
Web Interface:
Recording:
AI/Training:
Template Customization
How manage.py Works
The manage.py file is a Python script that:
- Loads configuration from
config.py and myconfig.py
- Creates a Vehicle object
- Adds parts (camera, controller, motors, etc.) to the vehicle
- Runs the vehicle loop at specified frequency
Key components:
Adding Custom Parts
You can modify manage.py to add custom functionality. See the Parts documentation for details.
Updating Your Car
Update manage.py and Scripts
When you update Donkeycar library, update your car application:
This updates:
manage.py
calibrate.py
train.py
config.py
myconfig.py is never overwritten by the update command. Your custom settings are safe.
Common Configuration Patterns
Beginner Setup
Racing Setup
Development/Testing
Troubleshooting
“No module named ‘donkeycar’”
- Activate your Python virtual environment
- Verify Donkeycar is installed:
pip list | grep donkey
“Permission denied” when running manage.py
Config changes not taking effect
- Ensure changes are in
myconfig.py, not config.py
- Check for Python syntax errors
- Verify indentation (Python is whitespace-sensitive)
Car runs but doesn’t match config
- Specify myconfig explicitly:
python manage.py drive --myconfig=myconfig.py
- Check that myconfig.py is in the same directory as manage.py
Next Steps