Nicolas Borla
/
BBR_1Ebene
BBR 1 Ebene
Controller.h
- Committer:
- borlanic
- Date:
- 2018-05-14
- Revision:
- 0:fbdae7e6d805
File content as of revision 0:fbdae7e6d805:
/* * Controller.cpp * Copyright (c) 2018, ZHAW * All rights reserved. * * Created on: 27.03.2018 * Author: BaBoRo Development Team */ #ifndef CONTROLLER_H_ #define CONTROLLER_H_ #include <stdint.h> #include "mbed.h" #include "EncoderCounter.h" #include "IMU.h" #include "LowpassFilter.h" #include "Motion.h" #include "Signal.h" #include "SerialCom.h" /** * controller class */ class Controller { public: //static const float TRANSLATIONAL_PROFILE_VELOCITY; //static const float ROTATIONAL_PROFILE_VELOCITY; static const float ALPHA; static const float RB; static const float RW; static const float PI; static const float SQRT_3; static const float LOWPASS_FILTER_FREQUENCY; static const float COUNTS_PER_TURN; static const float KI; static const float MIN_DUTY_CYCLE; static const float MAX_DUTY_CYCLE; static const float MAX_ACC_M; static const float COS_ALPHA; static const float SIN_ALPHA; static const float MB; Controller(PwmOut& pwm0, PwmOut& pwm1, PwmOut& pwm2, EncoderCounter& counter1, EncoderCounter& counter2, EncoderCounter& counter3, IMU& imu); virtual ~Controller(); void setGammaX(float gammaX); void setGammaY(float gammaY); void setGammaZ(float gammaZ); void setPhiX(float phiX); void setPhiY(float phiY); void setX(float x); void setY(float y); float getPhiX(); float getPhiY(); float getX(); float getY(); float gainG; float gain_dG; float offsetX; float offsetY; float sign(float v); private: static const uint32_t STACK_SIZE = 4096; // stack size of thread, given in [bytes] static const float PERIOD; // the period of the timer interrupt, given in [s] PwmOut& pwm0; PwmOut& pwm1; PwmOut& pwm2; EncoderCounter& counter1; EncoderCounter& counter2; EncoderCounter& counter3; float gammaXref; float gammaYref; float gammaZref; float phiXref; float phiYref; float gammaX; float gammaY; float gammaZ; float phiX; float phiY; float x; float y; float d_gammaX; float d_gammaY; float d_gammaZ; float d_phiX; float d_phiY; LowpassFilter speedFilter1; LowpassFilter speedFilter2; LowpassFilter speedFilter3; LowpassFilter d_phiXFilter; LowpassFilter d_phiYFilter; LowpassFilter gammaXFilter; LowpassFilter gammaYFilter; LowpassFilter d_gammaXFilter; LowpassFilter d_gammaYFilter; LowpassFilter M1Filter; LowpassFilter M2Filter; LowpassFilter M3Filter; float previousValueCounter1; float previousValueCounter2; float previousValueCounter3; float actualSpeed1; float actualSpeed2; float actualSpeed3; Motion M1motion; Motion M2motion; Motion M3motion; Motion d_phiXMotion; Motion d_phiYMotion; IMU& imu; //SerialCom com; Signal signal; Thread thread; Ticker ticker; Mutex mutex; // mutex to lock critical sections void sendSignal(); void run(); }; #endif /* CONTROLLER_H_ */