Skip to content

Commit

Permalink
check width&height params (#4017)
Browse files Browse the repository at this point in the history
Co-authored-by: GoesM <GoesM@buaa.edu.cn>
  • Loading branch information
2 people authored and SteveMacenski committed Jan 24, 2024
1 parent af08021 commit 8831248
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nav2_costmap_2d/src/costmap_2d_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,18 @@ Costmap2DROS::getParameters()
footprint_.c_str(), robot_radius_);
}
}

// 4. The width and height of map cannot be negative or 0 (to avoid abnoram memory usage)
if (map_width_meters_ <= 0) {
RCLCPP_ERROR(
get_logger(), "You try to set width of map to be negative or zero,"
" this isn't allowed, please give a positive value.");
}
if (map_height_meters_ <= 0) {
RCLCPP_ERROR(
get_logger(), "You try to set height of map to be negative or zero,"
" this isn't allowed, please give a positive value.");
}
}

void
Expand Down

0 comments on commit 8831248

Please sign in to comment.