Apollo  6.0
Open source self driving car software
environment_features.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 
17 #pragma once
18 
19 #include <string>
20 #include <unordered_set>
21 #include <utility>
22 #include <vector>
23 
24 #include "modules/common/proto/geometry.pb.h"
25 
26 namespace apollo {
27 namespace prediction {
28 
30  public:
31  EnvironmentFeatures() = default;
32 
33  virtual ~EnvironmentFeatures() = default;
34 
35  void set_ego_position(const double x, const double y);
36 
37  const common::Point3D& get_ego_position() const;
38 
39  void set_ego_speed(const double ego_speed);
40 
41  double get_ego_speed() const;
42 
43  void set_ego_acceleration(const double ego_acceleration);
44 
45  double get_ego_acceleration() const;
46 
47  void set_ego_heading(const double ego_heading);
48 
49  double get_ego_heading() const;
50 
51  bool has_ego_lane() const;
52 
53  void reset_ego_lane();
54 
55  void SetEgoLane(const std::string& lane_id, const double lane_s);
56 
57  std::pair<std::string, double> GetEgoLane() const;
58 
59  bool has_left_neighbor_lane() const;
60 
62 
63  void SetLeftNeighborLane(const std::string& lane_id, const double lane_s);
64 
65  std::pair<std::string, double> GetLeftNeighborLane() const;
66 
67  bool has_right_neighbor_lane() const;
68 
70 
71  void SetRightNeighborLane(const std::string& lane_id, const double lane_s);
72 
73  std::pair<std::string, double> GetRightNeighborLane() const;
74 
75  bool has_front_junction() const;
76 
77  void reset_front_junction();
78 
79  void SetFrontJunction(const std::string& junction_id, const double dist);
80 
81  std::pair<std::string, double> GetFrontJunction() const;
82 
83  void AddObstacleId(const int obstacle_id);
84 
85  const std::vector<int>& get_obstacle_ids() const;
86 
87  const std::unordered_set<std::string>& nonneglectable_reverse_lanes() const;
88 
89  void AddNonneglectableReverseLanes(const std::string& lane_id);
90 
91  bool RemoveNonneglectableReverseLanes(const std::string& lane_id);
92 
93  private:
94  common::Point3D ego_position_;
95 
96  double ego_speed_ = 0.0;
97 
98  double ego_acceleration_ = 0.0;
99 
100  double ego_heading_ = 0.0;
101 
102  bool has_ego_lane_ = false;
103 
104  std::string ego_lane_id_;
105 
106  double ego_lane_s_ = 0.0;
107 
108  bool has_left_neighbor_lane_ = false;
109 
110  std::string left_neighbor_lane_id_;
111 
112  double left_neighbor_lane_s_ = 0.0;
113 
114  bool has_right_neighbor_lane_ = false;
115 
116  std::string right_neighbor_lane_id_;
117 
118  double right_neighbor_lane_s_ = 0.0;
119 
120  bool has_front_junction_ = false;
121 
122  std::string front_junction_id_;
123 
124  double dist_to_front_junction_ = 0.0;
125 
126  std::vector<int> obstacle_ids_;
127 
128  std::unordered_set<std::string> nonneglectable_reverse_lanes_;
129 };
130 
131 } // namespace prediction
132 } // namespace apollo
std::pair< std::string, double > GetFrontJunction() const
void set_ego_heading(const double ego_heading)
bool RemoveNonneglectableReverseLanes(const std::string &lane_id)
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::pair< std::string, double > GetLeftNeighborLane() const
void AddObstacleId(const int obstacle_id)
const std::vector< int > & get_obstacle_ids() const
void SetLeftNeighborLane(const std::string &lane_id, const double lane_s)
void SetRightNeighborLane(const std::string &lane_id, const double lane_s)
void set_ego_speed(const double ego_speed)
void set_ego_acceleration(const double ego_acceleration)
void AddNonneglectableReverseLanes(const std::string &lane_id)
const common::Point3D & get_ego_position() const
void SetFrontJunction(const std::string &junction_id, const double dist)
void set_ego_position(const double x, const double y)
Definition: environment_features.h:29
void SetEgoLane(const std::string &lane_id, const double lane_s)
std::pair< std::string, double > GetRightNeighborLane() const
std::pair< std::string, double > GetEgoLane() const
const std::unordered_set< std::string > & nonneglectable_reverse_lanes() const