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

Dependents:   2021NHK_B_main

Committer:
highfieldsnj
Date:
Tue Jun 25 08:28:21 2019 +0000
Revision:
4:4cc455e372c2
Parent:
3:65ae32169b33
double -> float

Who changed what in which revision?

UserRevisionLine numberNew 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"
highfieldsnj 4:4cc455e372c2 5 const float F_PI = 3.141593f;
UCHITAKE 1:aed2cca33061 6
UCHITAKE 1:aed2cca33061 7 class PositionController {
UCHITAKE 1:aed2cca33061 8 public :
highfieldsnj 4:4cc455e372c2 9 PositionController(float accDistance_, float decDistance_, float initialVelocity_, float 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_);
highfieldsnj 4:4cc455e372c2 13 float getVelocityX();
highfieldsnj 4:4cc455e372c2 14 float getVelocityY();
UCHITAKE 1:aed2cca33061 15 private :
UCHITAKE 1:aed2cca33061 16
highfieldsnj 4:4cc455e372c2 17 float generateSineWave(float x, float initV, float termV, float start, float length);
takeuchi 2:2c5e4f521390 18
highfieldsnj 4:4cc455e372c2 19 float accDistance;
highfieldsnj 4:4cc455e372c2 20 float decDistance;
highfieldsnj 4:4cc455e372c2 21 float accTrue;
highfieldsnj 4:4cc455e372c2 22 float decTrue;
highfieldsnj 4:4cc455e372c2 23 float initialVelocity;
highfieldsnj 4:4cc455e372c2 24 float terminalVelocity;
UCHITAKE 1:aed2cca33061 25 float maxVelocity;
highfieldsnj 4:4cc455e372c2 26 float target;
takeuchi 2:2c5e4f521390 27 int targetX;
takeuchi 2:2c5e4f521390 28 int targetY;
highfieldsnj 4:4cc455e372c2 29 float radians;
highfieldsnj 4:4cc455e372c2 30 float velocity[2];
UCHITAKE 1:aed2cca33061 31
takeuchi 2:2c5e4f521390 32 bool enoughDistance;
UCHITAKE 1:aed2cca33061 33
highfieldsnj 4:4cc455e372c2 34 float getVelocity(int position);
UCHITAKE 1:aed2cca33061 35 };
UCHITAKE 1:aed2cca33061 36 #endif
takeuchi 2:2c5e4f521390 37