Apollo  6.0
Open source self driving car software
adc_trajectory_container.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2017 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 
22 #pragma once
23 
24 #include <memory>
25 #include <string>
26 #include <unordered_set>
27 #include <vector>
28 
29 #include "modules/planning/proto/planning.pb.h"
32 #include "modules/prediction/proto/lane_graph.pb.h"
33 
34 namespace apollo {
35 namespace prediction {
36 
38  public:
43 
47  virtual ~ADCTrajectoryContainer() = default;
48 
53  void Insert(const ::google::protobuf::Message& message) override;
54 
59  bool IsProtected() const;
60 
66  bool IsPointInJunction(const common::PathPoint& point) const;
67 
72  bool HasOverlap(const LaneSequence& lane_sequence) const;
73 
77  void SetPosition(const common::math::Vec2d& position);
78 
83  std::shared_ptr<const hdmap::JunctionInfo> ADCJunction() const;
84 
89  double ADCDistanceToJunction() const;
90 
95  const planning::ADCTrajectory& adc_trajectory() const;
96 
101  bool IsLaneIdInReferenceLine(const std::string& lane_id) const;
102 
103  bool IsLaneIdInTargetReferenceLine(const std::string& lane_id) const;
104 
105  const std::vector<std::string>& GetADCLaneIDSequence() const;
106 
107  const std::vector<std::string>& GetADCTargetLaneIDSequence() const;
108 
109  void SetJunction(const std::string& junction_id, const double distance);
110 
111  private:
112  void SetJunctionPolygon();
113 
114  void SetLaneSequence();
115 
116  void SetTargetLaneSequence();
117 
118  std::string ToString(const std::unordered_set<std::string>& lane_ids);
119 
120  std::string ToString(const std::vector<std::string>& lane_ids);
121 
122  private:
123  planning::ADCTrajectory adc_trajectory_;
124  common::math::Polygon2d adc_junction_polygon_;
125  std::shared_ptr<const hdmap::JunctionInfo> adc_junction_info_ptr_;
126  double s_dist_to_junction_;
127  std::unordered_set<std::string> adc_lane_ids_;
128  std::vector<std::string> adc_lane_seq_;
129  std::unordered_set<std::string> adc_target_lane_ids_;
130  std::vector<std::string> adc_target_lane_seq_;
131 };
132 
133 } // namespace prediction
134 } // namespace apollo
bool IsPointInJunction(const common::PathPoint &point) const
Check if a point is in the first junction of the adc trajectory.
bool IsProtected() const
Get the right-of-way status of ADC.
bool IsLaneIdInReferenceLine(const std::string &lane_id) const
Determine if a lane ID is in the reference line.
void SetPosition(const common::math::Vec2d &position)
Set ADC position.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
const std::vector< std::string > & GetADCLaneIDSequence() const
The class of polygon in 2-D.
Definition: polygon2d.h:43
Definition: container.h:33
const planning::ADCTrajectory & adc_trajectory() const
Get ADC planning trajectory.
const std::vector< std::string > & GetADCTargetLaneIDSequence() const
double ADCDistanceToJunction() const
Compute ADC&#39;s distance to junction.
bool IsLaneIdInTargetReferenceLine(const std::string &lane_id) const
Implements a class of 2-dimensional vectors.
Definition: vec2d.h:42
Define the data container base class.
void Insert(const ::google::protobuf::Message &message) override
Insert a data message into the container.
virtual ~ADCTrajectoryContainer()=default
Destructor.
bool HasOverlap(const LaneSequence &lane_sequence) const
Has overlap with ADC trajectory.
void SetJunction(const std::string &junction_id, const double distance)
std::shared_ptr< const hdmap::JunctionInfo > ADCJunction() const
Get ADC junction.
Definition: adc_trajectory_container.h:37