S-curve acceleration / deceleration model generator (using FPU)

Dependents:   2021NHK_B_main

Revision:
2:2c5e4f521390
Parent:
1:aed2cca33061
Child:
3:65ae32169b33
--- a/position_controller.h	Fri Aug 03 03:57:44 2018 +0000
+++ b/position_controller.h	Mon Aug 20 13:54:33 2018 +0900
@@ -5,23 +5,31 @@
 
 class PositionController {
     public :
-        PositionController(int accDist, float maxV, int targetX, int targetY);
+        PositionController(double accDistance_, double decDistance_, double initialVelocity_, double terminalVelocity_, float maxVelocity_, int targetX_, int targetY_);
 
         void compute(int positionX, int positionY);
-        float getVelocityX();
-        float getVelocityY();
+        double getVelocityX();
+        double getVelocityY();
     private :
 
-        int accelerationDistance;
+        double generateSineWave(double x, double initV, double termV, double start, double length);
+
+        double accDistance;
+        double decDistance;
+        double accTrue;
+        double decTrue;
+        double initialVelocity;
+        double terminalVelocity;
         float maxVelocity;
-        double targetDistance;
-        int targetDistanceX;
-        int targetDistanceY;
-        double targetRadians;
-        double maxJerk;
+        double target;
+        int targetX;
+        int targetY;
+        double radians;
+        double velocity[2];
 
-        float velocity[2];
+        bool enoughDistance;
 
-        float generateVelocity(int position);
+        double getVelocity(int position);
 };
 #endif
+