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

A proportional-integral-derivative controller for speed and steering using defualt integral hold 更多...

#include <control_checker.h>

apollo::control::ControlChecker 的协作图:

Public 成员函数

virtual ~ControlChecker ()=default
 initialize pid controller
 

静态 Public 成员函数

static ControlCheckStatus check_lateral_error (const SafetyCheckConf &conf, double *lateral_error)
 
static ControlCheckStatus check_heading_error (const SafetyCheckConf &conf, double *heading_error)
 
static ControlCheckStatus check_station_error (const SafetyCheckConf &conf, double *station_error)
 
static ControlCheckStatus check_speed_error (const SafetyCheckConf &conf, double *speed_error)
 

详细描述

A proportional-integral-derivative controller for speed and steering using defualt integral hold

在文件 control_checker.h 第 39 行定义.

构造及析构函数说明

◆ ~ControlChecker()

virtual apollo::control::ControlChecker::~ControlChecker ( )
virtualdefault

initialize pid controller

参数
pid_confconfiguration for pid controller

成员函数说明

◆ check_heading_error()

ControlCheckStatus apollo::control::ControlChecker::check_heading_error ( const SafetyCheckConf &  conf,
double *  heading_error 
)
static

在文件 control_checker.cc 第 59 行定义.

59 {
60 // if (!ControlUtil::is_need_safety_check()) {
61 // return NONE;
62 // }
63 double max_heading_error_E = conf.check_threshold().max_heading_error_e();
64 double max_heading_error_W = conf.check_threshold().max_heading_error_w();
65 // heading error error check
66 if (conf.use_heading_error_e_check()) {
67 if (std::fabs(*heading_error) > max_heading_error_E) {
68 ADEBUG << "[Error] heading error is not reliable due to: |" << *heading_error << "| > "
69 << max_heading_error_E;
70 *heading_error = common::math::Clamp(*heading_error, -max_heading_error_E, max_heading_error_E);
71 ADEBUG << "[Error] control heading e failed.";
72 return ERROR;
73 }
74 } else {
75 ADEBUG << "control heading error e check turn off.";
76 }
77 // heading error warning check
78 if (conf.use_heading_error_w_check()) {
79 if (std::fabs(*heading_error) > max_heading_error_W) {
80 ADEBUG << "[Warning] heading error is not reliable due to: |" << *heading_error << "| > "
81 << max_heading_error_W;
82 ADEBUG << "[Warning] control heading w failed.";
83 return WARNING;
84 }
85 } else {
86 ADEBUG << "control heading error w check turn off.";
87 }
88
89 return NONE;
90}
#define ADEBUG
Definition log.h:41
T Clamp(const T value, T bound1, T bound2)
Clamp a value between two bounds.
Definition math_utils.h:155

◆ check_lateral_error()

ControlCheckStatus apollo::control::ControlChecker::check_lateral_error ( const SafetyCheckConf &  conf,
double *  lateral_error 
)
static

在文件 control_checker.cc 第 26 行定义.

26 {
27 // if (!ControlUtil::is_need_safety_check()) {
28 // return NONE;
29 // }
30 double max_lateral_error_E = conf.check_threshold().max_lateral_error_e();
31 double max_lateral_error_W = conf.check_threshold().max_lateral_error_w();
32 // lateral error e check
33 if (conf.use_lateral_error_e_check()) {
34 if (std::fabs(*lateral_error) > max_lateral_error_E) {
35 ADEBUG << "[Error] lateral error is not reliable due to: |" << *lateral_error << "| > "
36 << max_lateral_error_E;
37 *lateral_error = common::math::Clamp(*lateral_error, -max_lateral_error_E, max_lateral_error_E);
38 ADEBUG << "[Error] control lateral e failed.";
39 return ERROR;
40 }
41 } else {
42 ADEBUG << "control lateral error e check turn off.";
43 }
44 // lateral error warning check
45 if (conf.use_lateral_error_w_check()) {
46 if (std::fabs(*lateral_error) > max_lateral_error_W) {
47 ADEBUG << "[Warning] lateral error is not reliable due to: |" << *lateral_error << "| > "
48 << max_lateral_error_W;
49 ADEBUG << "[Warning] control lateral w failed.";
50 return WARNING;
51 }
52 } else {
53 ADEBUG << "control lateral error w check turn off.";
54 }
55
56 return NONE;
57}

◆ check_speed_error()

ControlCheckStatus apollo::control::ControlChecker::check_speed_error ( const SafetyCheckConf &  conf,
double *  speed_error 
)
static

在文件 control_checker.cc 第 125 行定义.

125 {
126 // if (!ControlUtil::is_need_safety_check()) {
127 // return NONE;
128 // }
129 double max_speed_error_E = conf.check_threshold().max_speed_error_e();
130 double max_speed_error_W = conf.check_threshold().max_speed_error_w();
131 // speed error error check
132 if (conf.use_speed_error_e_check()) {
133 if (fabs(*speed_error) > max_speed_error_E) {
134 ADEBUG << "[Error] speed error is not reliable due to: |" << *speed_error << "| > " << max_speed_error_E;
135 *speed_error = common::math::Clamp(*speed_error, -max_speed_error_E, max_speed_error_E);
136 ADEBUG << "[Error] control speed e failed.";
137 return ERROR;
138 }
139 } else {
140 ADEBUG << "control speed error e check turn off.";
141 }
142 // speed error warning check
143 if (conf.use_speed_error_w_check()) {
144 if (fabs(*speed_error) > max_speed_error_W) {
145 ADEBUG << "[Warning] speed error is not reliable due to: |" << *speed_error << "| > " << max_speed_error_W;
146 ADEBUG << "[Warning] control speed w failed.";
147 return WARNING;
148 }
149 } else {
150 ADEBUG << "control speed error w check turn off.";
151 }
152
153 return NONE;
154}

◆ check_station_error()

ControlCheckStatus apollo::control::ControlChecker::check_station_error ( const SafetyCheckConf &  conf,
double *  station_error 
)
static

在文件 control_checker.cc 第 92 行定义.

92 {
93 // if (!ControlUtil::is_need_safety_check()) {
94 // return NONE;
95 // }
96 double max_station_error_E = conf.check_threshold().max_station_error_e();
97 double max_station_error_W = conf.check_threshold().max_station_error_w();
98 // station error error check
99 if (conf.use_station_error_e_check()) {
100 if (std::fabs(*station_error) > max_station_error_E) {
101 ADEBUG << "[Error] station error is not reliable due to: |" << *station_error << "| > "
102 << max_station_error_E;
103 *station_error = common::math::Clamp(*station_error, -max_station_error_E, max_station_error_E);
104 ADEBUG << "[Error] control station e failed.";
105 return ERROR;
106 }
107 } else {
108 ADEBUG << "control station error e check turn off.";
109 }
110 // station error warning check
111 if (conf.use_station_error_w_check()) {
112 if (std::fabs(*station_error) > max_station_error_W) {
113 ADEBUG << "[Warning] station error is not reliable due to: |" << *station_error << "| > "
114 << max_station_error_W;
115 ADEBUG << "[Warning] control station w failed.";
116 return WARNING;
117 }
118 } else {
119 ADEBUG << "control station error w check turn off.";
120 }
121
122 return NONE;
123}

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