Skip to content

Commit

Permalink
planner_3d: apply turn_penalty_cost_threshold in curve path
Browse files Browse the repository at this point in the history
  • Loading branch information
nhatao committed Aug 14, 2024
1 parent fdf3d19 commit 0dee3ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions planner_cspace/src/grid_astar_model_3dof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ float GridAstarModel3D::cost(
}

{
int sum = 0, sum_hyst = 0;
int sum = 0, sum_turn = 0, sum_hyst = 0;
Vec d_index(d[0], d[1], next[2]);
d_index.cycleUnsigned(map_info_.angle);

Expand All @@ -274,14 +274,18 @@ float GridAstarModel3D::cost(
const auto c = cm_[pos];
if (c > 99)
return -1;
if (c >= cc_.turn_penalty_cost_threshold_)
{
sum_turn += c;
}
sum += c;

if (hysteresis_)
sum_hyst += cm_hyst_[pos];
}
const float distf = cache_page->second.getDistance();
cost += sum * map_info_.linear_resolution * distf * cc_.weight_costmap_ / (100.0 * num);
cost += sum * map_info_.angular_resolution * std::abs(d[2]) * cc_.weight_costmap_turn_ / (100.0 * num);
cost += sum_turn * map_info_.angular_resolution * std::abs(d[2]) * cc_.weight_costmap_turn_ / (100.0 * num);
cost += sum_hyst * map_info_.linear_resolution * distf * cc_.weight_hysteresis_ / (100.0 * num);
}
}
Expand Down

0 comments on commit 0dee3ee

Please sign in to comment.