Now using the off-center indexer position and fixed some simulation bugs.
diff --git a/frc971/control_loops/index/index.cc b/frc971/control_loops/index/index.cc
index 4420ee3..b5ff7f8 100644
--- a/frc971/control_loops/index/index.cc
+++ b/frc971/control_loops/index/index.cc
@@ -107,9 +107,9 @@
/*static*/ const double IndexMotor::kEjectorStopPosition =
kLifterStopPosition + 0.01;
/*static*/ const double IndexMotor::kEjectorMovementVelocity = 1.0;
-/*static*/ const double IndexMotor::kBottomDiscDetectStart = -0.08;
-/*static*/ const double IndexMotor::kBottomDiscDetectStop = 0.200025;
-/*static*/ const double IndexMotor::kBottomDiscIndexDelay = 0.01;
+/*static*/ const double IndexMotor::kBottomDiscDetectStart = 0.00;
+/*static*/ const double IndexMotor::kBottomDiscDetectStop = 0.13;
+/*static*/ const double IndexMotor::kBottomDiscIndexDelay = 0.032;
// TODO(aschuh): Verify these with the sensor actually on.
/*static*/ const double IndexMotor::kTopDiscDetectStart =
@@ -628,7 +628,6 @@
// Turn on the transfer roller if we are ready.
if (status->ready_to_intake && hopper_disc_count_ < 4 &&
safe_goal_ == Goal::INTAKE) {
- printf("Go\n");
intake_voltage = transfer_voltage = 12.0;
}
}
diff --git a/frc971/control_loops/index/index_lib_test.cc b/frc971/control_loops/index/index_lib_test.cc
index 6963a64..c5ae309 100644
--- a/frc971/control_loops/index/index_lib_test.cc
+++ b/frc971/control_loops/index/index_lib_test.cc
@@ -133,15 +133,15 @@
void HandleAfterNegedge(
double index_velocity, double elapsed_time, double time_left) {
if (!has_bottom_disc_negedge_wait_position_) {
- if (time_left < after_negedge_time_left_) {
- after_negedge_time_left_ = 0.0;
+ if (after_negedge_time_left_ < time_left) {
// Assume constant velocity and compute the position.
bottom_disc_negedge_wait_position_ =
index_roller_position_ +
index_velocity * (elapsed_time + after_negedge_time_left_);
+ after_negedge_time_left_ = 0.0;
has_bottom_disc_negedge_wait_position_ = true;
} else {
- after_negedge_time_left_ -= elapsed_time;
+ after_negedge_time_left_ -= time_left;
}
}
}
@@ -716,7 +716,7 @@
} else {
index_motor_plant_.InsertDisc();
++num_grabbed;
- wait_counter = 5;
+ wait_counter = 9;
}
}
index_motor_plant_.Simulate();