46 ADEBUG <<
" - It is too far ahead and we are not so sure of its status.";
52 ADEBUG <<
"It is Parked and NON-MOVABLE.";
57 for (
const auto* other_obstacle :
59 if (other_obstacle->Id() == obstacle.
Id()) {
62 if (other_obstacle->IsVirtual()) {
65 if (other_obstacle->Perception().type() !=
69 const auto& other_boundary = other_obstacle->PerceptionSLBoundary();
71 if (other_boundary.start_l() > this_boundary.end_l() ||
72 other_boundary.end_l() < this_boundary.start_l()) {
76 double delta_s = other_boundary.
start_s() - this_boundary.end_s();
82 ADEBUG <<
"IT IS NON-MOVABLE!";
89 double block_obstacle_min_speed,
90 double min_front_sidepass_distance,
91 bool enable_obstacle_blocked_check) {
94 const auto& reference_line = reference_line_info.reference_line();
95 const SLBoundary& adc_sl_boundary = reference_line_info.AdcSlBoundary();
96 const PathDecision& path_decision = reference_line_info.path_decision();
97 ADEBUG <<
"Evaluating Obstacle: " << obstacle->
Id();
101 ADEBUG <<
" - It is virtual.";
106 if (!obstacle->
IsStatic() || obstacle->
speed() > block_obstacle_min_speed) {
107 ADEBUG <<
" - It is non-static.";
113 ADEBUG <<
" - It is behind ADC.";
118 static constexpr double kAdcDistanceSidePassThreshold = 15.0;
120 adc_sl_boundary.
end_s() + kAdcDistanceSidePassThreshold) {
121 ADEBUG <<
" - It is too far ahead.";
126 if (adc_sl_boundary.
end_s() + min_front_sidepass_distance >
128 ADEBUG <<
" - It is too close to side-pass.";
134 ADEBUG <<
" - It is not blocking our way.";
139 if (enable_obstacle_blocked_check &&
141 for (
const auto* other_obstacle : path_decision.
obstacles().
Items()) {
142 if (other_obstacle->Id() == obstacle->
Id()) {
145 if (other_obstacle->IsVirtual()) {
148 if (other_obstacle->PerceptionSLBoundary().start_l() >
150 other_obstacle->PerceptionSLBoundary().end_l() <
155 double delta_s = other_obstacle->PerceptionSLBoundary().start_s() -
163 ADEBUG <<
" - It is blocked by others, too.";
168 ADEBUG <<
"IT IS BLOCKING!";
175 const SLBoundary& adc_sl_boundary = reference_line_info.AdcSlBoundary();
176 double distance_between_adc_and_obstacle =
178 return distance_between_adc_and_obstacle;
183 const double driving_width =
185 const double adc_width =
187 ADEBUG <<
" (driving width = " << driving_width
188 <<
", adc_width = " << adc_width <<
")";
189 if (driving_width > adc_width + FLAGS_static_obstacle_nudge_l_buffer +
190 FLAGS_side_pass_driving_width_l_buffer) {
193 ADEBUG <<
"It is NOT blocking our path.";
197 ADEBUG <<
"It is blocking our path.";
203 if (!FLAGS_enable_scenario_side_pass_multiple_parked_obstacles) {
206 double road_left_width = 0.0;
207 double road_right_width = 0.0;
208 double max_road_right_width = 0.0;
210 &road_left_width, &road_right_width);
211 max_road_right_width = road_right_width;
213 &road_left_width, &road_right_width);
214 max_road_right_width = std::max(max_road_right_width, road_right_width);
216 max_road_right_width - 0.1;
218 std::vector<std::shared_ptr<const hdmap::LaneInfo>> lanes;
222 obstacle_box.center().y()),
223 std::min(obstacle_box.width(), obstacle_box.length()), &lanes);
224 bool is_on_parking_lane =
false;
225 if (lanes.size() == 1 &&
227 is_on_parking_lane =
true;
230 bool is_parked = is_on_parking_lane || is_at_road_edge;
231 return is_parked && obstacle->
IsStatic();
236 const std::string& blocking_obstacle_id) {
237 if (blocking_obstacle_id.empty()) {
238 ADEBUG <<
"There is no blocking obstacle.";
243 blocking_obstacle_id);
244 if (blocking_obstacle ==
nullptr) {
245 ADEBUG <<
"Blocking obstacle is no longer there.";
250 double blocking_obstacle_s =
252 ADEBUG <<
"Blocking obstacle is at s = " << blocking_obstacle_s;
254 const auto& first_encountered_overlaps =
256 for (
const auto& overlap : first_encountered_overlaps) {
257 ADEBUG << overlap.first <<
", " << overlap.second.DebugString();
263 auto distance = overlap.second.start_s - blocking_obstacle_s;
267 ADEBUG <<
"Too close to signal intersection (" << distance
268 <<
"m); don't SIDE_PASS.";
273 ADEBUG <<
"Too close to overlap_type[" << overlap.first <<
"] ("
274 << distance <<
"m); don't SIDE_PASS";
285 const std::string& blocking_obstacle_id) {
286 if (blocking_obstacle_id.empty()) {
287 ADEBUG <<
"There is no blocking obstacle.";
292 blocking_obstacle_id);
293 if (blocking_obstacle ==
nullptr) {
294 ADEBUG <<
"Blocking obstacle is no longer there.";
299 double blocking_obstacle_s =
301 double min_distance = std::numeric_limits<double>::max();
302 ADEBUG <<
"Blocking obstacle is at s = " << blocking_obstacle_s;
304 const auto& first_encountered_overlaps =
306 for (
const auto& overlap : first_encountered_overlaps) {
307 ADEBUG << overlap.first <<
", " << overlap.second.DebugString();
313 std::min(min_distance, overlap.second.start_s - blocking_obstacle_s);
321 const std::string& blocking_obstacle_id) {
322 if (blocking_obstacle_id.empty()) {
323 ADEBUG <<
"There is no blocking obstacle.";
328 blocking_obstacle_id);
329 if (blocking_obstacle ==
nullptr) {
330 ADEBUG <<
"Blocking obstacle is no longer there.";
335 double blocking_obstacle_start_s =
337 double blocking_obstacle_end_s =
339 double min_distance = std::numeric_limits<double>::max();
340 AINFO <<
"Blocking obstacle start s = " << blocking_obstacle_start_s
341 <<
", end_s: " << blocking_obstacle_end_s;
343 const auto& first_encountered_overlaps =
345 for (
const auto& overlap :
347 AINFO << overlap.DebugString();
348 double distance = std::numeric_limits<double>::max();
349 if ((blocking_obstacle_start_s >= overlap.start_s &&
350 blocking_obstacle_start_s <= overlap.end_s) ||
351 (blocking_obstacle_end_s >= overlap.start_s &&
352 blocking_obstacle_end_s <= overlap.end_s)) {
354 }
else if (blocking_obstacle_end_s < overlap.start_s) {
355 distance = overlap.start_s - blocking_obstacle_end_s;
357 distance = blocking_obstacle_start_s - overlap.end_s;
359 min_distance = std::min(min_distance, distance);
367 const std::string& blocking_obstacle_id,
const double threshold) {
368 if (blocking_obstacle_id.empty()) {
369 ADEBUG <<
"There is no blocking obstacle.";
374 blocking_obstacle_id);
375 if (blocking_obstacle ==
nullptr) {
376 ADEBUG <<
"Blocking obstacle is no longer there.";
380 double blocking_obstacle_s =
383 ADEBUG <<
"Blocking obstacle is at s = " << blocking_obstacle_s;
384 ADEBUG <<
"ADC is at s = " << adc_end_s;
385 ADEBUG <<
"Destination is at s = "
387 if (blocking_obstacle_s - adc_end_s + threshold >
@Brief This is a helper class that can load vehicle configurations.
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
static PointENU ToPointENU(const double x, const double y, const double z=0)
static const HDMap * BaseMapPtr()
int GetLanes(const apollo::common::PointENU &point, double distance, std::vector< LaneInfoConstPtr > *lanes) const
get all lanes in certain range
const std::vector< PathOverlap > & junction_overlaps() const
Frame holds all data for one planning cycle.
const std::list< ReferenceLineInfo > & reference_line_info() const
T * Find(const I id)
Find object by id in the container
const std::vector< const T * > & Items() const
List all the items in the container.
This is the class that associates an Obstacle with its path properties.
const std::string & Id() const
const SLBoundary & PerceptionSLBoundary() const
const common::math::Box2d & PerceptionBoundingBox() const
PathDecision represents all obstacle decisions on one path.
const IndexedList< std::string, Obstacle > & obstacles() const
ReferenceLineInfo holds all data for one reference line.
PathDecision * path_decision()
const ReferenceLine & reference_line() const
const std::vector< std::pair< OverlapType, hdmap::PathOverlap > > & FirstEncounteredOverlaps() const
double SDistanceToDestination() const
const SLBoundary & AdcSlBoundary() const
const hdmap::Path & map_path() const
double GetDrivingWidth(const SLBoundary &sl_boundary) const
bool GetRoadWidth(const double s, double *const road_left_width, double *const road_right_width) const
Planning module main class.
bool IsBlockingObstacleToSidePass(const Frame &frame, const Obstacle *obstacle, double block_obstacle_min_speed, double min_front_sidepass_distance, bool enable_obstacle_blocked_check)
Decide whether an obstacle is a blocking one that needs to be side-passed.
constexpr double kAdcDistanceThreshold
bool IsBlockingObstacleWithinDestination(const ReferenceLineInfo &reference_line_info, const std::string &blocking_obstacle_id, const double threshold)
double DistanceBlockingObstacleToJunction(const ReferenceLineInfo &reference_line_info, const std::string &blocking_obstacle_id)
constexpr double kJunctionClearanceDist
constexpr double kIntersectionClearanceDist
double DistanceBlockingObstacleToIntersection(const ReferenceLineInfo &reference_line_info, const std::string &blocking_obstacle_id)
constexpr double kObstaclesDistanceThreshold
bool IsNonmovableObstacle(const ReferenceLineInfo &reference_line_info, const Obstacle &obstacle)
bool IsBlockingDrivingPathObstacle(const ReferenceLine &reference_line, const Obstacle *obstacle)
double GetDistanceBetweenADCAndObstacle(const Frame &frame, const Obstacle *obstacle)
bool IsParkedVehicle(const ReferenceLine &reference_line, const Obstacle *obstacle)
bool IsBlockingObstacleFarFromIntersection(const ReferenceLineInfo &reference_line_info, const std::string &blocking_obstacle_id)