34 return Process(frame, reference_line_info);
43 const PathBound& path_boundaries,
const std::string& debug_name,
46 if (path_boundaries.empty()) {
47 AINFO <<
"path boundary is empty!";
50 CHECK_NOTNULL(reference_line_info);
54 std::vector<common::FrenetFramePoint> frenet_frame_left_boundaries;
55 std::vector<common::FrenetFramePoint> frenet_frame_right_boundaries;
58 frenet_frame_point.set_s(path_bound_point.s);
59 frenet_frame_point.set_dl(0.0);
60 frenet_frame_point.set_ddl(0.0);
62 frenet_frame_point.set_l(path_bound_point.l_lower.l);
63 frenet_frame_right_boundaries.push_back(frenet_frame_point);
64 frenet_frame_point.set_l(path_bound_point.l_upper.l);
65 frenet_frame_left_boundaries.push_back(frenet_frame_point);
68 auto frenet_frame_left_path =
70 auto frenet_frame_right_path =
75 left_path_data.
SetFrenetPath(std::move(frenet_frame_left_path));
78 right_path_data.
SetFrenetPath(std::move(frenet_frame_right_path));
81 auto* ptr_display_path_1 =
82 reference_line_info->
mutable_debug()->mutable_planning_data()->add_path();
83 ptr_display_path_1->set_name(std::string(
"planning_path_boundary_1_") +
85 ptr_display_path_1->mutable_path_point()->CopyFrom(
88 auto* ptr_display_path_2 =
89 reference_line_info->
mutable_debug()->mutable_planning_data()->add_path();
90 ptr_display_path_2->set_name(std::string(
"planning_path_boundary_2_") +
92 ptr_display_path_2->mutable_path_point()->CopyFrom(
98 const PathData& path_data,
const std::string& debug_name,
101 auto* ptr_optimized_path =
102 reference_line_info->
mutable_debug()->mutable_planning_data()->add_path();
103 ptr_optimized_path->set_name(std::string(
"candidate_path_") + debug_name);
104 ptr_optimized_path->mutable_path_point()->CopyFrom(
105 {path_points.begin(), path_points.end()});
110 if (FLAGS_use_front_axe_center_in_path_planning) {
111 double front_to_rear_axe_distance =
115 planning_start_point.mutable_path_point()->set_x(
117 front_to_rear_axe_distance *
119 planning_start_point.mutable_path_point()->set_y(
121 front_to_rear_axe_distance *
124 AINFO << std::fixed <<
"Plan at the starting point: x = "
126 <<
", y = " << planning_start_point.
path_point().
y()
137 CHECK_NOTNULL(sl_boundary);
139 if (point_index < 0 ||
140 static_cast<size_t>(point_index) > discrete_path.size()) {
143 sl_boundary->mutable_boundary_point()->Clear();
145 const auto& vehicle_config =
146 common::VehicleConfigHelper::Instance()->GetConfig();
147 const double ego_length = vehicle_config.vehicle_param().length();
148 const double ego_width = vehicle_config.vehicle_param().width();
149 const double ego_back_to_center =
150 vehicle_config.vehicle_param().back_edge_to_center();
151 const double ego_center_shift_distance =
152 ego_length / 2.0 - ego_back_to_center;
154 const auto& rear_center_path_point = discrete_path[point_index];
155 const double ego_theta = rear_center_path_point.theta();
157 {rear_center_path_point.x(), rear_center_path_point.y()}, ego_theta,
158 ego_length, ego_width);
160 ego_center_shift_distance * ego_box.cos_heading(),
161 ego_center_shift_distance * ego_box.sin_heading()};
162 ego_box.Shift(shift_vec);
165 ego_center_shift_distance;
A general class to denote the return status of an API call.
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
Rectangular (undirected) bounding box in 2-D.
Implements a class of 2-dimensional vectors.
Frame holds all data for one planning cycle.
const common::TrajectoryPoint & PlanningStartPoint() const
void SetReferenceLine(const ReferenceLine *reference_line)
const FrenetFramePath & frenet_frame_path() const
const DiscretizedPath & discretized_path() const
bool SetFrenetPath(FrenetFramePath frenet_path)
void RecordDebugInfo(const PathBound &path_boundaries, const std::string &debug_name, ReferenceLineInfo *const reference_line_info)
add path_boundary debug info for PnC monitor
apollo::common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info) override
bool GetSLBoundary(const PathData &path_data, int point_index, const ReferenceLineInfo *reference_line_info, SLBoundary *const sl_boundary)
get sl boundary of the point on PathData
virtual apollo::common::Status Process(Frame *frame, ReferenceLineInfo *reference_line_info)
void GetStartPointSLState()
calculate init sl state by planning start point, result will store in init_sl_state_
ReferenceLineInfo holds all data for one reference line.
const ReferenceLine & reference_line() const
planning_internal::Debug * mutable_debug()
std::pair< std::array< double, 3 >, std::array< double, 3 > > ToFrenetFrame(const common::TrajectoryPoint &traj_point) const
bool GetSLBoundary(const common::math::Box2d &box, SLBoundary *const sl_boundary, double warm_start_s=-1.0) const
Get the SL Boundary of the box.
ReferenceLineInfo * reference_line_info_
virtual common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info)
Planning module main class.
std::vector< PathBoundPoint > PathBound
optional PathPoint path_point
optional VehicleParam vehicle_param
optional double wheel_base