Apollo  6.0
Open source self driving car software
object_builder.h
Go to the documentation of this file.
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 <memory>
19 #include <string>
20 #include <vector>
21 
27 
28 namespace apollo {
29 namespace perception {
30 namespace lidar {
31 
33 
35  Eigen::Vector3d ref_center = Eigen::Vector3d(0, 0, 0);
36 };
37 
39  public:
40  ObjectBuilder() = default;
41  ~ObjectBuilder() = default;
42 
43  // @brief: initialization. Get orientation estimator instance.
44  // @param [in]: ObjectBuilderInitOptions.
45  bool Init(
47 
48  // @brief: calculate and fill object size, center, directions.
49  // @param [in]: ObjectBuilderOptions.
50  // @param [in/out]: LidarFrame*.
51  bool Build(const ObjectBuilderOptions& options, LidarFrame* frame);
52 
53  std::string Name() const { return "ObjectBuilder"; }
54 
55  private:
56  // @brief: calculate 2d polygon.
57  // and fill the convex hull vertices in object->polygon.
58  // @param [in/out]: ObjectPtr.
59  void ComputePolygon2D(
60  std::shared_ptr<apollo::perception::base::Object> object);
61 
62  // @brief: calculate the size, center of polygon.
63  // @param [in/out]: ObjectPtr.
64  void ComputePolygonSizeCenter(
65  std::shared_ptr<apollo::perception::base::Object> object);
66 
67  // @brief: calculate and fill timestamp and anchor_point.
68  // @param [in/out]: ObjectPtr.
69  void ComputeOtherObjectInformation(
70  std::shared_ptr<apollo::perception::base::Object> object);
71 
72  // @brief: calculate and fill default polygon value.
73  // @param [in]: min and max point.
74  // @param [in/out]: ObjectPtr.
75  void SetDefaultValue(
76  const Eigen::Vector3f& min_pt, const Eigen::Vector3f& max_pt,
77  std::shared_ptr<apollo::perception::base::Object> object);
78 
79  // @brief: decide whether input cloud is on the same line.
80  // if ture, add perturbation.
81  // @param [in/out]: pointcloud.
82  // @param [out]: is line: true, not line: false.
83  bool LinePerturbation(
85  cloud);
86 
87  // @brief: calculate 3D min max point
88  // @param [in]: point cloud.
89  // @param [in/out]: min and max points.
90  void GetMinMax3D(const apollo::perception::base::PointCloud<
92  Eigen::Vector3f* min_pt, Eigen::Vector3f* max_pt);
93 }; // class ObjectBuilder
94 
95 } // namespace lidar
96 } // namespace perception
97 } // namespace apollo
Eigen::Vector3f Vector3f
Definition: base_map_fwd.h:29
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: point.h:28
Eigen::Vector3d Vector3d
Definition: frame_transform.h:27
Definition: object_builder.h:38
Definition: point_cloud.h:37
bool Init(const char *binary_name)
Definition: lidar_frame.h:33
std::string Name() const
Definition: object_builder.h:53