2019/09/13ver
Dependencies: SerialMultiByte QEI omni_wheel PID R1370MeasuringWheel IRsensor ikarashiMDC_2byte_ver Eigen
lib/measuring_wheel/measuring_wheel.h@0:76663617eca3, 2019-09-13 (annotated)
- Committer:
- skouki
- Date:
- Fri Sep 13 02:15:30 2019 +0000
- Revision:
- 0:76663617eca3
2019/09/13
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
skouki | 0:76663617eca3 | 1 | #ifndef MEASURING_WHEEL_H |
skouki | 0:76663617eca3 | 2 | #define MEASURING_WHEEL_H |
skouki | 0:76663617eca3 | 3 | |
skouki | 0:76663617eca3 | 4 | #include "mbed.h" |
skouki | 0:76663617eca3 | 5 | #include "QEI.h" |
skouki | 0:76663617eca3 | 6 | #include "R1370.h" |
skouki | 0:76663617eca3 | 7 | #include "Dense.h" |
skouki | 0:76663617eca3 | 8 | |
skouki | 0:76663617eca3 | 9 | #define FIRST_HEDDER 0xEE |
skouki | 0:76663617eca3 | 10 | #define SECOND_HEDDER 0xFF |
skouki | 0:76663617eca3 | 11 | #define PPR 500.0 |
skouki | 0:76663617eca3 | 12 | #define PIII 3.14159265358979 |
skouki | 0:76663617eca3 | 13 | |
skouki | 0:76663617eca3 | 14 | class MeasuringWheel |
skouki | 0:76663617eca3 | 15 | { |
skouki | 0:76663617eca3 | 16 | public : |
skouki | 0:76663617eca3 | 17 | MeasuringWheel(PinName channel1_1, PinName channel1_2, PinName channel2_1, PinName channel2_2, PinName channel3_1, PinName channel3_2,PinName R1370TX,PinName R1370RX); |
skouki | 0:76663617eca3 | 18 | |
skouki | 0:76663617eca3 | 19 | double getOutX(); |
skouki | 0:76663617eca3 | 20 | double getOutY(); |
skouki | 0:76663617eca3 | 21 | double getWheel1(),getWheel2(),getWheel3(); |
skouki | 0:76663617eca3 | 22 | double getjyroAngle(); |
skouki | 0:76663617eca3 | 23 | double yaw; |
skouki | 0:76663617eca3 | 24 | private : |
skouki | 0:76663617eca3 | 25 | double diameter[3]; |
skouki | 0:76663617eca3 | 26 | double distance[3]; |
skouki | 0:76663617eca3 | 27 | double radian[3]; |
skouki | 0:76663617eca3 | 28 | Eigen::Matrix3d coefficient; |
skouki | 0:76663617eca3 | 29 | Eigen::Vector3d wheel; |
skouki | 0:76663617eca3 | 30 | Eigen::FullPivHouseholderQR<Eigen::Matrix3d> dec; |
skouki | 0:76663617eca3 | 31 | Eigen::Vector3d ans; |
skouki | 0:76663617eca3 | 32 | double miniX,miniY,X,Y,subX,subY,minusX,minusY; |
skouki | 0:76663617eca3 | 33 | int loopCounter; |
skouki | 0:76663617eca3 | 34 | void computeXY(); |
skouki | 0:76663617eca3 | 35 | void threadloop(); |
skouki | 0:76663617eca3 | 36 | |
skouki | 0:76663617eca3 | 37 | QEI w1; |
skouki | 0:76663617eca3 | 38 | QEI w2; |
skouki | 0:76663617eca3 | 39 | QEI w3; |
skouki | 0:76663617eca3 | 40 | R1370 r1370; |
skouki | 0:76663617eca3 | 41 | double Cdif, yawdegree; |
skouki | 0:76663617eca3 | 42 | Thread thread; |
skouki | 0:76663617eca3 | 43 | uint16_t X_, Y_,ofsetX, ofsetY, yawdegree_; |
skouki | 0:76663617eca3 | 44 | void resetposition(); |
skouki | 0:76663617eca3 | 45 | }; |
skouki | 0:76663617eca3 | 46 | |
skouki | 0:76663617eca3 | 47 | #endif |