Tutorial 02: Enable and Read Status
Prerequisites
- Completed Tutorial 01: Scan and Identify
- Know your motor_id and feedback_id
- Motor powered on and connected
Motor States Overview
Motor control follows a state machine:- DISABLED: Motor windings are not powered, shaft can rotate freely
- ENABLED: Motor is powered and can respond to control commands
Basic Enable/Disable
Using Python
Using CLI
Enable All Motors
When controlling multiple motors, enable them together:Reading Motor State
State Fields
TheMotorState dataclass contains:
| Field | Type | Unit | Description |
|---|---|---|---|
can_id | int | — | Motor CAN ID |
arbitration_id | int | — | CAN arbitration ID |
status_code | int | — | Motor status/error code |
pos | float | rad | Position |
vel | float | rad/s | Velocity |
torq | float | Nm | Estimated torque |
t_mos | float | °C | MOSFET temperature |
t_rotor | float | °C | Rotor temperature |
Basic State Reading
State Reading with Retry
Since feedback is asynchronous, implement retry logic:Continuous State Monitoring
Monitor Loop Pattern
Multi-Motor Monitoring
Understanding poll_feedback_once()
Background Polling (v0.1.7+)
Since version 0.1.7, the SDK uses background polling by default. You typically don’t need to callpoll_feedback_once().
Manual Polling (Legacy/Optional)
For backward compatibility or deterministic timing:Status Code Interpretation
Damiao Status Codes
| Code | Meaning | Action |
|---|---|---|
| 0 | Normal | None |
| 1 | Over-voltage | Check power supply |
| 2 | Under-voltage | Check power supply |
| 3 | Over-current | Reduce load |
| 4 | MOSFET over-temp | Cool down, reduce load |
| 5 | Rotor over-temp | Cool down, reduce load |
| 6 | Communication timeout | Check wiring |
Handling Errors
Temperature Monitoring
Implement continuous temperature monitoring:Complete Example
Next Steps
- Tutorial 03: Mode Switch and Control - Send control commands
- MotorState API - State dataclass reference
- Motor API - Full motor API