#[repr(u8)]pub enum AxisState {
Undefined = 0,
Idle = 1,
StartupSequence = 2,
FullCalibrationSequence = 3,
MotorCalibration = 4,
SensorlessControl = 5,
EncoderIndexSearch = 6,
EncoderOffsetCalibration = 7,
ClosedLoopControl = 8,
}Expand description
§State Machine
From the official docs:
The current state of an axis is indicated by
<axis>.current_state. The user can request a new state by assigning a new value to<axis>.requested_state. The default state after startup isIdle.
IdleStartupSequenceFullCalibrationSequenceMotorCalibrationSensorlessControlEncoderIndexSearchEncoderOffsetCalibrationClosedLoopControl
Variants§
Undefined = 0
Used for
Idle = 1
Disable motor PWM and do nothing
StartupSequence = 2
Run the startup procedure.
FullCalibrationSequence = 3
Run motor calibration and then encoder offset calibration
(or encoder index search if <axis>.encoder.config.use_index is true).
MotorCalibration = 4
Measure phase resistance and phase inductance of the motor.
To store the results set <axis>.motor.config.pre_calibrated to true and save the configuration.
After that you don’t have to run the motor calibration on the next start up.
This modifies the variables <axis>.motor.config.phase_resistance and <axis>.motor.config.phase_inductance.
SensorlessControl = 5
Run sensorless control.
The motor must be calibrated (<axis>.motor.is_calibrated).
<axis>.controller.control_mode must be true.
EncoderIndexSearch = 6
Turn the motor in one direction until the encoder index is traversed.
This state can only be entered if <axis>.encoder.config.use_index is true.
EncoderOffsetCalibration = 7
Turn the motor in one direction for a few seconds and then back to measure the offset between the encoder position and the electrical phase.
Can only be entered if the motor is calibrated (<axis>.motor.is_calibrated).
A successful encoder calibration will make the <axis>.encoder.is_ready go to true.
ClosedLoopControl = 8
Run closed loop control.
The action depends on the control mode.
Can only be entered if the motor is calibrated (<axis>.motor.is_calibrated)
and the encoder is ready (<axis>.encoder.is_ready).