Motion Listener
controller.application.listener.motion_listener
MotionListener
MotionListener(motion_runner: MotionRunner, message_display: MessageDisplay)
运动消息监听器。
负责监听运动执行器发送的消息,解码位置数据并显示。
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
motion_runner |
MotionRunner
|
运动执行器。 |
message_display |
MessageDisplay
|
消息显示服务。 |
robot_utils |
RobotUtils
|
机器人工具类,用于坐标转换。 |
初始化运动监听器。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
motion_runner
|
MotionRunner
|
运动执行器。 |
必需 |
message_display
|
MessageDisplay
|
消息显示服务。 |
必需 |
源代码位于: src/controller/controller/application/listener/motion_listener.py
16 17 18 19 20 21 22 23 24 25 26 | |
handle_motion_msg
handle_motion_msg(message, message_type)
处理运动消息,手动解析位置数据。
消息格式:AA55 + control(1) + mode(1) + joint_angles(24) + ... + CRC(2) + 0D0A 编码过程:弧度 -> radian2position -> 位置值(32位) -> 大端序16进制
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
message
|
str
|
原始16进制消息字符串。 |
必需 |
message_type
|
str
|
消息类型。 |
必需 |
源代码位于: src/controller/controller/application/listener/motion_listener.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |