Skip to content

Commit

Permalink
fix(obstacle_avoidance_planner): fix inf loop in mpt (#1881)
Browse files Browse the repository at this point in the history
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
  • Loading branch information
takayuki5168 authored Sep 23, 2022
1 parent 1279296 commit 1b23f84
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions planning/obstacle_avoidance_planner/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,19 @@ Trajectories ObstacleAvoidancePlanner::optimizeTrajectory(
return getPrevTrajs(p.path.points);
}

// NOTE: Elastic band sometimes diverges with status = "OSQP_SOLVED".
constexpr double max_path_change_diff = 1.0e4;
for (size_t i = 0; i < eb_traj->size(); ++i) {
const auto & eb_pos = eb_traj->at(i).pose.position;
const auto & path_pos = path.points.at(std::min(i, path.points.size() - 1)).pose.position;

This comment has been minimized.

Copy link
@FengChenHUSTUM

FengChenHUSTUM Sep 23, 2022

Is "p" missing here? I assume it should be "p.path.points"

This comment has been minimized.

Copy link
@takayuki5168

takayuki5168 Sep 24, 2022

Author Contributor

@FengChenHUSTUM Sorry for my mistake.
I've fixed.
f1aaa5d


const double diff_x = eb_pos.x - path_pos.x;
const double diff_y = eb_pos.y - path_pos.y;
if (max_path_change_diff < std::abs(diff_x) || max_path_change_diff < std::abs(diff_y)) {
return getPrevTrajs(path.points);
}
}

// EB has to be solved twice before solving MPT with fixed points
// since the result of EB is likely to change with/without fixing (1st/2nd EB)
// that makes MPT fixing points worse.
Expand Down

0 comments on commit 1b23f84

Please sign in to comment.