Apollo 10.0
自动驾驶开放平台
sensor_manager.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 <memory>
19#include <string>
20#include <unordered_map>
21
22#include "cyber/common/macros.h"
27
28namespace apollo {
29namespace perception {
30namespace algorithm {
31
34
36 public:
37 bool Init();
38
39 bool IsSensorExist(const std::string& name) const;
40
41 bool GetSensorInfo(const std::string& name,
42 apollo::perception::base::SensorInfo* sensor_info) const;
43
44 std::shared_ptr<BaseCameraDistortionModel> GetDistortCameraModel(
45 const std::string& name) const;
46
47 std::shared_ptr<BaseCameraModel> GetUndistortCameraModel(
48 const std::string& name) const;
49
50 // sensor type functions
51 bool IsHdLidar(const std::string& name) const;
53 bool IsLdLidar(const std::string& name) const;
55
56 bool IsLidar(const std::string& name) const;
58 bool IsRadar(const std::string& name) const;
60 bool IsCamera(const std::string& name) const;
62 bool IsUltrasonic(const std::string& name) const;
64
65 bool IsMainSensor(const std::string& name) const;
66
67 // sensor frame id function
68 std::string GetFrameId(const std::string& name) const;
69
70 private:
71 inline std::string IntrinsicPath(const std::string& frame_id) {
72 std::string intrinsics =
73 FLAGS_obs_sensor_intrinsic_path + "/" + frame_id + "_intrinsics.yaml";
74 return intrinsics;
75 }
76
77 private:
78 std::mutex mutex_;
79 bool inited_ = false;
80
81 std::unordered_map<std::string, apollo::perception::base::SensorInfo>
82 sensor_info_map_;
83 std::unordered_map<std::string, std::shared_ptr<BaseCameraDistortionModel>>
84 distort_model_map_;
85 std::unordered_map<std::string, std::shared_ptr<BaseCameraModel>>
86 undistort_model_map_;
87
89};
90
91} // namespace algorithm
92} // namespace perception
93} // namespace apollo
bool IsRadar(const std::string &name) const
bool IsHdLidar(const apollo::perception::base::SensorType &type) const
bool IsLidar(const apollo::perception::base::SensorType &type) const
bool IsCamera(const std::string &name) const
bool GetSensorInfo(const std::string &name, apollo::perception::base::SensorInfo *sensor_info) const
bool IsSensorExist(const std::string &name) const
std::shared_ptr< BaseCameraModel > GetUndistortCameraModel(const std::string &name) const
bool IsUltrasonic(const std::string &name) const
bool IsRadar(const apollo::perception::base::SensorType &type) const
bool IsLdLidar(const apollo::perception::base::SensorType &type) const
bool IsUltrasonic(const apollo::perception::base::SensorType &type) const
std::string GetFrameId(const std::string &name) const
bool IsCamera(const apollo::perception::base::SensorType &type) const
std::shared_ptr< BaseCameraDistortionModel > GetDistortCameraModel(const std::string &name) const
bool IsLdLidar(const std::string &name) const
bool IsHdLidar(const std::string &name) const
bool IsMainSensor(const std::string &name) const
bool IsLidar(const std::string &name) const
#define DECLARE_SINGLETON(classname)
Definition macros.h:52
SensorType
Sensor types are set in the order of lidar, radar, camera, ultrasonic Please make sure SensorType has...
Definition sensor_meta.h:29
class register implement
Definition arena_queue.h:37