DaMiao Motor Python Driver
Python driver for DaMiao brushless motors over CAN with a unified CLI, web GUI, and library API.
Quick links
| Resource | Link |
|---|---|
| Documentation home | GitHub Pages docs |
| Control modes and control laws | Motor Control Modes |
| API reference | DaMiaoController API |
| Firmware reference | DaMiao motor firmware (Gitee) |
| Source code | GitHub repository |
Highlights
- Control modes:
MIT,POS_VEL,VEL,FORCE_POS - Typical motor types:
3507,4310,4340,6006,8006,8009,10010/L - Unified CLI:
damiao scan,send-cmd-*, register tools, anddamiao gui - Python API for multi-motor control with continuous feedback polling
Installation
pip install damiao-motor
Requirements: Linux + CAN interface (socketcan on can0, etc.). Set CAN bitrate to match your motor before running commands.
Quick start
Safety: these examples can move hardware. Secure the motor and keep clear of moving parts.
python examples/example.py
Edit examples/example.py to set motor_id, feedback_id, motor_type, and channel.
from damiao_motor import DaMiaoController
controller = DaMiaoController(channel="can0", bustype="socketcan")
motor = controller.add_motor(motor_id=0x01, feedback_id=0x00, motor_type="4340")
controller.enable_all()
motor.ensure_control_mode("MIT")
motor.send_cmd_mit(
target_position=1.0,
target_velocity=0.0,
stiffness=20.0,
damping=0.5,
feedforward_torque=0.0,
)
state = motor.get_states()
print(state["pos"], state["vel"], state["torq"])
controller.shutdown()
Control laws
MIT mode (impedance control)
T_ref = Kp * (p_des - theta_m) + Kd * (v_des - dtheta_m) + tau_ff
iq_ref = T_ref / K_T
id_ref = 0
Full mode documentation:
CLI commands
All damiao subcommands require --motor-type (example: 4340).
| Command | Purpose |
|---|---|
damiao scan --motor-type 4340 |
Scan bus for motors |
damiao send-cmd-mit --motor-type 4340 --id 1 |
MIT command |
damiao send-cmd-pos-vel --motor-type 4340 --id 1 |
POS_VEL command |
damiao send-cmd-vel --motor-type 4340 --id 1 |
VEL command |
damiao send-cmd-force-pos --motor-type 4340 --id 1 |
FORCE_POS command |
damiao set-zero-command --motor-type 4340 --id 1 |
Zero hold command |
damiao set-zero-position --motor-type 4340 --id 1 |
Set current position to zero |
damiao set-can-timeout --motor-type 4340 --id 1 --timeout-ms 1000 |
Set CAN timeout (reg 9) |
damiao set-motor-id / damiao set-feedback-id |
Change IDs (reg 8 / reg 7) |
damiao gui |
Launch web GUI |
Web GUI
damiao gui
Open the local web UI (default to http://127.0.0.1:5000).
GUI docs: Web GUI guide
API reference
DaMiaoController(channel, bustype)controller.add_motor(motor_id, feedback_id, motor_type)motor.ensure_control_mode(mode)motor.send_cmd_mit(...)motor.send_cmd_pos_vel(...)motor.send_cmd_vel(...)motor.send_cmd_force_pos(...)motor.send_cmd(...)motor.get_states()motor.get_register(...)/motor.write_register(...)
API docs:
Metadata
Release files for damiao-motor 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| damiao_motor-1.0.6.tar.gz | 1.1 MB | Without provenance | Details for damiao_motor-1.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| damiao_motor-1.0.6-py3-none-any.whl | Python 3 | none | any | Details for damiao_motor-1.0.6-py3-none-any.whl |
Total release size: 1.2 MB
Release files / damiao_motor-1.0.6.tar.gz
| Download URL | damiao_motor-1.0.6.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9ce7290a310b1a96120447d5c16242c6dec44e9b02f10de964c900d7db96e14
|
|
BLAKE2b-256 checksum How to use checksums |
87296da7d209e7d892f98a517b03286efff8d168a0b9b37878e0d809bb82dfd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / damiao_motor-1.0.6-py3-none-any.whl
| Download URL | damiao_motor-1.0.6-py3-none-any.whl |
|---|---|
| Size | 64.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eed20f85fdf5c52a7f4c714e4400864c49213396c6a712fdbd90e5370ccfabdd
|
|
BLAKE2b-256 checksum How to use checksums |
6a312f4460d1290135588cb434907ef71d9f4a0572037e82e30183f365deafe4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for damiao-motor 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.