Implement new controller

Dependencies:   mbed-rtos mbed QEI BNO055 MPU6050_DMP_Nucleo-I2Cdev virgo3_imuHandler_Orion_PCB MAX17048 Servo

Fork of Orion_newPCB_test by Team Virgo v3

Committer:
ahmed_lv
Date:
Tue Mar 20 05:56:22 2018 +0000
Revision:
30:44676e1b38f8
Parent:
11:49344285c82a
Editted Input Variables to PID

Who changed what in which revision?

UserRevisionLine numberNew contents of line
akashvibhute 11:49344285c82a 1 #ifndef pidControl_H
akashvibhute 11:49344285c82a 2 #define pidControl_H
akashvibhute 11:49344285c82a 3
akashvibhute 11:49344285c82a 4 #include "mbed.h"
akashvibhute 11:49344285c82a 5 #include "generalFunctions.h"
akashvibhute 11:49344285c82a 6 #include "config.h"
akashvibhute 11:49344285c82a 7
akashvibhute 11:49344285c82a 8 class pidControl
akashvibhute 11:49344285c82a 9 {
akashvibhute 11:49344285c82a 10 public:
akashvibhute 11:49344285c82a 11 pidControl();
akashvibhute 11:49344285c82a 12 void setGains(float kP,float kI, float kD, float kFf);
akashvibhute 11:49344285c82a 13 void setTermLimits(float P_min, float P_max, float I_min, float I_max, float D_min, float D_max, float Ff_min, float Ff_max);
akashvibhute 11:49344285c82a 14 void setOutputRange(float outMin, float outMax);
akashvibhute 11:49344285c82a 15 float calcOutput(float setPoint, float feedback, float servoTime);
akashvibhute 11:49344285c82a 16 float processAcc(float setPoint, float targetAcc, float servoTime);
akashvibhute 11:49344285c82a 17
akashvibhute 11:49344285c82a 18 float PIDFf_terms[4];
akashvibhute 11:49344285c82a 19 float Summ_term;
akashvibhute 11:49344285c82a 20
akashvibhute 11:49344285c82a 21 private:
akashvibhute 11:49344285c82a 22 float PIDFf_gains[4];
akashvibhute 11:49344285c82a 23 float PIDFf_limits[4][2];
akashvibhute 11:49344285c82a 24 float output_limits[2];
akashvibhute 11:49344285c82a 25
akashvibhute 11:49344285c82a 26 float controlError[2];
akashvibhute 11:49344285c82a 27
akashvibhute 11:49344285c82a 28 float prevSetPoint; //for acceleration
akashvibhute 11:49344285c82a 29 float compensatedSetPoint;
akashvibhute 11:49344285c82a 30
akashvibhute 11:49344285c82a 31 //float PIDFf_terms[4];
akashvibhute 11:49344285c82a 32 //float Summ_term;
akashvibhute 11:49344285c82a 33 };
akashvibhute 11:49344285c82a 34
akashvibhute 11:49344285c82a 35
akashvibhute 11:49344285c82a 36 #endif