Apollo  6.0
Open source self driving car software
obstacle_clusters.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 
17 #pragma once
18 
19 #include <memory>
20 #include <mutex>
21 #include <string>
22 #include <unordered_map>
23 #include <utility>
24 #include <vector>
25 
28 #include "modules/prediction/proto/feature.pb.h"
29 
30 namespace apollo {
31 namespace prediction {
32 
34  public:
38  ObstacleClusters() = default;
42  void Init();
43 
52  LaneGraph GetLaneGraph(
53  const double start_s, const double length, const bool consider_lane_split,
54  std::shared_ptr<const apollo::hdmap::LaneInfo> lane_info_ptr);
55 
66  const double start_s, const double length, const bool is_on_lane,
67  std::shared_ptr<const apollo::hdmap::LaneInfo> lane_info_ptr);
68 
76  bool ForwardNearbyObstacle(const LaneSequence& lane_sequence, const double s,
77  LaneObstacle* const lane_obstacle);
78 
86  void AddObstacle(const int obstacle_id, const std::string& lane_id,
87  const double lane_s, const double lane_l);
88 
92  void SortObstacles();
93 
101  bool ForwardNearbyObstacle(const LaneSequence& lane_sequence,
102  const int obstacle_id, const double obstacle_s,
103  const double obstacle_l,
104  NearbyObstacle* const nearby_obstacle_ptr);
105 
113  bool BackwardNearbyObstacle(const LaneSequence& lane_sequence,
114  const int obstacle_id, const double obstacle_s,
115  const double obstacle_l,
116  NearbyObstacle* const nearby_obstacle_ptr);
117 
123  StopSign QueryStopSignByLaneId(const std::string& lane_id);
124 
125  std::unordered_map<std::string, std::vector<LaneObstacle>>&
127  return lane_obstacles_;
128  }
129 
130  private:
131  std::unordered_map<std::string, std::vector<LaneObstacle>> lane_obstacles_;
132  std::unordered_map<std::string, StopSign> lane_id_stop_sign_map_;
133 };
134 
135 } // namespace prediction
136 } // namespace apollo
ObstacleClusters()=default
Constructor.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
bool BackwardNearbyObstacle(const LaneSequence &lane_sequence, const int obstacle_id, const double obstacle_s, const double obstacle_l, NearbyObstacle *const nearby_obstacle_ptr)
Get the backward nearest obstacle on lane sequence at s.
std::unordered_map< std::string, std::vector< LaneObstacle > > & GetLaneObstacles()
Definition: obstacle_clusters.h:126
LaneGraph GetLaneGraphWithoutMemorizing(const double start_s, const double length, const bool is_on_lane, std::shared_ptr< const apollo::hdmap::LaneInfo > lane_info_ptr)
Obtain a lane graph given a lane info and s, but don&#39;t memorize it.
Definition: obstacle_clusters.h:33
StopSign QueryStopSignByLaneId(const std::string &lane_id)
Query stop sign by lane ID.
LaneGraph GetLaneGraph(const double start_s, const double length, const bool consider_lane_split, std::shared_ptr< const apollo::hdmap::LaneInfo > lane_info_ptr)
Obtain a lane graph given a lane info and s.
void SortObstacles()
Sort lane obstacles by lane s.
void AddObstacle(const int obstacle_id, const std::string &lane_id, const double lane_s, const double lane_l)
Add an obstacle into clusters.
Some util functions.
void Init()
Remove all lane graphs.
bool ForwardNearbyObstacle(const LaneSequence &lane_sequence, const double s, LaneObstacle *const lane_obstacle)
Get the nearest obstacle on lane sequence at s.