35 const std::shared_ptr<DependencyInjector>& injector) {
40 return Task::LoadConfig<FallbackPathConfig>(&config_);
49 std::vector<PathBoundary> candidate_path_boundaries;
50 std::vector<PathData> candidate_path_data;
53 if (!DecidePathBounds(&candidate_path_boundaries)) {
56 if (!OptimizePath(candidate_path_boundaries, &candidate_path_data)) {
59 if (!AssessPath(&candidate_path_data,
61 AERROR <<
"Path assessment failed";
67bool FallbackPath::DecidePathBounds(std::vector<PathBoundary>* boundary) {
68 boundary->emplace_back();
69 auto& path_bound = boundary->back();
73 const std::string msg =
"Failed to initialize path boundaries.";
80 AERROR <<
"Failed to decide a rough boundary based on self lane.";
86 AERROR <<
"Failed to decide a rough boundary based on adc.";
89 path_bound.set_label(absl::StrCat(
"fallback/",
"self"));
94bool FallbackPath::OptimizePath(
95 const std::vector<PathBoundary>& path_boundaries,
96 std::vector<PathData>* candidate_path_data) {
99 std::array<double, 3> end_state = {0.0, 0.0, 0.0};
100 for (
const auto& path_boundary : path_boundaries) {
101 size_t path_boundary_size = path_boundary.boundary().size();
102 if (path_boundary_size <= 1U) {
103 AERROR <<
"Get invalid path boundary with size: " << path_boundary_size;
106 std::vector<double> opt_l, opt_dl, opt_ddl;
107 std::vector<std::pair<double, double>> ddl_bounds;
112 std::vector<double> ref_l(path_boundary_size, 0);
113 std::vector<double> weight_ref_l(path_boundary_size,
114 config.path_reference_l_weight());
117 ddl_bounds, jerk_bound, config, &opt_l, &opt_dl, &opt_ddl);
120 opt_l, opt_dl, opt_ddl, path_boundary.delta_s(),
121 path_boundary.start_s());
123 path_data.SetReferenceLine(&reference_line);
124 path_data.SetFrenetPath(std::move(frenet_frame_path));
125 if (FLAGS_use_front_axe_center_in_path_planning) {
126 auto discretized_path = DiscretizedPath(
129 path_data.SetDiscretizedPath(discretized_path);
131 path_data.set_path_label(path_boundary.label());
132 path_data.set_blocking_obstacle_id(path_boundary.blocking_obstacle_id());
133 candidate_path_data->push_back(std::move(path_data));
136 if (candidate_path_data->empty()) {
142bool FallbackPath::AssessPath(std::vector<PathData>* candidate_path_data,
143 PathData* final_path) {
144 PathData curr_path_data = candidate_path_data->back();
147 if (curr_path_data.Empty()) {
148 ADEBUG <<
"Fallback Path: path data is empty.";
153 ADEBUG <<
"Fallback Path: ADC is greatly off reference line.";
159 ADEBUG <<
"Fallback Path: ADC is greatly off road.";
163 if (curr_path_data.Empty()) {
164 AINFO <<
"Lane follow path is empty after trimed";
167 *final_path = curr_path_data;
A general class to denote the return status of an API call.
static Status OK()
generate a success status.
@Brief This is a helper class that can load vehicle configurations.
bool Init(const std::string &config_dir, const std::string &name, const std::shared_ptr< DependencyInjector > &injector) override
Frame holds all data for one planning cycle.
static bool IsGreatlyOffReferenceLine(const PathData &path_data)
static bool IsGreatlyOffRoad(const ReferenceLineInfo &reference_line_info, const PathData &path_data)
static bool GetBoundaryFromSelfLane(const ReferenceLineInfo &reference_line_info, const SLState &init_sl_state, PathBoundary *const path_bound)
generate path bound by self lane and adc position
static bool ExtendBoundaryByADC(const ReferenceLineInfo &reference_line_info, const SLState &init_sl_state, const double extend_buffer, PathBoundary *const path_bound)
extend boundary to include adc
static bool InitPathBoundary(const ReferenceLineInfo &reference_line_info, PathBoundary *const path_bound, SLState init_sl_state)
Starting from ADC's current position, increment until the path length, and set lateral bounds to be i...
void RecordDebugInfo(const PathBound &path_boundaries, const std::string &debug_name, ReferenceLineInfo *const reference_line_info)
add path_boundary debug info for PnC monitor
void GetStartPointSLState()
calculate init sl state by planning start point, result will store in init_sl_state_
static std::vector< common::PathPoint > ConvertPathPointRefFromFrontAxeToRearAxe(const PathData &path_data)
static void CalculateAccBound(const PathBoundary &path_boundary, const ReferenceLine &reference_line, std::vector< std::pair< double, double > > *ddl_bounds)
calculate ddl bound by referenceline kappa and adc lat accleration
static FrenetFramePath ToPiecewiseJerkPath(const std::vector< double > &x, const std::vector< double > &dx, const std::vector< double > &ddx, const double delta_s, const double start_s)
Data format tramform from raw data to FrenetFramePath
static double EstimateJerkBoundary(const double vehicle_speed)
Calculation of jerk boundary based on vehicle kinematics model.
static bool OptimizePath(const SLState &init_state, const std::array< double, 3 > &end_state, std::vector< double > l_ref, std::vector< double > l_ref_weight, const PathBoundary &path_boundary, const std::vector< std::pair< double, double > > &ddl_bounds, double dddl_bound, const PiecewiseJerkPathConfig &config, std::vector< double > *x, std::vector< double > *dx, std::vector< double > *ddx)
Piecewise jerk path optimizer.
ReferenceLineInfo holds all data for one reference line.
const ReferenceLine & reference_line() const
const PathData & path_data() const
bool IsChangeLanePath() const
Check if the current reference line is a change lane reference line, i.e., ADC's current position is ...
PathData * mutable_path_data()
ReferenceLineInfo * reference_line_info_
virtual bool Init(const std::string &config_dir, const std::string &name, const std::shared_ptr< DependencyInjector > &injector)
Planning module main class.
optional double extend_buffer
optional PiecewiseJerkPathConfig path_optimizer_config