Apollo 11.0
自动驾驶开放平台
msg_exporter.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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 <vector>
21
22#include "Eigen/Dense"
23
24#include "cyber/cyber.h"
25#include "modules/common_msgs/sensor_msgs/pointcloud.pb.h"
26#include "modules/common_msgs/sensor_msgs/sensor_image.pb.h"
30
31namespace apollo {
32namespace perception {
33namespace msg {
34
37
39 public:
42
43 public:
44 MsgExporter(std::shared_ptr<apollo::cyber::Node> node,
45 const std::vector<std::string> channels,
46 const std::vector<std::string> child_frame_ids);
47 ~MsgExporter() = default;
48
49 private:
50 void ImageMessageHandler(const std::shared_ptr<const ImgMsg>& img_msg,
51 const std::string& channel,
52 const std::string& child_frame_id,
53 const std::string& folder);
54 void PointCloudMessageHandler(const std::shared_ptr<const PcMsg>& cloud_msg,
55 const std::string& channel,
56 const std::string& child_frame_id,
57 const std::string& folder);
58 bool SavePointCloud(const pcl::PointCloud<PCLPointXYZIT>& point_cloud,
59 double timestamp, const std::string& folder);
60 bool SaveImage(const unsigned char* color_image,
61 const unsigned char* range_image, std::size_t width,
62 std::size_t height, double timestamp,
63 const std::string& folder);
64 bool QuerySensorToWorldPose(double timestamp,
65 const std::string& child_frame_id,
66 Eigen::Matrix4d* pose);
67 bool QueryPose(double timestamp, const std::string& frame_id,
68 const std::string& child_frame_id, Eigen::Matrix4d* pose);
69 bool SavePose(const Eigen::Matrix4d& pose, double timestamp,
70 const std::string& folder);
71 bool IsStereoCamera(const std::string& channel);
72 bool IsCamera(const std::string& channel);
73 bool IsLidar(const std::string& channel);
74 std::string TransformChannelToFolder(const std::string& channel);
75
76 private:
77 std::shared_ptr<apollo::cyber::Node> _cyber_node;
78 std::vector<std::string> _channels;
79 std::vector<std::string> _child_frame_ids;
80 std::string _localization_method;
81 Buffer* tf2_buffer_ = Buffer::Instance();
82};
83
84} // namespace msg
85} // namespace perception
86} // namespace apollo
apollo::drivers::PointCloud PcMsg
class register implement
Definition arena_queue.h:37