Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(turn_signal_decider): straddle bound method #7006

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,23 @@ class TurnSignalDecider
using tier4_autoware_utils::transformVector;

const auto footprint = vehicle_info.createFootprint();

for (const auto & lane : lanes) {
for (size_t i = shift_line.start_idx; i < shift_line.end_idx; ++i) {
const auto transform = pose2transform(path.path.points.at(i).point.pose);
const auto shifted_vehicle_footprint = transformVector(footprint, transform);

if (intersects(lane.leftBound2d().basicLineString(), shifted_vehicle_footprint)) {
return true;
}

if (intersects(lane.rightBound2d().basicLineString(), shifted_vehicle_footprint)) {
return true;
}
}
}

return false;
const auto start_itr = std::next(path.path.points.begin(), shift_line.start_idx);
const auto end_itr = std::next(path.path.points.begin(), shift_line.end_idx);

return std::any_of(start_itr, end_itr, [&footprint, &lanes](const auto & point) {
const auto transform = pose2transform(point.point.pose);
const auto shifted_vehicle_footprint = transformVector(footprint, transform);

auto check_for_vehicle_and_bound_intersection =
[&shifted_vehicle_footprint](const auto & lane) {
const auto & left_bound = lane.leftBound2d().basicLineString();
const auto & right_bound = lane.rightBound2d().basicLineString();
return intersects(left_bound, shifted_vehicle_footprint) ||
intersects(right_bound, shifted_vehicle_footprint);
};

return std::any_of(lanes.begin(), lanes.end(), check_for_vehicle_and_bound_intersection);
});
};

inline bool isNearEndOfShift(
Expand Down
Loading