Apollo 11.0
自动驾驶开放平台
object_builder.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
17#pragma once
18
19#include <memory>
20#include <string>
21#include <vector>
22
27
28namespace apollo {
29namespace perception {
30namespace lidar {
31
32static const float kEpsilon = 1e-6f;
33static const float kEpsilonForSize = 1e-2f;
34static const float kEpsilonForLine = 1e-3f;
35
38
39using ObjectPtr = std::shared_ptr<apollo::perception::base::Object>;
42
44
46 Eigen::Vector3d ref_center = Eigen::Vector3d(0, 0, 0);
47};
48
50 public:
55 ObjectBuilder() = default;
56
61 ~ObjectBuilder() = default;
62
70 bool Init(
72
81 bool Build(const ObjectBuilderOptions& options, LidarFrame* frame);
82
88 std::string Name() const { return "ObjectBuilder"; }
89
90 public:
91 // @brief: calculate 2d polygon.
92 // and fill the convex hull vertices in object->polygon.
93 // @param [in/out]: ObjectPtr.
95 std::shared_ptr<apollo::perception::base::Object> object);
96
97 // @brief: calculate the size, center of polygon.
98 // @param [in/out]: ObjectPtr.
100 std::shared_ptr<apollo::perception::base::Object> object);
101
102 // @brief: calculate and fill timestamp and anchor_point.
103 // @param [in/out]: ObjectPtr.
105 std::shared_ptr<apollo::perception::base::Object> object);
106
107 // @brief: calculate height_above_ground.
108 // @param [in/out]: ObjectPtr.
110 std::shared_ptr<apollo::perception::base::Object> object);
111
112 // @brief: calculate and fill front-critical.
113 // @param [in/out]: ObjectPtr and pose
115 std::shared_ptr<apollo::perception::base::Object> object,
116 Eigen::Affine3d& lidar2novatel_pose);
117
118 // @brief: calculate and fill default polygon value.
119 // @param [in]: min and max point.
120 // @param [in/out]: ObjectPtr.
122 const Eigen::Vector3f& min_pt, const Eigen::Vector3f& max_pt,
123 std::shared_ptr<apollo::perception::base::Object> object);
124
125 // @brief: decide whether input cloud is on the same line.
126 // if ture, add perturbation.
127 // @param [in/out]: pointcloud.
128 // @param [out]: is line: true, not line: false.
131 cloud);
132
133 // @brief: calculate 3D min max point
134 // @param [in]: point cloud.
135 // @param [in/out]: min and max points.
138 Eigen::Vector3f* min_pt, Eigen::Vector3f* max_pt);
139}; // class ObjectBuilder
140
141} // namespace lidar
142} // namespace perception
143} // namespace apollo
void ComputeHeightAboveGround(std::shared_ptr< apollo::perception::base::Object > object)
bool LinePerturbation(apollo::perception::base::PointCloud< apollo::perception::base::PointF > *cloud)
void ComputeOtherObjectInformation(std::shared_ptr< apollo::perception::base::Object > object)
void GetMinMax3D(const apollo::perception::base::PointCloud< apollo::perception::base::PointF > &cloud, Eigen::Vector3f *min_pt, Eigen::Vector3f *max_pt)
~ObjectBuilder()=default
Destroy the Object Builder object
void ComputePolygon2D(std::shared_ptr< apollo::perception::base::Object > object)
std::string Name() const
Name of Object Builder
ObjectBuilder()=default
Construct a new Object Builder object
bool Init(const ObjectBuilderInitOptions &options=ObjectBuilderInitOptions())
Init the Object Builder object with initialization options
void SetDefaultValue(const Eigen::Vector3f &min_pt, const Eigen::Vector3f &max_pt, std::shared_ptr< apollo::perception::base::Object > object)
bool Build(const ObjectBuilderOptions &options, LidarFrame *frame)
Calculate and fill object size, center, directions.
void JudgeFrontCritical(std::shared_ptr< apollo::perception::base::Object > object, Eigen::Affine3d &lidar2novatel_pose)
void ComputePolygonSizeCenter(std::shared_ptr< apollo::perception::base::Object > object)
std::shared_ptr< apollo::perception::base::Object > ObjectPtr
class register implement
Definition arena_queue.h:37