-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(obstacle_avoidance_planner): fix inf loop in mpt (#1881)
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
- Loading branch information
1 parent
1279296
commit 1b23f84
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
takayuki5168
Author
Contributor
|
||
|
||
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. | ||
|
Is "p" missing here? I assume it should be "p.path.points"