NHK2019_Team_B_Automatic_machine_maegawa

Dependencies:   SerialMultiByte QEI omni_wheel PID R1370MeasuringWheel IRsensor ikarashiMDC_2byte_ver Eigen

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