Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: 7_20_17_FSG_ 7_21_17_FSG 7_26_17_FSG
Fork of Controller by
controller.hpp
- Committer:
- mdavis30
- Date:
- 2017-07-28
- Revision:
- 6:29cf76bb9956
- Parent:
- 0:2566234da01a
File content as of revision 6:29cf76bb9956:
#ifndef MBED_DEPTHCONTROLLER_H #define MBED_DEPTHCONTROLLER_H #include "mbed.h" class PositionController { public: PositionController(); void update(float position, float velocity, float dt); float getOutput(); void setPgain(float gain); void setIgain(float gain); void setDgain(float gain); void writeSetPoint(float cmd); void writeSetPoint_la(float cmd); // void setConfigFlag(); protected: float _setPoint; float _Pgain; float _Dgain; float _Igain; float _error; float _integral; float _lastTime; float _dt; float _output; // bool configFlag; // int readConfiguration(); }; template <typename T> T clamp(T value, T min, T max) { if(value < min) { return min; } else if(value > max) { return max; } else { return value; } }; #endif