Apollo 11.0
自动驾驶开放平台
base_tl_preprocessor.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2021 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#include <vector>
21
22#include "cyber/common/macros.h"
27
28namespace apollo {
29namespace perception {
30namespace trafficlight {
31
33 int gpu_id = 0;
35 std::vector<std::string> camera_names;
36};
37
39 std::map<std::string, int>* image_borders_size = nullptr;
40};
41
43 public:
48 BaseTLPreprocessor() = default;
53 virtual ~BaseTLPreprocessor() = default;
61 virtual bool Init(const TrafficLightPreprocessorInitOptions& options) = 0;
67 virtual std::string Name() const = 0;
79 const camera::CarPose& pose, const TLPreprocessorOption& option,
80 std::vector<base::TrafficLightPtr>* lights) = 0;
90 virtual bool SyncInformation(const double ts,
91 const std::string& camera_name) = 0;
104 const camera::CarPose& pose, const TLPreprocessorOption& option,
105 const std::string& camera_name,
106 std::vector<base::TrafficLightPtr>* lights) = 0;
115 virtual bool SetCameraWorkingFlag(const std::string& camera_name,
116 bool is_working) = 0;
125 virtual bool GetCameraWorkingFlag(const std::string& camera_name,
126 bool* is_working) const = 0;
132 virtual const std::vector<std::string>& GetCameraNamesByDescendingFocalLen()
133 const = 0;
134
135 private:
137};
138
140#define PERCEPTION_REGISTER_TLPREPROCESSOR(name) \
141 PERCEPTION_REGISTER_CLASS(BaseTLPreprocessor, name)
142
143} // namespace trafficlight
144} // namespace perception
145} // namespace apollo
virtual bool Init(const TrafficLightPreprocessorInitOptions &options)=0
Traffic light preprocessing initialization parameters.
virtual std::string Name() const =0
returns the name of the preprocessing plugin.
virtual bool SetCameraWorkingFlag(const std::string &camera_name, bool is_working)=0
Set the camera working flag object.
BaseTLPreprocessor()=default
Construct a new base trafficlight preprocessor object.
virtual bool UpdateLightsProjection(const camera::CarPose &pose, const TLPreprocessorOption &option, const std::string &camera_name, std::vector< base::TrafficLightPtr > *lights)=0
Update the traffic light projection status and determine whether the projection exceeds the boundary ...
virtual bool UpdateCameraSelection(const camera::CarPose &pose, const TLPreprocessorOption &option, std::vector< base::TrafficLightPtr > *lights)=0
Select the appropriate camera for preprocessing according to the position of the vehicle and the posi...
virtual const std::vector< std::string > & GetCameraNamesByDescendingFocalLen() const =0
Get the camera names by descending focal len object.
virtual ~BaseTLPreprocessor()=default
Destroy the base trafficlight preprocessor object.
virtual bool SyncInformation(const double ts, const std::string &camera_name)=0
Determine whether the selected camera is available and synchronize timestamp information.
virtual bool GetCameraWorkingFlag(const std::string &camera_name, bool *is_working) const =0
Get the camera working flag object.
#define DISALLOW_COPY_AND_ASSIGN(classname)
Definition macros.h:48
class register implement
Definition arena_queue.h:37
#define PERCEPTION_REGISTER_REGISTERER(base_class)
Definition registerer.h:92