Apollo 11.0
自动驾驶开放平台
apollo::control::ControlTaskExtend类 参考

#include <control_task_extend.h>

类 apollo::control::ControlTaskExtend 继承关系图:
apollo::control::ControlTaskExtend 的协作图:

Public 成员函数

 ControlTaskExtend ()
 constructor
 
virtual ~ControlTaskExtend ()
 destructor
 
std::string Name () const
 reset ControlTaskAgent
 
- Public 成员函数 继承自 apollo::control::ControlTask
 ControlTask ()=default
 constructor
 
virtual ~ControlTask ()=default
 destructor
 
virtual common::Status Init (std::shared_ptr< DependencyInjector > injector)=0
 initialize Controller
 
virtual common::Status ComputeControlCommand (const localization::LocalizationEstimate *localization, const canbus::Chassis *chassis, const planning::ADCTrajectory *trajectory, control::ControlCommand *cmd)=0
 compute control command based on current vehicle status and target trajectory
 
virtual common::Status Reset ()=0
 reset Controller
 
virtual void Stop ()=0
 stop controller
 

Protected 成员函数

template<typename T >
bool LoadParamsPipelineConfig (T *pipeline_config)
 
bool LoadCalibrationTable (const std::string &calibration_table_path, calibration_table *calibration_table_conf)
 
bool VehicleStatusIdentificationUpdate (const localization::LocalizationEstimate *localization, const canbus::Chassis *chassis, const planning::ADCTrajectory *trajectory)
 
bool IsForwardModel ()
 
bool IsEdgeFollow ()
 
bool CheckInPit (double pit_replan_check_time, double pit_replan_check_count, double vehicle_speed, bool replan)
 
bool IsLargeCurvature (const double ref_curvature, const double min_large_ref_curvature, bool *is_in_large_curvature)
 
bool IsLeftCurvature (const double ref_curvature)
 
double GetVehicleSpeed (std::shared_ptr< DependencyInjector > injector, const bool &use_filter, const double &filter_coeff)
 
double ThrottleCmdFilter (const bool &use_filter, const double &filter_coeff, const double &throttle)
 
- Protected 成员函数 继承自 apollo::control::ControlTask
template<typename T >
bool LoadConfig (T *config)
 
bool LoadCalibrationTable (calibration_table *calibration_table_conf)
 

详细描述

在文件 control_task_extend.h 第 51 行定义.

构造及析构函数说明

◆ ControlTaskExtend()

apollo::control::ControlTaskExtend::ControlTaskExtend ( )

constructor

在文件 control_task_extend.cc 第 46 行定义.

46 : name_("Control Task Base Extend") {
47 AINFO << "Using " << name_ << ".";
48}
#define AINFO
Definition log.h:42

◆ ~ControlTaskExtend()

virtual apollo::control::ControlTaskExtend::~ControlTaskExtend ( )
inlinevirtual

destructor

在文件 control_task_extend.h 第 61 行定义.

61{}

成员函数说明

◆ CheckInPit()

bool apollo::control::ControlTaskExtend::CheckInPit ( double  pit_replan_check_time,
double  pit_replan_check_count,
double  vehicle_speed,
bool  replan 
)
protected

在文件 control_task_extend.cc 第 106 行定义.

110 {
111 static std::pair<double, int> replan_count(0, 0);
112
114
115 if (now - replan_count.first > pit_replan_check_time) {
116 replan_count.first = 0;
117 replan_count.second = 0;
118 }
119
120 if (replan) {
121 if (now - replan_count.first > pit_replan_check_time) {
122 replan_count.first = now;
123 replan_count.second = 1;
124 } else {
125 replan_count.first = now;
126 replan_count.second++;
127 }
128 }
129
130 const auto &vehicle_param = common::VehicleConfigHelper::GetConfig().vehicle_param();
131 if (replan_count.second >= pit_replan_check_count
132 && abs(vehicle_speed) < vehicle_param.max_abs_speed_when_stopped()) {
133 return true;
134 } else {
135 return false;
136 }
137}
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
static double NowInSeconds()
gets the current time in second.
Definition clock.cc:56
T abs(const T &x)
Get absolute value of x
Definition misc.h:63
optional VehicleParam vehicle_param

◆ GetVehicleSpeed()

double apollo::control::ControlTaskExtend::GetVehicleSpeed ( std::shared_ptr< DependencyInjector >  injector,
const bool &  use_filter,
const double &  filter_coeff 
)
protected

在文件 control_task_extend.cc 第 170 行定义.

173 {
174 double vehicle_speed = injector->vehicle_state()->linear_velocity();
175 if (use_filter) {
176 // vehicle move direction changed, then reset filter
177 if (vehicle_speed * vehicle_speed_last_ < 0) {
178 vehicle_speed_last_ = 0.0;
179 }
180 vehicle_speed = ExponentialSmoothing::exponential_smoothing(vehicle_speed, vehicle_speed_last_, filter_coeff);
181 }
182 vehicle_speed_last_ = vehicle_speed;
183 return vehicle_speed;
184}
static double exponential_smoothing(const double &current_value, const double &last_value, const double &alpha)

◆ IsEdgeFollow()

bool apollo::control::ControlTaskExtend::IsEdgeFollow ( )
protected

在文件 control_task_extend.cc 第 98 行定义.

98 {
99 bool is_in_edge_follow = false;
100 if (trajectory_message_->trajectory_type() == ADCTrajectory::EDGE_FOLLOW) {
101 is_in_edge_follow = true;
102 }
103 return is_in_edge_follow;
104}
optional TrajectoryType trajectory_type

◆ IsForwardModel()

bool apollo::control::ControlTaskExtend::IsForwardModel ( )
protected

在文件 control_task_extend.cc 第 80 行定义.

80 {
81 bool is_forward = false;
82 if (chassis_->gear_location() != trajectory_message_->gear()) {
84 is_forward = true;
85 } else {
86 is_forward = false;
87 }
88 } else {
89 if (trajectory_message_->gear() != canbus::Chassis::GEAR_REVERSE) {
90 is_forward = true;
91 } else {
92 is_forward = false;
93 }
94 }
95 return is_forward;
96}
optional GearPosition gear_location
optional apollo::canbus::Chassis::GearPosition gear

◆ IsLargeCurvature()

bool apollo::control::ControlTaskExtend::IsLargeCurvature ( const double  ref_curvature,
const double  min_large_ref_curvature,
bool *  is_in_large_curvature 
)
protected

在文件 control_task_extend.cc 第 143 行定义.

146 {
147 ADEBUG << "Into IsLargeCurvature. " << "ref_curvature is " << ref_curvature << ", min_large_ref_curvature is "
148 << min_large_ref_curvature;
149 bool is_in_large_cur = false;
150 if (ref_curvature > min_large_ref_curvature) {
151 ADEBUG << "ref_curvature is " << ref_curvature << ", in large curvature.";
152 is_in_large_cur = true;
153 *is_in_large_curvature = is_in_large_cur;
154 return true;
155 } else {
156 is_in_large_cur = false;
157 *is_in_large_curvature = is_in_large_cur;
158 return false;
159 }
160}
#define ADEBUG
Definition log.h:41

◆ IsLeftCurvature()

bool apollo::control::ControlTaskExtend::IsLeftCurvature ( const double  ref_curvature)
protected

在文件 control_task_extend.cc 第 162 行定义.

162 {
163 bool is_left_cur = false;
164 if (ref_curvature > 0) {
165 is_left_cur = true;
166 }
167 return is_left_cur;
168}

◆ LoadCalibrationTable()

bool apollo::control::ControlTaskExtend::LoadCalibrationTable ( const std::string &  calibration_table_path,
calibration_table *  calibration_table_conf 
)
protected

在文件 control_task_extend.cc 第 50 行定义.

52 {
53 std::string calibration_table_path_absolute
54 = absl::StrCat("/apollo/modules/control/control_component/conf/", calibration_table_path);
55 if (!apollo::cyber::common::GetProtoFromFile(calibration_table_path_absolute, calibration_table_conf)) {
56 AERROR << "Load calibration table failed!";
57 return false;
58 }
59 AINFO << "Load the calibraiton table file successfully, file path: " << calibration_table_path_absolute;
60 return true;
61}
#define AERROR
Definition log.h:44
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
Definition file.cc:132

◆ LoadParamsPipelineConfig()

template<typename T >
bool apollo::control::ControlTaskExtend::LoadParamsPipelineConfig ( T *  pipeline_config)
protected

在文件 control_task_extend.h 第 106 行定义.

106 {
107 int status;
108 std::string class_name = abi::__cxa_demangle(typeid(*this).name(), 0, 0, &status);
109 AINFO << "class_name is " << class_name;
110 // Generate the default task config path from PluginManager.
111 std::string pipeline_config_path
113 class_name, "conf/params_pipeline.pb.txt");
114 AINFO << "pipeline_config_path is " << pipeline_config_path;
115
116 if (!apollo::cyber::common::GetProtoFromFile(pipeline_config_path, pipeline_config)) {
117 AERROR << "Load config of " << class_name << " failed!";
118 return false;
119 }
120 AINFO << "Load the [" << class_name << "] params pipeline file successfully, file path: " << pipeline_config_path;
121 return true;
122}
ControlTask()=default
constructor
std::string GetPluginConfPath(const std::string &class_name, const std::string &conf_name)
get plugin configuration file location
static PluginManager * Instance()
get singleton instance of PluginManager

◆ Name()

std::string apollo::control::ControlTaskExtend::Name ( ) const
virtual

reset ControlTaskAgent

返回
Status reset status

controller name

返回
string controller name in string

实现了 apollo::control::ControlTask.

被 apollo::control::DebugInfoControlTask, apollo::control::LatPlusController, apollo::control::LonPlusController , 以及 apollo::control::ReplanControlTask 重载.

在文件 control_task_extend.cc 第 139 行定义.

139 {
140 return name_;
141}

◆ ThrottleCmdFilter()

double apollo::control::ControlTaskExtend::ThrottleCmdFilter ( const bool &  use_filter,
const double &  filter_coeff,
const double &  throttle 
)
protected

在文件 control_task_extend.cc 第 186 行定义.

189 {
190 double throttle_filtered = throttle;
191 if (use_filter) {
192 throttle_filtered = ExponentialSmoothing::exponential_smoothing(throttle, throttle_last_, filter_coeff);
193 throttle_last_ = throttle_filtered;
194 }
195
196 return throttle_filtered;
197}

◆ VehicleStatusIdentificationUpdate()

bool apollo::control::ControlTaskExtend::VehicleStatusIdentificationUpdate ( const localization::LocalizationEstimate *  localization,
const canbus::Chassis *  chassis,
const planning::ADCTrajectory *  trajectory 
)
protected

在文件 control_task_extend.cc 第 63 行定义.

66 {
67 localization_ = localization;
68 chassis_ = chassis;
69 trajectory_message_ = trajectory;
70 ACHECK(localization_ != nullptr) << "Fail to get localization msg!";
71 ACHECK(chassis_ != nullptr) << "Fail to get chassis msg!";
72 ACHECK(trajectory_message_ != nullptr) << "Fail to get trajectory msg!";
73
76
77 return true;
78}
#define ACHECK(cond)
Definition log.h:80

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