Skip to content

Commit

Permalink
perf PR 8427
Browse files Browse the repository at this point in the history
  • Loading branch information
technolojin committed Oct 21, 2024
1 parent b75ca96 commit 36fb43e
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions perception/map_based_prediction/src/map_based_prediction_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,13 @@ std::vector<PosePath> MapBasedPredictionNode::convertPathType(

const double lane_yaw = std::atan2(
current_p.position.y - prev_p.position.y, current_p.position.x - prev_p.position.x);
current_p.orientation = tier4_autoware_utils::createQuaternionFromYaw(lane_yaw);
const double sin_yaw_half = std::sin(lane_yaw / 2.0);
const double cos_yaw_half = std::cos(lane_yaw / 2.0);
current_p.orientation.x = 0.0;
current_p.orientation.y = 0.0;
current_p.orientation.z = sin_yaw_half;
current_p.orientation.w = cos_yaw_half;

converted_path.push_back(current_p);
prev_p = current_p;
}
Expand Down Expand Up @@ -2052,15 +2058,27 @@ std::vector<PosePath> MapBasedPredictionNode::convertPathType(

const double lane_yaw = std::atan2(
current_p.position.y - prev_p.position.y, current_p.position.x - prev_p.position.x);
current_p.orientation = tier4_autoware_utils::createQuaternionFromYaw(lane_yaw);
const double sin_yaw_half = std::sin(lane_yaw / 2.0);
const double cos_yaw_half = std::cos(lane_yaw / 2.0);
current_p.orientation.x = 0.0;
current_p.orientation.y = 0.0;
current_p.orientation.z = sin_yaw_half;
current_p.orientation.w = cos_yaw_half;

converted_path.push_back(current_p);
prev_p = current_p;
}
}

// Resample Path
const auto resampled_converted_path =
motion_utils::resamplePoseVector(converted_path, reference_path_resolution_);
const bool use_akima_spline_for_xy = true;
const bool use_lerp_for_z = true;
// the options use_akima_spline_for_xy and use_lerp_for_z are set to true
// but the implementation of use_akima_spline_for_xy in resamplePoseVector and
// resamplePointVector is opposite to the options so the options are set to true to use linear
// interpolation for xy
const auto resampled_converted_path = motion_utils::resamplePoseVector(
converted_path, reference_path_resolution_, use_akima_spline_for_xy, use_lerp_for_z);
converted_paths.push_back(resampled_converted_path);
}

Expand Down

0 comments on commit 36fb43e

Please sign in to comment.