S-curve acceleration / deceleration model generator (using FPU)
position_controller.h@2:2c5e4f521390, 2018-08-20 (annotated)
- Committer:
- takeuchi
- Date:
- Mon Aug 20 13:54:33 2018 +0900
- Revision:
- 2:2c5e4f521390
- Parent:
- 1:aed2cca33061
- Child:
- 3:65ae32169b33
??????
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" |
UCHITAKE | 1:aed2cca33061 | 5 | |
UCHITAKE | 1:aed2cca33061 | 6 | class PositionController { |
UCHITAKE | 1:aed2cca33061 | 7 | public : |
takeuchi |
2:2c5e4f521390 | 8 | PositionController(double accDistance_, double decDistance_, double initialVelocity_, double terminalVelocity_, float maxVelocity_, int targetX_, int targetY_); |
UCHITAKE | 1:aed2cca33061 | 9 | |
UCHITAKE | 1:aed2cca33061 | 10 | void compute(int positionX, int positionY); |
takeuchi |
2:2c5e4f521390 | 11 | double getVelocityX(); |
takeuchi |
2:2c5e4f521390 | 12 | double getVelocityY(); |
UCHITAKE | 1:aed2cca33061 | 13 | private : |
UCHITAKE | 1:aed2cca33061 | 14 | |
takeuchi |
2:2c5e4f521390 | 15 | double generateSineWave(double x, double initV, double termV, double start, double length); |
takeuchi |
2:2c5e4f521390 | 16 | |
takeuchi |
2:2c5e4f521390 | 17 | double accDistance; |
takeuchi |
2:2c5e4f521390 | 18 | double decDistance; |
takeuchi |
2:2c5e4f521390 | 19 | double accTrue; |
takeuchi |
2:2c5e4f521390 | 20 | double decTrue; |
takeuchi |
2:2c5e4f521390 | 21 | double initialVelocity; |
takeuchi |
2:2c5e4f521390 | 22 | double terminalVelocity; |
UCHITAKE | 1:aed2cca33061 | 23 | float maxVelocity; |
takeuchi |
2:2c5e4f521390 | 24 | double target; |
takeuchi |
2:2c5e4f521390 | 25 | int targetX; |
takeuchi |
2:2c5e4f521390 | 26 | int targetY; |
takeuchi |
2:2c5e4f521390 | 27 | double radians; |
takeuchi |
2:2c5e4f521390 | 28 | double velocity[2]; |
UCHITAKE | 1:aed2cca33061 | 29 | |
takeuchi |
2:2c5e4f521390 | 30 | bool enoughDistance; |
UCHITAKE | 1:aed2cca33061 | 31 | |
takeuchi |
2:2c5e4f521390 | 32 | double getVelocity(int position); |
UCHITAKE | 1:aed2cca33061 | 33 | }; |
UCHITAKE | 1:aed2cca33061 | 34 | #endif |
takeuchi |
2:2c5e4f521390 | 35 |