Sub programs of serial_transport, PID and motor contrl.

Dependents:   tracking_ball_0516 tracking_ball_0516

PID_Controller.h

Committer:
helenh
Date:
2021-05-30
Revision:
7:fd405402ff8c
Parent:
2:a668eb71516b

File content as of revision 7:fd405402ff8c:

#include<mbed.h>
#ifndef PID_CONTROLLER_H
#define PID_CONTROLLER_H
#include "Circle_Buffer_Class.h"
//int kp = 100;
//int ki = 10;

#define WINDOWS_TIME 30
#define BALANCE_ANGLE 50

class Ball_PID{

public :
  //构造函数  
  Ball_PID(int p,int i,int d,int k);
  void Set_Balance_Value(int value);
  //析构函数
  ~Ball_PID();
  //根据输入,计算误差,按PID,计算出输出值
  int PID_Calculation(int preset_value,int actual_value); 
private:
  //PID_P
  int m_PID_P;
  //PID_I
  int m_PID_I;
  //PID_D;
  int m_PID_D;
  //输出增益
  int m_K;
  //存储历史值
  Circle_Buffer_Class * m_history_value;
    
};


#endif