mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-21 23:44:48 +08:00
move bandwith to config
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user