57 {
58 if (frame_history == nullptr) {
59 const std::string msg = "frame history is null.";
61 return Status(ErrorCode::PLANNING_ERROR, msg);
62 }
63 if (current_frame == nullptr) {
64 const std::string msg = "frame is null.";
66 return Status(ErrorCode::PLANNING_ERROR, msg);
67 }
68 if (current_trajectory_pb == nullptr) {
69 const std::string msg = "current trajectory pb is null";
71 return Status(ErrorCode::PLANNING_ERROR, msg);
72 }
73 const auto& main_decision = current_trajectory_pb->decision().main_decision();
74 if (!main_decision.has_stop()) {
75
76 ADEBUG <<
"skip smoothing for current planning is not stop";
78 }
79
80 const auto& vehicle_state = current_frame->vehicle_state();
81 const double max_adc_stop_speed = common::VehicleConfigHelper::Instance()
82 ->GetConfig()
83 .vehicle_param()
84 .max_abs_speed_when_stopped();
85 if (vehicle_state.linear_velocity() > max_adc_stop_speed) {
86 ADEBUG <<
"vehicle speed:" << vehicle_state.linear_velocity()
87 << " skip smoothing for non-stop scenario";
89 }
90
91 if (!IsCloseStop(vehicle_state, main_decision.stop())) {
92 ADEBUG <<
"vehicle state:" << vehicle_state.DebugString()
93 << " skip smoothing for ADC is not close to stop point";
95 }
96
97 auto previous_frame = frame_history->Latest();
98 if (previous_frame == nullptr) {
99 const std::string msg = "previous frame is null";
101 return Status(ErrorCode::PLANNING_ERROR, msg);
102 }
103 const auto& previous_planning =
104 previous_frame->current_frame_planned_trajectory();
105 auto header = current_trajectory_pb->header();
106 *current_trajectory_pb = previous_planning;
107 current_trajectory_pb->mutable_header()->CopyFrom(header);
108 auto smoother_debug = current_trajectory_pb->mutable_debug()
109 ->mutable_planning_data()
110 ->mutable_smoother();
111 smoother_debug->set_is_smoothed(true);
112 smoother_debug->set_type(
115}
static Status OK()
generate a success status.