Skip to content

Commit a9aa868

Browse files
committed
fix(motor-control): add a state to the motor control that maintains the difference between a never homed and a stopped gripper
1 parent 9b4907f commit a9aa868

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

include/motor-control/core/brushed_motor/brushed_motor_interrupt_handler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class BrushedMotorInterruptHandler {
199199
cancel_and_clear_moves(can::ids::ErrorCode::estop_detected);
200200
} else if (hardware.has_cancel_request()) {
201201
if (!hardware.get_stay_enabled()) {
202-
hardware.set_motor_state(BrushedMotorState::UNHOMED);
202+
hardware.set_motor_state(BrushedMotorState::STOPPED);
203203
}
204204
cancel_and_clear_moves(can::ids::ErrorCode::stop_requested,
205205
can::ids::ErrorSeverity::warning);

include/motor-control/core/types.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ enum class BrushedMotorState : uint8_t {
4444
UNHOMED = 0x0,
4545
FORCE_CONTROLLING_HOME = 0x1,
4646
FORCE_CONTROLLING = 0x2,
47-
POSITION_CONTROLLING = 0x3
48-
};
47+
POSITION_CONTROLLING = 0x3,
48+
STOPPED = 0x4
49+
};

motor-control/tests/test_brushed_motor_interrupt_handler.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,10 @@ SCENARIO("handler recovers from error state") {
526526
test_objs.hw.request_cancel();
527527
test_objs.handler.run_interrupt();
528528
THEN(
529-
"motor state should become un-homed only if stay engaged is "
530-
"falsy") {
529+
"motor state should become stopped only if stay engaged is "
530+
"false") {
531531
REQUIRE(test_objs.hw.get_motor_state() ==
532-
(!stay_engaged ? BrushedMotorState::UNHOMED
532+
(!stay_engaged ? BrushedMotorState::STOPPED
533533
: og_motor_state));
534534
}
535535
THEN("a stop requested warning is issued") {
@@ -560,4 +560,4 @@ SCENARIO("handler recovers from error state") {
560560
}
561561
}
562562
}
563-
}
563+
}

0 commit comments

Comments
 (0)