Add format script which invokes clang-format on the C++ source code (#41)

On Windows machines, clang-format.exe must be in the PATH environment variable.
This commit is contained in:
Tyler Veness
2016-05-20 17:30:37 -07:00
committed by Peter Johnson
parent 68690643d2
commit e14e45da76
383 changed files with 13787 additions and 13198 deletions

View File

@@ -9,11 +9,11 @@
#include "Base.h"
#include "Controller.h"
#include "HAL/cpp/priority_mutex.h"
#include "LiveWindow/LiveWindow.h"
#include "Notifier.h"
#include "PIDInterface.h"
#include "PIDSource.h"
#include "Notifier.h"
#include "HAL/cpp/priority_mutex.h"
#include "Timer.h"
#include <memory>
@@ -27,17 +27,16 @@ 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
* care of the integral calculations, as well as writing the given PIDOutput.
*/
class PIDController : public LiveWindowSendable,
public PIDInterface,
public ITableListener {
public:
PIDController(float p, float i, float d, PIDSource *source, PIDOutput *output,
PIDController(float p, float i, float d, PIDSource* source, PIDOutput* output,
float period = 0.05);
PIDController(float p, float i, float d, float f, PIDSource *source,
PIDOutput *output, float period = 0.05);
PIDController(float p, float i, float d, float f, PIDSource* source,
PIDOutput* output, float period = 0.05);
virtual ~PIDController();
PIDController(const PIDController&) = delete;
@@ -79,26 +78,38 @@ class PIDController : public LiveWindowSendable,
virtual void InitTable(std::shared_ptr<ITable> table) override;
protected:
PIDSource *m_pidInput;
PIDOutput *m_pidOutput;
PIDSource* m_pidInput;
PIDOutput* m_pidOutput;
std::shared_ptr<ITable> m_table;
virtual void Calculate();
virtual double CalculateFeedForward();
private:
float m_P; // factor for "proportional" control
float m_I; // factor for "integral" control
float m_D; // factor for "derivative" control
float m_F; // factor for "feed forward" control
float m_maximumOutput = 1.0; // |maximum output|
float m_minimumOutput = -1.0; // |minimum output|
float m_maximumInput = 0; // maximum input - limit setpoint to this
float m_minimumInput = 0; // minimum input - limit setpoint to this
bool m_continuous = false; // do the endpoints wrap around? eg. Absolute encoder
bool m_enabled = false; // is the pid controller enabled
float m_prevError = 0; // the prior error (used to compute velocity)
double m_totalError = 0; // the sum of the errors for use in the integral calc
// factor for "proportional" control
float m_P;
// factor for "integral" control
float m_I;
// factor for "derivative" control
float m_D;
// factor for "feed forward" control
float m_F;
// |maximum output|
float m_maximumOutput = 1.0;
// |minimum output|
float m_minimumOutput = -1.0;
// maximum input - limit setpoint to this
float m_maximumInput = 0;
// minimum input - limit setpoint to this
float m_minimumInput = 0;
// do the endpoints wrap around? eg. Absolute encoder
bool m_continuous = false;
// is the pid controller enabled
bool m_enabled = false;
// the prior error (used to compute velocity)
float m_prevError = 0;
// the sum of the errors for use in the integral calc
double m_totalError = 0;
enum {
kAbsoluteTolerance,
kPercentTolerance,
@@ -123,12 +134,12 @@ class PIDController : public LiveWindowSendable,
std::unique_ptr<Notifier> m_controlLoop;
Timer m_setpointTimer;
void Initialize(float p, float i, float d, float f, PIDSource *source,
PIDOutput *output, float period = 0.05);
void Initialize(float p, float i, float d, float f, PIDSource* source,
PIDOutput* output, float period = 0.05);
virtual std::shared_ptr<ITable> GetTable() const override;
virtual std::string GetSmartDashboardType() const override;
virtual void ValueChanged(ITable *source, llvm::StringRef key,
virtual void ValueChanged(ITable* source, llvm::StringRef key,
std::shared_ptr<nt::Value> value,
bool isNew) override;
virtual void UpdateTable() override;