mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-18 01:18:52 +08:00
Split hall calibration into polarity and offset calibration, full calibration sequence only includes hall polarity cal
This commit is contained in:
@@ -465,6 +465,8 @@ void Axis::run_state_machine_loop() {
|
||||
task_chain_[pos++] = AXIS_STATE_IDLE;
|
||||
} else if (requested_state_ == AXIS_STATE_FULL_CALIBRATION_SEQUENCE) {
|
||||
task_chain_[pos++] = AXIS_STATE_MOTOR_CALIBRATION;
|
||||
if (encoder_.config_.mode == ODriveIntf::EncoderIntf::MODE_HALL)
|
||||
task_chain_[pos++] = AXIS_STATE_ENCODER_HALL_POLARITY_CALIBRATION;
|
||||
if (encoder_.config_.use_index)
|
||||
task_chain_[pos++] = AXIS_STATE_ENCODER_INDEX_SEARCH;
|
||||
task_chain_[pos++] = AXIS_STATE_ENCODER_OFFSET_CALIBRATION;
|
||||
@@ -503,13 +505,23 @@ void Axis::run_state_machine_loop() {
|
||||
status = encoder_.run_direction_find();
|
||||
} break;
|
||||
|
||||
case AXIS_STATE_ENCODER_HALL_CALIBRATION: {
|
||||
case AXIS_STATE_ENCODER_HALL_POLARITY_CALIBRATION: {
|
||||
if (!motor_.is_calibrated_)
|
||||
goto invalid_state_label;
|
||||
|
||||
status = encoder_.run_hall_polarity_calibration();
|
||||
if (status)
|
||||
status = encoder_.run_hall_phase_calibration();
|
||||
} break;
|
||||
|
||||
case AXIS_STATE_ENCODER_HALL_OFFSET_CALIBRATION: {
|
||||
if (!motor_.is_calibrated_)
|
||||
goto invalid_state_label;
|
||||
|
||||
if (!encoder_.config_.hall_polarity_calibrated) {
|
||||
encoder_.set_error(ODriveIntf::EncoderIntf::ERROR_HALL_NOT_CALIBRATED_YET);
|
||||
goto invalid_state_label;
|
||||
}
|
||||
|
||||
status = encoder_.run_hall_phase_calibration();
|
||||
} break;
|
||||
|
||||
case AXIS_STATE_HOMING: {
|
||||
|
||||
@@ -1163,8 +1163,13 @@ valuetypes:
|
||||
brief: Run axis homing function.
|
||||
doc:
|
||||
Endstops must be enabled to use this feature.
|
||||
EncoderHallCalibration:
|
||||
brief: Rotate the motor in lockin and calibrate hall states
|
||||
EncoderHallPolarityCalibration:
|
||||
brief: Rotate the motor in lockin and calibrate hall polarity
|
||||
doc:
|
||||
ODrive assumes 120 degree electrical hall spacing. This routine determines if that
|
||||
is the case and sets the polarity if the halls are on 60 degree electrical spacing
|
||||
EncoderHallOffsetCalibration:
|
||||
brief: Rotate the motor for 30s to calibrate hall sensor edge offsets
|
||||
doc:
|
||||
The phase offset is not calibrated at this time, so the map is only relative
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": true,
|
||||
"pythonPath": "${command:python.pythonPath}",
|
||||
"python": "${command:python.pythonPath}",
|
||||
"program": "${file}",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"env": {},
|
||||
|
||||
@@ -35,7 +35,8 @@ AXIS_STATE_CLOSED_LOOP_CONTROL = 8
|
||||
AXIS_STATE_LOCKIN_SPIN = 9
|
||||
AXIS_STATE_ENCODER_DIR_FIND = 10
|
||||
AXIS_STATE_HOMING = 11
|
||||
AXIS_STATE_ENCODER_HALL_CALIBRATION = 12
|
||||
AXIS_STATE_ENCODER_HALL_POLARITY_CALIBRATION = 12
|
||||
AXIS_STATE_ENCODER_HALL_OFFSET_CALIBRATION = 13
|
||||
|
||||
# ODrive.Encoder.Mode
|
||||
ENCODER_MODE_INCREMENTAL = 0
|
||||
|
||||
Reference in New Issue
Block a user