Add _src to estimate pointers

This commit is contained in:
Oskar Weigl
2020-07-25 20:24:55 -07:00
parent 1808bedf1a
commit 97469235d7
2 changed files with 10 additions and 9 deletions
+6 -5
View File
@@ -278,8 +278,8 @@ bool Axis::run_lockin_spin(const LockinConfig_t &lockin_config) {
// Note run_sensorless_control_loop and run_closed_loop_control_loop are very similar and differ only in where we get the estimate from.
bool Axis::run_sensorless_control_loop() {
controller_.pos_estimate_linear_ = nullptr;
controller_.pos_estimate_circular_ = nullptr;
controller_.pos_estimate_linear_src_ = nullptr;
controller_.pos_estimate_circular_src_ = nullptr;
controller_.pos_estimate_valid_src_ = nullptr;
controller_.vel_estimate_src_ = &sensorless_estimator_.vel_estimate_;
controller_.vel_estimate_valid_src_ = &sensorless_estimator_.vel_estimate_valid_;
@@ -302,8 +302,9 @@ bool Axis::run_closed_loop_control_loop() {
}
// To avoid any transient on startup, we intialize the setpoint to be the current position
controller_.pos_setpoint_ = *controller_.pos_estimate_linear_;
controller_.input_pos_ = *controller_.pos_estimate_linear_;
// TODO: use circular src if in circular mode.
controller_.pos_setpoint_ = *controller_.pos_estimate_linear_src_;
controller_.input_pos_ = *controller_.pos_estimate_linear_src_;
// Avoid integrator windup issues
controller_.vel_integrator_torque_ = 0.0f;
@@ -353,7 +354,7 @@ bool Axis::run_homing() {
}
// To avoid any transient on startup, we intialize the setpoint to be the current position
controller_.pos_setpoint_ = *controller_.pos_estimate_linear_;
controller_.pos_setpoint_ = *controller_.pos_estimate_linear_src_;
// Avoid integrator windup issues
controller_.vel_integrator_torque_ = 0.0f;