Apollo 11.0
自动驾驶开放平台
msg_serializer.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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 <vector>
19
21#include "modules/common_msgs/perception_msgs/perception_obstacle.pb.h"
22#include "modules/common_msgs/perception_msgs/perception_benchmark.pb.h"
23
24namespace apollo {
25namespace perception {
26namespace onboard {
27
29 public:
30 MsgSerializer() = default;
31 ~MsgSerializer() = default;
32
33 static bool SerializeMsg(double timestamp, uint64_t lidar_timestamp,
34 int seq_num,
35 const std::vector<base::ObjectPtr>& objects,
36 const apollo::common::ErrorCode& error_code,
37 PerceptionObstacles* obstacles);
38
39 static bool SerializeBenchmarkMsg(
40 double timestamp, uint64_t lidar_timestamp,
41 int seq_num,
42 const std::vector<base::ObjectPtr>& objects,
43 PerceptionBenchmarkFrame* obstacles);
44
45 static bool SerializeLidarFrameMsg(
46 double timestamp, uint64_t lidar_timestamp,
47 int seq_num, const Eigen::Affine3d& pose,
48 const std::vector<base::ObjectPtr>& objects,
49 PerceptionBenchmarkFrame* obstacles, bool use_lidar_cooridinate = true);
50
51 private:
52 static bool ConvertObjectToPb(const base::ObjectPtr& object_ptr,
53 PerceptionObstacle* pb_msg);
54
55 static bool ConvertSegmentedObjectToPb(const base::ObjectPtr& object_ptr,
56 PerceptionObstacle* pb_msg, const Eigen::Affine3d& pose,
57 bool use_lidar_cooridinate = true);
58};
59
60} // namespace onboard
61} // namespace perception
62} // namespace apollo
static bool SerializeMsg(double timestamp, uint64_t lidar_timestamp, int seq_num, const std::vector< base::ObjectPtr > &objects, const apollo::common::ErrorCode &error_code, PerceptionObstacles *obstacles)
static bool SerializeLidarFrameMsg(double timestamp, uint64_t lidar_timestamp, int seq_num, const Eigen::Affine3d &pose, const std::vector< base::ObjectPtr > &objects, PerceptionBenchmarkFrame *obstacles, bool use_lidar_cooridinate=true)
static bool SerializeBenchmarkMsg(double timestamp, uint64_t lidar_timestamp, int seq_num, const std::vector< base::ObjectPtr > &objects, PerceptionBenchmarkFrame *obstacles)
std::shared_ptr< Object > ObjectPtr
Definition object.h:127
class register implement
Definition arena_queue.h:37