first
Dependents: 17robo_fuzi 17robo_tokyo_kaede
pid_encoder.h
- Committer:
- echo_piyo
- Date:
- 2017-09-24
- Revision:
- 0:929eee8e2c2c
- Child:
- 1:0c64de09bd9b
File content as of revision 0:929eee8e2c2c:
#ifndef MBED_PID_ENCORDER_H #define MBED_PID_ENCORDER_H #include "pid.h" #include "mbed.h" #define PI 3.141592654f #define Nmax 18000 #define invalidN 0.1 class Encoder : public PositionPid //: public Speed_pid { public: Encoder (PinName A_Phase, PinName B_Phase); void setPpr(int Ppr); void cal(float target, float dt); float deg(); float get_deg_cylinder(); float rad(); int pulse(); float N(); void origin(); private : InterruptIn A; InterruptIn B; int ppr; signed int count; float radian,oldtheta; float w,v,n; float degree, deg_cylinder; void A_count(); void B_count(); }; #endif