Overview
MQTT telemetry provides:- Real-time monitoring - Stream metrics to remote dashboards
- Remote logging - Capture Python logs over the network
- Data streaming - Push sensor readings to IoT platforms
- Performance analysis - Monitor throttle, steering, and velocity
- Flexible topics - Publish to custom MQTT topics
Architecture
The telemetry system uses MQTT protocol to publish data:Configuration
Enable MQTT telemetry inmyconfig.py:
donkeycar/templates/cfg_path_follow.py:481-494.
Environment Variables
Override settings with environment variables:MqttTelemetry Part
Basic Usage
donkeycar/templates/path_follow.py:102-103.
Implementation
The telemetry part fromdonkeycar/parts/telemetry.py:24-51:
Publishing Formats
Individual Topics (Default)
Each metric publishes to its own topic:JSON Format
Publish all metrics in a single JSON message:donkeycar/parts/telemetry.py:109-111:
Custom Metrics
Add custom metrics to telemetry:donkeycar/parts/telemetry.py:53-61:
Logging Integration
Publish Python logs via MQTT:donkeycar/parts/telemetry.py:48-51:
Manual Reporting
Publish arbitrary metrics:donkeycar/parts/telemetry.py:73-85:
Threaded Operation
The telemetry part runs in a background thread:donkeycar/parts/telemetry.py:175-179.
MQTT Brokers
Public Brokers
Test with public MQTT brokers:Local Broker
Install Mosquitto locally:Cloud Platforms
Connect to IoT platforms:Monitoring
Command Line
Subscribe to telemetry topics:Python Subscriber
Web Dashboard
Use MQTT dashboards:- Node-RED - Visual flow-based dashboard
- Grafana - Time-series visualization
- Home Assistant - IoT dashboard
- HiveMQ Web Client - Browser-based monitoring
Data Types
Supported telemetry types:donkeycar/parts/telemetry.py:64-71:
Performance
Monitor telemetry queue:donkeycar/parts/telemetry.py:95-96:
Best Practices
- Use local broker - Reduce latency and network dependencies
- Limit publish rate - Balance resolution with bandwidth
- Monitor queue size - Detect slow network or broker issues
- Filter metrics - Only publish necessary data
- Use JSON for dashboards - Easier to parse in web UIs
Troubleshooting
Connection Failed
No Data Published
High Queue Size
- Increase
TELEMETRY_PUBLISH_PERIOD - Reduce number of metrics
- Check network bandwidth
- Use local MQTT broker
Next Steps
- Monitor path following with telemetry
- Stream kinematics pose data
- Integrate with simulator metrics
