Skip to content

踩坑Robotics Stack Exchange2024-06-07

MoveIt2获取状态报错timestamp为0,需修正节点初始化与Executor ​

本文由 AI 根据公开内容整理,可能有误,请以原文为准:MoveIt2 Didn't receive robot state (joint angles) with recent timestamp within 1.000000 seconds(Robotics Stack Exchange #111134)

状态:已解决

问题 ​

调用 getCurrentState() 或 getCurrentPose() 时报错 "Didn't receive robot state (joint angles) with recent timestamp within 1.000000 seconds",提示请求时间为3533s但最新状态时间为0.000000。

环境 ​

ROS2 MoveIt2, rclcpp, MoveGroupInterface, MultiThreadedExecutor/SingleThreadedExecutor

解决办法 ​

  1. 修改类定义使 m2Iface 直接继承 rclcpp::Node,避免在类内部额外创建子节点 node_,确保 MoveIt 接口绑定到主节点上下文。
  2. 将执行器改为 SingleThreadedExecutor 并在独立 std::thread 中调用 spin(),或在主函数中使用 rclcpp::spin(move_group_node) 替代手动多线程管理。
  3. 使用 MoveGroupInterface::Options(groupName, "robot_description", moveNs) 显式指定参数进行初始化,并紧接着调用 startStateMonitor() 启动状态监听。
  4. 确保 node_options 开启 automatically_declare_parameters_from_overrides(true) 以正确加载配置参数。

原问题作者:Filip Zorić;采纳答案作者:Filip Zorić。原内容依 CC BY-SA 4.0 授权,本页摘要同样依 CC BY-SA 4.0 授权。

来源

本页事实对应的公开页面,以原文为准。

  1. Robotics Stack Exchange #111134:MoveIt2 Didn't receive robot state (joint angles) with recent timestamp within 1.000000 seconds访问 2026-10-27