Apollo 10.0
自动驾驶开放平台
obstacle_clusters.h
浏览该文件的文档.
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/common_msgs/prediction_msgs/feature.pb.h"
29
30namespace apollo {
31namespace prediction {
32
34 public:
38 ObstacleClusters() = default;
42 void Init();
43
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
89 void ClearObstacle();
90
94 void SortObstacles();
95
103 bool ForwardNearbyObstacle(const LaneSequence& lane_sequence,
104 const int obstacle_id, const double obstacle_s,
105 const double obstacle_l,
106 NearbyObstacle* const nearby_obstacle_ptr);
107
115 bool BackwardNearbyObstacle(const LaneSequence& lane_sequence,
116 const int obstacle_id, const double obstacle_s,
117 const double obstacle_l,
118 NearbyObstacle* const nearby_obstacle_ptr);
119
125 StopSign QueryStopSignByLaneId(const std::string& lane_id);
126
127 std::unordered_map<std::string, std::vector<LaneObstacle>>&
129 return lane_obstacles_;
130 }
131
132 private:
133 std::unordered_map<std::string, std::vector<LaneObstacle>> lane_obstacles_;
134 std::unordered_map<std::string, StopSign> lane_id_stop_sign_map_;
135};
136
137} // namespace prediction
138} // namespace apollo
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
std::unordered_map< std::string, std::vector< LaneObstacle > > & GetLaneObstacles()
bool ForwardNearbyObstacle(const LaneSequence &lane_sequence, const double s, LaneObstacle *const lane_obstacle)
Get the nearest obstacle on lane sequence at 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
StopSign QueryStopSignByLaneId(const std::string &lane_id)
Query stop sign by lane ID
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't memorize it.
ObstacleClusters()=default
Constructor
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
void SortObstacles()
Sort lane obstacles by lane s
void Init()
Remove all lane graphs
Some util functions.
class register implement
Definition arena_queue.h:37