@@ -2402,15 +2402,9 @@ std::vector<PosePath> MapBasedPredictionNode::convertPathType(
2402
2402
continue ;
2403
2403
}
2404
2404
2405
- const double dx = current_p.position .x - prev_p.position .x ;
2406
- const double dy = current_p.position .y - prev_p.position .y ;
2407
- const double sin_yaw_half = dy / (std::sqrt (dx * dx + dy * dy) + dx);
2408
- const double cos_yaw_half = std::sqrt (1 - sin_yaw_half * sin_yaw_half);
2409
- current_p.orientation .x = 0.0 ;
2410
- current_p.orientation .y = 0.0 ;
2411
- current_p.orientation .z = sin_yaw_half;
2412
- current_p.orientation .w = cos_yaw_half;
2413
-
2405
+ const double lane_yaw = std::atan2 (
2406
+ current_p.position .y - prev_p.position .y , current_p.position .x - prev_p.position .x );
2407
+ current_p.orientation = autoware::universe_utils::createQuaternionFromYaw (lane_yaw);
2414
2408
converted_path.push_back (current_p);
2415
2409
prev_p = current_p;
2416
2410
}
@@ -2439,29 +2433,17 @@ std::vector<PosePath> MapBasedPredictionNode::convertPathType(
2439
2433
}
2440
2434
}
2441
2435
2442
- const double dx = current_p.position .x - prev_p.position .x ;
2443
- const double dy = current_p.position .y - prev_p.position .y ;
2444
- const double sin_yaw_half = dy / (std::sqrt (dx * dx + dy * dy) + dx);
2445
- const double cos_yaw_half = std::sqrt (1 - sin_yaw_half * sin_yaw_half);
2446
- current_p.orientation .x = 0.0 ;
2447
- current_p.orientation .y = 0.0 ;
2448
- current_p.orientation .z = sin_yaw_half;
2449
- current_p.orientation .w = cos_yaw_half;
2450
-
2436
+ const double lane_yaw = std::atan2 (
2437
+ current_p.position .y - prev_p.position .y , current_p.position .x - prev_p.position .x );
2438
+ current_p.orientation = autoware::universe_utils::createQuaternionFromYaw (lane_yaw);
2451
2439
converted_path.push_back (current_p);
2452
2440
prev_p = current_p;
2453
2441
}
2454
2442
}
2455
2443
2456
2444
// Resample Path
2457
- const bool use_akima_spline_for_xy = true ;
2458
- const bool use_lerp_for_z = true ;
2459
- // the options use_akima_slpine_for_xy and use_lerp_for_z are set to true
2460
- // but the implementation of use_akima_slpine_for_xy in resamplePoseVector and
2461
- // resamplePointVector is opposite to the options so the options are set to true to use linear
2462
- // interpolation for xy
2463
- const auto resampled_converted_path = autoware::motion_utils::resamplePoseVector (
2464
- converted_path, reference_path_resolution_, use_akima_spline_for_xy, use_lerp_for_z);
2445
+ const auto resampled_converted_path =
2446
+ autoware::motion_utils::resamplePoseVector (converted_path, reference_path_resolution_);
2465
2447
converted_paths.push_back (resampled_converted_path);
2466
2448
}
2467
2449
0 commit comments