Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(motor-control): catch falling 96 channel #810

Merged
merged 4 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class MotionController {
if (hardware.is_timer_interrupt_running()) {
hardware.set_cancel_request(error_severity, error_code);
}
disable_motor();
}

void clear_cancel_request() { hardware.clear_cancel_request(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,24 @@ class MotorInterruptHandler {
if (!_has_active_move or
hardware.position_flags.check_flag(
MotorPositionStatus::Flags::stepper_position_ok) or
buffered_move.check_stop_condition(
MoveStopCondition::limit_switch) or
buffered_move.check_stop_condition(
MoveStopCondition::limit_switch_backoff)) {
return;
}
if (buffered_move.check_stop_condition(
MoveStopCondition::limit_switch)) {
// Since the encoders are always setup that negative is towards the
// limit switch if the encoder has increased past the start position
// we know that we've stalled which means on the z axis that
// something is falling so we want to trigger a collision so we can
// catch it before it hits something
if ((buffered_move.start_encoder_position -
hardware.get_encoder_pulses()) > 10) {
return;
} else {
cancel_and_clear_moves(can::ids::ErrorCode::collision_detected);
}
}

if (buffered_move.check_stop_condition(MoveStopCondition::stall)) {
// if expected, finish move and clear queue to prepare for position
Expand Down
Loading