微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 ros

如何解决使用 ros

我试图在代码中切换控制器,但它一直返回 false,我不知道为什么,这是代码

 ros::ServiceClient switch_controller = n.serviceClient<controller_manager_msgs::SwitchController>("egm/controller_manager/switch_controller");

std::vector<std::string> start_controller;
      start_controller.push_back("joint_group_veLocity_controller");
      std::vector<std::string> stop_controller;
      stop_controller.push_back("");
      switch_controller_req.start_controllers = start_controller;
      switch_controller_req.stop_controllers = stop_controller;
      switch_controller_req.strictness = 1;
      switch_controller_req.start_asap = false;
      switch_controller_req.timeout = 0.0;
      ros::service::waitForService("egm/controller_manager/switch_controller",ros::Duration(5));
      success = stop_rapid.call(switch_controller_req,switch_controller_resp);
      if (success)
      {
        ROS_INFO_STREAM("Controller switch correctly");

      }
      else
      {
        ROS_ERROR_STREAM("Error occured trying to switch controller");
        return 0;
      }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。