提交 9cc0bc2a 编写于 作者: Y Yuliang Guo 提交者: Tae Eun Choe

perception: address an issue with camera detection module, making it to create...

perception: address an issue with camera detection module, making it to create output folder automatically based on config file (#6782)
上级 4c83e49a
......@@ -117,6 +117,25 @@ void LaneCameraPerception::InitLane(
CHECK(lane_postprocessor_->Init(postprocessor_init_options))
<< "Failed to init " << lane_postprocessor_param.name();
AINFO << "lane_postprocessor: " << lane_postprocessor_->Name();
// Init output file folder
if (perception_param_.has_debug_param() &&
perception_param_.debug_param().has_lane_out_dir()) {
write_out_lane_file_ = true;
out_lane_dir_ = perception_param_.debug_param().lane_out_dir();
std::string command;
command = "mkdir -p " + out_lane_dir_;
system(command.c_str());
}
if (perception_param_.has_debug_param() &&
perception_param_.debug_param().has_calibration_out_dir()) {
write_out_calib_file_ = true;
out_calib_dir_ = perception_param_.debug_param().calibration_out_dir();
std::string command;
command = "mkdir -p " + out_calib_dir_;
system(command.c_str());
}
}
}
......@@ -208,12 +227,13 @@ bool LaneCameraPerception::Perception(
PERCEPTION_PERF_BLOCK_END_WITH_INDICATOR(
frame->data_provider->sensor_name(), "LanePostprocessor3D");
std::string save_path = perception_param_.debug_param().lane_out_dir()
+ "/" + std::to_string(frame->frame_id) + ".txt";
WriteLanelines(perception_param_.has_debug_param() &&
perception_param_.debug_param().has_lane_out_dir(),
save_path,
frame->lane_objects);
if (write_out_lane_file_) {
std::string lane_file_path =
out_lane_dir_ + "/" + std::to_string(frame->frame_id) + ".txt";
WriteLanelines(write_out_lane_file_,
lane_file_path,
frame->lane_objects);
}
} else {
AINFO << "Skip lane detection & calibration due to sensor mismatch.";
AINFO << "Will use service sync from obstacle camera instead.";
......@@ -223,13 +243,13 @@ bool LaneCameraPerception::Perception(
frame->data_provider->sensor_name(), "CalibrationService");
}
std::string save_calibration_path =
perception_param_.debug_param().calibration_out_dir()
+ "/" + std::to_string(frame->frame_id) + ".txt";
WriteCalibrationOutput(perception_param_.has_debug_param() &&
perception_param_.debug_param().has_calibration_out_dir(),
save_calibration_path, frame);
if (write_out_calib_file_) {
std::string calib_file_path =
out_calib_dir_ + "/" + std::to_string(frame->frame_id) + ".txt";
WriteCalibrationOutput(write_out_calib_file_,
calib_file_path,
frame);
}
return true;
}
} // namespace camera
......
......@@ -70,6 +70,10 @@ class LaneCameraPerception : public BaseCameraPerception {
std::shared_ptr<BaseCalibrationService> calibration_service_;
app::PerceptionParam perception_param_;
std::string lane_calibration_working_sensor_name_ = "";
bool write_out_lane_file_ = false;
bool write_out_calib_file_ = false;
std::string out_lane_dir_;
std::string out_calib_dir_;
};
} // namespace camera
......
......@@ -228,6 +228,25 @@ void ObstacleCameraPerception::InitLane(
CHECK(lane_postprocessor_->Init(postprocessor_init_options))
<< "Failed to init " << lane_postprocessor_param.name();
AINFO << "lane_postprocessor: " << lane_postprocessor_->Name();
// Init output file folder
if (perception_param_.has_debug_param() &&
perception_param_.debug_param().has_lane_out_dir()) {
write_out_lane_file_ = true;
out_lane_dir_ = perception_param_.debug_param().lane_out_dir();
std::string command;
command = "mkdir -p " + out_lane_dir_;
system(command.c_str());
}
if (perception_param_.has_debug_param() &&
perception_param_.debug_param().has_calibration_out_dir()) {
write_out_calib_file_ = true;
out_calib_dir_ = perception_param_.debug_param().calibration_out_dir();
std::string command;
command = "mkdir -p " + out_calib_dir_;
system(command.c_str());
}
}
}
......@@ -323,12 +342,13 @@ bool ObstacleCameraPerception::Perception(
PERCEPTION_PERF_BLOCK_END_WITH_INDICATOR(
frame->data_provider->sensor_name(), "LanePostprocessor3D");
std::string save_path = perception_param_.debug_param().lane_out_dir()
+ "/" + std::to_string(frame->frame_id) + ".txt";
WriteLanelines(perception_param_.has_debug_param() &&
perception_param_.debug_param().has_lane_out_dir(),
save_path,
frame->lane_objects);
if (write_out_lane_file_) {
std::string lane_file_path =
out_lane_dir_ + "/" + std::to_string(frame->frame_id) + ".txt";
WriteLanelines(write_out_lane_file_,
lane_file_path,
frame->lane_objects);
}
} else {
AINFO << "Skip lane detection & calibration due to sensor mismatch.";
AINFO << "Will use service sync from obstacle camera instead.";
......@@ -338,12 +358,13 @@ bool ObstacleCameraPerception::Perception(
frame->data_provider->sensor_name(), "CalibrationService");
}
std::string save_calibration_path =
perception_param_.debug_param().calibration_out_dir()
+ "/" + std::to_string(frame->frame_id) + ".txt";
WriteCalibrationOutput(perception_param_.has_debug_param() &&
perception_param_.debug_param().has_calibration_out_dir(),
save_calibration_path, frame);
if (write_out_calib_file_) {
std::string calib_file_path =
out_calib_dir_ + "/" + std::to_string(frame->frame_id) + ".txt";
WriteCalibrationOutput(write_out_calib_file_,
calib_file_path,
frame);
}
// obstacle
if (!tracker_->Predict(tracker_options, frame)) {
......
......@@ -87,6 +87,10 @@ class ObstacleCameraPerception : public BaseCameraPerception {
std::ofstream out_track_;
std::ofstream out_pose_;
std::string lane_calibration_working_sensor_name_ = "";
bool write_out_lane_file_ = false;
bool write_out_calib_file_ = false;
std::string out_lane_dir_;
std::string out_calib_dir_;
protected:
ObjectTemplateManager *object_template_manager_ = nullptr;
......
......@@ -72,7 +72,3 @@ object_template_param {
}
}
debug_param {
lane_out_dir : "/apollo/debug_output/lane/"
calibration_out_dir : "/apollo/debug_output/calib/"
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册