Skip to content

Commit

Permalink
revert to the unhomed state during estop or collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Nov 15, 2024
1 parent a9aa868 commit b385686
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class BrushedMotorInterruptHandler {
can::ids::ErrorCode::collision_detected);
report_position(pulses);
error_handled = true;
hardware.set_motor_state(BrushedMotorState::UNHOMED);
}
} else if (motor_state != BrushedMotorState::UNHOMED) {
auto pulses = hardware.get_encoder_pulses();
Expand All @@ -166,6 +167,7 @@ class BrushedMotorInterruptHandler {
motor_state == BrushedMotorState::FORCE_CONTROLLING
? can::ids::ErrorCode::labware_dropped
: can::ids::ErrorCode::collision_detected;
hardware.set_motor_state(BrushedMotorState::UNHOMED);
cancel_and_clear_moves(err);
report_position(pulses);
error_handled = true;
Expand Down Expand Up @@ -197,8 +199,10 @@ class BrushedMotorInterruptHandler {
} else if (estop_triggered()) {
in_estop = true;
cancel_and_clear_moves(can::ids::ErrorCode::estop_detected);
hardware.set_motor_state(BrushedMotorState::UNHOMED);
} else if (hardware.has_cancel_request()) {
if (!hardware.get_stay_enabled()) {
if (!hardware.get_stay_enabled() &&
hardware.get_motor_state() != BrushedMotorState::UNHOMED) {
hardware.set_motor_state(BrushedMotorState::STOPPED);
}
cancel_and_clear_moves(can::ids::ErrorCode::stop_requested,
Expand Down

0 comments on commit b385686

Please sign in to comment.