腰部关节说明

一、概述

腰部是机器人的躯干俯仰/姿态调节机构。它最大的特点不是接口多,而是同一台机器上只有一套实现:手册第五章明确写了三种驱动方案由 waist_model 配置决定,三者互斥,不能混用。

本文覆盖手册第五章腰部的全部二次开发接口,共 16 条:

Zerr(2 条)
1 控制话题 + 1 状态话题
GiantCrab(2 条)
1 控制话题 + 1 状态话题
YD100(12 条)
4 话题 + 6 服务 + 2 动作
每接口配示例
命令行 / Python / C++ 各一段

Zerr 与 GiantCrab 是单轴方案,对外只暴露一组「位置命令 + 当前角度」,接口极简,其使能、速度、参数读写、自检全部属于系统内部接口。YD100 是四轴方案,接口最全,且手册特别说明:采用 YD100 的机型,升降也由本组接口控制。

对接腰部真正要小心的是三件事:① 先确认自己的机器是哪套 waist_model,走错方案一个接口都调不通;② 弧度和度在 YD100 的规划层与驱动层之间是分开的;③ YD100 三个状态话题是 BEST_EFFORT 发布,订阅端不对齐 QoS 会「静默收不到数据」。

腰部接口挂在 /fd_robot/waist*、/fd_robot/yd100* 下,由 fd_waist_motor_driver_pkg(Zerr / GiantCrab)、yd100_control、tl_hardware、yd100_controller(YD100)分别提供。驱动节点未启动时,相关接口不会有任何响应。

1.1 与 fd_api 腰部关节接口的关系

工作区已有 《fd_api 腰部关节说明》(C++ 封装层)。两者是两个层级,不要混用:

对比项 fd_api 封装层 本文(ROS 2 原生接口)
调用方式 fd_robot::Control::waist_set_pos() ros2 topic pub / ros2 service call / send_goal
角度单位 度(waist_set_pos(spd, acc, dec, pos_deg)) Zerr / GiantCrab 弧度;YD100 规划层弧度、驱动层度
接口粒度 单轴语义(前倾 / 后仰 / 位置) 按驱动方案分栈;YD100 为四轴 + 笛卡尔增量
可用范围 受封装层支持范围限制 可触及 YD100 的使能、故障复位、安全停机、单关节步进等全部能力
不要同时用两套接口控制腰部。手册 1.2 节接入步骤第 6 条明确:同一执行器同一时间只能有一个控制来源。fd_api 与 ROS 2 接口同时下发会互相抢控制权。

1.2 腰部在整机中的位置

上层应用程序
ros2 topic pub / service call / action send_goal
▼
腰部 ROS 2 接口层
Zerr · GiantCrab · YD100(按 waist_model 三选一)
▼
驱动 / 规划层
fd_waist_motor_driver_pkg · yd100_control · tl_hardware · yd100_controller
▼
腰部执行机构
单轴(Zerr / GiantCrab) |  四轴(YD100)

二、运行前提与约定

2.1 环境与驱动前提

项 要求 说明
环境 source install/setup.bash 调用任何接口前先执行
域号 ROS_DOMAIN_ID=25 必须与整机一致,否则看不到任何话题
驱动节点 已启动 驱动未启动时接口不会有任何响应,先 ros2 topic list 确认接口可见
腰部驱动类型 waist_model zerr / giantcrab / yd100,三者互斥,决定本文哪一节适用于你
确认方式:ros2 topic list | grep waist。若能看到 /fd_robot/waist_joints/*,说明是 YD100 方案;若只有 /fd_robot/waist_motor/cmd 与 /fd_robot/waist/current_pose,则是 Zerr 或 GiantCrab——两者再靠 ros2 param 或现场配置区分。

2.2 三种驱动方案对照

项 Zerr GiantCrab YD100
配置条件 waist_model=zerr waist_model=giantcrab waist_model=yd100
轴向 单轴 单轴 四轴(waist_joint1–4)
来源包 fd_waist_motor_driver_pkg fd_waist_motor_driver_pkg yd100_control / tl_hardware / yd100_controller
二次开发接口 2 条(1 命令 + 1 反馈) 2 条(1 命令 + 1 反馈) 12 条(4 话题 + 6 服务 + 2 动作)
单位 弧度 弧度 规划层弧度 / 驱动层度 / 笛卡尔 dx,dz 米
软限位 fd_api 常用约 0–35°(约 0–0.61 rad),超出限幅 以驱动参数为准 各轴默认约 −90°~90°,由 yd100_j*_lower/upper_limit_deg 设定(现场配置)
使能 / 速度 / 参数 / 自检 有,但全部为系统内部接口 不提供 有(enable / fault_reset / safe_stop 为二次开发接口)
动作接口 无 无 2 个 move_to_location
反馈频率 1 Hz 默认 10 Hz 50 / 100 / 250 Hz(视控制路径)
GiantCrab 有一个容易误解的接口名:/fd_robot/waist_motor/status 是命令输入(发送如 stop 的字符串),不是状态反馈。它不是二次开发接口,要读角度请订阅 /fd_robot/waist/current_pose。

2.3 单位约定(本文最易错处)

接口 / 字段 单位 备注
waist_motor/cmd 弧度 Zerr / GiantCrab,name=['waist']
waist/current_pose 弧度 Zerr / GiantCrab,同上约定
waist_joints/joint_state 弧度 YD100,四轴位置与速度
waist_joints/cartesian_cmd dx, dz 米;dpitch, dyaw 弧度 增量命令,name=['dx','dz','dpitch','dyaw']
waist_joints/cartesian_state x, z 米;pitch, yaw 弧度 绝对位姿
WaistMoveToLocation.positions_rad 弧度 规划层动作(tl_hardware)
Yd100MoveToLocation.positions_deg 度 驱动层动作(yd100_controller),关节名也不同
joint_step.delta_rad 弧度 字段名已含单位
记住这条分界线:YD100 的规划层(tl_hardware)说弧度,驱动层(yd100_controller)说度。两个 move_to_location 同名但分属两层,关节名前缀也不同(waist_joint* vs yd100_j*)。

2.4 QoS:YD100 必须对齐 BEST_EFFORT

这是腰部对接最容易「查不出原因」的坑。/fd_robot/waist_joints/joint_state、cartesian_state、motion_status 三个话题均以 BEST_EFFORT 发布。订阅端必须同样使用 BEST_EFFORT,否则收不到任何消息,而且 ROS 2 不会报错——表现为「订阅成功了,但回调一次都不进」。

命令行 ros2 topic echo 默认自适应,通常正常;用 rclpy / rclcpp 自行创建订阅时必须显式指定(见第七、八章示例)。

2.5 安全前提

  • 始终订阅急停:程序运行期间订阅 /fd_robot/emergency_signal,data 为 true 时立即停止发送任何运动命令。
  • 急停会改变腰部状态:触发急停、关机或重启服务时,升降、腰部等执行器会进入安全状态,不要把关机、重启相关接口当作常规控制手段。
  • 单一控制来源:Pico 遥操作、/teleop/joint_targets_* 或底层 /tl_control/* 正在控制时,不要再通过本文接口下发命令。
  • 现场确认:下发运动命令前先确认整机状态与周边安全。

三、接口总览

下表列出腰部全部二次开发接口(手册第五章分割线以上)。话题 表示由你的程序发布或订阅,服务 表示发起调用,动作 表示发送目标并跟踪结果。

3.1 二次开发接口清单

方案 类型 名称 说明 配置条件
Zerr 话题 /fd_robot/waist_motor/cmd 腰部位置命令(发布,弧度) waist_model=zerr
话题 /fd_robot/waist/current_pose 当前腰部角度(订阅,弧度);1 Hz waist_model=zerr
GiantCrab 话题 /fd_robot/waist_motor/cmd 腰部位置命令(发布,弧度) waist_model=giantcrab
话题 /fd_robot/waist/current_pose 当前腰部角度(订阅,弧度);默认 10 Hz waist_model=giantcrab
YD100 话题 /fd_robot/waist_joints/joint_state 四轴位置和速度(弧度);50/100/250 Hz;BEST_EFFORT waist_model=yd100
话题 /fd_robot/waist_joints/cartesian_cmd 笛卡尔空间增量命令:dx / dz / dpitch / dyaw waist_model=yd100
话题 /fd_robot/waist_joints/cartesian_state 笛卡尔绝对位姿 x/z(m)、pitch/yaw(rad);BEST_EFFORT waist_model=yd100
话题 /fd_robot/waist_joints/motion_status 运动模式与到位状态;BEST_EFFORT waist_model=yd100
服务 /fd_robot/yd100/enable 轴使能;axis_names 为空时作用于全部轴 waist_model=yd100
服务 /fd_robot/yd100/fault_reset 故障复位;axis_names 规则同 enable waist_model=yd100
服务 /fd_robot/yd100/safe_stop 安全停机,停机状态会保持(锁存) waist_model=yd100
服务 /fd_robot/waist_joints/joint_step 单关节相对步进(delta_rad 弧度) waist_model=yd100
服务 /fd_robot/waist_joints/motion_stop 停止当前腰部运动(Trigger) waist_model=yd100
服务 /fd_robot/waist_joints/cartesian_stop 与 motion_stop 功能相同(别名) waist_model=yd100
动作 /fd_robot/waist_joints/move_to_location 规划层关节运动到目标(positions_rad,弧度) waist_model=yd100
动作 /fd_robot/yd100_controller/move_to_location 驱动层关节运动到目标(positions_deg,度) waist_model=yd100
两个 move_to_location 别选错。同名不同层:/fd_robot/waist_joints/move_to_location 属规划层(tl_hardware),关节名 waist_joint*、单位弧度;/fd_robot/yd100_controller/move_to_location 属驱动层(yd100_controller),关节名 yd100_j*、单位度。日常对接建议走规划层。

3.2 系统内部接口(仅供排查,勿与二次开发接口同时调用)

方案 名称 类型 说明
Zerr /fd_robot/waist_motor/velocity_cmd 话题 速度控制,参数 servo_id、vel、acc、dec
/fd_robot/waist_motor/enable_cmd 话题 使能
/fd_robot/waist_motor/position_cmd 话题 底层位置控制
/fd_robot/waist_motor/pt_cmd 话题 PT 模式控制
/fd_robot/waist_motor/motor_info 话题 电机运行数据;1 Hz
Zerr /fd_robot/waist_motor/get_motor_status 服务 查询电机状态
/fd_robot/waist_motor/read_param_srv 服务 读取参数
/fd_robot/waist_motor/write_param_srv 服务 写入参数
/fd_robot/self_check/waist 服务 腰部自检
GiantCrab /fd_robot/waist_motor/status 话题 字符串控制命令(如 stop),是命令输入不是反馈
YD100 /fd_robot/yd100/state_array 话题 各轴 CiA 402 状态与总线状态;50 Hz
/fd_robot/waist_joints/joint_cmd 话题 四轴关节点位流(仅控制过程中发布);默认约 250 Hz
/fd_robot/waist_joints/joint_cmd_status 话题 点位流状态机;10 Hz
/fd_robot/yd100_controller/jog_cmd 话题 手动点动(Jog),velocity 单位为 rad/s
YD100 /fd_robot/yd100/hold 服务 临时保持位置(不锁存),由控制器内部使用
/fd_robot/yd100/csp_trace 服务 CSP / 点位流跟踪开关
/fd_robot/yd100_controller/jog_stop 服务 停止点动

四、Zerr / GiantCrab 接口详解

Zerr 与 GiantCrab 都是单轴方案,对外只露出两个同名话题,差异只在软限位来源和反馈频率。本章把两个方案合并讲解,参数表里用配置条件区分。

/fd_robot/waist_motor/cmd 话题
腰部位置命令。由你的程序发布,类型 sensor_msgs/JointState,位置单位为弧度。
配置条件:waist_model=zerr 或 waist_model=giantcrab。
字段 侧 类型 取值 说明
name 消息 string[] ['waist'] 固定为 waist
position 消息 float64[] 弧度 目标角度;Zerr 超出软限位约 0–35°(约 0–0.61 rad)时限幅
Zerr 的限幅是静默的:超出范围会被截断到边界值后继续执行,调用方不会收到错误提示。如果发的目标「看起来没生效」,先怀疑是被限幅了。
GiantCrab 的限位以驱动参数为准,手册未给出具体数值。

示例

① 命令行(ros2 CLI)

# 读取当前角度(Zerr / GiantCrab 通用)
ros2 topic echo /fd_robot/waist/current_pose

# 发送位置命令:name 固定 'waist',position 单位为弧度
# 0.0 rad ≈ 0°(回中)
ros2 topic pub -1 /fd_robot/waist_motor/cmd sensor_msgs/msg/JointState \
  "{name: ['waist'], position: [0.0]}"

# 目标约 20°(20 × π / 180 ≈ 0.349 rad)
ros2 topic pub -1 /fd_robot/waist_motor/cmd sensor_msgs/msg/JointState \
  "{name: ['waist'], position: [0.349]}"

# 查看一次即可退出
ros2 topic echo --once /fd_robot/waist/current_pose

② Python(rclpy)

import math
import rclpy
from rclpy.node import Node
from sensor_msgs.msg import JointState

class WaistSimple(Node):
    def __init__(self):
        super().__init__('waist_simple')
        self.pub = self.create_publisher(JointState, '/fd_robot/waist_motor/cmd', 10)
        # 反馈话题为普通 RELIABLE,默认 QoS 即可(BEST_EFFORT 要求仅 YD100)
        self.sub = self.create_subscription(
            JointState, '/fd_robot/waist/current_pose', self.on_pose, 10)

    def on_pose(self, msg):
        # position 单位为弧度,转换为度便于观察
        rad = msg.position[0] if msg.position else float('nan')
        self.get_logger().info(f'waist = {rad:.4f} rad ({math.degrees(rad):.2f} deg)')

    def move_deg(self, deg: float):
        cmd = JointState()
        cmd.name = ['waist']
        cmd.position = [math.radians(deg)]   # 接口要求弧度,这里用度做入参换算
        self.pub.publish(cmd)
        self.get_logger().info(f'cmd waist -> {deg:.2f} deg ({math.radians(deg):.4f} rad)')

def main():
    rclpy.init()
    node = WaistSimple()
    node.move_deg(20.0)          # 目标 20°
    rclpy.spin(node)             # 持续接收 current_pose
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <cmath>
#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/joint_state.hpp>

using sensor_msgs::msg::JointState;

class WaistSimple : public rclcpp::Node {
public:
  WaistSimple() : Node("waist_simple") {
    pub_ = create_publisher<JointState>("/fd_robot/waist_motor/cmd", 10);
    sub_ = create_subscription<JointState>(
        "/fd_robot/waist/current_pose", 10,
        [this](JointState::SharedPtr msg) {
          if (msg->position.empty()) return;
          const double rad = msg->position[0];
          RCLCPP_INFO(get_logger(), "waist = %.4f rad (%.2f deg)",
                      rad, rad * 180.0 / M_PI);
        });
  }

  void moveDeg(double deg) {
    JointState cmd;
    cmd.name = {"waist"};
    cmd.position = {deg * M_PI / 180.0};   // 入参用度,下发转弧度
    pub_->publish(cmd);
    RCLCPP_INFO(get_logger(), "cmd waist -> %.2f deg", deg);
  }

private:
  rclcpp::Publisher<JointState>::SharedPtr pub_;
  rclcpp::Subscription<JointState>::SharedPtr sub_;
};

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  auto node = std::make_shared<WaistSimple>();
  node->moveDeg(20.0);
  rclcpp::spin(node);
  rclcpp::shutdown();
  return 0;
}
/fd_robot/waist/current_pose 话题
当前腰部角度反馈。由你的程序订阅,类型 sensor_msgs/JointState,name=['waist'],位置单位为弧度。
配置条件:waist_model=zerr(1 Hz)或 waist_model=giantcrab(默认 10 Hz)。
字段 侧 类型 取值 说明
name 消息 string[] ['waist'] 固定为 waist
position 消息 float64[] 弧度 当前角度
Zerr 的反馈只有 1 Hz。如果你写的是「发布命令后 sleep 0.2s 再读角度」,会读到上一次的旧值。正确做法是订阅并等待数据更新,或把判定超时放宽到秒级。

示例

① 命令行(ros2 CLI)

# 持续观察角度变化(Ctrl+C 退出)
ros2 topic echo /fd_robot/waist/current_pose

# 查看发布频率是否符合预期(Zerr 应为 1 Hz 左右)
ros2 topic hz /fd_robot/waist/current_pose

# 查看话题类型与字段定义
ros2 interface show sensor_msgs/msg/JointState

② Python(rclpy)

import math
import rclpy
from rclpy.node import Node
from sensor_msgs.msg import JointState

class WaistWatch(Node):
    """订阅腰部角度,按目标值判定是否到位。"""
    def __init__(self, target_rad: float, tol_rad: float = 0.02):
        super().__init__('waist_watch')
        self.target = target_rad
        self.tol = tol_rad
        self.reached = False
        self.create_subscription(
            JointState, '/fd_robot/waist/current_pose', self.on_pose, 10)

    def on_pose(self, msg):
        if not msg.position:
            return
        cur = msg.position[0]
        self.get_logger().info(
            f'cur={cur:.4f} target={self.target:.4f} '
            f'err={abs(cur - self.target):.4f} rad')
        if abs(cur - self.target) <= self.tol:
            self.reached = True
            self.get_logger().info('腰部已到位')
            raise SystemExit

def main():
    rclpy.init()
    node = WaistWatch(target_rad=math.radians(20.0))
    try:
        rclpy.spin(node)
    except SystemExit:
        pass
    finally:
        node.destroy_node()
        rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <cmath>
#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/joint_state.hpp>

class WaistWatch : public rclcpp::Node {
public:
  WaistWatch(double target_rad, double tol_rad = 0.02)
      : Node("waist_watch"), target_(target_rad), tol_(tol_rad) {
    sub_ = create_subscription<sensor_msgs::msg::JointState>(
        "/fd_robot/waist/current_pose", 10,
        [this](sensor_msgs::msg::JointState::SharedPtr msg) {
          if (msg->position.empty()) return;
          const double cur = msg->position[0];
          RCLCPP_INFO(get_logger(), "cur=%.4f target=%.4f err=%.4f rad",
                      cur, target_, std::fabs(cur - target_));
          if (std::fabs(cur - target_) <= tol_) {
            RCLCPP_INFO(get_logger(), "腰部已到位");
            rclcpp::shutdown();
          }
        });
  }
private:
  double target_, tol_;
  rclcpp::Subscription<sensor_msgs::msg::JointState>::SharedPtr sub_;
};

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  rclcpp::spin(std::make_shared<WaistWatch>(20.0 * M_PI / 180.0));
  rclcpp::shutdown();
  return 0;
}
到位判定用的容差数值手册未给出。上面示例中的 0.02 rad(约 1.15°)是工程建议值,不是手册数据。Zerr 反馈仅 1 Hz,容差过小会导致判定一直不通过,建议结合实际机构刚度放宽。

五、YD100 话题接口详解

YD100 是四轴腰部方案。驱动层关节名为 yd100_j1–yd100_j4,对外发布状态时映射为 waist_joint1–waist_joint4。本章四个话题中有三个是 BEST_EFFORT,请先看 2.4 节的 QoS 说明。

旧话题 /fd_robot/yd100/joint_states 已移除,请勿使用。需要关节状态请订阅 /fd_robot/waist_joints/joint_state。
另外,系统中没有 cartesian_status 话题,运动状态统一由 motion_status 发布——这一点已列入手册附录已知限制。
/fd_robot/waist_joints/joint_state 话题 BEST_EFFORT
四轴位置和速度反馈。由你的程序订阅,类型 sensor_msgs/JointState,单位为弧度。来源包 yd100_control。
发布频率取决于控制路径:点位流模式约 100 Hz 或 250 Hz;ros2_control 模式跟随 state_array,约 50 Hz。
字段 侧 类型 取值 说明
name 消息 string[] waist_joint1–waist_joint4 四轴关节名
position 消息 float64[] 弧度 各轴当前位置
velocity 消息 float64[] 弧度/s 各轴当前速度

示例

① 命令行(ros2 CLI)

# 查看四轴状态(ros2 topic echo 的 QoS 自适应,通常可直接收到)
ros2 topic echo /fd_robot/waist_joints/joint_state

# 确认实际发布频率(50 / 100 / 250 Hz 之一)
ros2 topic hz /fd_robot/waist_joints/joint_state

# 查看 QoS 配置,确认发布端是 BEST_EFFORT
ros2 topic info -v /fd_robot/waist_joints/joint_state

② Python(rclpy)— 必须显式指定 BEST_EFFORT

import rclpy
from rclpy.node import Node
from rclpy.qos import QoSProfile, ReliabilityPolicy, HistoryPolicy
from sensor_msgs.msg import JointState

class WaistJointState(Node):
    def __init__(self):
        super().__init__('waist_joint_state_sub')

        # ★ 关键:发布端为 BEST_EFFORT,订阅端必须一致,否则收不到任何消息且不报错
        qos = QoSProfile(
            depth=10,
            history=HistoryPolicy.KEEP_LAST,
            reliability=ReliabilityPolicy.BEST_EFFORT,
        )

        self.create_subscription(
            JointState,
            '/fd_robot/waist_joints/joint_state',
            self.on_state,
            qos,          # 传入自定义 QoS,而不是整数 10
        )

    def on_state(self, msg):
        pairs = ', '.join(
            f'{n}={p:.4f}rad' for n, p in zip(msg.name, msg.position))
        self.get_logger().info(f'[{len(msg.name)} 轴] {pairs}')

def main():
    rclpy.init()
    node = WaistJointState()
    try:
        rclpy.spin(node)
    except KeyboardInterrupt:
        pass
    finally:
        node.destroy_node()
        rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)— 必须显式指定 BEST_EFFORT

#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/joint_state.hpp>

class WaistJointState : public rclcpp::Node {
public:
  WaistJointState() : Node("waist_joint_state_sub") {
    // ★ 关键:best_effort() 与发布端对齐,否则订阅静默失败
    rclcpp::QoS qos(rclcpp::KeepLast(10));
    qos.best_effort();

    sub_ = create_subscription<sensor_msgs::msg::JointState>(
        "/fd_robot/waist_joints/joint_state", qos,
        [this](sensor_msgs::msg::JointState::SharedPtr msg) {
          std::string s;
          for (size_t i = 0; i < msg->name.size() && i < msg->position.size(); ++i) {
            s += msg->name[i] + "=" + std::to_string(msg->position[i]) + "rad ";
          }
          RCLCPP_INFO(get_logger(), "[%zu 轴] %s", msg->name.size(), s.c_str());
        });
  }
private:
  rclcpp::Subscription<sensor_msgs::msg::JointState>::SharedPtr sub_;
};

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  rclcpp::spin(std::make_shared<WaistJointState>());
  rclcpp::shutdown();
  return 0;
}
/fd_robot/waist_joints/cartesian_cmd 话题
笛卡尔空间增量命令。由你的程序发布,类型 sensor_msgs/JointState,来源包 tl_hardware。
四个增量分量的 name 固定为 dx / dz / dpitch / dyaw。
字段 侧 类型 取值 说明
name 消息 string[] ['dx','dz','dpitch','dyaw'] 固定四分量
position[0] 消息 float64 米 dx:水平增量
position[1] 消息 float64 米 dz:竖直增量
position[2] 消息 float64 弧度 dpitch:俯仰增量
position[3] 消息 float64 弧度 dyaw:偏航增量
这是增量,不是绝对位姿。想读绝对位姿请订阅 cartesian_state。同一数组里两种单位并存(前两个米、后两个弧度),是最容易写错的一处。

示例

① 命令行(ros2 CLI)

# 纯俯仰增量:dyaw 约 0.05 rad(≈2.86°),其余为 0
ros2 topic pub -1 /fd_robot/waist_joints/cartesian_cmd sensor_msgs/msg/JointState \
  "{name: ['dx', 'dz', 'dpitch', 'dyaw'], position: [0.0, 0.0, 0.0, 0.05]}"

# 纯竖直抬升 3 cm(dz 单位为米)
ros2 topic pub -1 /fd_robot/waist_joints/cartesian_cmd sensor_msgs/msg/JointState \
  "{name: ['dx', 'dz', 'dpitch', 'dyaw'], position: [0.0, 0.03, 0.0, 0.0]}"

# 观察绝对位姿与运动状态(注意订阅端 QoS)
ros2 topic echo /fd_robot/waist_joints/cartesian_state
ros2 topic echo /fd_robot/waist_joints/motion_status

② Python(rclpy)

import rclpy
from rclpy.node import Node
from sensor_msgs.msg import JointState

class WaistCartesianCmd(Node):
    NAMES = ['dx', 'dz', 'dpitch', 'dyaw']   # 前两者米,后两者弧度

    def __init__(self):
        super().__init__('waist_cartesian_cmd')
        self.pub = self.create_publisher(
            JointState, '/fd_robot/waist_joints/cartesian_cmd', 10)

    def send(self, dx=0.0, dz=0.0, dpitch=0.0, dyaw=0.0):
        msg = JointState()
        msg.name = list(self.NAMES)
        msg.position = [dx, dz, dpitch, dyaw]
        self.pub.publish(msg)
        self.get_logger().info(
            f'cartesian cmd: dx={dx}m dz={dz}m '
            f'dpitch={dpitch}rad dyaw={dyaw}rad')

def main():
    rclpy.init()
    node = WaistCartesianCmd()
    node.send(dyaw=0.05)                 # 偏航增量约 2.86°
    node.send(dz=0.03)                   # 抬升 3 cm
    rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/joint_state.hpp>

class WaistCartesianCmd : public rclcpp::Node {
public:
  WaistCartesianCmd() : Node("waist_cartesian_cmd") {
    pub_ = create_publisher<sensor_msgs::msg::JointState>(
        "/fd_robot/waist_joints/cartesian_cmd", 10);
  }

  void send(double dx, double dz, double dpitch, double dyaw) {
    sensor_msgs::msg::JointState msg;
    msg.name = {"dx", "dz", "dpitch", "dyaw"};
    msg.position = {dx, dz, dpitch, dyaw};   // m, m, rad, rad
    pub_->publish(msg);
    RCLCPP_INFO(get_logger(),
                "cartesian cmd: dx=%.3fm dz=%.3fm dpitch=%.3frad dyaw=%.3frad",
                dx, dz, dpitch, dyaw);
  }

private:
  rclcpp::Publisher<sensor_msgs::msg::JointState>::SharedPtr pub_;
};

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  auto node = std::make_shared<WaistCartesianCmd>();
  node->send(0.0, 0.03, 0.0, 0.0);   // 抬升 3 cm
  rclcpp::spin_some(node);
  rclcpp::shutdown();
  return 0;
}
/fd_robot/waist_joints/cartesian_state 话题 BEST_EFFORT
笛卡尔空间绝对位姿反馈。由你的程序订阅,类型 sensor_msgs/JointState,来源包 tl_hardware,随状态更新发布。
发布端 QoS 为 BEST_EFFORT,订阅端必须一致。
字段 侧 类型 取值 说明
name 消息 string[] x / z / pitch / yaw 绝对位姿四分量
x 消息 float64 米 水平绝对位置
z 消息 float64 米 竖直绝对位置
pitch 消息 float64 弧度 俯仰绝对角度
yaw 消息 float64 弧度 偏航绝对角度

示例

① 命令行(ros2 CLI)

# 读取绝对位姿
ros2 topic echo /fd_robot/waist_joints/cartesian_state

# 确认 QoS 为 BEST_EFFORT(订阅端不对齐会收不到)
ros2 topic info -v /fd_robot/waist_joints/cartesian_state

# 只取一帧
ros2 topic echo --once /fd_robot/waist_joints/cartesian_state

② Python(rclpy)

import rclpy
from rclpy.node import Node
from rclpy.qos import QoSProfile, ReliabilityPolicy
from sensor_msgs.msg import JointState

class WaistCartesianState(Node):
    def __init__(self):
        super().__init__('waist_cartesian_state_sub')
        qos = QoSProfile(depth=10, reliability=ReliabilityPolicy.BEST_EFFORT)
        self.create_subscription(
            JointState, '/fd_robot/waist_joints/cartesian_state',
            self.on_state, qos)

    def on_state(self, msg):
        # 按 name 建索引,避免依赖数组顺序
        d = dict(zip(msg.name, msg.position))
        self.get_logger().info(
            f"x={d.get('x', float('nan')):.4f}m "
            f"z={d.get('z', float('nan')):.4f}m "
            f"pitch={d.get('pitch', float('nan')):.4f}rad "
            f"yaw={d.get('yaw', float('nan')):.4f}rad")

def main():
    rclpy.init()
    node = WaistCartesianState()
    try:
        rclpy.spin(node)
    except KeyboardInterrupt:
        pass
    finally:
        node.destroy_node()
        rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <map>
#include <string>
#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/joint_state.hpp>

class WaistCartesianState : public rclcpp::Node {
public:
  WaistCartesianState() : Node("waist_cartesian_state_sub") {
    rclcpp::QoS qos(rclcpp::KeepLast(10));
    qos.best_effort();                       // ★ 与发布端对齐
    sub_ = create_subscription<sensor_msgs::msg::JointState>(
        "/fd_robot/waist_joints/cartesian_state", qos,
        [this](sensor_msgs::msg::JointState::SharedPtr msg) {
          std::map<std::string, double> d;
          for (size_t i = 0; i < msg->name.size() && i < msg->position.size(); ++i)
            d[msg->name[i]] = msg->position[i];
          RCLCPP_INFO(get_logger(), "x=%.4fm z=%.4fm pitch=%.4frad yaw=%.4frad",
                      d["x"], d["z"], d["pitch"], d["yaw"]);
        });
  }
private:
  rclcpp::Subscription<sensor_msgs::msg::JointState>::SharedPtr sub_;
};

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  rclcpp::spin(std::make_shared<WaistCartesianState>());
  rclcpp::shutdown();
  return 0;
}
/fd_robot/waist_joints/motion_status 话题 BEST_EFFORT
运动模式与到位状态。由你的程序订阅,类型 fd_msgs/WaistMotionStatus,来源包 tl_hardware,随状态更新发布。
这是 YD100 判断「动没动完」的唯一状态来源(不存在 cartesian_status)。
字段 侧 类型 取值 说明
mode 消息 int 0 IDLE / 1 CARTESIAN / 2 JOINT_STEP / 3 JOINT_MOVE 当前运动模式
state 消息 int 0 IDLE / 1 MOVING / 2 REACHED / 3 STOPPED / 4 REJECTED / 5 FAILED 2 = REACHED 表示已到位
完成判定只认 state == REACHED(或 IDLE),不要用固定延时。同时留意 REJECTED 与 FAILED——它们是失败态,若只判「不等于 MOVING」会把失败误判成到位。

示例

① 命令行(ros2 CLI)

# 观察运动状态变化
ros2 topic echo /fd_robot/waist_joints/motion_status

# 查看消息定义
ros2 interface show fd_msgs/msg/WaistMotionStatus

② Python(rclpy)— 等待到位

import rclpy
from rclpy.node import Node
from rclpy.qos import QoSProfile, ReliabilityPolicy

# fd_msgs 为工程内自定义消息包,需先 source install/setup.bash
from fd_msgs.msg import WaistMotionStatus

MODE = {0: 'IDLE', 1: 'CARTESIAN', 2: 'JOINT_STEP', 3: 'JOINT_MOVE'}
STATE = {0: 'IDLE', 1: 'MOVING', 2: 'REACHED',
         3: 'STOPPED', 4: 'REJECTED', 5: 'FAILED'}

class WaistMotionWatch(Node):
    def __init__(self):
        super().__init__('waist_motion_watch')
        qos = QoSProfile(depth=10, reliability=ReliabilityPolicy.BEST_EFFORT)
        self.create_subscription(
            WaistMotionStatus, '/fd_robot/waist_joints/motion_status',
            self.on_status, qos)
        self.done = False

    def on_status(self, msg):
        m = MODE.get(msg.mode, msg.mode)
        s = STATE.get(msg.state, msg.state)
        self.get_logger().info(f'mode={m} state={s}')
        if s == 'REACHED':
            self.get_logger().info('腰部已到位')
            self.done = True
        elif s in ('REJECTED', 'FAILED'):
            self.get_logger().error(f'腰部运动失败:{s}')
            self.done = True

def main():
    rclpy.init()
    node = WaistMotionWatch()
    try:
        rclpy.spin(node)
    except KeyboardInterrupt:
        pass
    finally:
        node.destroy_node()
        rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)— 等待到位

#include <rclcpp/rclcpp.hpp>
#include "fd_msgs/msg/waist_motion_status.hpp"

using fd_msgs::msg::WaistMotionStatus;

class WaistMotionWatch : public rclcpp::Node {
public:
  WaistMotionWatch() : Node("waist_motion_watch") {
    rclcpp::QoS qos(rclcpp::KeepLast(10));
    qos.best_effort();
    sub_ = create_subscription<WaistMotionStatus>(
        "/fd_robot/waist_joints/motion_status", qos,
        [this](WaistMotionStatus::SharedPtr msg) {
          RCLCPP_INFO(get_logger(), "mode=%d state=%d", msg->mode, msg->state);
          if (msg->state == 2) {                 // REACHED
            RCLCPP_INFO(get_logger(), "腰部已到位");
            rclcpp::shutdown();
          } else if (msg->state == 4 || msg->state == 5) {   // REJECTED / FAILED
            RCLCPP_ERROR(get_logger(), "腰部运动失败 state=%d", msg->state);
            rclcpp::shutdown();
          }
        });
  }
private:
  rclcpp::Subscription<WaistMotionStatus>::SharedPtr sub_;
};

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  rclcpp::spin(std::make_shared<WaistMotionWatch>());
  rclcpp::shutdown();
  return 0;
}
三个 BEST_EFFORT 话题一视同仁。joint_state / cartesian_state / motion_status 的订阅端都要显式 BEST_EFFORT。用 create_subscription(Type, topic, cb, 10) 传整数深度默认是 RELIABLE,会静默收不到数据。

六、YD100 服务接口详解

本章 6 个服务。其中 enable 是运动前置条件——手册明确:轴未使能时,运动动作会执行失败(result_code 为 NOT_ENABLED)。动作接口见第七章。

/fd_robot/yd100/enable 服务
轴使能。类型 fd_msgs/Yd100Enable,来源包 yd100_control。
axis_names 为空时作用于全部轴。
字段 侧 类型 取值 说明
axis_names 请求 string[] waist_joint1–4 或 yd100_j1–4 空 = 全部轴
enable 请求 bool true / false true 使能,false 断使能

示例

① 命令行(ros2 CLI)

# 使能全部轴(axis_names 留空)
ros2 service call /fd_robot/yd100/enable fd_msgs/srv/Yd100Enable \
  "{axis_names: [], enable: true}"

# 只使能单轴
ros2 service call /fd_robot/yd100/enable fd_msgs/srv/Yd100Enable \
  "{axis_names: ['waist_joint1'], enable: true}"

# 查看服务定义
ros2 interface show fd_msgs/srv/Yd100Enable

② Python(rclpy)

import rclpy
from rclpy.node import Node
from fd_msgs.srv import Yd100Enable

class WaistEnable(Node):
    def __init__(self):
        super().__init__('waist_enable')
        self.cli = self.create_client(Yd100Enable, '/fd_robot/yd100/enable')
        if not self.cli.wait_for_service(timeout_sec=3.0):
            self.get_logger().error('enable 服务不可用,请确认 waist_model=yd100')
            raise SystemExit(1)

    def call(self, axis_names=None, enable=True):
        req = Yd100Enable.Request()
        req.axis_names = axis_names or []      # 空 = 全部轴
        req.enable = enable
        fut = self.cli.call_async(req)
        rclpy.spin_until_future_complete(self, fut, timeout_sec=5.0)
        resp = fut.result()
        self.get_logger().info(f'enable({req.axis_names}, {enable}) -> {resp}')
        return resp

def main():
    rclpy.init()
    node = WaistEnable()
    node.call(axis_names=[], enable=True)      # 全部轴使能
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <chrono>
#include <memory>
#include <rclcpp/rclcpp.hpp>
#include "fd_msgs/srv/yd100_enable.hpp"

using namespace std::chrono_literals;

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("waist_enable");
  auto cli = node->create_client<fd_msgs::srv::Yd100Enable>(
      "/fd_robot/yd100/enable");

  if (!cli->wait_for_service(3s)) {
    RCLCPP_ERROR(node->get_logger(), "enable 服务不可用");
    rclcpp::shutdown();
    return 1;
  }

  auto req = std::make_shared<fd_msgs::srv::Yd100Enable::Request>();
  req->axis_names = {};      // 空 = 全部轴
  req->enable = true;

  auto fut = cli->async_send_request(req);
  if (fut.wait_for(5s) == std::future_status::ready) {
    RCLCPP_INFO(node->get_logger(), "enable 调用完成");
  } else {
    RCLCPP_ERROR(node->get_logger(), "enable 调用超时");
  }

  rclcpp::shutdown();
  return 0;
}
/fd_robot/yd100/fault_reset 服务
故障复位。类型 fd_msgs/Yd100FaultReset,来源包 yd100_control。
axis_names 规则与 enable 相同:为空时作用于全部轴。
字段 侧 类型 取值 说明
axis_names 请求 string[] waist_joint1–4 或 yd100_j1–4 空 = 全部轴

示例

① 命令行(ros2 CLI)

# 复位全部轴故障
ros2 service call /fd_robot/yd100/fault_reset fd_msgs/srv/Yd100FaultReset \
  "{axis_names: []}"

# 只复位单轴
ros2 service call /fd_robot/yd100/fault_reset fd_msgs/srv/Yd100FaultReset \
  "{axis_names: ['waist_joint2']}"

② Python(rclpy)

import rclpy
from rclpy.node import Node
from fd_msgs.srv import Yd100FaultReset

class WaistFaultReset(Node):
    def __init__(self):
        super().__init__('waist_fault_reset')
        self.cli = self.create_client(
            Yd100FaultReset, '/fd_robot/yd100/fault_reset')
        if not self.cli.wait_for_service(timeout_sec=3.0):
            self.get_logger().error('fault_reset 服务不可用')
            raise SystemExit(1)

    def call(self, axis_names=None):
        req = Yd100FaultReset.Request()
        req.axis_names = axis_names or []      # 空 = 全部轴
        fut = self.cli.call_async(req)
        rclpy.spin_until_future_complete(self, fut, timeout_sec=5.0)
        self.get_logger().info(f'fault_reset -> {fut.result()}')
        return fut.result()

def main():
    rclpy.init()
    node = WaistFaultReset()
    node.call([])
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <chrono>
#include <rclcpp/rclcpp.hpp>
#include "fd_msgs/srv/yd100_fault_reset.hpp"

using namespace std::chrono_literals;

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("waist_fault_reset");
  auto cli = node->create_client<fd_msgs::srv::Yd100FaultReset>(
      "/fd_robot/yd100/fault_reset");

  if (!cli->wait_for_service(3s)) {
    RCLCPP_ERROR(node->get_logger(), "fault_reset 服务不可用");
    rclcpp::shutdown();
    return 1;
  }

  auto req = std::make_shared<fd_msgs::srv::Yd100FaultReset::Request>();
  req->axis_names = {};      // 空 = 全部轴

  auto fut = cli->async_send_request(req);
  if (fut.wait_for(5s) == std::future_status::ready) {
    RCLCPP_INFO(node->get_logger(), "fault_reset 调用完成");
  }

  rclcpp::shutdown();
  return 0;
}
/fd_robot/yd100/safe_stop 服务
安全停机。类型 fd_msgs/Yd100SafeStop,来源包 yd100_control。
停机状态会保持(锁存)——不会自动恢复,需显式处理后才可继续运动。
字段 侧 类型 取值 说明
axis_names 请求 string[] waist_joint1–4 或 yd100_j1–4 空 = 全部轴
disable 请求 bool true / false 停机后是否断开使能
reason 请求 string 如 'manual' 停机原因字符串
disable=true 会断开使能。之后若还要运动,必须重新调用 /fd_robot/yd100/enable,否则动作会返回 NOT_ENABLED。

示例

① 命令行(ros2 CLI)

# 安全停机:不断使能(保留抱闸能力),原因 manual
ros2 service call /fd_robot/yd100/safe_stop fd_msgs/srv/Yd100SafeStop \
  "{axis_names: [], disable: false, reason: 'manual'}"

# 安全停机并断开使能
ros2 service call /fd_robot/yd100/safe_stop fd_msgs/srv/Yd100SafeStop \
  "{axis_names: [], disable: true, reason: 'manual'}"

② Python(rclpy)

import rclpy
from rclpy.node import Node
from fd_msgs.srv import Yd100SafeStop

class WaistSafeStop(Node):
    def __init__(self):
        super().__init__('waist_safe_stop')
        self.cli = self.create_client(Yd100SafeStop, '/fd_robot/yd100/safe_stop')
        if not self.cli.wait_for_service(timeout_sec=3.0):
            self.get_logger().error('safe_stop 服务不可用')
            raise SystemExit(1)

    def call(self, reason='manual', disable=False, axis_names=None):
        req = Yd100SafeStop.Request()
        req.axis_names = axis_names or []
        req.disable = disable
        req.reason = reason
        fut = self.cli.call_async(req)
        rclpy.spin_until_future_complete(self, fut, timeout_sec=5.0)
        self.get_logger().info(
            f'safe_stop(reason={reason}, disable={disable}) 已下发')
        return fut.result()

def main():
    rclpy.init()
    node = WaistSafeStop()
    node.call(reason='manual', disable=False)
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <chrono>
#include <rclcpp/rclcpp.hpp>
#include "fd_msgs/srv/yd100_safe_stop.hpp"

using namespace std::chrono_literals;

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("waist_safe_stop");
  auto cli = node->create_client<fd_msgs::srv::Yd100SafeStop>(
      "/fd_robot/yd100/safe_stop");

  if (!cli->wait_for_service(3s)) {
    RCLCPP_ERROR(node->get_logger(), "safe_stop 服务不可用");
    rclcpp::shutdown();
    return 1;
  }

  auto req = std::make_shared<fd_msgs::srv::Yd100SafeStop::Request>();
  req->axis_names = {};
  req->disable = false;       // 停机后保持使能
  req->reason = "manual";

  auto fut = cli->async_send_request(req);
  if (fut.wait_for(5s) == std::future_status::ready)
    RCLCPP_INFO(node->get_logger(), "safe_stop 已下发");

  rclcpp::shutdown();
  return 0;
}
/fd_robot/waist_joints/joint_step 服务
单关节相对步进。类型 fd_msgs/WaistJointStep,来源包 tl_hardware。
一次只作用一个关节,相对当前位置移动 delta_rad。
字段 侧 类型 取值 说明
joint_name 请求 string waist_joint1–waist_joint4 目标关节
delta_rad 请求 float64 弧度 相对步进量
velocity_scale 请求 float64 (0, 1] 超出范围时拒绝执行
acceleration_scale 请求 float64 (0, 1] 超出范围时拒绝执行
accepted 响应 bool   是否接受该请求
generation 响应 uint64   本次运动的序号
message 响应 string   结果说明
先看 accepted 再看 message。velocity_scale / acceleration_scale 超出 (0, 1] 属于「拒绝」语义——命令不会执行,但服务本身正常返回,只能靠 accepted=false 和 message 判断。

示例

① 命令行(ros2 CLI)

# 让 waist_joint1 相对步进 0.05 rad,速度/加速度缩放均取 0.3
ros2 service call /fd_robot/waist_joints/joint_step fd_msgs/srv/WaistJointStep \
  "{joint_name: 'waist_joint1', delta_rad: 0.05, velocity_scale: 0.3, acceleration_scale: 0.3}"

# 下进步进(负值)
ros2 service call /fd_robot/waist_joints/joint_step fd_msgs/srv/WaistJointStep \
  "{joint_name: 'waist_joint1', delta_rad: -0.05, velocity_scale: 0.3, acceleration_scale: 0.3}"

② Python(rclpy)

import math
import rclpy
from rclpy.node import Node
from fd_msgs.srv import WaistJointStep

class WaistJointStep(Node):
    def __init__(self):
        super().__init__('waist_joint_step')
        self.cli = self.create_client(
            WaistJointStep, '/fd_robot/waist_joints/joint_step')
        if not self.cli.wait_for_service(timeout_sec=3.0):
            self.get_logger().error('joint_step 服务不可用')
            raise SystemExit(1)

    def call(self, joint_name, delta_rad, vs=0.3, acs=0.3):
        req = WaistJointStep.Request()
        req.joint_name = joint_name
        req.delta_rad = delta_rad          # 弧度
        req.velocity_scale = vs            # 必须落在 (0, 1]
        req.acceleration_scale = acs
        fut = self.cli.call_async(req)
        rclpy.spin_until_future_complete(self, fut, timeout_sec=5.0)
        r = fut.result()
        if r is None:
            self.get_logger().error('调用超时')
            return None
        if not r.accepted:
            self.get_logger().error(f'被拒绝:{r.message}')
        else:
            self.get_logger().info(
                f'已接受,generation={r.generation} {r.message}')
        return r

def main():
    rclpy.init()
    node = WaistJointStep()
    # 步进 3°(换算为弧度),缩放参数必须 ≤ 1
    node.call('waist_joint1', math.radians(3.0), vs=0.3, acs=0.3)
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <chrono>
#include <cmath>
#include <rclcpp/rclcpp.hpp>
#include "fd_msgs/srv/waist_joint_step.hpp"

using namespace std::chrono_literals;

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("waist_joint_step");
  auto cli = node->create_client<fd_msgs::srv::WaistJointStep>(
      "/fd_robot/waist_joints/joint_step");

  if (!cli->wait_for_service(3s)) {
    RCLCPP_ERROR(node->get_logger(), "joint_step 服务不可用");
    rclcpp::shutdown();
    return 1;
  }

  auto req = std::make_shared<fd_msgs::srv::WaistJointStep::Request>();
  req->joint_name = "waist_joint1";
  req->delta_rad = 3.0 * M_PI / 180.0;   // 3° 转弧度
  req->velocity_scale = 0.3;             // (0, 1]
  req->acceleration_scale = 0.3;

  auto fut = cli->async_send_request(req);
  if (fut.wait_for(5s) == std::future_status::ready) {
    auto r = fut.get();
    if (!r->accepted)
      RCLCPP_ERROR(node->get_logger(), "被拒绝:%s", r->message.c_str());
    else
      RCLCPP_INFO(node->get_logger(), "已接受,generation=%lu",
                  static_cast<unsigned long>(r->generation));
  }

  rclcpp::shutdown();
  return 0;
}
/fd_robot/waist_joints/motion_stop 与
/fd_robot/waist_joints/cartesian_stop 服务
停止当前腰部运动。两个服务类型均为 std_srvs/Trigger,来源包 tl_hardware。
手册明确:cartesian_stop 与 motion_stop 功能相同(别名),调用哪个都可以。
字段 侧 类型 取值 说明
(无请求字段) 请求 — — std_srvs/Trigger 无参
success 响应 bool   是否成功
message 响应 string   结果说明

示例

① 命令行(ros2 CLI)

# 停止当前腰部运动(两个接口等价,任选其一)
ros2 service call /fd_robot/waist_joints/motion_stop std_srvs/srv/Trigger "{}"
ros2 service call /fd_robot/waist_joints/cartesian_stop std_srvs/srv/Trigger "{}"

② Python(rclpy)

import rclpy
from rclpy.node import Node
from std_srvs.srv import Trigger

class WaistMotionStop(Node):
    def __init__(self):
        super().__init__('waist_motion_stop')
        # 两个名字任选;此处用别名 cartesian_stop
        self.cli = self.create_client(
            Trigger, '/fd_robot/waist_joints/motion_stop')
        if not self.cli.wait_for_service(timeout_sec=3.0):
            self.get_logger().error('motion_stop 服务不可用')
            raise SystemExit(1)

    def call(self):
        fut = self.cli.call_async(Trigger.Request())
        rclpy.spin_until_future_complete(self, fut, timeout_sec=5.0)
        r = fut.result()
        self.get_logger().info(f'motion_stop: success={r.success} msg={r.message}')
        return r

def main():
    rclpy.init()
    node = WaistMotionStop()
    node.call()
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <chrono>
#include <rclcpp/rclcpp.hpp>
#include <std_srvs/srv/trigger.hpp>

using namespace std::chrono_literals;

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("waist_motion_stop");
  auto cli = node->create_client<std_srvs::srv::Trigger>(
      "/fd_robot/waist_joints/motion_stop");

  if (!cli->wait_for_service(3s)) {
    RCLCPP_ERROR(node->get_logger(), "motion_stop 服务不可用");
    rclcpp::shutdown();
    return 1;
  }

  auto fut = cli->async_send_request(
      std::make_shared<std_srvs::srv::Trigger::Request>());
  if (fut.wait_for(5s) == std::future_status::ready) {
    auto r = fut.get();
    RCLCPP_INFO(node->get_logger(), "motion_stop: success=%d msg=%s",
                r->success, r->message.c_str());
  }

  rclcpp::shutdown();
  return 0;
}

七、YD100 动作接口详解

两个动作同名不同层。日常对接建议走规划层(tl_hardware):关节名与状态话题一致、支持超时保护。

对比项 规划层 驱动层
动作名 /fd_robot/waist_joints/move_to_location /fd_robot/yd100_controller/move_to_location
来源包 tl_hardware yd100_controller
类型 fd_msgs/WaistMoveToLocation fd_msgs/Yd100MoveToLocation
关节名 waist_joint* yd100_j1–yd100_j4(不能用 waist_joint*)
位置单位 弧度(positions_rad) 度(positions_deg)
/fd_robot/waist_joints/move_to_location 动作
规划层关节运动到目标位置。类型 fd_msgs/WaistMoveToLocation,来源包 tl_hardware。
positions_rad 单位为弧度;关节名用 waist_joint*。这是推荐的腰部运动入口。
字段 侧 类型 取值 说明
joint_names 请求 string[] waist_joint* 长度与 positions_rad 一致
positions_rad 请求 float64[] 弧度 目标关节角
velocity_scale 请求 float64 (0, 1] 超出范围时拒绝执行
acceleration_scale 请求 float64 (0, 1] 超出范围时拒绝执行
timeout_sec 请求 float64 须大于规划时长 ≤0 或非有限值时拒绝执行
result_code 结果 int32 0 SUCCESS / 1 CANCELED / 2 TIMEOUT / 3 NOT_REACHED / 4 REJECTED / 5 CONTROLLER_ERROR / 6 NOT_ENABLED 仅 0 为成功
关节名与位置数组必须等长且一一对应。joint_names 长度为 N,则 positions_rad 也必须是 N。可以只控制其中几个轴(示例中控制 2 个轴),但两者长度不一致会被拒绝。

示例

① 命令行(ros2 CLI)

# 规划层运动:waist_joint1、joint2 分别到 0.0 和 0.1 rad
ros2 action send_goal /fd_robot/waist_joints/move_to_location \
  fd_msgs/action/WaistMoveToLocation \
  "{joint_names: ['waist_joint1', 'waist_joint2'], \
    positions_rad: [0.0, 0.1], \
    velocity_scale: 0.3, acceleration_scale: 0.3, \
    timeout_sec: 10.0}"

# 加 --feedback 观察执行反馈
ros2 action send_goal --feedback /fd_robot/waist_joints/move_to_location \
  fd_msgs/action/WaistMoveToLocation \
  "{joint_names: ['waist_joint1'], positions_rad: [0.2], \
    velocity_scale: 0.3, acceleration_scale: 0.3, timeout_sec: 10.0}"

# 查看动作定义
ros2 interface show fd_msgs/action/WaistMoveToLocation

② Python(rclpy)

import math
import rclpy
from rclpy.action import ActionClient
from rclpy.node import Node
from fd_msgs.action import WaistMoveToLocation

RESULT = {0: 'SUCCESS', 1: 'CANCELED', 2: 'TIMEOUT', 3: 'NOT_REACHED',
          4: 'REJECTED', 5: 'CONTROLLER_ERROR', 6: 'NOT_ENABLED'}

class WaistMove(Node):
    def __init__(self):
        super().__init__('waist_move')
        self.cli = ActionClient(
            self, WaistMoveToLocation, '/fd_robot/waist_joints/move_to_location')
        if not self.cli.wait_for_server(timeout_sec=3.0):
            self.get_logger().error('动作服务端不可用')
            raise SystemExit(1)

    def move(self, names, positions_rad, timeout_sec=10.0):
        goal = WaistMoveToLocation.Goal()
        goal.joint_names = names
        goal.positions_rad = positions_rad        # 弧度
        goal.velocity_scale = 0.3                 # (0, 1]
        goal.acceleration_scale = 0.3             # (0, 1]
        goal.timeout_sec = timeout_sec            # 须大于规划时长

        send_fut = self.cli.send_goal_async(
            goal, feedback_callback=self.on_feedback)
        rclpy.spin_until_future_complete(self, send_fut)
        handle = send_fut.result()
        if not handle.accepted:
            self.get_logger().error('目标被拒绝')
            return None

        res_fut = handle.get_result_async()
        rclpy.spin_until_future_complete(self, res_fut)
        code = res_fut.result().result.result_code
        self.get_logger().info(f'result_code={code} ({RESULT.get(code, "?")})')
        return code

    def on_feedback(self, fb):
        self.get_logger().info(f'feedback: {fb.feedback}')

def main():
    rclpy.init()
    node = WaistMove()
    node.move(['waist_joint1', 'waist_joint2'],
              [0.0, math.radians(5.73)],   # 约 0.1 rad
              timeout_sec=10.0)
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <chrono>
#include <memory>
#include <rclcpp/rclcpp.hpp>
#include <rclcpp_action/rclcpp_action.hpp>
#include "fd_msgs/action/waist_move_to_location.hpp"

using namespace std::chrono_literals;
using Move = fd_msgs::action::WaistMoveToLocation;

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("waist_move");

  auto cli = rclcpp_action::create_client<Move>(
      node, "/fd_robot/waist_joints/move_to_location");

  if (!cli->wait_for_action_server(3s)) {
    RCLCPP_ERROR(node->get_logger(), "动作服务端不可用");
    rclcpp::shutdown();
    return 1;
  }

  Move::Goal goal;
  goal.joint_names = {"waist_joint1", "waist_joint2"};
  goal.positions_rad = {0.0, 0.1};        // 弧度
  goal.velocity_scale = 0.3;              // (0, 1]
  goal.acceleration_scale = 0.3;
  goal.timeout_sec = 10.0;                // 须大于规划时长

  auto opts = rclcpp_action::Client<Move>::SendGoalOptions();
  opts.feedback_callback =
      [node](auto, const std::shared_ptr<const Move::Feedback> fb) {
        (void)fb;
        RCLCPP_INFO(node->get_logger(), "feedback received");
      };

  auto fut = cli->async_send_goal(goal, opts);
  if (fut.wait_for(5s) != std::future_status::ready) {
    RCLCPP_ERROR(node->get_logger(), "发送目标超时");
    rclcpp::shutdown();
    return 1;
  }
  auto handle = fut.get();
  if (!handle) {
    RCLCPP_ERROR(node->get_logger(), "目标被拒绝");
    rclcpp::shutdown();
    return 1;
  }

  auto res_fut = cli->async_get_result(handle);
  if (res_fut.wait_for(30s) == std::future_status::ready) {
    int32_t code = res_fut.get().result->result_code;
    RCLCPP_INFO(node->get_logger(), "result_code=%d", code);
  }

  rclcpp::shutdown();
  return 0;
}
/fd_robot/yd100_controller/move_to_location 动作
驱动层关节运动到目标位置。类型 fd_msgs/Yd100MoveToLocation,来源包 yd100_controller。
positions_deg 单位为度;关节名必须用 yd100_j1–yd100_j4。
字段 侧 类型 取值 说明
joint_names 请求 string[] yd100_j1–yd100_j4 长度与 positions_deg 一致;不能使用 waist_joint*
positions_deg 请求 float64[] 度,须在该轴限位内 超出限位时拒绝执行
duration_sec 请求 float64 >0 运动时长
timeout_sec 请求 float64 >0 建议大于 duration_sec
result_code 结果 int32 0 SUCCESS … 7 NOT_ENABLED(含 6 BUS_FAULT) 轴未使能时执行失败
驱动层动作的结束码与规划层不同:它含 6 BUS_FAULT(总线故障),且 7 NOT_ENABLED。规划层则是 5 CONTROLLER_ERROR / 6 NOT_ENABLED。两套码表不要混用。

示例

① 命令行(ros2 CLI)

# 驱动层运动:yd100_j1、j2 分别到 0.0 和 5.0 度,运动 3 秒
ros2 action send_goal /fd_robot/yd100_controller/move_to_location \
  fd_msgs/action/Yd100MoveToLocation \
  "{joint_names: ['yd100_j1', 'yd100_j2'], positions_deg: [0.0, 5.0], \
    duration_sec: 3.0, timeout_sec: 10.0}"

# 轴未使能时先使能
ros2 service call /fd_robot/yd100/enable fd_msgs/srv/Yd100Enable \
  "{axis_names: [], enable: true}"

② Python(rclpy)

import rclpy
from rclpy.action import ActionClient
from rclpy.node import Node
from fd_msgs.action import Yd100MoveToLocation

RESULT = {0: 'SUCCESS', 1: 'CANCELED', 2: 'TIMEOUT', 3: 'NOT_REACHED',
          4: 'REJECTED', 5: 'CONTROLLER_ERROR', 6: 'BUS_FAULT',
          7: 'NOT_ENABLED'}

class Yd100Move(Node):
    def __init__(self):
        super().__init__('yd100_move')
        self.cli = ActionClient(
            self, Yd100MoveToLocation,
            '/fd_robot/yd100_controller/move_to_location')
        if not self.cli.wait_for_server(timeout_sec=3.0):
            self.get_logger().error('驱动层动作服务端不可用')
            raise SystemExit(1)

    def move(self, names, positions_deg, duration_sec=3.0, timeout_sec=10.0):
        goal = Yd100MoveToLocation.Goal()
        goal.joint_names = names                 # yd100_j1–yd100_j4
        goal.positions_deg = positions_deg       # 度,须在限位内
        goal.duration_sec = duration_sec         # >0
        goal.timeout_sec = timeout_sec           # 建议 > duration_sec

        send_fut = self.cli.send_goal_async(goal)
        rclpy.spin_until_future_complete(self, send_fut)
        handle = send_fut.result()
        if not handle.accepted:
            self.get_logger().error('目标被拒绝(检查关节名/限位/使能)')
            return None

        res_fut = handle.get_result_async()
        rclpy.spin_until_future_complete(self, res_fut)
        code = res_fut.result().result.result_code
        self.get_logger().info(f'result_code={code} ({RESULT.get(code, "?")})')
        return code

def main():
    rclpy.init()
    node = Yd100Move()
    node.move(['yd100_j1', 'yd100_j2'], [0.0, 5.0],
              duration_sec=3.0, timeout_sec=10.0)
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

③ C++(rclcpp)

#include <chrono>
#include <rclcpp/rclcpp.hpp>
#include <rclcpp_action/rclcpp_action.hpp>
#include "fd_msgs/action/yd100_move_to_location.hpp"

using namespace std::chrono_literals;
using Move = fd_msgs::action::Yd100MoveToLocation;

int main(int argc, char** argv) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("yd100_move");

  auto cli = rclcpp_action::create_client<Move>(
      node, "/fd_robot/yd100_controller/move_to_location");

  if (!cli->wait_for_action_server(3s)) {
    RCLCPP_ERROR(node->get_logger(), "驱动层动作服务端不可用");
    rclcpp::shutdown();
    return 1;
  }

  Move::Goal goal;
  goal.joint_names = {"yd100_j1", "yd100_j2"};   // 必须用 yd100_j*
  goal.positions_deg = {0.0, 5.0};               // 度,须在限位内
  goal.duration_sec = 3.0;                       // >0
  goal.timeout_sec = 10.0;                       // 建议 > duration_sec

  auto fut = cli->async_send_goal(goal);
  if (fut.wait_for(5s) != std::future_status::ready) {
    RCLCPP_ERROR(node->get_logger(), "发送目标超时");
    rclcpp::shutdown();
    return 1;
  }
  auto handle = fut.get();
  if (!handle) {
    RCLCPP_ERROR(node->get_logger(), "目标被拒绝");
    rclcpp::shutdown();
    return 1;
  }

  auto res_fut = cli->async_get_result(handle);
  if (res_fut.wait_for(30s) == std::future_status::ready) {
    RCLCPP_INFO(node->get_logger(), "result_code=%d",
                res_fut.get().result->result_code);
  }

  rclcpp::shutdown();
  return 0;
}
轴未使能时,两个动作都会失败。手册 5.3.3 明确:「轴未使能时,请先调用 /fd_robot/yd100/enable」。典型流程是 enable → 运动 →(可选)safe_stop,见第八章。

八、典型流程与完整示例

8.1 Zerr / GiantCrab 最小闭环

单轴方案没有动作接口,也没有到位事件,闭环只有三步:订阅反馈 → 发布目标 → 等角度收敛。

步骤 动作 接口
1 订阅当前位置 /fd_robot/waist/current_pose
2 发布目标(弧度) /fd_robot/waist_motor/cmd
3 持续比对角度直到落入容差 同上(订阅)
Zerr 反馈仅 1 Hz,别用短睡眠。订阅回调本身就是「等数据」的正确方式;若用轮询,请把超时设到秒级。

8.2 YD100 端到端流程

步骤 动作 接口 注意
1 确认配置为 YD100 ros2 topic list | grep waist_joints 看不到说明不是 YD100 方案
2 订阅急停信号 /fd_robot/emergency_signal 运行期间必须常驻
3 订阅状态(BEST_EFFORT) joint_state / cartesian_state / motion_status 显式指定 BEST_EFFORT
4 轴使能 /fd_robot/yd100/enable 运动前置条件
5 (可选)清故障 /fd_robot/yd100/fault_reset 有故障时才需要
6 执行运动 /fd_robot/waist_joints/move_to_location 弧度;关节名与数组等长
7 判定结果 result_code 或 motion_status.state 不要用固定延时
8 (可选)安全停机 /fd_robot/yd100/safe_stop 状态锁存,需显式恢复
① 确认 waist_model=yd100  →  ② 订阅急停 + 三个状态话题(BEST_EFFORT)
▼
③ enable(全部轴使能)
可选:fault_reset 清故障
▼
④ 运动:joint_step(单轴步进)或 move_to_location(多轴规划)
▼
⑤ 判定:result_code == 0  或  motion_status.state == REACHED
▼
⑥ 收尾:motion_stop 停止  /  safe_stop 安全停机(锁存)

8.3 Python 完整示例(YD100 闭环)

#!/usr/bin/env python3
"""YD100 腰部完整闭环:使能 -> 运动 -> 判定 -> 收尾。

注意:
1. 三个状态话题均为 BEST_EFFORT,订阅必须显式指定。
2. 到位判定用 result_code 或 motion_status.state,不要用固定延时。
3. 本示例为按参数表推导的示意代码,字段名以本机
   ros2 interface show fd_msgs/action/WaistMoveToLocation 为准。
"""
import math
import rclpy
from rclpy.action import ActionClient
from rclpy.node import Node
from rclpy.qos import QoSProfile, ReliabilityPolicy
from std_msgs.msg import Bool
from sensor_msgs.msg import JointState
from fd_msgs.action import WaistMoveToLocation
from fd_msgs.srv import Yd100Enable
from fd_msgs.msg import WaistMotionStatus

STATE = {0: 'IDLE', 1: 'MOVING', 2: 'REACHED',
         3: 'STOPPED', 4: 'REJECTED', 5: 'FAILED'}
RESULT = {0: 'SUCCESS', 1: 'CANCELED', 2: 'TIMEOUT', 3: 'NOT_REACHED',
          4: 'REJECTED', 5: 'CONTROLLER_ERROR', 6: 'NOT_ENABLED'}

class WaistClient(Node):
    def __init__(self):
        super().__init__('waist_client')
        best_effort = QoSProfile(depth=10,
                                 reliability=ReliabilityPolicy.BEST_EFFORT)

        # ① 急停常驻订阅(RELIABLE,普通 QoS)
        self.estop = False
        self.create_subscription(
            Bool, '/fd_robot/emergency_signal', self.on_estop, 10)

        # ② 三个 BEST_EFFORT 状态话题
        self.motion_state = None
        self.create_subscription(
            WaistMotionStatus, '/fd_robot/waist_joints/motion_status',
            self.on_motion, best_effort)
        self.create_subscription(
            JointState, '/fd_robot/waist_joints/joint_state',
            self.on_joints, best_effort)
        self.create_subscription(
            JointState, '/fd_robot/waist_joints/cartesian_state',
            self.on_cart, best_effort)

        # ③ 服务与动作客户端
        self.enable_cli = self.create_client(
            Yd100Enable, '/fd_robot/yd100/enable')
        self.move_cli = ActionClient(
            self, WaistMoveToLocation, '/fd_robot/waist_joints/move_to_location')

    # ---------- 回调 ----------
    def on_estop(self, msg):
        if msg.data and not self.estop:
            self.get_logger().warn('收到急停信号,停止下发运动命令')
        self.estop = bool(msg.data)

    def on_motion(self, msg):
        self.motion_state = msg.state
        self.get_logger().info(f'motion state = {STATE.get(msg.state, msg.state)}')

    def on_joints(self, msg):
        self.get_logger().debug(f'joint_state: {list(zip(msg.name, msg.position))}')

    def on_cart(self, msg):
        self.get_logger().debug(f'cartesian_state: {list(zip(msg.name, msg.position))}')

    # ---------- 步骤 ----------
    def do_enable(self):
        if not self.enable_cli.wait_for_service(timeout_sec=3.0):
            self.get_logger().error('enable 服务不可用')
            return False
        req = Yd100Enable.Request()
        req.axis_names = []            # 空 = 全部轴
        req.enable = True
        fut = self.enable_cli.call_async(req)
        rclpy.spin_until_future_complete(self, fut, timeout_sec=5.0)
        self.get_logger().info('轴已使能')
        return True

    def do_move(self, names, positions_rad, timeout_sec=10.0):
        if self.estop:
            self.get_logger().error('急停中,拒绝下发运动')
            return None
        if not self.move_cli.wait_for_server(timeout_sec=3.0):
            self.get_logger().error('动作服务端不可用')
            return None

        goal = WaistMoveToLocation.Goal()
        goal.joint_names = names
        goal.positions_rad = positions_rad      # 弧度
        goal.velocity_scale = 0.3               # (0, 1]
        goal.acceleration_scale = 0.3           # (0, 1]
        goal.timeout_sec = timeout_sec          # 须大于规划时长

        send_fut = self.move_cli.send_goal_async(goal)
        rclpy.spin_until_future_complete(self, send_fut)
        handle = send_fut.result()
        if not handle.accepted:
            self.get_logger().error('目标被拒绝')
            return None

        res_fut = handle.get_result_async()
        rclpy.spin_until_future_complete(self, res_fut)
        code = res_fut.result().result.result_code
        self.get_logger().info(f'result_code={code} ({RESULT.get(code, "?")})')
        if code != 0:
            self.get_logger().error('运动未成功')
        return code

def main():
    rclpy.init()
    node = WaistClient()

    if not node.do_enable():
        rclpy.shutdown()
        return

    # 四轴中控制前两轴:j1 回 0 rad,j2 到约 5.73°(0.1 rad)
    node.do_move(['waist_joint1', 'waist_joint2'],
                 [0.0, 0.1],
                 timeout_sec=10.0)

    # 再等一小段时间,让 motion_status 完成状态刷新
    for _ in range(20):
        rclpy.spin_once(node, timeout_sec=0.1)

    node.get_logger().info(f'最终 motion state={node.motion_state}')
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()
该示例为「示意代码」。手册原文只提供 ros2 命令行示例;程序化调用同样是标准 ROS 2 写法,但 fd_msgs 的字段名请以本机 ros2 interface show fd_msgs/action/WaistMoveToLocation 的输出为准。

8.4 完成判定对照

方案 判定依据 成功条件
Zerr / GiantCrab /fd_robot/waist/current_pose 角度落入容差;Zerr 参考 1 Hz 更新节奏
YD100 动作 Action result_code 仅 0 = SUCCESS
YD100 步进 joint_step.accepted + motion_status.state accepted=true 且最终 state == REACHED
YD100 通用 motion_status.state 2 = REACHED;REJECTED/FAILED 为失败
不要用固定延时判定完成。手册 1.2 节接入步骤对机械臂明确写了「不要用固定延时等待」;腰部同样适用——不同负载、不同行程耗时差异很大。

九、注意事项与已知限制

9.1 硬性约束

三套驱动互斥。waist_model=zerr / giantcrab / yd100 三者互斥,不能混用。先确认自己的机器是哪一套,再对照相应章节——走错方案一个接口都调不通。
YD100 三个状态话题是 BEST_EFFORT。joint_state、cartesian_state、motion_status 的订阅端必须显式对齐 BEST_EFFORT,否则收不到任何消息且 ROS 2 不报错。这是本文最值得记住的一条。
运动前必须使能。YD100 轴未使能时,两个 move_to_location 都会失败(NOT_ENABLED)。先调 /fd_robot/yd100/enable。
safe_stop 是锁存状态。停机状态会保持,不会自动恢复;且 disable=true 会断开使能,之后需重新 enable 才能运动。
单位分界线:Zerr / GiantCrab 全弧度;YD100 规划层弧度、驱动层度、笛卡尔 dx/dz 米、dpitch/dyaw 弧度。同一数组里都可能出现两种单位。
Zerr 超限是静默限幅。超范围值会被截断到边界继续执行,不报错。而 velocity_scale / acceleration_scale 超 (0, 1] 是拒绝(不执行)。两种语义要分清。
单一控制来源。Pico 遥操作、/teleop/joint_targets_*、底层 /tl_control/* 或 fd_api 正在控制时,不要再通过本文接口下发命令。

9.2 腰部相关已知限制(源自手册附录)

下表摘自手册附录「已知限制」,只保留与腰部相关的条目。「影响」分级为本文按对接风险补充的工程判断,不是手册数据。

接口 限制 建议用法 影响
三个 YD100 状态话题 均以 BEST_EFFORT 发布,订阅端不对齐会收不到任何消息且无报错 订阅端显式使用 BEST_EFFORT 高
/fd_robot/waist_joints/cartesian_status 不存在该话题 请订阅 motion_status 高
/fd_robot/yd100/joint_states 旧话题已移除 改用 /fd_robot/waist_joints/joint_state 高
/yd100_joint_trajectory_controller/joint_trajectory ros2_control 内部使用的点位流,不支持直接通过原生 FollowJointTrajectory 调用 关节运动到位请使用 /fd_robot/waist_joints/move_to_location 中
Zerr 软限位 超出约 0–35° 时静默限幅,无错误提示 下发前自行做范围校验并记录日志 中
joint_step velocity_scale / acceleration_scale 超 (0, 1] 时拒绝执行 先判 accepted,再看 message 低
/fd_robot/waist_motor/status (GiantCrab)是命令输入不是状态反馈 读角度请订阅 /fd_robot/waist/current_pose 低

9.3 通用提醒

急停优先于一切。程序运行期间始终订阅 /fd_robot/emergency_signal;data=true 时立即停止发送运动命令。急停触发后腰部会进入安全状态。
先确认接口可见再发命令。用 ros2 topic list、ros2 service list、ros2 action list 确认所需接口存在;驱动节点未启动时接口不会有任何响应。
内部接口只用于排查。各节中标注「系统内部接口」的部分(Zerr 的使能/速度/参数/自检、GiantCrab 的 status、YD100 的 state_array / joint_cmd / jog_cmd / hold / csp_trace 等)仅供排查问题参考,请勿与二次开发接口同时调用。
与 fd_api 不要混用。两套接口是不同层级,单位也可能不同(fd_api 腰部用度)。同时使用会抢控制权。
腰部 ROS 接口说明 — 天链机器人 © 2026