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

Dependents:   2018NHK_gaku_ver2

example /media/uploads/UCHITAKE/log.png

position_controller.h

Committer:
UCHITAKE
Date:
2018-08-03
Revision:
1:aed2cca33061
Child:
2:2c5e4f521390

File content as of revision 1:aed2cca33061:

#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