Apollo 11.0
自动驾驶开放平台
st_obstacles_processor.h
浏览该文件的文档.
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
21#pragma once
22
23#include <string>
24#include <tuple>
25#include <unordered_map>
26#include <utility>
27#include <vector>
28
29#include "modules/common_msgs/config_msgs/vehicle_config.pb.h"
30#include "modules/common_msgs/planning_msgs/decision.pb.h"
39
40namespace apollo {
41namespace planning {
42
43constexpr double kADCSafetyLBuffer = 0.1;
44constexpr double kSIgnoreThreshold = 0.01;
45constexpr double kTIgnoreThreshold = 0.1;
46constexpr double kOvertakenObsCautionTime = 0.5;
47
49 public:
51
52 void Init(const double planning_distance, const double planning_time,
53 const PathData& path_data, PathDecision* const path_decision,
54 History* const history);
55
56 virtual ~STObstaclesProcessor() = default;
57
59
60 std::unordered_map<std::string, STBoundary> GetAllSTBoundaries();
61
73 double t,
74 std::vector<std::pair<double, double>>* const available_s_bounds,
75 std::vector<
76 std::vector<std::pair<std::string, ObjectDecisionType>>>* const
77 available_obs_decisions);
78
86 double t, std::pair<double, double>* const limiting_speed_info);
87
90 void SetObstacleDecision(const std::string& obs_id,
91 const ObjectDecisionType& obs_decision);
92
96 const std::vector<std::pair<std::string, ObjectDecisionType>>&
97 obstacle_decisions);
98
99 private:
106 bool ComputeObstacleSTBoundary(const Obstacle& obstacle,
107 std::vector<STPoint>* const lower_points,
108 std::vector<STPoint>* const upper_points,
109 bool* const is_caution_obstacle,
110 double* const obs_caution_end_t);
111
120 bool GetOverlappingS(const std::vector<common::PathPoint>& adc_path_points,
121 const common::math::Box2d& obstacle_instance,
122 const double adc_l_buffer,
123 std::pair<double, double>* const overlapping_s);
124
136 int GetSBoundingPathPointIndex(
137 const std::vector<common::PathPoint>& adc_path_points,
138 const common::math::Box2d& obstacle_instance, const double s_thresh,
139 const bool is_before, const int start_idx, const int end_idx);
140
151 bool IsPathPointAwayFromObstacle(const common::PathPoint& path_point,
152 const common::PathPoint& direction_point,
153 const common::math::Box2d& obs_box,
154 const double s_thresh, const bool is_before);
155
163 bool IsADCOverlappingWithObstacle(const common::PathPoint& adc_path_point,
164 const common::math::Box2d& obs_box,
165 const double l_buffer) const;
166
173 std::vector<std::pair<double, double>> FindSGaps(
174 const std::vector<std::tuple<int, double, double, double, std::string>>&
175 obstacle_t_edges,
176 double s_min, double s_max);
177
185 ObjectDecisionType DetermineObstacleDecision(const double obs_s_min,
186 const double obs_s_max,
187 const double s) const;
188
193 bool IsSWithinADCLowRoadRightSegment(const double s) const;
194
195 private:
196 double planning_time_;
197 double planning_distance_;
198 PathData path_data_;
199 common::VehicleParam vehicle_param_;
200 double adc_path_init_s_;
201 PathDecision* path_decision_;
202
203 // A vector of sorted obstacle's t-edges:
204 // (is_starting_t, t, s_min, s_max, obs_id).
205 std::vector<std::tuple<int, double, double, double, std::string>>
206 obs_t_edges_;
207 int obs_t_edges_idx_;
208
209 std::unordered_map<std::string, STBoundary> obs_id_to_st_boundary_;
210 std::unordered_map<std::string, ObjectDecisionType> obs_id_to_decision_;
211
212 std::vector<std::tuple<std::string, STBoundary, Obstacle*>>
213 candidate_clear_zones_;
214
215 std::unordered_map<std::string, STBoundary>
216 obs_id_to_alternative_st_boundary_;
217
218 std::vector<std::pair<double, double>> adc_low_road_right_segments_;
219
220 History* history_ = nullptr;
221};
222
223} // namespace planning
224} // namespace apollo
A general class to denote the return status of an API call.
Definition status.h:43
Rectangular (undirected) bounding box in 2-D.
Definition box2d.h:52
This is the class that associates an Obstacle with its path properties.
Definition obstacle.h:62
PathDecision represents all obstacle decisions on one path.
common::Status MapObstaclesToSTBoundaries(PathDecision *const path_decision)
bool GetLimitingSpeedInfo(double t, std::pair< double, double > *const limiting_speed_info)
Provided that decisions for all existing obstacles are made, get the speed limiting info from limitin...
void Init(const double planning_distance, const double planning_time, const PathData &path_data, PathDecision *const path_decision, History *const history)
std::unordered_map< std::string, STBoundary > GetAllSTBoundaries()
void SetObstacleDecision(const std::string &obs_id, const ObjectDecisionType &obs_decision)
Set the decision for a given obstacle.
bool GetSBoundsFromDecisions(double t, std::vector< std::pair< double, double > > *const available_s_bounds, std::vector< std::vector< std::pair< std::string, ObjectDecisionType > > > *const available_obs_decisions)
Given a time t, get the lower and upper s-boundaries.
Planning module main class.
constexpr double kSIgnoreThreshold
constexpr double kOvertakenObsCautionTime
constexpr double kADCSafetyLBuffer
constexpr double kTIgnoreThreshold
class register implement
Definition arena_queue.h:37