Apollo planning 模块(三):path decider
lane follow场景为例,包含一个stage,每个stage又包含若干个task。在路径决策方面,依次进行lane_change_decider、path_reuse_decider、path_lane_borrow_decider、path_bounds_decider。在路径优化方面,依次进行piecewise_jerk_path_optimizer、path_assessment_decider、path_decider。
1.lane_change_decider
2.path_reuse_decider
3.path_lane_borrow_decider
Status PathLaneBorrowDecider::Process( Frame* const frame, ReferenceLineInfo* const reference_line_info) { // Sanity checks. CHECK_NOTNULL(frame); CHECK_NOTNULL(reference_line_info); // skip path_lane_borrow_decider if reused path if (FLAGS_enable_skip_path_tasks && reference_line_info->path_reusable()) { // for debug AINFO << "skip due to reusing path"; return Status::OK(); } // By default, don't borrow any lane. reference_line_info->set_is_path_lane_borrow(false); // Check if lane-borrowing is needed, if so, borrow lane. if (Decider::config_.path_lane_borrow_decider_config() .allow_lane_borrowing() && IsNecessaryToBorrowLane(*frame, *reference_line_info)) { reference_line_info->set_is_path_lane_borrow(true); } return Status::OK(); }
bool PathLaneBorrowDecider::IsNecessaryToBorrowLane( const Frame& frame, const ReferenceLineInfo& reference_line_info) { auto* mutable_path_decider_status = injector_->planning_context() ->mutable_planning_status() ->mutable_path_decider(); if (mutable_path_decider_status->is_in_path_lane_borrow_scenario()) { // If originally borrowing neighbor lane: if (mutable_path_decider_status->able_to_use_self_lane_counter() >= 6) { // If have been able to use self-lane for some time, then switch to // non-lane-borrowing. mutable_path_decider_status->set_is_in_path_lane_borrow_scenario(false); mutable_path_decider_status->clear_decided_side_pass_direction(); AINFO << "Switch from LANE-BORROW path to SELF-LANE path."; } } else { // If originally not borrowing neighbor lane: ADEBUG << "Blocking obstacle ID[" << mutable_path_decider_status->front_static_obstacle_id() << "]"; // ADC requirements check for lane-borrowing: if (!HasSingleReferenceLine(frame)) { return false; } //车速降低到规定车速值以下才允许借道:默认值 5 (单位:m/s或km/h???) if (!IsWithinSidePassingSpeedADC(frame)) { return false; } // Obstacle condition check for lane-borrowing:遮挡的障碍远离路口才允许借道,否则可能导致在路口时无法驶入正确车道 if (!IsBlockingObstacleFarFromIntersection(reference_line_info)) { return false; } //是否长期阻挡车道:默认值3秒 if (!IsLongTermBlockingObstacle()) { return false; } //障碍物与目标点距离是否小于一定值??? if (!IsBlockingObstacleWithinDestination(reference_line_info)) { return false; } //是否为可超越车辆:救护车、警车不可超越 if (!IsSidePassableObstacle(reference_line_info)) { return false; } // switch to lane-borrowing // set side-pass direction const auto& path_decider_status = injector_->planning_context()->planning_status().path_decider(); if (path_decider_status.decided_side_pass_direction().empty()) { // first time init decided_side_pass_direction bool left_borrowable; bool right_borrowable; //根据当前车道左右车道线的类型,检车左右车道是否可以借道(SOLID_YELLOW或者SOLID_WHITE不可以换道) CheckLaneBorrow(reference_line_info, &left_borrowable, &right_borrowable); if (!left_borrowable && !right_borrowable) { mutable_path_decider_status->set_is_in_path_lane_borrow_scenario(false); return false; } else { mutable_path_decider_status->set_is_in_path_lane_borrow_scenario(true); if (left_borrowable) { mutable_path_decider_status->add_decided_side_pass_direction( PathDeciderStatus::LEFT_BORROW); } if (right_borrowable) { mutable_path_decider_status->add_decided_side_pass_direction( PathDeciderStatus::RIGHT_BORROW); } } } AINFO << "Switch from SELF-LANE path to LANE-BORROW path."; } return mutable_path_decider_status->is_in_path_lane_borrow_scenario(); }
4.path_bounds_decider