Skip to content

Commit

Permalink
feat: keep stop policy v0.11.2 (reopen) (autowarefoundation#1246)
Browse files Browse the repository at this point in the history
* feat(avoidance): keep stopping until all shift lines are registered

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>

* revert refactoring due to cherry-pick

---------

Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
Co-authored-by: satoshi-ota <satoshi.ota928@gmail.com>
  • Loading branch information
saka1-s and satoshi-ota committed Apr 10, 2024
1 parent 4d368b9 commit 202a178
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@
stop_buffer: 1.0 # [m]

policy:
# policy for rtc request. select "shift_line" or "maneuver".
# "shift_line": request approval for each shift line.
# "maneuver": request approval for avoidance maneuver (avoid + return).
approval: "shift_line"
# policy for vehicle slow down behavior. select "best_effort" or "reliable".
# "best_effort": slow down deceleration & jerk are limited by constraints.
# but there is a possibility that the vehicle can't stop in front of the vehicle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ struct AvoidanceParameters
// policy
bool use_shorten_margin_immediately{false};

// policy
std::string policy_approval{"shift_line"};

// policy
std::string policy_deceleration{"best_effort"};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ bool isBestEffort(const std::string & policy)
{
return policy == "best_effort";
}

bool perManeuver(const std::string & policy)
{
return policy == "maneuver";
}
} // namespace

AvoidanceModule::AvoidanceModule(
Expand Down Expand Up @@ -2316,9 +2321,16 @@ AvoidLineArray AvoidanceModule::findNewShiftLine(const AvoidLineArray & candidat
break;
}

if (!is_ignore_shift(candidate)) {
return get_subsequent_shift(i);
if (is_ignore_shift(candidate)) {
continue;
}

if (perManeuver(parameters_->policy_approval)) {
return candidates;
}

const auto new_shift_lines = get_subsequent_shift(i);
return new_shift_lines;
}

DEBUG_PRINT("No new shift point exists.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ AvoidanceModuleManager::AvoidanceModuleManager(
// policy
{
std::string ns = "avoidance.policy.";
p.policy_approval = getOrDeclareParameter<std::string>(*node, ns + "approval");
p.policy_deceleration = getOrDeclareParameter<std::string>(*node, ns + "deceleration");
p.policy_lateral_margin = getOrDeclareParameter<std::string>(*node, ns + "lateral_margin");
p.use_shorten_margin_immediately =
Expand Down

0 comments on commit 202a178

Please sign in to comment.