Documentation Index
Fetch the complete documentation index at: https://motorbridge.seeedstudio.com/llms.txt
Use this file to discover all available pages before exploring further.
Source:
motor_cli/MYACTUATOR_API.zh-CN.mdMyActuator API 与模式参考(完整版)
通道兼容说明(PCAN + slcan + Damiao 串口桥)
- Linux SocketCAN 直接使用网卡名:
can0、can1、slcan0。 - 串口类 USB-CAN 需先创建并拉起
slcan0:sudo slcand -o -c -s8 /dev/ttyUSB0 slcan0 && sudo ip link set slcan0 up。 - 仅 Damiao 可选串口桥链路:
--transport dm-serial --serial-port /dev/ttyACM0 --serial-baud 921600。 - Linux SocketCAN 下
--channel不要带@bitrate(例如can0@1000000无效)。 - Windows(PCAN 后端)中,
can0/can1映射PCAN_USBBUS1/2,可选@bitrate后缀。
motor_cli 中 MyActuator 控制能力的实用总表。
1)基础信息
- 厂商名:
myactuator - CAN ID 规则:
- 发送命令:
0x140 + motor_id - 接收反馈:
0x240 + motor_id
- 发送命令:
- 常见 ID 范围:
motor_id in [1, 32] - 对于 ID=1 的默认值:
--motor-id 1--feedback-id 0x241
2)motor_cli 支持模式
scan:扫描 1..32enable:释放刹车(0x77)disable:关电机(0x80)stop:停止闭环(0x81)set-zero:将当前位置写为编码器零点(0x64,断电重启后持久生效)status:读取状态2(0x9C)current:电流闭环(0xA1)vel:速度闭环(0xA2)pos:绝对位置闭环(0xA4)version:读取版本日期(0xB2)mode-query:读取系统运行模式(0x70)
3)参数与单位
| 参数 | 类型 | 默认值 | 作用模式 | 单位 |
|---|---|---|---|---|
--start-id | u16 | 1 | scan | id |
--end-id | u16 | 32 | scan | id |
--current | f32 | 0.0 | current | A |
--vel | f32 | 0.0 | vel | rad/s |
--pos | f32 | 0.0 | pos | rad |
--max-speed | f32 | 8.726646 | pos | rad/s |
--loop | u64 | 1 | 全部 | 次 |
--dt-ms | u64 | 20 | 全部 | ms |
4)当前 CLI 的编码细节
CLI 输入统一使用弧度/弧度每秒,再在内部转换为 MyActuator 协议使用的角度/角度每秒。A1电流模式:[4..5] = int16(current / 0.01)
A2速度模式:[4..7] = int32((vel_rad_s.to_degrees()) * 100)
A4绝对位置模式:[2..3] = uint16(max_speed_rad_s.to_degrees())[4..7] = int32(pos_rad.to_degrees() * 100)
5)反馈解码(状态/命令回包)
对于0x9C、0xA1、0xA2、0xA4 回包:
data[1]:温度(int8, °C)data[2..3]:电流(int16 * 0.01 A)data[4..5]:速度(int16, deg/s)data[6..7]:轴角(int16 * 0.01 deg,近圈角)
0x92 多圈角回包:
data[4..7]:多圈角(int32 * 0.01 deg)
angle=...:来自状态2(0x9C)mt_angle=...:来自多圈角(0x92),用于绝对位置判定
6)常用命令示例
7)故障排查
如果“有回包但不转”:- 用
0x9A查询状态1并看故障码。 - 若故障码为
0x0004,表示欠压保护。 - 先恢复供电电压,再执行复位(
0x76)与释放刹车(0x77)。
data[3]:刹车释放标志data[4..5]:母线电压(uint16 * 0.1 V)data[6..7]:故障码