ros_tutorials icon indicating copy to clipboard operation
ros_tutorials copied to clipboard

colcon build error

Open XZ-Niupitang opened this issue 1 year ago • 2 comments

/ROS/src/ros_tutorials/turtlesim/tutorials/teleop_turtle_key.cpp:200:5: error: no match for ‘operator=’ (operand types are ‘rclcpp_action::Client<turtlesim::action::RotateAbsolute>::GoalResponseCallback’ {aka ‘std::function<void(std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> >)>’} and ‘TeleopTurtle::sendGoal(float)::<lambda(std::shared_future<std::shared_ptr<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute> > >)>’)
  200 |     };
      |     ^

After the error is reported here, teleop_turtle_key.cpp is canceled the sendGoal () function in the compilation is normal, what is the problem?

void TeleopTurtle::sendGoal(float theta)
{
  auto goal = turtlesim::action::RotateAbsolute::Goal();
  goal.theta = theta;
  auto send_goal_options = rclcpp_action::Client<turtlesim::action::RotateAbsolute>::SendGoalOptions();
  // send_goal_options.goal_response_callback =
  //   [this](std::shared_future<rclcpp_action::ClientGoalHandle<turtlesim::action::RotateAbsolute>::SharedPtr> future)
  //   {
  //     RCLCPP_DEBUG(nh_->get_logger(), "Goal response received");
  //     this->goal_handle_ = future.get();
  //   };
  rotate_absolute_client_->async_send_goal(goal, send_goal_options);
}

XZ-Niupitang avatar Mar 03 '23 03:03 XZ-Niupitang

We are going to need more information about which platform and versions you are using.

mjcarroll avatar Mar 03 '23 15:03 mjcarroll

我们将需要有关您正在使用的平台和版本的更多信息。

The system version is Ubuntu 22.04LTS,The ROS2 environment is humble,After logging out, it is running normally. Creating a package or node under the workspace can compile and work normally. I just want to know whether the code I logged out will cause ROS2 to run incorrectly.

XZ-Niupitang avatar Mar 04 '23 08:03 XZ-Niupitang