S-curve acceleration / deceleration model generator (using FPU)
Diff: position_controller.h
- Revision:
- 1:aed2cca33061
- Child:
- 2:2c5e4f521390
diff -r fe7037fdc1b5 -r aed2cca33061 position_controller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/position_controller.h Fri Aug 03 03:57:44 2018 +0000 @@ -0,0 +1,27 @@ +#ifndef POSITION_CONTROLLER_H +#define POSITION_CONTROLLER_H + +#include "mbed.h" + +class PositionController { + public : + PositionController(int accDist, float maxV, int targetX, int targetY); + + void compute(int positionX, int positionY); + float getVelocityX(); + float getVelocityY(); + private : + + int accelerationDistance; + float maxVelocity; + double targetDistance; + int targetDistanceX; + int targetDistanceY; + double targetRadians; + double maxJerk; + + float velocity[2]; + + float generateVelocity(int position); +}; +#endif