Updated the shooter loop to simplify it and add more tests. Fixed the poles to be close to last year.
diff --git a/frc971/control_loops/shooter.h b/frc971/control_loops/shooter.h
index f26c42d..7358de2 100644
--- a/frc971/control_loops/shooter.h
+++ b/frc971/control_loops/shooter.h
@@ -17,34 +17,33 @@
explicit ShooterMotor(
control_loops::ShooterLoop *my_shooter = &control_loops::shooter);
+ // Control loop time step.
+ static const double dt;
+
+ // Maximum speed of the shooter wheel which the encoder is rated for in
+ // rad/sec.
+ static const double kMaxSpeed;
+
protected:
virtual void RunIteration(
const control_loops::ShooterLoop::Goal *goal,
const control_loops::ShooterLoop::Position *position,
::aos::control_loops::Output *output,
control_loops::ShooterLoop::Status *status);
+
private:
- // Timestep of the control loop (in seconds)
- static constexpr double dt = 0.01;
-
- // Maximum speed of the shooter wheel which the encoder is rated for.
- // 10000 rpm * (2 * M_PI radians / rotation) / (60 sec / min) * 15 / 34
- static constexpr double max_speed = 461.998919646;
-
// The state feedback control loop to talk to.
::std::unique_ptr<StateFeedbackLoop<2, 1, 1>> loop_;
// History array and stuff for determining average velocity and whether
// we are ready to shoot.
- static const int kHistoryLength = 10;
- double history[kHistoryLength];
+ static const int kHistoryLength = 5;
+ double history_[kHistoryLength];
ptrdiff_t history_position_;
double average_velocity_;
double position_goal_;
-
- // time_ is used for recording data so that we have a time.
- double time_;
+ double last_position_;
DISALLOW_COPY_AND_ASSIGN(ShooterMotor);
};