S-curve acceleration / deceleration model generator S字加減速

Dependents:   2018NHK_gaku_ver2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers position_controller.h Source File

position_controller.h

00001 #ifndef POSITION_CONTROLLER_H
00002 #define POSITION_CONTROLLER_H
00003 
00004 #include "mbed.h"
00005 #define M_PI 3.141592653589793238462643383219502884
00006 
00007 class PositionController {
00008     public :
00009         PositionController(double accDistance_, double decDistance_, double initialVelocity_, double terminalVelocity_, float maxVelocity_);
00010 
00011         void compute(int positionX, int positionY);
00012         void targetXY(int targetX_, int targetY_);
00013         double getVelocityX();
00014         double getVelocityY();
00015     private :
00016 
00017         double generateSineWave(double x, double initV, double termV, double start, double length);
00018 
00019         double accDistance;
00020         double decDistance;
00021         double accTrue;
00022         double decTrue;
00023         double initialVelocity;
00024         double terminalVelocity;
00025         float maxVelocity;
00026         double target;
00027         int targetX;
00028         int targetY;
00029         double radians;
00030         double velocity[2];
00031 
00032         bool enoughDistance;
00033 
00034         double getVelocity(int position);
00035 };
00036 #endif
00037