Skip to content

Commit

Permalink
perf(crosswalk): decrease calcSignedArcLength() process (autowarefoun…
Browse files Browse the repository at this point in the history
…dation#4879)

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota authored and tkimura4 committed Sep 5, 2023
1 parent ce82206 commit eb13433
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ using motion_utils::calcLateralOffset;
using motion_utils::calcLongitudinalOffsetPoint;
using motion_utils::calcLongitudinalOffsetPose;
using motion_utils::calcSignedArcLength;
using motion_utils::calcSignedArcLengthPartialSum;
using motion_utils::findNearestSegmentIndex;
using motion_utils::insertTargetPoint;
using motion_utils::resamplePath;
Expand Down Expand Up @@ -731,15 +732,15 @@ Polygon2d CrosswalkModule::getAttentionArea(
{
const auto & ego_pos = planner_data_->current_odometry->pose.position;
const auto ego_polygon = createVehiclePolygon(planner_data_->vehicle_info_);
const auto backward_path_length =
calcSignedArcLength(sparse_resample_path.points, size_t(0), ego_pos);
const auto length_sum = calcSignedArcLengthPartialSum(
sparse_resample_path.points, size_t(0), sparse_resample_path.points.size());

Polygon2d attention_area;
for (size_t j = 0; j < sparse_resample_path.points.size() - 1; ++j) {
const auto & p_ego_front = sparse_resample_path.points.at(j).point.pose;
const auto & p_ego_back = sparse_resample_path.points.at(j + 1).point.pose;
const auto front_length =
calcSignedArcLength(sparse_resample_path.points, ego_pos, p_ego_front.position);
const auto back_length =
calcSignedArcLength(sparse_resample_path.points, ego_pos, p_ego_back.position);
const auto front_length = length_sum.at(j) - backward_path_length;
const auto back_length = length_sum.at(j + 1) - backward_path_length;

if (back_length < crosswalk_attention_range.first) {
continue;
Expand Down

0 comments on commit eb13433

Please sign in to comment.