An unofficial Damiao motor control library, developed based on the official SDK. 一个非官方的达妙电机控制库, 基于官方sdk二次开发
Project description
pydamiao
一个非官方的达妙电机 Python 库。
pydamiao 基于官方 SDK 的工作流做了更 Python 风格的封装,提供串口通信、电机管理、参数读写和常见控制模式的高层接口,适合快速集成到自己的项目中。
特性
- 基于
pyserial的简单串口总线封装 - 提供
Motor和MotorManager高层接口 - 同时支持单电机和多电机场景
- 内置参数读写辅助方法
- 支持
MIT、VEL、POS_VEL等常见控制模式
安装
从源码安装:
git clone https://github.com/DBinK/pydamiao.git
cd pydamiao
pip install -e .
快速开始
import math
import time
from pydamiao import ControlMode, MotorManager, MotorType, SerialBus
bus = SerialBus("COM3", baudrate=921600, timeout=0.01)
manager = MotorManager(bus)
motor1 = manager.add_motor(MotorType.DM4310, 0x06, 0x12)
motor2 = manager.add_motor(MotorType.DM4310, 0x05, 0x12)
if not motor1.set_mode(ControlMode.POS_VEL).is_ok:
raise RuntimeError("motor1 切换到 POS_VEL 失败")
if not motor2.set_mode(ControlMode.VEL).is_ok:
raise RuntimeError("motor2 切换到 VEL 失败")
motor1.save_params().unwrap()
motor2.save_params().unwrap()
for result in manager.enable_all().values():
result.unwrap()
for _ in range(1000):
q = math.sin(time.time())
motor1.set_pos_vel(q * 8, 3)
motor2.set_velocity(8 * q)
time.sleep(0.001)
bus.close()
API 概览
SerialBus:共享串口通信总线Motor:单个电机的高层控制对象MotorManager:同一总线上的多电机管理器ControlMode、MotorType、MotorReg:协议相关枚举和辅助类型
示例
可运行示例见 examples 目录。
项目状态
项目仍在持续迭代中,正式稳定版本发布前 API 可能会继续调整。
许可证
MIT,详见 LICENSE。
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydamiao-0.1.1.tar.gz.
File metadata
- Download URL: pydamiao-0.1.1.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53bd91dff094fc955ce6439dd409814ad71989b92ae863451908d6b184cdf95e
|
|
| MD5 |
d0362c2649af10c79c37439129cd3bed
|
|
| BLAKE2b-256 |
a503309142b9579a4a68ccbbb613f46cc6d0bedb4949ab21a90f82aeb3b5b54f
|
Provenance
The following attestation bundles were made for pydamiao-0.1.1.tar.gz:
Publisher:
test_and_publish.yml on DBinK/pydamiao
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydamiao-0.1.1.tar.gz -
Subject digest:
53bd91dff094fc955ce6439dd409814ad71989b92ae863451908d6b184cdf95e - Sigstore transparency entry: 1417623683
- Sigstore integration time:
-
Permalink:
DBinK/pydamiao@0a402ad8e5aa69d84e94ed7b83871ea3d5ddedf8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DBinK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test_and_publish.yml@0a402ad8e5aa69d84e94ed7b83871ea3d5ddedf8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pydamiao-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pydamiao-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6965a35d20eb1625b7704c095323911c80b9149c309346e3d8744b3a8522383e
|
|
| MD5 |
6d07ed0295b63f60f26ddd72d0b4e6ae
|
|
| BLAKE2b-256 |
ad38c4be2f23efed033d2e96c231a790db9ef105f7dc17c4cd268100959a7fc8
|
Provenance
The following attestation bundles were made for pydamiao-0.1.1-py3-none-any.whl:
Publisher:
test_and_publish.yml on DBinK/pydamiao
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydamiao-0.1.1-py3-none-any.whl -
Subject digest:
6965a35d20eb1625b7704c095323911c80b9149c309346e3d8744b3a8522383e - Sigstore transparency entry: 1417623702
- Sigstore integration time:
-
Permalink:
DBinK/pydamiao@0a402ad8e5aa69d84e94ed7b83871ea3d5ddedf8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DBinK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test_and_publish.yml@0a402ad8e5aa69d84e94ed7b83871ea3d5ddedf8 -
Trigger Event:
push
-
Statement type: