Skip to content

Commit

Permalink
[MPPI] empty path_follow_critic proper fix (#3599)
Browse files Browse the repository at this point in the history
* [MPPI] empty path_follow_critic proper fix

* fix linting issue

---------

Co-authored-by: Guillaume Doisy <[email protected]>
Co-authored-by: Steve Macenski <[email protected]>
  • Loading branch information
3 people committed Jun 9, 2023
1 parent 8b72277 commit 8edb367
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nav2_mppi_controller/src/critics/path_follow_critic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ void PathFollowCritic::initialize()

void PathFollowCritic::score(CriticData & data)
{
const size_t path_size = data.path.x.shape(0) - 1;

if (!enabled_ || path_size == 0 ||
if (!enabled_ || data.path.x.shape(0) < 2 ||
utils::withinPositionGoalTolerance(threshold_to_consider_, data.state.pose.pose, data.path))
{
return;
}

utils::setPathFurthestPointIfNotSet(data);
utils::setPathCostsIfNotSet(data, costmap_ros_);
const size_t path_size = data.path.x.shape(0) - 1;

auto offseted_idx = std::min(
*data.furthest_reached_path_point + offset_from_furthest_, path_size);
Expand Down

0 comments on commit 8edb367

Please sign in to comment.