19#include "modules/planning/scenarios/pull_over/proto/pull_over.pb.h"
40 const auto& pull_over_status =
42 if (!pull_over_status.has_position() ||
43 !pull_over_status.position().has_x() ||
44 !pull_over_status.position().has_y() || !pull_over_status.has_theta()) {
45 ADEBUG <<
"pull_over status not set properly: "
46 << pull_over_status.DebugString();
52 reference_line.XYToSL(pull_over_status.position(), &pull_over_sl);
55 double distance = adc_front_edge_s - pull_over_sl.
s();
57 ADEBUG <<
"ADC passed pull-over spot: distance[" << distance <<
"]";
62 const double max_adc_stop_speed = common::VehicleConfigHelper::Instance()
65 .max_abs_speed_when_stopped();
66 if (adc_speed > max_adc_stop_speed) {
67 ADEBUG <<
"ADC not stopped: speed[" << adc_speed <<
"]";
71 static constexpr double kStartParkCheckRange = 3.0;
72 if (distance <= -kStartParkCheckRange) {
73 ADEBUG <<
"ADC still far: distance[" << distance <<
"]";
78 vehicle_state_provider->
y()};
80 pull_over_status.position().y()};
83 reference_line_info, scenario_config, adc_position,
84 vehicle_state_provider->
heading(), target_position,
85 pull_over_status.theta(),
true);
99 const auto& pull_over_status =
101 if (!pull_over_status.has_position() ||
102 !pull_over_status.position().has_x() ||
103 !pull_over_status.position().has_y() || !pull_over_status.has_theta()) {
104 ADEBUG <<
"pull_over status not set properly: "
105 << pull_over_status.DebugString();
110 pull_over_status.position().y()};
112 reference_line_info, scenario_config, {path_point.
x(), path_point.
y()},
113 path_point.
theta(), target_position, pull_over_status.theta(),
123 const double adc_theta,
125 const double target_theta,
const bool check_s) {
126 const auto& reference_line = reference_line_info.
reference_line();
128 reference_line.XYToSL(target_position, &target_sl);
130 reference_line.XYToSL(adc_position, &adc_position_sl);
132 const double s_diff = target_sl.
s() - adc_position_sl.
s();
133 const double l_diff = std::fabs(target_sl.
l() - adc_position_sl.
l());
134 const double theta_diff =
137 ADEBUG <<
"adc_position_s[" << adc_position_sl.
s() <<
"] adc_position_l["
138 << adc_position_sl.
l() <<
"] target_s[" << target_sl.
s()
139 <<
"] target_l[" << target_sl.
l() <<
"] s_diff[" << s_diff
140 <<
"] l_diff[" << l_diff <<
"] theta_diff[" << theta_diff <<
"]";
146 ret = (ret && s_diff >= 0 &&
The class of vehicle state.
double linear_velocity() const
Get the vehicle's linear velocity.
double x() const
Get the x-coordinate of vehicle position.
double y() const
Get the y-coordinate of vehicle position.
double heading() const
Get the heading of vehicle position, which is the angle between the vehicle's heading direction and t...
Implements a class of 2-dimensional vectors.
double x() const
Getter for x component
const PlanningStatus & planning_status() const
ReferenceLineInfo holds all data for one reference line.
const ReferenceLine & reference_line() const
const SLBoundary & AdcSlBoundary() const
Planning module main class.
double NormalizeAngle(const double angle)
Normalize angle to [-PI, PI).
PullOverState CheckADCPullOver(const common::VehicleStateProvider *vehicle_state_provider, const ReferenceLineInfo &reference_line_info, const ScenarioPullOverConfig &scenario_config, const PlanningContext *planning_context)
: check adc parked properly
PullOverState CheckADCPullOverPathPoint(const ReferenceLineInfo &reference_line_info, const ScenarioPullOverConfig &scenario_config, const common::PathPoint &path_point, const PlanningContext *planning_context)
: check path data to see properly
bool CheckPullOverPositionBySL(const ReferenceLineInfo &reference_line_info, const ScenarioPullOverConfig &scenario_config, const common::math::Vec2d &adc_position, const double adc_theta, const common::math::Vec2d &target_position, const double target_theta, const bool check_s)
optional PullOverStatus pull_over
optional double max_s_error_to_end_point
optional double pass_destination_threshold
optional double max_l_error_to_end_point
optional double max_theta_error_to_end_point