2019/09/13ver
Dependencies: SerialMultiByte QEI omni_wheel PID R1370MeasuringWheel IRsensor ikarashiMDC_2byte_ver Eigen
lib/S-ShapeModel/position_controller.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 POSITION_CONTROLLER_H |
skouki | 0:76663617eca3 | 2 | #define POSITION_CONTROLLER_H |
skouki | 0:76663617eca3 | 3 | |
skouki | 0:76663617eca3 | 4 | #include "mbed.h" |
skouki | 0:76663617eca3 | 5 | #include "Geometry.h" |
skouki | 0:76663617eca3 | 6 | //#define M_PI 3.141592653589793238462643383219502884 |
skouki | 0:76663617eca3 | 7 | |
skouki | 0:76663617eca3 | 8 | class PositionController { |
skouki | 0:76663617eca3 | 9 | public : |
skouki | 0:76663617eca3 | 10 | PositionController(double accDistance_, double decDistance_, double initialVelocity_, double terminalVelocity_, float maxVelocity_); |
skouki | 0:76663617eca3 | 11 | |
skouki | 0:76663617eca3 | 12 | void compute(int positionX, int positionY); |
skouki | 0:76663617eca3 | 13 | void targetXY(int targetX_, int targetY_); |
skouki | 0:76663617eca3 | 14 | double getVelocityX(); |
skouki | 0:76663617eca3 | 15 | double getVelocityY(); |
skouki | 0:76663617eca3 | 16 | private : |
skouki | 0:76663617eca3 | 17 | |
skouki | 0:76663617eca3 | 18 | double generateSineWave(double x, double initV, double termV, double start, double length); |
skouki | 0:76663617eca3 | 19 | |
skouki | 0:76663617eca3 | 20 | double accDistance; |
skouki | 0:76663617eca3 | 21 | double decDistance; |
skouki | 0:76663617eca3 | 22 | double accTrue; |
skouki | 0:76663617eca3 | 23 | double decTrue; |
skouki | 0:76663617eca3 | 24 | double initialVelocity; |
skouki | 0:76663617eca3 | 25 | double terminalVelocity; |
skouki | 0:76663617eca3 | 26 | float maxVelocity; |
skouki | 0:76663617eca3 | 27 | double target; |
skouki | 0:76663617eca3 | 28 | int targetX; |
skouki | 0:76663617eca3 | 29 | int targetY; |
skouki | 0:76663617eca3 | 30 | double radians; |
skouki | 0:76663617eca3 | 31 | double velocity[2]; |
skouki | 0:76663617eca3 | 32 | |
skouki | 0:76663617eca3 | 33 | bool enoughDistance; |
skouki | 0:76663617eca3 | 34 | |
skouki | 0:76663617eca3 | 35 | double getVelocity(int position); |
skouki | 0:76663617eca3 | 36 | }; |
skouki | 0:76663617eca3 | 37 | #endif |
skouki | 0:76663617eca3 | 38 |