How to abort existing goals and get the feedback for new goals with ROS2 actions?

asked 2021-03-02 19:37:21 -0600

webvenky gravatar image

When I added a feedback funciton to the waypoint_follower of Navigation2 as shown below.

  auto send_goal_options = rclcpp_action::Client<ClientT>::SendGoalOptions();
  send_goal_options.feedback_callback =
    std::bind(&WaypointFollower::feedback_callback, this, std::placeholders::_1, std::placeholders::_2);
  send_goal_options.result_callback =
    std::bind(&WaypointFollower::resultCallback, this, std::placeholders::_1);
  send_goal_options.goal_response_callback =
    std::bind(&WaypointFollower::goalResponseCallback, this, std::placeholders::_1);

  future_goal_handle_ =
    nav_to_pose_client_->async_send_goal(client_goal, send_goal_options);

Whenever the action gets aborted (when I send a new goal before the old goal gets completed), the feedback_callback function stops getting called again.

Do I have to unbind/unregister the callback function before I send a new goal? Please help.

edit retag flag offensive close merge delete