Reflowed comments and removed commented out code (#735)

This commit is contained in:
Tyler Veness
2017-11-16 00:33:51 -08:00
committed by Peter Johnson
parent 1e8d18b328
commit c663d7cd16
103 changed files with 784 additions and 778 deletions

View File

@@ -30,8 +30,8 @@ class PIDOutput;
/**
* Class implements a PID Control Loop.
*
* Creates a separate thread which reads the given PIDSource and takes
* care of the integral calculations, as well as writing the given PIDOutput.
* Creates a separate thread which reads the given PIDSource and takes care of
* the integral calculations, as well as writing the given PIDOutput.
*
* This feedback controller runs in discrete time, so time deltas are not used
* in the integral and derivative calculations. Therefore, the sample rate
@@ -105,38 +105,51 @@ class PIDController : public LiveWindowSendable, public PIDInterface {
double GetContinuousError(double error) const;
private:
// factor for "proportional" control
// Factor for "proportional" control
double m_P;
// factor for "integral" control
// Factor for "integral" control
double m_I;
// factor for "derivative" control
// Factor for "derivative" control
double m_D;
// factor for "feed forward" control
// Factor for "feed forward" control
double m_F;
// |maximum output|
double m_maximumOutput = 1.0;
// |minimum output|
double m_minimumOutput = -1.0;
// maximum input - limit setpoint to this
// Maximum input - limit setpoint to this
double m_maximumInput = 0;
// minimum input - limit setpoint to this
// Minimum input - limit setpoint to this
double m_minimumInput = 0;
// do the endpoints wrap around? eg. Absolute encoder
// Do the endpoints wrap around? eg. Absolute encoder
bool m_continuous = false;
// is the pid controller enabled
// Is the pid controller enabled
bool m_enabled = false;
// the prior error (used to compute velocity)
// The prior error (used to compute velocity)
double m_prevError = 0;
// the sum of the errors for use in the integral calc
// The sum of the errors for use in the integral calc
double m_totalError = 0;
enum {
kAbsoluteTolerance,
kPercentTolerance,
kNoTolerance
} m_toleranceType = kNoTolerance;
// the percetage or absolute error that is considered on target.
// The percetage or absolute error that is considered on target.
double m_tolerance = 0.05;
double m_setpoint = 0;
double m_prevSetpoint = 0;
double m_error = 0;
@@ -145,6 +158,7 @@ class PIDController : public LiveWindowSendable, public PIDInterface {
// Length of buffer for averaging for tolerances.
std::atomic<unsigned> m_bufLength{1};
std::queue<double> m_buf;
double m_bufTotal = 0;