Apollo 11.0
自动驾驶开放平台
apollo::planning::Smoother类 参考

#include <smoother.h>

apollo::planning::Smoother 的协作图:

Public 成员函数

 Smoother ()=default
 
virtual ~Smoother ()=default
 
apollo::common::Status Smooth (const FrameHistory *frame_history, const Frame *current_frame, ADCTrajectory *const current_trajectory_pb)
 

详细描述

在文件 smoother.h 第 32 行定义.

构造及析构函数说明

◆ Smoother()

apollo::planning::Smoother::Smoother ( )
default

◆ ~Smoother()

virtual apollo::planning::Smoother::~Smoother ( )
virtualdefault

成员函数说明

◆ Smooth()

apollo::common::Status apollo::planning::Smoother::Smooth ( const FrameHistory *  frame_history,
const Frame *  current_frame,
ADCTrajectory *const  current_trajectory_pb 
)

在文件 smoother.cc 第 55 行定义.

57 {
58 if (frame_history == nullptr) {
59 const std::string msg = "frame history is null.";
60 AERROR << msg;
61 return Status(ErrorCode::PLANNING_ERROR, msg);
62 }
63 if (current_frame == nullptr) {
64 const std::string msg = "frame is null.";
65 AERROR << msg;
66 return Status(ErrorCode::PLANNING_ERROR, msg);
67 }
68 if (current_trajectory_pb == nullptr) {
69 const std::string msg = "current trajectory pb is null";
70 AERROR << msg;
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 // skip for current planning is not stop.
76 ADEBUG << "skip smoothing for current planning is not stop";
77 return Status::OK();
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";
88 return Status::OK();
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";
94 return Status::OK();
95 }
96
97 auto previous_frame = frame_history->Latest();
98 if (previous_frame == nullptr) {
99 const std::string msg = "previous frame is null";
100 AWARN << msg;
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(
114 return Status::OK();
115}
static Status OK()
generate a success status.
Definition status.h:60
#define ADEBUG
Definition log.h:41
#define AERROR
Definition log.h:44
#define AWARN
Definition log.h:43

该类的文档由以下文件生成: