68 {
69
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) {
73
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.";
77 LaneDetectorInitOptions lane_detector_init_options;
78 const auto &lane_detector_param = lane_param.lane_detector_param();
79 const auto &lane_detector_plugin_param = lane_detector_param.plugin_param();
80 lane_detector_init_options.config_file =
81 lane_detector_plugin_param.config_file();
82 lane_detector_init_options.config_path =
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";
88 auto pinhole = static_cast<base::PinholeCameraModel *>(model.get());
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();
92 lane_detector_init_options.base_camera_model = model;
93 AINFO <<
"lane_detector_name: " << lane_detector_plugin_param.name();
94
95
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();
102
103
104 const auto &lane_postprocessor_param =
105 lane_param.lane_postprocessor_param();
106 LanePostprocessorInitOptions postprocessor_init_options;
107 postprocessor_init_options.config_path =
108 lane_postprocessor_param.config_path();
109 postprocessor_init_options.config_file =
110 lane_postprocessor_param.config_file();
111
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();
119
120
121 if (perception_param.has_debug_param() &&
122 perception_param.debug_param().has_lane_out_dir()) {
123 write_out_lane_file_ = true;
124 out_lane_dir_ = perception_param.debug_param().lane_out_dir();
126 }
127
128 if (perception_param.has_debug_param() &&
129 perception_param.debug_param().has_calibration_out_dir()) {
130 write_out_calib_file_ = true;
131 out_calib_dir_ = perception_param.debug_param().calibration_out_dir();
133 }
134 }
135}
bool EnsureDirectory(const std::string &directory_path)
Check if a specified directory specified by directory_path exists.