mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-18 09:29:03 +08:00
fix encoder offset calibration and error handling
This commit is contained in:
@@ -251,14 +251,20 @@ void Axis::run_state_machine_loop() {
|
||||
switch (current_state_) {
|
||||
case AXIS_STATE_MOTOR_CALIBRATION:
|
||||
status = motor_.run_calibration();
|
||||
if (!status)
|
||||
error_ |= ERROR_MOTOR_FAILED;
|
||||
break;
|
||||
|
||||
case AXIS_STATE_ENCODER_INDEX_SEARCH:
|
||||
status = encoder_.run_index_search();
|
||||
if (!status)
|
||||
error_ |= ERROR_ENCODER_FAILED;
|
||||
break;
|
||||
|
||||
case AXIS_STATE_ENCODER_OFFSET_CALIBRATION:
|
||||
status = encoder_.run_offset_calibration();
|
||||
if (!status)
|
||||
error_ |= ERROR_ENCODER_FAILED;
|
||||
break;
|
||||
|
||||
case AXIS_STATE_SENSORLESS_CONTROL:
|
||||
|
||||
@@ -103,7 +103,7 @@ bool Encoder::run_offset_calibration() {
|
||||
// Temporarily disable index search so it doesn't mess
|
||||
// with the offset calibration
|
||||
bool old_use_index = config_.use_index;
|
||||
config_.use_index = true;
|
||||
config_.use_index = false;
|
||||
|
||||
float voltage_magnitude;
|
||||
if (axis_->motor_.config_.motor_type == MOTOR_TYPE_HIGH_CURRENT)
|
||||
|
||||
Reference in New Issue
Block a user