Erste version der Software für der Prototyp

Committer:
borlanic
Date:
Thu Mar 29 09:25:16 2018 +0000
Revision:
1:d5c5bb30ac90
Parent:
0:380207fcb5c1
Child:
2:3f836b662104
Erste veriosn software

Who changed what in which revision?

UserRevisionLine numberNew contents of line
borlanic 0:380207fcb5c1 1 /*
borlanic 0:380207fcb5c1 2 * Controller.cpp
borlanic 0:380207fcb5c1 3 * Copyright (c) 2018, ZHAW
borlanic 0:380207fcb5c1 4 * All rights reserved.
borlanic 0:380207fcb5c1 5 *
borlanic 0:380207fcb5c1 6 * Created on: 27.03.2018
borlanic 0:380207fcb5c1 7 * Author: BaBoRo Development Team
borlanic 0:380207fcb5c1 8 */
borlanic 0:380207fcb5c1 9
borlanic 0:380207fcb5c1 10 #ifndef CONTROLLER_H_
borlanic 0:380207fcb5c1 11 #define CONTROLLER_H_
borlanic 0:380207fcb5c1 12
borlanic 0:380207fcb5c1 13 #include <stdint.h>
borlanic 0:380207fcb5c1 14 #include "mbed.h"
borlanic 0:380207fcb5c1 15 #include "EncoderCounter.h"
borlanic 0:380207fcb5c1 16 #include "IMU.h"
borlanic 0:380207fcb5c1 17 #include "LowpassFilter.h"
borlanic 0:380207fcb5c1 18
borlanic 0:380207fcb5c1 19 /**
borlanic 0:380207fcb5c1 20 *
borlanic 0:380207fcb5c1 21 */
borlanic 0:380207fcb5c1 22 class Controller {
borlanic 0:380207fcb5c1 23
borlanic 0:380207fcb5c1 24 public:
borlanic 0:380207fcb5c1 25
borlanic 0:380207fcb5c1 26 //static const float TRANSLATIONAL_PROFILE_VELOCITY;
borlanic 0:380207fcb5c1 27 //static const float ROTATIONAL_PROFILE_VELOCITY;
borlanic 0:380207fcb5c1 28 static const float ALPHA;
borlanic 0:380207fcb5c1 29 static const float RB;
borlanic 0:380207fcb5c1 30 static const float RW;
borlanic 0:380207fcb5c1 31 static const float PI;
borlanic 0:380207fcb5c1 32 static const float SQRT_3;
borlanic 0:380207fcb5c1 33 static const float LOWPASS_FILTER_FREQUENCY;
borlanic 0:380207fcb5c1 34 static const float COUNTS_PER_TURN;
borlanic 0:380207fcb5c1 35
borlanic 0:380207fcb5c1 36 Controller(PwmOut& pwm0, PwmOut& pwm1, PwmOut& pwm2, EncoderCounter& counter1, EncoderCounter& counter2, EncoderCounter& counter3, IMU& imu);
borlanic 0:380207fcb5c1 37 virtual ~Controller();
borlanic 0:380207fcb5c1 38 void setGammaX(float gammaX);
borlanic 0:380207fcb5c1 39 void setGammaY(float gammaY);
borlanic 0:380207fcb5c1 40 void setGammaZ(float gammaZ);
borlanic 0:380207fcb5c1 41 void setPhiX(float phiX);
borlanic 0:380207fcb5c1 42 void setPhiY(float phiY);
borlanic 0:380207fcb5c1 43 void setX(float x);
borlanic 0:380207fcb5c1 44 void setY(float y);
borlanic 0:380207fcb5c1 45
borlanic 0:380207fcb5c1 46 float getPhiX();
borlanic 0:380207fcb5c1 47 float getPhiY();
borlanic 0:380207fcb5c1 48 float getX();
borlanic 0:380207fcb5c1 49 float getY();
borlanic 0:380207fcb5c1 50
borlanic 0:380207fcb5c1 51
borlanic 0:380207fcb5c1 52 private:
borlanic 0:380207fcb5c1 53
borlanic 0:380207fcb5c1 54 static const uint32_t STACK_SIZE = 4096; // stack size of thread, given in [bytes]
borlanic 0:380207fcb5c1 55 static const float PERIOD; // the period of the timer interrupt, given in [s]
borlanic 0:380207fcb5c1 56
borlanic 0:380207fcb5c1 57 PwmOut& pwm0;
borlanic 0:380207fcb5c1 58 PwmOut& pwm1;
borlanic 0:380207fcb5c1 59 PwmOut& pwm2;
borlanic 0:380207fcb5c1 60
borlanic 0:380207fcb5c1 61 EncoderCounter& counter1;
borlanic 0:380207fcb5c1 62 EncoderCounter& counter2;
borlanic 0:380207fcb5c1 63 EncoderCounter& counter3;
borlanic 0:380207fcb5c1 64
borlanic 0:380207fcb5c1 65 float gammaX;
borlanic 0:380207fcb5c1 66 float gammaY;
borlanic 0:380207fcb5c1 67 float gammaZ;
borlanic 0:380207fcb5c1 68 float phiX;
borlanic 0:380207fcb5c1 69 float phiY;
borlanic 0:380207fcb5c1 70 float x;
borlanic 0:380207fcb5c1 71 float y;
borlanic 0:380207fcb5c1 72
borlanic 0:380207fcb5c1 73 float d_gammaX;
borlanic 0:380207fcb5c1 74 float d_gammaY;
borlanic 0:380207fcb5c1 75 float d_gammaZ;
borlanic 0:380207fcb5c1 76 float d_phiX;
borlanic 0:380207fcb5c1 77 float d_phiY;
borlanic 0:380207fcb5c1 78
borlanic 0:380207fcb5c1 79 LowpassFilter speedFilter1;
borlanic 0:380207fcb5c1 80 LowpassFilter speedFilter2;
borlanic 0:380207fcb5c1 81 LowpassFilter speedFilter3;
borlanic 0:380207fcb5c1 82
borlanic 0:380207fcb5c1 83 float previousValueCounter1;
borlanic 0:380207fcb5c1 84 float previousValueCounter2;
borlanic 0:380207fcb5c1 85 float previousValueCounter3;
borlanic 0:380207fcb5c1 86 float actualSpeed1;
borlanic 0:380207fcb5c1 87 float actualSpeed2;
borlanic 0:380207fcb5c1 88 float actualSpeed3;
borlanic 0:380207fcb5c1 89
borlanic 0:380207fcb5c1 90 IMU& imu;
borlanic 0:380207fcb5c1 91 //Signal signal;
borlanic 0:380207fcb5c1 92 Thread thread;
borlanic 0:380207fcb5c1 93 //Ticker ticker;
borlanic 0:380207fcb5c1 94
borlanic 0:380207fcb5c1 95 //void sendSignal();
borlanic 0:380207fcb5c1 96 void run();
borlanic 0:380207fcb5c1 97 };
borlanic 0:380207fcb5c1 98
borlanic 0:380207fcb5c1 99 #endif /* CONTROLLER_H_ */