mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-22 16:14:37 +08:00
fix sensorless estimator error
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user