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: Tourobo2022_TBCMotorDriver
Pid.h
- Committer:
- YutaTogashi
- Date:
- 2019-09-10
- Revision:
- 2:7fede27af6ca
- Parent:
- 1:4bc4c63ea283
- Child:
- 4:3c2651359136
File content as of revision 2:7fede27af6ca:
#ifndef PID_H
#define PID_H
#include "mbed.h"
enum MODE_NUMBER{
POSITION_PID,
SPEED_PID,
};
class Pid {
public:
void setup(float Kp,float Ki,float Kd,short PidMode = 0,float period = 0.01f);
void calculate(float targetValue,float nowValue,bool enableErrorIntegration=true);
void reset();
float getDuty();
private:
float KP,KI,KD,PERIOD,duty,now,before;
float p,i,d,e,e1,e2;
short MODE;
//Timer pid;
};
#endif