Apollo 11.0
自动驾驶开放平台
barrier_recognition_component.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2024 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
17#pragma once
18
19#include <atomic>
20#include <limits>
21#include <memory>
22#include <string>
23
27#include "modules/common_msgs/sensor_msgs/pointcloud.pb.h"
28#include "modules/common_msgs/perception_msgs/perception_barrier_gate.pb.h"
31#include "modules/perception/barrier_recognition/proto/barrier_recognition_component_config.pb.h"
35
36namespace apollo {
37namespace perception {
38namespace lidar {
39
40using onboard::LidarFrameMessage;
42
44 : public cyber::Component<LidarFrameMessage> {
45public:
48public:
50 virtual ~BarrierRecognitionComponent() = default;
57 bool Init() override;
65 bool Proc(const std::shared_ptr<LidarFrameMessage>& message) override;
66
67private:
68 bool InternalProc(
69 const std::shared_ptr<LidarFrameMessage>& message,
70 std::vector<BarrieGate>& gates);
71
72 bool QueryPoseAndGates(const double ts, const Eigen::Affine3d& pose,
73 std::vector<apollo::hdmap::BarrierGate>* gates);
74
75 void GetGatesPolygon(const apollo::hdmap::BarrierGate& barrier_gate,
76 std::vector<double>& world_polygon);
77
78 bool MakeProtobufMsg(double msg_timestamp, int seq_num,
79 std::vector<BarrieGate> gates,
81
82private:
83 uint32_t seq_num_ = 0;
84 double forward_distance_to_queries_ = 20;
85 double last_gates_ts_ = -1.0;
86 double valid_hdmap_interval_ = 1.5;
87 double tf2_timeout_second_ = 0.01;
88
89 std::string tf2_frame_id_;
90 std::string tf2_child_frame_id_;
91
92 // Barrier recognizer bank
93 BarrierRecognizerBank barrier_bank_;
94 // Barrier tracker
95 BarrierStatusTracker status_tracker_;
96
97 std::vector<apollo::hdmap::BarrierGate> last_gates_;
98 Buffer* tf2_buffer_ = Buffer::Instance();
99 apollo::perception::map::HDMapInput* hd_map_ = nullptr;
100
101 std::shared_ptr<cyber::Writer<PerceptionBarrierGate>> writer_;
102};
103
105
106} // namespace lidar
107} // namespace perception
108} // namespace apollo
bool Proc(const std::shared_ptr< LidarFrameMessage > &message) override
Process of barrier recognition
bool Init() override
Init barrier recognition component
#define CYBER_REGISTER_COMPONENT(name)
Definition component.h:657
class register implement
Definition arena_queue.h:37