first
Dependents: 17robo_fuzi 17robo_tokyo_kaede
pid_encoder.h@0:929eee8e2c2c, 2017-09-24 (annotated)
- Committer:
- echo_piyo
- Date:
- Sun Sep 24 05:24:06 2017 +0000
- Revision:
- 0:929eee8e2c2c
- Child:
- 1:0c64de09bd9b
????2??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
echo_piyo | 0:929eee8e2c2c | 1 | |
echo_piyo | 0:929eee8e2c2c | 2 | #ifndef MBED_PID_ENCORDER_H |
echo_piyo | 0:929eee8e2c2c | 3 | #define MBED_PID_ENCORDER_H |
echo_piyo | 0:929eee8e2c2c | 4 | |
echo_piyo | 0:929eee8e2c2c | 5 | #include "pid.h" |
echo_piyo | 0:929eee8e2c2c | 6 | #include "mbed.h" |
echo_piyo | 0:929eee8e2c2c | 7 | |
echo_piyo | 0:929eee8e2c2c | 8 | #define PI 3.141592654f |
echo_piyo | 0:929eee8e2c2c | 9 | #define Nmax 18000 |
echo_piyo | 0:929eee8e2c2c | 10 | #define invalidN 0.1 |
echo_piyo | 0:929eee8e2c2c | 11 | |
echo_piyo | 0:929eee8e2c2c | 12 | class Encoder : public PositionPid //: public Speed_pid |
echo_piyo | 0:929eee8e2c2c | 13 | { |
echo_piyo | 0:929eee8e2c2c | 14 | public: |
echo_piyo | 0:929eee8e2c2c | 15 | Encoder (PinName A_Phase, PinName B_Phase); |
echo_piyo | 0:929eee8e2c2c | 16 | void setPpr(int Ppr); |
echo_piyo | 0:929eee8e2c2c | 17 | void cal(float target, float dt); |
echo_piyo | 0:929eee8e2c2c | 18 | float deg(); |
echo_piyo | 0:929eee8e2c2c | 19 | float get_deg_cylinder(); |
echo_piyo | 0:929eee8e2c2c | 20 | float rad(); |
echo_piyo | 0:929eee8e2c2c | 21 | int pulse(); |
echo_piyo | 0:929eee8e2c2c | 22 | float N(); |
echo_piyo | 0:929eee8e2c2c | 23 | void origin(); |
echo_piyo | 0:929eee8e2c2c | 24 | |
echo_piyo | 0:929eee8e2c2c | 25 | private : |
echo_piyo | 0:929eee8e2c2c | 26 | InterruptIn A; |
echo_piyo | 0:929eee8e2c2c | 27 | InterruptIn B; |
echo_piyo | 0:929eee8e2c2c | 28 | |
echo_piyo | 0:929eee8e2c2c | 29 | int ppr; |
echo_piyo | 0:929eee8e2c2c | 30 | signed int count; |
echo_piyo | 0:929eee8e2c2c | 31 | float radian,oldtheta; |
echo_piyo | 0:929eee8e2c2c | 32 | float w,v,n; |
echo_piyo | 0:929eee8e2c2c | 33 | float degree, deg_cylinder; |
echo_piyo | 0:929eee8e2c2c | 34 | |
echo_piyo | 0:929eee8e2c2c | 35 | void A_count(); |
echo_piyo | 0:929eee8e2c2c | 36 | void B_count(); |
echo_piyo | 0:929eee8e2c2c | 37 | }; |
echo_piyo | 0:929eee8e2c2c | 38 | |
echo_piyo | 0:929eee8e2c2c | 39 | #endif |