Apollo  6.0
Open source self driving car software
lane_camera_perception.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 
18 #include <fstream>
19 #include <map>
20 #include <memory>
21 #include <string>
22 
23 #include "modules/perception/camera/app/proto/perception.pb.h"
33 
34 namespace apollo {
35 namespace perception {
36 namespace camera {
37 
39  public:
41  : lane_detector_(nullptr),
42  lane_postprocessor_(nullptr),
43  calibration_service_(nullptr) {}
46  ~LaneCameraPerception() = default;
47  bool Init(const CameraPerceptionInitOptions &options) override;
48  void InitLane(const std::string &work_root,
49  base::BaseCameraModelPtr &model, // NOLINT
50  const app::PerceptionParam &perception_param);
51  void InitCalibrationService(const std::string &work_root,
52  const base::BaseCameraModelPtr model,
53  const app::PerceptionParam &perception_param);
55  const std::map<std::string, float> name_camera_ground_height_map,
56  const std::map<std::string, float> name_camera_pitch_angle_diff_map,
57  const float &pitch_angle_calibrator_working_sensor);
58  void SetIm2CarHomography(Eigen::Matrix3d homography_im2car);
59  bool GetCalibrationService(BaseCalibrationService **calibration_service);
60  bool Perception(const CameraPerceptionOptions &options,
61  CameraFrame *frame) override;
62  std::string Name() const override { return "LaneCameraPerception"; }
63 
64  private:
65  std::map<std::string, Eigen::Matrix3f> name_intrinsic_map_;
66  std::map<std::string, Eigen::Matrix4d> name_extrinsic_map_;
67  std::shared_ptr<BaseLaneDetector> lane_detector_;
68  std::shared_ptr<BaseLanePostprocessor> lane_postprocessor_;
69  std::shared_ptr<BaseCalibrationService> calibration_service_;
70  app::PerceptionParam perception_param_;
71  std::string lane_calibration_working_sensor_name_ = "";
72  bool write_out_lane_file_ = false;
73  bool write_out_calib_file_ = false;
74  std::string out_lane_dir_;
75  std::string out_calib_dir_;
76 };
77 
78 } // namespace camera
79 } // namespace perception
80 } // namespace apollo
void InitLane(const std::string &work_root, base::BaseCameraModelPtr &model, const app::PerceptionParam &perception_param)
Definition: camera_frame.h:33
void SetCameraHeightAndPitch(const std::map< std::string, float > name_camera_ground_height_map, const std::map< std::string, float > name_camera_pitch_angle_diff_map, const float &pitch_angle_calibrator_working_sensor)
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool Init(const CameraPerceptionInitOptions &options) override
Definition: base_camera_perception.h:28
Definition: base_camera_perception.h:36
void InitCalibrationService(const std::string &work_root, const base::BaseCameraModelPtr model, const app::PerceptionParam &perception_param)
Definition: base_calibration_service.h:40
std::string Name() const override
Definition: lane_camera_perception.h:62
LaneCameraPerception()
Definition: lane_camera_perception.h:40
Definition: lane_camera_perception.h:38
std::shared_ptr< BaseCameraModel > BaseCameraModelPtr
Definition: camera.h:75
void SetIm2CarHomography(Eigen::Matrix3d homography_im2car)
Eigen::Matrix3d Matrix3d
Definition: base_map_fwd.h:33
Definition: base_camera_perception.h:34
bool GetCalibrationService(BaseCalibrationService **calibration_service)
LaneCameraPerception & operator=(const LaneCameraPerception &)=delete
bool Perception(const CameraPerceptionOptions &options, CameraFrame *frame) override