删除手部串联控制驱动,加入系统报错信息话题发布

This commit is contained in:
2026-09-17 13:42:11 +08:00
parent 9479a8ccb2
commit 50aba5217f
5 changed files with 101 additions and 87 deletions
+74 -41
View File
@@ -49,6 +49,80 @@ ros2 topic echo /robot1/right_arm/joint_states
当前反馈中没有关节加速度字段。如果外部软件必须获取关节加速度,需要在上游根据 `velocity[]` 和时间戳自行差分,或者让厂家提供 SDK 原生加速度反馈接口。
## 机器人健康/故障状态
当前 `officer_sdk/lbot_driver` 已发布系统错误信息 topic:
```text
/robot1/system_error
```
消息类型:
```text
lbot_arm_interfaces/msg/SystemError
```
消息定义:
```text
std_msgs/Header header
int32 error_code
string error_msg
bool connected
```
字段含义:
```text
error_code SDK 或 driver 上报的错误码
error_msg 错误信息
connected 发布错误时 driver 是否认为机器人处于连接状态
```
示例:
```bash
ros2 topic echo /robot1/system_error
```
目前该 topic 会在以下情况发布:
```text
SDK error callback 触发时
连接机器人失败时,error_code = -1
状态监控启动失败时,error_code = -2
```
注意:SDK 当前状态结构 `lbot_full_state_t` 只包含左右臂关节状态、末端位姿、时间戳和 IP;没有完整的故障码、告警码、使能状态、急停状态等字段。因此 `/robot1/system_error` 当前是错误事件 topic,不是完整健康状态快照。
仍然可以辅助查看 ROS 日志:
```text
/rosout
```
示例:
```bash
ros2 topic echo /rosout
```
也可以查看启动脚本日志:
```bash
tail -f ~/workspace/wpz_LbotArm/log/lbot_arm_control.log
```
如果后续需要稳定给外部软件使用的完整健康状态快照,建议在 `SystemError.msg` 之外再新增 `RobotHealth.msg`,并在连接/重连逻辑、使能/急停服务回调中维护并周期发布该状态。需要修改的位置:
```text
src/officer_sdk/lbot_arm_interfaces/msg/RobotHealth.msg
src/officer_sdk/lbot_arm_interfaces/CMakeLists.txt
src/officer_sdk/lbot_driver/include/lbot_driver/lbot_driver.h
src/officer_sdk/lbot_driver/src/lbot_driver.cpp
```
## 机械臂关节空间控制
外部软件如果需要发送机械臂各关节目标位置,使用 MoveJ 服务,不是 topic。
@@ -173,45 +247,6 @@ ros2 topic pub --once /robot1/right_hand/set_l20_joint std_msgs/msg/Int32MultiAr
"{data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}"
```
## L20/R20 单指串联位置控制
如果只需要控制单根手指,可以使用:
```text
/robot1/left_hand/set_l20_series_position
/robot1/right_hand/set_l20_series_position
```
消息类型:
```text
std_msgs/msg/Int32MultiArray
```
当前约定的数据格式:
```text
data[0] finger 编号
data[1..6] 该手指的 6 个位置参数
```
finger 编号:
```text
0 thumb
1 index
2 middle
3 ring
4 little
```
示例,控制左手食指:
```bash
ros2 topic pub --once /robot1/left_hand/set_l20_series_position std_msgs/msg/Int32MultiArray \
"{data: [1, 0, 30, 30, 0, 0, 0]}"
```
## 相关代码位置
反馈发布:
@@ -238,8 +273,6 @@ L20/R20 灵巧手 topic:
```text
LeftArmServiceNode::left_hand_l20_set_joint_callback()
RightArmServiceNode::right_hand_l20_set_joint_callback()
LeftArmServiceNode::left_hand_l20_set_series_position_callback()
RightArmServiceNode::right_hand_l20_set_series_position_callback()
```
SDK API 声明: