Apollo 10.0
自动驾驶开放平台
base_calibration_service.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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 <map>
19#include <string>
20
21#include "cyber/common/macros.h"
27
28namespace apollo {
29namespace perception {
30namespace camera {
31
40
42
44 public:
46
47 virtual ~BaseCalibrationService() = default;
48
49 virtual bool Init(const CalibrationServiceInitOptions &options =
51
52 virtual bool BuildIndex() = 0;
53
54 // @brief query camera to world pose with refinement if any
55 virtual bool QueryCameraToWorldPose(Eigen::Matrix4d *pose) const {
56 return false;
57 }
58
59 // @brief query depth on ground plane given pixel coordinate
60 virtual bool QueryDepthOnGroundPlane(int x, int y, double *depth) const {
61 return false;
62 }
63
64 // @brief query 3d point on ground plane given pixel coordinate
65 virtual bool QueryPoint3dOnGroundPlane(int x, int y,
66 Eigen::Vector3d *point3d) const {
67 return false;
68 }
69
70 // @brief query ground plane in camera frame, parameterized as
71 // [n^T, d] with n^T*x+d=0
73 Eigen::Vector4d *plane_param) const {
74 return false;
75 }
76
77 // @brief query camera to ground height and pitch angle
78 virtual bool QueryCameraToGroundHeightAndPitchAngle(float *height,
79 float *pitch) const {
80 return false;
81 }
82
83 virtual float QueryCameraToGroundHeight() const { return 0.f; }
84
85 virtual float QueryPitchAngle() const { return 0.f; }
86
87 // @brief using calibrator to update pitch angle
88 virtual void Update(onboard::CameraFrame *frame) {
89 // do nothing
90 }
91
92 // @brief using calibrator to update lane detection pitch angle
93 // TODO(huqilin): need to unify the camera and lane update interfaces
94 virtual void Update(CameraFrame *frame) {
95 // do nothing
96 }
97
98 // @brief set camera height, pitch and project matrix
100 const std::map<std::string, float> &name_camera_ground_height_map,
101 const std::map<std::string, float> &name_camera_pitch_angle_diff_map,
102 const float &pitch_angle_master_sensor) {
103 // do nothing
104 }
105
106 virtual std::string Name() const = 0;
107
109}; // class BaseCalibrationService
110
112#define REGISTER_CALIBRATION_SERVICE(name) \
113 PERCEPTION_REGISTER_CLASS(BaseCalibrationService, name)
114
115} // namespace camera
116} // namespace perception
117} // namespace apollo
virtual bool QueryDepthOnGroundPlane(int x, int y, double *depth) const
virtual void Update(onboard::CameraFrame *frame)
virtual bool QueryPoint3dOnGroundPlane(int x, int y, Eigen::Vector3d *point3d) const
virtual bool Init(const CalibrationServiceInitOptions &options=CalibrationServiceInitOptions())=0
virtual bool QueryCameraToWorldPose(Eigen::Matrix4d *pose) const
virtual bool QueryCameraToGroundHeightAndPitchAngle(float *height, float *pitch) const
virtual 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_master_sensor)
virtual bool QueryGroundPlaneInCameraFrame(Eigen::Vector4d *plane_param) const
std::map< T, EigenType, std::less< T >, Eigen::aligned_allocator< std::pair< const T, EigenType > > > EigenMap
Definition eigen_defs.h:40
class register implement
Definition arena_queue.h:37
#define PERCEPTION_REGISTER_REGISTERER(base_class)
Definition registerer.h:92
apollo::common::EigenMap< std::string, Eigen::Matrix3f > name_intrinsic_map