@@ -467,12 +467,28 @@ std::vector<landmark_manager::Landmark> LidarMarkerLocalizer::detect_landmarks(
467467 center_intensity_grid_msg.info .width = bin_num;
468468 center_intensity_grid_msg.info .height = ring_num;
469469 center_intensity_grid_msg.info .origin .position .x = min_x;
470- center_intensity_grid_msg.info .origin .position .y = param_.marker_to_vehicle_offset_y ;
471- center_intensity_grid_msg.info .origin .position .z =
472- param_.marker_height_from_ground +
473- center_intensity_grid_msg.info .height * center_intensity_grid_msg.info .resolution / 2.0 ;
474- center_intensity_grid_msg.info .origin .orientation =
475- autoware_utils_geometry::create_quaternion_from_rpy (-M_PI / 2.0 , 0.0 , 0.0 );
470+ if (param_.road_surface_mode ) {
471+ center_intensity_grid_msg.info .origin .position .y =
472+ param_.marker_to_vehicle_offset_y -
473+ center_intensity_grid_msg.info .height * center_intensity_grid_msg.info .resolution / 2.0 ;
474+ center_intensity_grid_msg.info .origin .position .z = param_.marker_height_from_ground ;
475+ if (param_.marker_to_vehicle_offset_y >= 0 ) {
476+ center_intensity_grid_msg.info .origin .position .y +=
477+ center_intensity_grid_msg.info .height * center_intensity_grid_msg.info .resolution ;
478+ center_intensity_grid_msg.info .origin .orientation =
479+ autoware_utils_geometry::create_quaternion_from_rpy (M_PI, 0.0 , 0.0 );
480+ } else {
481+ center_intensity_grid_msg.info .origin .orientation =
482+ autoware_utils_geometry::create_quaternion_from_rpy (0.0 , 0.0 , 0.0 );
483+ }
484+ } else {
485+ center_intensity_grid_msg.info .origin .position .y = param_.marker_to_vehicle_offset_y ;
486+ center_intensity_grid_msg.info .origin .position .z =
487+ param_.marker_height_from_ground +
488+ center_intensity_grid_msg.info .height * center_intensity_grid_msg.info .resolution / 2.0 ;
489+ center_intensity_grid_msg.info .origin .orientation =
490+ autoware_utils_geometry::create_quaternion_from_rpy (-M_PI / 2.0 , 0.0 , 0.0 );
491+ }
476492 center_intensity_grid_msg.data = std::vector<int8_t >(
477493 center_intensity_grid_msg.info .width * center_intensity_grid_msg.info .height , -1 );
478494
@@ -589,7 +605,11 @@ std::vector<landmark_manager::Landmark> LidarMarkerLocalizer::detect_landmarks(
589605 static_cast <double >(i) + static_cast <double >(param_.intensity_pattern .size ()) / 2.0 ;
590606 Pose marker_pose_on_base_link;
591607 marker_pose_on_base_link.position .x = bin_position * param_.resolution + min_x;
592- marker_pose_on_base_link.position .y = reference_ring_y[i];
608+ if (param_.road_surface_mode ) {
609+ marker_pose_on_base_link.position .y = param_.marker_to_vehicle_offset_y ;
610+ } else {
611+ marker_pose_on_base_link.position .y = reference_ring_y[i];
612+ }
593613 marker_pose_on_base_link.position .z = param_.marker_height_from_ground ;
594614 marker_pose_on_base_link.orientation =
595615 autoware_utils::create_quaternion_from_rpy (M_PI_2, 0.0 , 0.0 ); // TODO(YamatoAndo)
@@ -770,9 +790,14 @@ void LidarMarkerLocalizer::save_intensity(
770790
771791 // extract marker pointcloud
772792 for (const auto & point : points_ptr->points ) {
773- const double xy_distance = std::sqrt (
793+ double xy_distance = std::sqrt (
774794 std::pow (point.x - marker_pose.position .x , 2.0 ) +
775795 std::pow (point.y - marker_pose.position .y , 2.0 ));
796+ if (param_.road_surface_mode ) {
797+ xy_distance = std::sqrt (
798+ std::pow (point.x - marker_pose.position .x , 2.0 ) +
799+ std::pow (point.z - marker_pose.position .z , 2.0 ));
800+ }
776801 if (xy_distance < param_.radius_for_extracting_marker_pointcloud ) {
777802 marker_points_ptr->push_back (point);
778803
0 commit comments