Skip to content

Commit

Permalink
fix unintended behavior: add escape and move replace state before pat…
Browse files Browse the repository at this point in the history
…h generation

Signed-off-by: yoshiri <[email protected]>
  • Loading branch information
YoshiRi committed Oct 27, 2023
1 parent 2713694 commit 6acc281
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions perception/map_based_prediction/src/map_based_prediction_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ lanelet::Lanelets getLeftOppositeLanelets(
void replaceObjectYawWithLaneletsYaw(

Check warning on line 691 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L691

Added line #L691 was not covered by tests
const LaneletsData & current_lanelets, TrackedObject & transformed_object)
{
// return if no lanelet is found
if (current_lanelets.empty()) return;

Check warning on line 695 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L695

Added line #L695 was not covered by tests
auto & pose_with_cov = transformed_object.kinematics.pose_with_covariance;
// for each lanelet, calc lanelet angle and calculate mean angle
double sum_x = 0.0;
Expand Down Expand Up @@ -893,15 +895,8 @@ void MapBasedPredictionNode::objectsCallback(const TrackedObjects::ConstSharedPt
// Get Closest Lanelet
const auto current_lanelets = getCurrentLanelets(transformed_object);

// Fix object angle if its orientation unreliable (e.g. far object by radar sensor)
if (
transformed_object.kinematics.orientation_availability ==
autoware_auto_perception_msgs::msg::TrackedObjectKinematics::UNAVAILABLE) {
replaceObjectYawWithLaneletsYaw(current_lanelets, transformed_object);
}

// Update Objects History
updateObjectsHistory(output.header, transformed_object, current_lanelets);
// Update Objects History
updateObjectsHistory(output.header, transformed_object, current_lanelets);

// For off lane obstacles
if (current_lanelets.empty()) {
Expand Down Expand Up @@ -960,11 +955,19 @@ void MapBasedPredictionNode::objectsCallback(const TrackedObjects::ConstSharedPt
getDebugMarker(object, max_prob_path->maneuver, debug_markers.markers.size());
debug_markers.markers.push_back(debug_marker);

// Fix object angle if its orientation unreliable (e.g. far object by radar sensor)
// This prevent bending predicted path

Check warning on line 959 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L958-L959

Added lines #L958 - L959 were not covered by tests
TrackedObject yaw_fixed_transformed_object = transformed_object;
if (
transformed_object.kinematics.orientation_availability ==
autoware_auto_perception_msgs::msg::TrackedObjectKinematics::UNAVAILABLE) {
replaceObjectYawWithLaneletsYaw(current_lanelets, yaw_fixed_transformed_object);
}

Check warning on line 965 in perception/map_based_prediction/src/map_based_prediction_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/map_based_prediction/src/map_based_prediction_node.cpp#L963-L965

Added lines #L963 - L965 were not covered by tests
// Generate Predicted Path
std::vector<PredictedPath> predicted_paths;
for (const auto & ref_path : ref_paths) {
PredictedPath predicted_path =
path_generator_->generatePathForOnLaneVehicle(transformed_object, ref_path.path);
PredictedPath predicted_path = path_generator_->generatePathForOnLaneVehicle(
yaw_fixed_transformed_object, ref_path.path);
if (predicted_path.path.empty()) {
continue;
}
Expand Down

0 comments on commit 6acc281

Please sign in to comment.