ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Custom Nav2 Plugin - Achtion server aborts handle

asked 2023-07-13 04:18:51 -0500

ChWa02 gravatar image

System: Ubuntu 22.04, ROS2 Humble, Nav2

Hi,

I'am writing a nav2 costmap plugin. So far, everything works as intended, the costmap get the values I am setting and I am able to see the correct costmap in RVIZ.

The curious thing is that as soon as I enable the plugin the action server won't calculate any path. Sadly, I get no other error message than:

 [controller_server]: [follow_path] [ActionServer] Aborting handle.

What are possible reasons that the path can't be calculated?

I am setting the costs in the following way:

void 
SemLayer::updateCosts(nav2_costmap_2d::Costmap2D &master_grid,int min_i, int min_j, int max_i, int max_j) {

  if (!enabled_) {
    return;
  }

  if (!obj_detected_){
    return;
  }

  unsigned int size_x = master_grid.getSizeInCellsX(), size_y = master_grid.getSizeInCellsY();

  min_i = std::max(0, min_i);
  min_j = std::max(0, min_j);
  max_i = std::min(static_cast<int>(size_x), max_i);
  max_j = std::min(static_cast<int>(size_y), max_j);

  for (int x = min_i; x < max_i / 2; x++) {
    for (int y = min_j; y < max_j / 2; y++) {
      master_grid.setCost(x, y, 120);
    }
  } 
  obj_detected_ = false;
}

Many thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-07-13 06:42:42 -0500

ChWa02 gravatar image

Found my error! I've missed the line current_ = true; In the onInitialize() method

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-07-13 04:18:51 -0500

Seen: 119 times

Last updated: Jul 13 '23