diff --git a/Firmware/MotorControl/sensorless_estimator.cpp b/Firmware/MotorControl/sensorless_estimator.cpp index 84f12f55..94c09c68 100644 --- a/Firmware/MotorControl/sensorless_estimator.cpp +++ b/Firmware/MotorControl/sensorless_estimator.cpp @@ -36,6 +36,11 @@ bool SensorlessEstimator::update() { // TODO: we read values here which are modified by a higher priority interrupt. // This is not thread-safe. auto current_meas = axis_->motor_.current_meas_; + if (!axis_->motor_.is_armed_) { + // While the motor is disarmed the current is not measurable so we + // assume that it's zero. + current_meas = {0.0f, 0.0f}; + } if (!current_meas.has_value()) { error_ |= ERROR_UNKNOWN_CURRENT_MEASUREMENT; reset(); // Reset state for when the next valid current measurement comes in.