Apollo 10.0
自动驾驶开放平台
apollo::control::LeadlagController类 参考

A lead/lag controller for speed and steering using defualt integral hold 更多...

#include <leadlag_controller.h>

apollo::control::LeadlagController 的协作图:

Public 成员函数

void Init (const LeadlagConf &leadlag_conf, const double dt)
 initialize lead/lag controller
 
void SetLeadlag (const LeadlagConf &leadlag_conf)
 alpha, beta and tau
 
void TransformC2d (const double dt)
 transfer lead/lag controller coefficients to the discrete-time form, with the bilinear transform (trapezoidal integration) method
 
void Reset ()
 reset variables for lead/leg controller
 
virtual double Control (const double error, const double dt)
 compute control value based on the error
 
int InnerstateSaturationStatus () const
 get saturation status
 

Protected 属性

double alpha_ = 0.0
 
double beta_ = 0.0
 
double tau_ = 0.0
 
double Ts_ = 0.01
 
double kn1_ = 0.0
 
double kn0_ = 0.0
 
double kd1_ = 0.0
 
double kd0_ = 0.0
 
double previous_output_ = 0.0
 
double previous_innerstate_ = 0.0
 
double innerstate_ = 0.0
 
double innerstate_saturation_high_ = 0.0
 
double innerstate_saturation_low_ = 0.0
 
int innerstate_saturation_status_ = 0
 
bool transfromc2d_enabled_ = false
 

详细描述

A lead/lag controller for speed and steering using defualt integral hold

在文件 leadlag_controller.h38 行定义.

成员函数说明

◆ Control()

double apollo::control::LeadlagController::Control ( const double  error,
const double  dt 
)
virtual

compute control value based on the error

参数
errorerror value, the difference between a desired value and a measured value
dtsampling time interval
返回
control value based on Lead/Lag terms

在文件 leadlag_controller.cc26 行定义.

26 {
27 // check if the c2d transform passed during the initilization
29 TransformC2d(dt);
31 AWARN << "C2d transform failed; will work as a unity compensator, dt: "
32 << dt;
33 return error; // treat the Lead/Lag as a unity proportional controller
34 }
35 }
36 // check if the current sampling time is valid
37 if (dt <= 0.0) {
38 AWARN << "dt <= 0, will use the last output, dt: " << dt;
39 return previous_output_;
40 }
41 double output = 0.0;
42
43 innerstate_ = (error - previous_innerstate_ * kd0_) / kd1_; // calculate
44 // the inner (intermedia) state under the Direct form II for the Lead / Lag
45 // compensator factorization
52 } else {
54 }
55
58 previous_output_ = output;
59 return output;
60}
void TransformC2d(const double dt)
transfer lead/lag controller coefficients to the discrete-time form, with the bilinear transform (tra...
#define AWARN
Definition log.h:43

◆ Init()

void apollo::control::LeadlagController::Init ( const LeadlagConf leadlag_conf,
const double  dt 
)

initialize lead/lag controller

参数
leadlag_confconfiguration for leadlag controller
dtsampling time interval

在文件 leadlag_controller.cc69 行定义.

69 {
70 previous_output_ = 0.0;
72 innerstate_ = 0.0;
74 std::fabs(leadlag_conf.innerstate_saturation_level());
76 -std::fabs(leadlag_conf.innerstate_saturation_level());
78 SetLeadlag(leadlag_conf);
79 TransformC2d(dt);
80}
void SetLeadlag(const LeadlagConf &leadlag_conf)
alpha, beta and tau

◆ InnerstateSaturationStatus()

int apollo::control::LeadlagController::InnerstateSaturationStatus ( ) const

get saturation status

返回
saturation status

在文件 leadlag_controller.cc112 行定义.

112 {
114}

◆ Reset()

void apollo::control::LeadlagController::Reset ( )

reset variables for lead/leg controller

在文件 leadlag_controller.cc62 行定义.

62 {
63 previous_output_ = 0.0;
65 innerstate_ = 0.0;
67}

◆ SetLeadlag()

void apollo::control::LeadlagController::SetLeadlag ( const LeadlagConf leadlag_conf)

alpha, beta and tau

参数
leadlag_confconfiguration for leadlag controller

在文件 leadlag_controller.cc82 行定义.

82 {
83 alpha_ = leadlag_conf.alpha();
84 beta_ = leadlag_conf.beta();
85 tau_ = leadlag_conf.tau();
86}

◆ TransformC2d()

void apollo::control::LeadlagController::TransformC2d ( const double  dt)

transfer lead/lag controller coefficients to the discrete-time form, with the bilinear transform (trapezoidal integration) method

参数
dtsampling time interval

在文件 leadlag_controller.cc88 行定义.

88 {
89 if (dt <= 0.0) {
90 AWARN << "dt <= 0, continuous-discrete transformation failed, dt: " << dt;
92 } else {
93 double a1 = alpha_ * tau_;
94 double a0 = 1.00;
95 double b1 = beta_ * tau_;
96 double b0 = beta_;
97 Ts_ = dt;
98 kn1_ = 2 * b1 + Ts_ * b0;
99 kn0_ = Ts_ * b0 - 2 * b1;
100 kd1_ = 2 * a1 + Ts_ * a0;
101 kd0_ = Ts_ * a0 - 2 * a1;
102 if (kd1_ <= 0.0) {
103 AWARN << "kd1 <= 0, continuous-discrete transformation failed, kd1: "
104 << kd1_;
105 transfromc2d_enabled_ = false;
106 } else {
108 }
109 }
110}

类成员变量说明

◆ alpha_

double apollo::control::LeadlagController::alpha_ = 0.0
protected

在文件 leadlag_controller.h82 行定义.

◆ beta_

double apollo::control::LeadlagController::beta_ = 0.0
protected

在文件 leadlag_controller.h83 行定义.

◆ innerstate_

double apollo::control::LeadlagController::innerstate_ = 0.0
protected

在文件 leadlag_controller.h94 行定义.

◆ innerstate_saturation_high_

double apollo::control::LeadlagController::innerstate_saturation_high_ = 0.0
protected

在文件 leadlag_controller.h95 行定义.

◆ innerstate_saturation_low_

double apollo::control::LeadlagController::innerstate_saturation_low_ = 0.0
protected

在文件 leadlag_controller.h96 行定义.

◆ innerstate_saturation_status_

int apollo::control::LeadlagController::innerstate_saturation_status_ = 0
protected

在文件 leadlag_controller.h97 行定义.

◆ kd0_

double apollo::control::LeadlagController::kd0_ = 0.0
protected

在文件 leadlag_controller.h90 行定义.

◆ kd1_

double apollo::control::LeadlagController::kd1_ = 0.0
protected

在文件 leadlag_controller.h89 行定义.

◆ kn0_

double apollo::control::LeadlagController::kn0_ = 0.0
protected

在文件 leadlag_controller.h88 行定义.

◆ kn1_

double apollo::control::LeadlagController::kn1_ = 0.0
protected

在文件 leadlag_controller.h87 行定义.

◆ previous_innerstate_

double apollo::control::LeadlagController::previous_innerstate_ = 0.0
protected

在文件 leadlag_controller.h93 行定义.

◆ previous_output_

double apollo::control::LeadlagController::previous_output_ = 0.0
protected

在文件 leadlag_controller.h92 行定义.

◆ tau_

double apollo::control::LeadlagController::tau_ = 0.0
protected

在文件 leadlag_controller.h84 行定义.

◆ transfromc2d_enabled_

bool apollo::control::LeadlagController::transfromc2d_enabled_ = false
protected

在文件 leadlag_controller.h98 行定义.

◆ Ts_

double apollo::control::LeadlagController::Ts_ = 0.01
protected

在文件 leadlag_controller.h85 行定义.


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