Apollo 11.0
自动驾驶开放平台
camera_detection_bev_component.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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 <vector>
20
21#include "modules/common_msgs/perception_msgs/perception_obstacle.pb.h"
22#include "modules/common_msgs/sensor_msgs/sensor_image.pb.h"
23#include "modules/perception/camera_detection_bev/proto/camera_detection_bev.pb.h"
24
25#include "cyber/cyber.h"
29
30namespace apollo {
31namespace perception {
32namespace camera {
33
35 public:
38
39 public:
40 CameraDetectionBevComponent() : timestamp_offset_(0) {}
47 bool Init() override;
48
49 private:
50 bool InitTransformWrapper(const CameraDetectionBEV& detection_param);
51 bool InitCameraFrame(const CameraDetectionBEV& detection_param);
52 bool InitListeners(const CameraDetectionBEV& detection_param);
53 bool InitDetector(const CameraDetectionBEV& detection_param);
54
55 bool OnReceiveImage(const std::shared_ptr<drivers::Image>& msg);
56
57 void CameraToWorldCoor(const Eigen::Affine3d& camera2world,
58 std::vector<base::ObjectPtr>* objs);
59 int ConvertObjectToPb(const base::ObjectPtr& object_ptr,
60 PerceptionObstacle* pb_msg);
61 int MakeProtobufMsg(double msg_timestamp, int seq_num,
62 const std::vector<base::ObjectPtr>& objects,
63 PerceptionObstacles* obstacles);
64
65 private:
66 int image_height_;
67 int image_width_;
68 uint32_t seq_num_ = 0;
69 double timestamp_offset_ = 0;
70
71 std::shared_ptr<CameraFrame> frame_ptr_;
72 std::shared_ptr<BaseObstacleDetector> detector_;
73 std::shared_ptr<onboard::TransformWrapper> trans_wrapper_;
74
75 std::vector<std::shared_ptr<cyber::Reader<drivers::Image>>> readers_;
76 std::shared_ptr<cyber::Writer<PerceptionObstacles>> writer_;
77};
78
80
81} // namespace camera
82} // namespace perception
83} // namespace apollo
bool Init() override
Init for camera detection 2d compoment
#define CYBER_REGISTER_COMPONENT(name)
Definition component.h:657
std::shared_ptr< Object > ObjectPtr
Definition object.h:127
class register implement
Definition arena_queue.h:37