Apollo  6.0
Open source self driving car software
position_metric.h
Go to the documentation of this file.
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 #include <string>
19 
20 namespace apollo {
21 namespace perception {
22 namespace benchmark {
23 
25  // TODO(...): add hdmap, pose, ...
26  bool roi_is_main_lanes = false;
27 };
28 
30  void cal_position_metric(const ObjectPtr& object,
31  const PositionMetricOption& option);
32 
33  double radial_distance = 0.0;
34  double horizontal_distance = 0.0;
35  double vertical_distance = 0.0;
36  double angle = 0.0;
37  bool is_in_roi = false;
38 
39  bool is_valid = false;
40 };
41 
43  public:
44  virtual unsigned int get_index(const PositionMetric& position) const = 0;
45  virtual unsigned int get_dim() const = 0;
46  virtual std::string get_element(unsigned int index) const = 0;
47 };
48 
50  public:
51  unsigned int get_index(const PositionMetric& position) const override;
52  unsigned int get_dim() const override;
53  std::string get_element(unsigned int index) const override;
54 
55  public:
56  static void set_distance(double distance);
57 
58  protected:
59  static double _s_distance;
60  static double _s_half_distance;
61 };
62 
63 // 0~30, 30~60, 60~120, 120~200, 200~
65  public:
66  unsigned int get_index(const PositionMetric& position) const override;
67  unsigned int get_dim() const override;
68  std::string get_element(unsigned int index) const override;
69 };
70 
72  public:
73  unsigned int get_index(const PositionMetric& position) const override;
74  unsigned int get_dim() const override;
75  std::string get_element(unsigned int index) const override;
76 
77  public:
78  static void set_front_view_angle(double angle);
79  static void set_rear_view_angle(double angle);
80  static void set_front_view_distance(double distance);
81  static void set_rear_view_distance(double distance);
82 
83  private:
84  static double _s_front_view_angle;
85  static double _s_rear_view_angle;
86  static double _s_front_view_distance;
87  static double _s_rear_view_distance;
88 };
89 
91  public:
92  unsigned int get_index(const PositionMetric& position) const override;
93  unsigned int get_dim() const override;
94  std::string get_element(unsigned int index) const override;
95 
96  public:
97  static void set_front_box_distance(double distance);
98  static void set_rear_box_distance(double distance);
99  static void set_side_box_distance(double distance);
100 
101  private:
102  static double _s_front_box_distance;
103  static double _s_rear_box_distance;
104  static double _s_side_box_distance;
105 };
106 
108  public:
109  unsigned int get_index(const PositionMetric& position) const override;
110  unsigned int get_dim() const override;
111  std::string get_element(unsigned int index) const override;
112 
113  public:
114  static void set_ignore_roi_outside(bool ignore);
115 
116  protected:
118 };
119 
120 } // namespace benchmark
121 } // namespace perception
122 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
static double _s_distance
Definition: position_metric.h:59
std::shared_ptr< Object > ObjectPtr
Definition: object.h:158
static bool _s_ignore_roi_outside
Definition: position_metric.h:117
Definition: position_metric.h:29
bool roi_is_main_lanes
Definition: position_metric.h:26
static double _s_half_distance
Definition: position_metric.h:60