Apollo 11.0
自动驾驶开放平台
lidar_output_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
17#pragma once
18
19#include <atomic>
20#include <limits>
21#include <memory>
22#include <string>
23#include <queue>
24
25#include <boost/filesystem.hpp>
26
27#include "modules/common_msgs/perception_msgs/perception_benchmark.pb.h"
28#include "modules/perception/lidar_output/proto/lidar_output_component_config.pb.h"
29
30#include "cyber/common/file.h"
31#include "cyber/common/log.h"
34
35namespace apollo {
36namespace perception {
37namespace lidar {
38
39using onboard::LidarFrameMessage;
40using onboard::SensorFrameMessage;
41
42class LidarOutputComponent : public cyber::Component<SensorFrameMessage> {
43 public:
45 virtual ~LidarOutputComponent();
52 bool Init() override;
60 bool Proc(const std::shared_ptr<SensorFrameMessage>& message) override;
61
69 bool SaveBenchmarkFrame(const std::shared_ptr<SensorFrameMessage>& message);
70
72 const std::shared_ptr<LidarFrameMessage>& message);
73
79
80 private:
81 std::string output_channel_name_;
82 std::shared_ptr<apollo::cyber::Writer<PerceptionObstacles>> writer_;
83 // for saving benchmark frame
84 bool save_benchmark_frame_ = false;
85 std::string benchmark_frame_output_dir_;
86 std::mutex benchmark_mutex_;
87 std::atomic<bool> is_terminate_;
88 std::queue<std::shared_ptr<SensorFrameMessage>> message_buffer_;
89 std::unique_ptr<std::thread> benchmark_thread_;
90
91 std::string lidar_frame_output_dir_;
92 std::shared_ptr<apollo::cyber::Reader<LidarFrameMessage>> lidar_frame_reader_;
93 bool use_lidar_cooridinate_ = false;
94 bool timestamp_two_decimal_format_ = false;
95};
96
98
99} // namespace lidar
100} // namespace perception
101} // namespace apollo
bool SaveBenchmarkFrame(const std::shared_ptr< SensorFrameMessage > &message)
Save benchmark frame for end-to-end evaluation
bool SaveBenchmarkLidarFrame(const std::shared_ptr< LidarFrameMessage > &message)
bool Init() override
Init lidar output component
bool Proc(const std::shared_ptr< SensorFrameMessage > &message) override
Process of lidar output component
#define CYBER_REGISTER_COMPONENT(name)
Definition component.h:657
class register implement
Definition arena_queue.h:37