Skip to content

Commit

Permalink
feat(avoidance): keep stopping until all shift lines are registered (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#5658)

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota authored and danielsanchezaran committed Dec 15, 2023
1 parent ebb6ada commit c18d45c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@
stop_buffer: 1.0 # [m]

policy:
# policy for rtc request. select "per_shift_line" or "per_avoidance_maneuver".
# "per_shift_line": request approval for each shift line.
# "per_avoidance_maneuver": request approval for avoidance maneuver (avoid + return).
make_approval_request: "per_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 @@ -285,6 +285,9 @@ struct AvoidanceParameters
// policy
bool use_shorten_margin_immediately{false};

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ AvoidanceModuleManager::AvoidanceModuleManager(
// policy
{
std::string ns = "avoidance.policy.";
p.policy_approval = getOrDeclareParameter<std::string>(*node, ns + "make_approval_request");
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ bool isBestEffort(const std::string & policy)
return policy == "best_effort";
}

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

AvoidLine merge(const AvoidLine & line1, const AvoidLine & line2, const UUID id)
{
AvoidLine ret{};
Expand Down Expand Up @@ -1213,11 +1218,18 @@ AvoidLineArray ShiftLineGenerator::findNewShiftLine(
break;
}

if (!is_ignore_shift(candidate)) {
const auto new_shift_lines = get_subsequent_shift(i);
debug.step4_new_shift_line = new_shift_lines;
return new_shift_lines;
if (is_ignore_shift(candidate)) {
continue;
}

if (perManeuver(parameters_->policy_approval)) {
debug.step4_new_shift_line = shift_lines;
return shift_lines;
}

const auto new_shift_lines = get_subsequent_shift(i);
debug.step4_new_shift_line = new_shift_lines;
return new_shift_lines;
}

return {};
Expand Down

0 comments on commit c18d45c

Please sign in to comment.