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

Dependents:   2021NHK_B_main

position_controller.h

Committer:
takeuchi
Date:
2018-08-20
Revision:
2:2c5e4f521390
Parent:
1:aed2cca33061
Child:
3:65ae32169b33

File content as of revision 2:2c5e4f521390:

#ifndef POSITION_CONTROLLER_H
#define POSITION_CONTROLLER_H

#include "mbed.h"

class PositionController {
    public :
        PositionController(double accDistance_, double decDistance_, double initialVelocity_, double terminalVelocity_, float maxVelocity_, int targetX_, int targetY_);

        void compute(int positionX, int positionY);
        double getVelocityX();
        double getVelocityY();
    private :

        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 target;
        int targetX;
        int targetY;
        double radians;
        double velocity[2];

        bool enoughDistance;

        double getVelocity(int position);
};
#endif