Skip to main content

Python driver for DaMiao motors

Project description

DaMiao Motor Python Driver

Python 3.8+ Platform PyPI Docs Repository

Python driver for DaMiao brushless motors over CAN with a unified CLI, web GUI, and library API.

DaMiao Motor Control GUI

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, and damiao 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)

MIT mode control law

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

API docs:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

damiao_motor-1.0.7b1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

damiao_motor-1.0.7b1-py3-none-any.whl (67.2 kB view details)

Uploaded Python 3

File details

Details for the file damiao_motor-1.0.7b1.tar.gz.

File metadata

  • Download URL: damiao_motor-1.0.7b1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for damiao_motor-1.0.7b1.tar.gz
Algorithm Hash digest
SHA256 e09702490344c19e9ee1894b85a82b40c36b88d390f935921c7a662169f630ba
MD5 2283c9a25d462e6d46288eac68c3151d
BLAKE2b-256 15463c79357682348f5a4e2ca654a66c124e3720fa9da41e048e4916c632e3e7

See more details on using hashes here.

File details

Details for the file damiao_motor-1.0.7b1-py3-none-any.whl.

File metadata

  • Download URL: damiao_motor-1.0.7b1-py3-none-any.whl
  • Upload date:
  • Size: 67.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for damiao_motor-1.0.7b1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e6cfc51f6da36c4f2ad3a9eb07a8043fd96134b1ac729d9aad9860f112df0dc
MD5 42fcde48b3441c55c79a66979c31555f
BLAKE2b-256 ab6e1945d55760d187298a035626b987fcac26dea9f2341f953cba2bc7366bdb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page