move bandwith to config

This commit is contained in:
Oskar Weigl
2018-05-15 17:27:12 -07:00
parent c13bee09ed
commit 37e01b9865
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -230,7 +230,7 @@ static bool decode_hall(uint8_t hall_state, int32_t* hall_cnt) {
bool Encoder::update() {
// Calculate encoder pll gains
float pll_kp = 2.0f * bandwidth_; // basic conversion to discrete time
float pll_kp = 2.0f * config_.bandwidth; // basic conversion to discrete time
float pll_ki = 0.25f * (pll_kp * pll_kp); // Critically damped
// Check that we don't get problems with discrete time approximation
+2 -2
View File
@@ -35,6 +35,7 @@ public:
// index search succeeds
float offset_float = 0.0f; // Sub-count phase alignment offset
float calib_range = 0.02f;
float bandwidth = 1000.0f;
};
Encoder(const EncoderHardwareConfig_t& hw_config,
@@ -72,7 +73,6 @@ public:
float pll_vel_ = 0.0f; // [rad/s]
// float pll_kp_ = 0.0f; // [rad/s / rad]
// float pll_ki_ = 0.0f; // [(rad/s^2) / rad]
float bandwidth_ = 1000.0f; // [/s]
// Updated by low_level pwm_adc_cb
uint8_t hall_state_ = 0x0; // bit[0] = HallA, .., bit[2] = HallC
@@ -102,7 +102,7 @@ public:
make_protocol_property("cpr", &config_.cpr),
make_protocol_property("offset", &config_.offset),
make_protocol_property("offset_float", &config_.offset_float),
make_protocol_property("bandwidth", &bandwidth_),
make_protocol_property("bandwidth", &config_.bandwidth),
make_protocol_property("calib_range", &config_.calib_range)
)
);