S-curve acceleration / deceleration model generator (using FPU)
position_controller.h@3:65ae32169b33, 2018-09-15 (annotated)
- Committer:
- tanabe2000
- Date:
- Sat Sep 15 05:05:27 2018 +0000
- Revision:
- 3:65ae32169b33
- Parent:
- 2:2c5e4f521390
- Child:
- 4:4cc455e372c2
targetmode????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
UCHITAKE | 1:aed2cca33061 | 1 | #ifndef POSITION_CONTROLLER_H |
UCHITAKE | 1:aed2cca33061 | 2 | #define POSITION_CONTROLLER_H |
UCHITAKE | 1:aed2cca33061 | 3 | |
UCHITAKE | 1:aed2cca33061 | 4 | #include "mbed.h" |
tanabe2000 | 3:65ae32169b33 | 5 | #define M_PI 3.141592653589793238462643383219502884 |
UCHITAKE | 1:aed2cca33061 | 6 | |
UCHITAKE | 1:aed2cca33061 | 7 | class PositionController { |
UCHITAKE | 1:aed2cca33061 | 8 | public : |
tanabe2000 | 3:65ae32169b33 | 9 | PositionController(double accDistance_, double decDistance_, double initialVelocity_, double terminalVelocity_, float maxVelocity_); |
UCHITAKE | 1:aed2cca33061 | 10 | |
UCHITAKE | 1:aed2cca33061 | 11 | void compute(int positionX, int positionY); |
tanabe2000 | 3:65ae32169b33 | 12 | void targetXY(int targetX_, int targetY_); |
takeuchi |
2:2c5e4f521390 | 13 | double getVelocityX(); |
takeuchi |
2:2c5e4f521390 | 14 | double getVelocityY(); |
UCHITAKE | 1:aed2cca33061 | 15 | private : |
UCHITAKE | 1:aed2cca33061 | 16 | |
takeuchi |
2:2c5e4f521390 | 17 | double generateSineWave(double x, double initV, double termV, double start, double length); |
takeuchi |
2:2c5e4f521390 | 18 | |
takeuchi |
2:2c5e4f521390 | 19 | double accDistance; |
takeuchi |
2:2c5e4f521390 | 20 | double decDistance; |
takeuchi |
2:2c5e4f521390 | 21 | double accTrue; |
takeuchi |
2:2c5e4f521390 | 22 | double decTrue; |
takeuchi |
2:2c5e4f521390 | 23 | double initialVelocity; |
takeuchi |
2:2c5e4f521390 | 24 | double terminalVelocity; |
UCHITAKE | 1:aed2cca33061 | 25 | float maxVelocity; |
takeuchi |
2:2c5e4f521390 | 26 | double target; |
takeuchi |
2:2c5e4f521390 | 27 | int targetX; |
takeuchi |
2:2c5e4f521390 | 28 | int targetY; |
takeuchi |
2:2c5e4f521390 | 29 | double radians; |
takeuchi |
2:2c5e4f521390 | 30 | double velocity[2]; |
UCHITAKE | 1:aed2cca33061 | 31 | |
takeuchi |
2:2c5e4f521390 | 32 | bool enoughDistance; |
UCHITAKE | 1:aed2cca33061 | 33 | |
takeuchi |
2:2c5e4f521390 | 34 | double getVelocity(int position); |
UCHITAKE | 1:aed2cca33061 | 35 | }; |
UCHITAKE | 1:aed2cca33061 | 36 | #endif |
takeuchi |
2:2c5e4f521390 | 37 |