Skip to main content
The Config class manages configuration for your Donkeycar. It loads settings from Python files (config.py and myconfig.py) and makes them available as attributes.

Overview

Donkeycar uses a two-file configuration system:
  1. config.py - Default settings that come with Donkeycar templates
  2. myconfig.py - Your personal overrides that take precedence
This allows you to update Donkeycar without losing your custom settings.

Loading Configuration

load_config(config_path=None, myconfig="myconfig.py")

The primary function to load configuration.
str
default:"None"
Path to config.py file. If None, searches for config.py in the current working directory.
str
default:"myconfig.py"
Filename of personal config overrides. Looked for in the same directory as config.py.
Returns:
Config
Config instance with all settings loaded as attributes
Example: Default Loading
Example: Specify Config Path
Example: Custom Override File
Example: From manage.py

Config Class

from_pyfile(filename)

Load configuration from a Python file.
str
required
Path to the Python file containing configuration variables
Returns:
bool
True if file was loaded successfully
Only variables in UPPER_CASE are loaded from the file. This convention separates configuration from code.

from_object(obj)

Load configuration from a Python object (module, class, etc).
object
required
Object containing configuration attributes

from_dict(d, keys=[])

Update configuration from a dictionary.
dict
required
Dictionary of configuration key-value pairs
list
default:"[]"
Optional list of keys to update. If empty, all UPPER_CASE keys are updated.
Example: Selective Override

show()

Print all configuration values to console.

__str__()

Get configuration as a string (list of tuples).

to_pyfile(path)

Save current configuration to a Python file.
str
required
Path where the configuration file should be written
Generated file format:

Configuration System

config.py vs myconfig.py

The two-file system separates defaults from customization: config.py (template defaults)
myconfig.py (your overrides)
Result when loaded:

Common Configuration Options

Camera Settings

Drive Train Settings

Vehicle Loop Settings

Joystick/Controller Settings

Training Settings

Recording Settings

AI/Autopilot Settings

Usage Examples

Example: Basic Drive Script

Example: Environment-Specific Configs

Example: Runtime Overrides

Example: Config Validation

Best Practices

Keep myconfig.py Minimal

Only override what you need to change:

Document Your Overrides

Add comments explaining why you changed values:

Version Control

Track myconfig.py in git to preserve your settings:

Backup Before Updates

Before updating Donkeycar:

See Also