70 CHECK_GT(perception_param.lane_param_size(), 0)
71 <<
"Failed to include lane_param";
72 for (
int i = 0; i < perception_param.lane_param_size(); ++i) {
74 const auto &lane_param = perception_param.
lane_param(i);
75 ACHECK(lane_param.has_lane_detector_param())
76 <<
"Failed to include lane_detector_param.";
78 const auto &lane_detector_param = lane_param.lane_detector_param();
79 const auto &lane_detector_plugin_param = lane_detector_param.plugin_param();
81 lane_detector_plugin_param.config_file();
83 lane_detector_plugin_param.config_path();
84 model = algorithm::SensorManager::Instance()->GetUndistortCameraModel(
85 lane_detector_param.camera_name());
86 ACHECK(model) <<
"Can't find " << lane_detector_param.camera_name()
87 <<
" in data/conf/sensor_meta.pb.txt";
89 name_intrinsic_map_.insert(std::pair<std::string, Eigen::Matrix3f>(
90 lane_detector_param.camera_name(), pinhole->get_intrinsic_params()));
91 lane_detector_init_options.
gpu_id = perception_param.
gpu_id();
93 AINFO <<
"lane_detector_name: " << lane_detector_plugin_param.name();
96 lane_detector_.reset(BaseLaneDetectorRegisterer::GetInstanceByName(
97 lane_detector_plugin_param.name()));
98 CHECK_NOTNULL(lane_detector_);
99 ACHECK(lane_detector_->Init(lane_detector_init_options))
100 <<
"Failed to init: " << lane_detector_plugin_param.name();
101 AINFO <<
"Detector: " << lane_detector_->Name();
104 const auto &lane_postprocessor_param =
105 lane_param.lane_postprocessor_param();
108 lane_postprocessor_param.config_path();
110 lane_postprocessor_param.config_file();
112 lane_postprocessor_.reset(
113 BaseLanePostprocessorRegisterer::GetInstanceByName(
114 lane_postprocessor_param.name()));
115 CHECK_NOTNULL(lane_postprocessor_);
116 ACHECK(lane_postprocessor_->Init(postprocessor_init_options))
117 <<
"Failed to init: " << lane_postprocessor_param.name();
118 AINFO <<
"lane_postprocessor: " << lane_postprocessor_->Name();
121 if (perception_param.has_debug_param() &&
122 perception_param.
debug_param().has_lane_out_dir()) {
123 write_out_lane_file_ =
true;
125 EnsureDirectory(out_lane_dir_);
128 if (perception_param.has_debug_param() &&
129 perception_param.
debug_param().has_calibration_out_dir()) {
130 write_out_calib_file_ =
true;
132 EnsureDirectory(out_calib_dir_);
141 ACHECK(perception_param.has_calibration_service_param())
142 <<
"Failed to include calibration_service_param";
147 lane_calibration_working_sensor_name_;
150 calibration_service_param.calibrator_method();
152 static_cast<int>(model->get_height());
154 static_cast<int>(model->get_width());
156 calibration_service_.reset(
157 BaseCalibrationServiceRegisterer::GetInstanceByName(
158 calibration_service_param.plugin_param().name()));
159 CHECK_NOTNULL(calibration_service_);
160 ACHECK(calibration_service_->Init(calibration_service_init_options))
161 <<
"Failed to init " << calibration_service_param.plugin_param().name();
162 AINFO <<
"Calibration service: " << calibration_service_->Name();
166 const std::map<std::string, float> name_camera_ground_height_map,
167 const std::map<std::string, float> name_camera_pitch_angle_diff_map,
168 const float &pitch_angle_calibrator_working_sensor) {
169 if (calibration_service_ ==
nullptr) {
170 AERROR <<
"Calibraion service is not available";
173 calibration_service_->SetCameraHeightAndPitch(
174 name_camera_ground_height_map, name_camera_pitch_angle_diff_map,
175 pitch_angle_calibrator_working_sensor);
200 AERROR <<
"Calibraion service is not available";
205 if (lane_calibration_working_sensor_name_ ==
211 if (!lane_detector_->Detect(lane_detetor_options, frame)) {
212 AERROR <<
"Failed to detect lane.";
218 if (!lane_postprocessor_->Process2D(lane_postprocessor_options, frame)) {
219 AERROR <<
"Failed to postprocess lane 2D.";
223 "LanePostprocessor2D");
228 "CalibrationService");
230 if (!lane_postprocessor_->Process3D(lane_postprocessor_options, frame)) {
231 AERROR <<
"Failed to postprocess lane 3D.";
235 "LanePostprocessor3D");
237 if (write_out_lane_file_) {
238 std::string lane_file_path =
239 absl::StrCat(out_lane_dir_,
"/", frame->
frame_id,
".txt");
243 AINFO <<
"Skip lane detection & calibration due to sensor mismatch.";
244 AINFO <<
"Will use service sync from obstacle camera instead.";
248 "CalibrationService");
251 if (write_out_calib_file_) {
252 std::string calib_file_path =
253 absl::StrCat(out_calib_dir_,
"/", frame->
frame_id,
".txt");