Skip to content

Commit

Permalink
Control: re-name some mrac control parameters for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-y-wang authored and sjiang2018 committed Nov 1, 2019
1 parent 0f7632d commit edfb49e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion modules/control/common/mrac_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void MracController::Init(const MracConf &mrac_conf, const double dt) {
// Initialize the saturation limits
bound_ratio_ = mrac_conf.mrac_saturation_level();
// Initialize the common model parameters
model_order_ = mrac_conf.mrac_reference_order();
model_order_ = mrac_conf.mrac_model_order();
// Initialize the system states
input_desired_ = Matrix::Zero(1, 2);
state_action_ = Matrix::Zero(model_order_, 2);
Expand Down
4 changes: 2 additions & 2 deletions modules/control/common/mrac_controller_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MracControllerTest : public ::testing::Test {
TEST_F(MracControllerTest, MracControl) {
double dt = 0.01;
Matrix state = Matrix::Zero(1, 1);
MracConf mrac_conf = lat_controller_conf_.actuation_mrac_conf();
MracConf mrac_conf = lat_controller_conf_.steer_mrac_conf();
MracController mrac_controller;
mrac_controller.Init(mrac_conf, dt);
mrac_controller.Reset();
Expand Down Expand Up @@ -103,7 +103,7 @@ TEST_F(MracControllerTest, MracControl) {
// equation
TEST_F(MracControllerTest, CheckLyapunovPD) {
double dt = 0.01;
MracConf mrac_conf = lat_controller_conf_.actuation_mrac_conf();
MracConf mrac_conf = lat_controller_conf_.steer_mrac_conf();
MracController mrac_controller;
mrac_controller.Init(mrac_conf, dt);
// test on 1st order adaption dynamics
Expand Down
6 changes: 3 additions & 3 deletions modules/control/conf/control_conf.pb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ lat_controller_conf {
max_iteration: 150
max_lateral_acceleration: 5.0
enable_reverse_leadlag_compensation: true
enable_actuation_mrac_control: false
enable_steer_mrac_control: false
enable_look_ahead_back_control: true
lookahead_station: 1.4224
lookback_station: 2.8448
Expand Down Expand Up @@ -105,8 +105,8 @@ lat_controller_conf {
beta: 1.0
tau: 0.0
}
actuation_mrac_conf {
mrac_reference_order: 1
steer_mrac_conf {
mrac_model_order: 1
reference_time_constant: 0.01
reference_natural_frequency: 10
reference_damping_ratio: 0.9
Expand Down
10 changes: 5 additions & 5 deletions modules/control/controller/lat_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ Status LatController::Init(const ControlConf *control_conf) {
}

bool enable_mrac =
control_conf_->lat_controller_conf().enable_actuation_mrac_control();
control_conf_->lat_controller_conf().enable_steer_mrac_control();
if (enable_mrac) {
mrac_controller_.Init(lat_controller_conf.actuation_mrac_conf(), ts_);
mrac_controller_.Init(lat_controller_conf.steer_mrac_conf(), ts_);
}

return Status::OK();
Expand Down Expand Up @@ -492,11 +492,11 @@ Status LatController::ComputeControlCommand(
// Re-compute the steering command if the MRAC control is enabled, with steer
// angle limitation and steer rate limitation
bool enable_mrac =
control_conf_->lat_controller_conf().enable_actuation_mrac_control();
control_conf_->lat_controller_conf().enable_steer_mrac_control();
if (enable_mrac) {
const int mrac_model_order = control_conf_->lat_controller_conf()
.actuation_mrac_conf()
.mrac_reference_order();
.steer_mrac_conf()
.mrac_model_order();
Matrix steer_state = Matrix::Zero(mrac_model_order, 1);
steer_state(0, 0) = chassis->steering_percentage();
if (mrac_model_order > 1) {
Expand Down
4 changes: 2 additions & 2 deletions modules/control/proto/lat_controller_conf.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ message LatControllerConf {
optional bool enable_look_ahead_back_control = 20 [default = false];
optional double lookahead_station = 21 [default = 0.0];
optional double lookback_station = 22 [default = 0.0];
optional MracConf actuation_mrac_conf = 23;
optional bool enable_actuation_mrac_control = 24 [default = false];
optional MracConf steer_mrac_conf = 23;
optional bool enable_steer_mrac_control = 24 [default = false];
}
8 changes: 4 additions & 4 deletions modules/control/proto/mrac_conf.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ syntax = "proto2";
package apollo.control;

message MracConf {
optional int32 mrac_reference_order = 1 [default = 1];
optional int32 mrac_model_order = 1 [default = 1];
optional double reference_time_constant = 2;
optional double reference_natural_frequency = 3;
optional double reference_damping_ratio = 4;
// state gain size must be not higher than the mrac_reference_order
// state gain size must be not higher than the mrac_model_order
repeated double adaption_state_gain = 5;
optional double adaption_desired_gain = 6;
optional double adaption_nonlinear_gain = 7;
// adaption matrix size must match the model matrix size based on mrac_reference_order
// adaption matrix size must match the model matrix size based on mrac_model_order
repeated double adaption_matrix_p = 8;
optional double mrac_saturation_level = 9 [default = 1.0];
// compensation gain size must be not higher than the mrac_reference_order
// compensation gain size must be not higher than the mrac_model_order
repeated double anti_windup_compensation_gain = 10;
}
6 changes: 3 additions & 3 deletions modules/control/testdata/conf/control_conf.pb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ lat_controller_conf {
ratio: 0.4
}
}
enable_actuation_mrac_control: true
actuation_mrac_conf {
mrac_reference_order: 1
enable_steer_mrac_control: true
steer_mrac_conf {
mrac_model_order: 1
reference_time_constant: 0.01
reference_natural_frequency: 10
reference_damping_ratio: 0.9
Expand Down

0 comments on commit edfb49e

Please sign in to comment.