Skip to content

Commit

Permalink
fix(gripper): reduce gripper error spam (#605)
Browse files Browse the repository at this point in the history
* hardware said we should switch this to 2mm to make errors less spamy until further testing

* change the move tolorance and fix the tests
  • Loading branch information
ryanthecoder authored Mar 17, 2023
1 parent c4c2e1a commit 2680171
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace error_tolerance_config {

// upon advice from hardware, 0.01mm is a good limit for precision
static constexpr double ACCEPTABLE_DISTANCE_TOLERANCE_MM = 0.01;
static constexpr double UNWANTED_MOVEMENT_DISTANCE_MM = 0.02;
static constexpr double ACCEPTABLE_DISTANCE_TOLERANCE_MM = 2;
static constexpr double UNWANTED_MOVEMENT_DISTANCE_MM = 2;

class BrushedMotorErrorTolerance {
public:
Expand Down
8 changes: 4 additions & 4 deletions motor-control/tests/test_brushed_motor_interrupt_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ SCENARIO("Brushed motor interrupt handler handle move messages") {
// check if position is withen acceptable parameters
REQUIRE(
std::abs(read_ack.encoder_position - msg.encoder_position) <
int32_t(gear_config.get_encoder_pulses_per_mm() * 0.01));
int32_t(gear_config.get_encoder_pulses_per_mm() * 2));
REQUIRE(read_ack.ack_id == AckMessageId::stopped_by_condition);
}
}
Expand Down Expand Up @@ -279,7 +279,7 @@ SCENARIO("labware dropped during grip move") {
}
test_objs.reporter.messages.clear();
THEN("Movement starts again") {
test_objs.hw.set_encoder_value(1800);
test_objs.hw.set_encoder_value(40000);
test_objs.handler.set_enc_idle_state(false);
// Burn through the holdoff ticks
for (uint32_t i = 0; i <= HOLDOFF_TICKS; i++) {
Expand Down Expand Up @@ -332,7 +332,7 @@ SCENARIO("collision while homed") {
}
test_objs.reporter.messages.clear();
THEN("Movement starts again") {
test_objs.hw.set_encoder_value(200);
test_objs.hw.set_encoder_value(40000);
test_objs.handler.set_enc_idle_state(false);
// Burn through the holdoff ticks
for (uint32_t i = 0; i <= HOLDOFF_TICKS; i++) {
Expand Down Expand Up @@ -414,7 +414,7 @@ SCENARIO("A collision during position controlled move") {
// check if position is withen acceptable parameters
REQUIRE(
std::abs(read_ack.encoder_position - msg.encoder_position) <
int32_t(gear_config.get_encoder_pulses_per_mm() * 0.01));
int32_t(gear_config.get_encoder_pulses_per_mm() * 2));
REQUIRE(read_ack.ack_id == AckMessageId::stopped_by_condition);
}
test_objs.reporter.messages.clear();
Expand Down

0 comments on commit 2680171

Please sign in to comment.