小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
ros2 humble action代码,移植到ros2 foxy下报错
-
使用humble现在在编写一个机器人代码,很无奈因为其他工具库的原因,要将系统降到ubuntn20.04,所以ros2 版本也就跟着降到foxy,原来的ros2 humble action代码,移植到ros2 foxy下报错。各位路过的大佬帮忙看看,不胜感激。
参考https://fishros.com/d2lros2/#/教程写的代码。
自己的代码片段:
auto send_goal_options = rclcpp_action::Client<MoveRobot>::SendGoalOptions();
send_goal_options.goal_response_callback = std::bind(&Task::MoveActionGoalResponseCallback, this, _1);
send_goal_options.feedback_callback = std::bind(&Task::MoveActionFeedbackCallback, this, _1, _2);
send_goal_options.result_callback = std::bind(&Task::MoveActionResultCallback, this, _1);第二行代码报错
报错如下:
/home/de/project/smartcore/src/task/src/taskMaster.cpp:172:102: error: no match for ‘operator=’ (operand types are ‘rclcpp_action::Client<core_interfaces::action::MoveRobot>::GoalResponseCallback’ {aka ‘std::function<void(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<core_interfaces::action::MoveRobot> > >)>’} and ‘std::_Bind_helper<false, void (TASKMASTER::Task::)(std::shared_ptr<rclcpp_action::ClientGoalHandle<core_interfaces::action::MoveRobot> >), TASKMASTER::Task, const std::_Placeholder<1>&>::type’ {aka ‘std::_Bind<void (TASKMASTER::Task::(TASKMASTER::Task, std::_Placeholder<1>))(std::shared_ptr<rclcpp_action::ClientGoalHandle<core_interfaces::action::MoveRobot> >)>’})
172 | k = std::bind(&Task::MoveActionGoalResponseCallback, this, _1); -