Fix trapezoidal profile PID controller setpoint bug (#2210)

Co-Authored-By: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
Matt
2020-01-01 15:23:25 -08:00
committed by Peter Johnson
parent abe25b795b
commit 222669dc2c
8 changed files with 90 additions and 14 deletions

View File

@@ -118,7 +118,7 @@ class ProfiledPIDCommand
ProfiledPIDCommand(const ProfiledPIDCommand& other) = default;
void Initialize() override { m_controller.Reset(); }
void Initialize() override { m_controller.Reset(m_measurement()); }
void Execute() override {
m_useOutput(m_controller.Calculate(m_measurement(), m_goal()),

View File

@@ -62,10 +62,10 @@ class ProfiledPIDSubsystem : public SubsystemBase {
void SetGoal(Distance_t goal) { m_goal = State{goal, Velocity_t(0)}; }
/**
* Enables the PID control. Resets the controller.
* Enables the PID control. Resets the controller.
*/
virtual void Enable() {
m_controller.Reset();
m_controller.Reset(GetMeasurement());
m_enabled = true;
}