Added an abort + error, and confirmed to naming convention.
This commit is contained in:
riewert
2021-05-04 21:18:27 -04:00
committed by PAJohnson
parent 5a9bd63ed1
commit ac6c565b30
3 changed files with 10 additions and 2 deletions
+7 -2
View File
@@ -395,8 +395,13 @@ bool Axis::run_homing() {
error_ &= ~ERROR_MIN_ENDSTOP_PRESSED; // clear this error since we deliberately drove into the endstop
if (encoder_.pos_estimate_.any() == std::nullopt || !encoder_.pos_estimate_.any().has_value()){
return error_ |= ERROR_UNKNOWN_POSITION, false;
}
// Calculate the desired position after offset.
float inputBuffer = encoder_.pos_estimate_.any().value() + min_endstop_.config_.offset;
float input_buffer = encoder_.pos_estimate_.any().value() + min_endstop_.config_.offset;
controller_.config_.control_mode = Controller::CONTROL_MODE_POSITION_CONTROL;
controller_.config_.input_mode = Controller::INPUT_MODE_TRAP_TRAJ;
@@ -404,7 +409,7 @@ bool Axis::run_homing() {
// Initialize closed loop control, and then set the desired location.
start_closed_loop_control();
controller_.input_pos_ = inputBuffer;
controller_.input_pos_ = input_buffer;
controller_.input_pos_updated();
while ((requested_state_ == AXIS_STATE_UNDEFINED) && motor_.is_armed_ && !controller_.trajectory_done_) {
+2
View File
@@ -414,6 +414,8 @@ interfaces:
OVER_TEMP:
# unused
doc: Check `motor.error` for more details.
UNKNOWN_POSITION:
doc: There isn't a valid position estimate available.
step_dir_active: readonly bool
last_drv_fault: readonly uint32
current_state: readonly AxisState
+1
View File
@@ -101,6 +101,7 @@ AXIS_ERROR_MAX_ENDSTOP_PRESSED = 0x00002000
AXIS_ERROR_ESTOP_REQUESTED = 0x00004000
AXIS_ERROR_HOMING_WITHOUT_ENDSTOP = 0x00020000
AXIS_ERROR_OVER_TEMP = 0x00040000
AXIS_ERROR_UNKNOWN_POSITION = 0x00080000
# ODrive.Motor.Error
MOTOR_ERROR_NONE = 0x00000000