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.
Dependencies: mbed BNO055_fusion_AUV
PIDusna/PID.h
- Committer:
- pmmccorkell
- Date:
- 2020-11-12
- Revision:
- 4:e89234ca9d4e
- Parent:
- 0:37123f30e8b2
File content as of revision 4:e89234ca9d4e:
/* * PID class for mbed * US Naval Academy * Robotics and Control TSD * Patrick McCorkell * * Created: 2019 Dec 11 * */ #include "mbed.h" typedef struct { float Kp; float Ki; float Kd; } PID_GAINS_TypeDef; class PID { public: PID (float Kp, float Ki, float Kd, float dt, float deadzone=0); void calculate_K(float Tu); void set_dt(float dt); void clear_integral(); void clear_error(); void clear_error_previous(); void clear(); void set_K(float Kp, float Ki=0, float Kd=0); void set_deadzone(float deadzone); float process(float setpoint, float measured); float process(float error); void get_gain_values(PID_GAINS_TypeDef *gains); protected: float _Kp; float _Ki; float _Kd; float _floor; float _deadzone; float _dt; float _error_previous; float _integral; //private: };