Skip to content

Commit

Permalink
Updating error logging in Smac collision detector object (#4743)
Browse files Browse the repository at this point in the history
* Updating error logging in Smac configs

Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>

* linting

Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>

---------

Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>
  • Loading branch information
SteveMacenski committed Nov 8, 2024
1 parent 12b4233 commit edfb953
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions nav2_smac_planner/src/collision_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ void GridCollisionChecker::setFootprint(
const double & possible_collision_cost)
{
possible_collision_cost_ = static_cast<float>(possible_collision_cost);
if (possible_collision_cost_ <= 0.0f) {
RCLCPP_ERROR_THROTTLE(
logger_, *clock_, 1000,
"Inflation layer either not found or inflation is not set sufficiently for "
"optimized non-circular collision checking capabilities. It is HIGHLY recommended to set"
" the inflation radius to be at MINIMUM half of the robot's largest cross-section. See "
"github.com/ros-planning/navigation2/tree/main/nav2_smac_planner#potential-fields"
" for full instructions. This will substantially impact run-time performance.");
}

footprint_is_radius_ = radius;

// Use radius, no caching required
Expand Down Expand Up @@ -114,18 +124,8 @@ bool GridCollisionChecker::inCollision(
footprint_cost_ = static_cast<float>(costmap_->getCost(
static_cast<unsigned int>(x + 0.5f), static_cast<unsigned int>(y + 0.5f)));

if (footprint_cost_ < possible_collision_cost_) {
if (possible_collision_cost_ > 0.0f) {
return false;
} else {
RCLCPP_ERROR_THROTTLE(
logger_, *clock_, 1000,
"Inflation layer either not found or inflation is not set sufficiently for "
"optimized non-circular collision checking capabilities. It is HIGHLY recommended to set"
" the inflation radius to be at MINIMUM half of the robot's largest cross-section. See "
"github.com/ros-planning/navigation2/tree/main/nav2_smac_planner#potential-fields"
" for full instructions. This will substantially impact run-time performance.");
}
if (footprint_cost_ < possible_collision_cost_ && possible_collision_cost_ > 0.0f) {
return false;
}

// If its inscribed, in collision, or unknown in the middle,
Expand Down

0 comments on commit edfb953

Please sign in to comment.