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: SBDBT arrc_mbed BNO055
PIDco.hpp
- Committer:
- kazumayamanaka
- Date:
- 2022-01-19
- Revision:
- 0:a1238c4cd105
- Child:
- 5:1a850f68a06c
File content as of revision 0:a1238c4cd105:
#ifndef PID_CO_H
#define PID_CO_H
#include "mbed.h"
#define Kp 0.0001
#define Ki 0.0000014
#define Kd 0.0000001
#define co (108 * 3.1415926535897) / 500
class PIDco{
public://use in main.cpp
PIDco();
double obt_spd();
void pass_val(double PULSE,double TARGET);
void wheel_ctl(PinName PIN_A,PinName PIN_B);
private:
void cal_spd();
void cal_Error();
void renew_Error();
void cal_Pval();
void cal_Ival();
void cal_Dval();
void cal_pwm();
double spd;
double Target,Error_a,Error_b;
double Pval,Ival,Dval,Pwm;
double Integral,dt;
double diff,pulse_a,pulse_b;
double v1p_set,v1m_set;
};
#endif