Simple program for introduction of mirror actuator.

Committer:
altb2
Date:
Thu Apr 01 13:38:54 2021 +0000
Revision:
6:9ebeffe446e4
Parent:
5:768e10f6d372
Child:
7:942fd77d5e19
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
altb2 5:768e10f6d372 1 #include "mbed.h"
altb2 5:768e10f6d372 2 #include "EncoderCounter.h"
altb2 5:768e10f6d372 3 #include "EncoderCounterIndex.h"
altb2 5:768e10f6d372 4 #include "DiffCounter.h"
altb2 5:768e10f6d372 5 #include "LinearCharacteristics.h"
altb2 5:768e10f6d372 6 #include "ThreadFlag.h"
altb2 5:768e10f6d372 7 #include "path_1d.h"
altb2 6:9ebeffe446e4 8 #include "PIDT2_Cntrl.h"
altb2 5:768e10f6d372 9 #include "Unwrapper_2pi.h"
altb2 6:9ebeffe446e4 10 #include "Mirror_Kinematic.h"
altb2 6:9ebeffe446e4 11 #include "data_structs.h"
altb2 5:768e10f6d372 12
altb2 5:768e10f6d372 13 extern EncoderCounter counter1,counter2;
altb2 5:768e10f6d372 14 extern EncoderCounterIndex index1,index2;
altb2 5:768e10f6d372 15 extern DiffCounter diff1,diff2;
altb2 5:768e10f6d372 16 extern path_1d *current_path;
altb2 6:9ebeffe446e4 17 extern LinearCharacteristics i2u;
altb2 6:9ebeffe446e4 18 //extern AnalogOut i_des1, i_des2;
altb2 6:9ebeffe446e4 19 extern AnalogOut i_des2;
altb2 5:768e10f6d372 20 extern DigitalOut i_enable;
altb2 5:768e10f6d372 21 extern Timer glob_ti;
altb2 6:9ebeffe446e4 22 extern Mirror_Kinematic mc;
altb2 6:9ebeffe446e4 23 extern DigitalOut laser_on;
altb2 6:9ebeffe446e4 24 extern DATA_Xchange data;
altb2 6:9ebeffe446e4 25 extern DigitalOut led1;
altb2 5:768e10f6d372 26
altb2 5:768e10f6d372 27 // This is the loop class, it is not a controller at first hand, it guarantees a cyclic call
altb2 5:768e10f6d372 28 class ControllerLoop
altb2 5:768e10f6d372 29 {
altb2 5:768e10f6d372 30 public:
altb2 5:768e10f6d372 31 ControllerLoop(float Ts);
altb2 5:768e10f6d372 32 virtual ~ControllerLoop();
altb2 6:9ebeffe446e4 33 void start_loop(void);
altb2 6:9ebeffe446e4 34 void init_controllers(void);
altb2 6:9ebeffe446e4 35
altb2 5:768e10f6d372 36
altb2 5:768e10f6d372 37
altb2 5:768e10f6d372 38 private:
altb2 5:768e10f6d372 39 void loop(void);
altb2 5:768e10f6d372 40 Thread thread;
altb2 5:768e10f6d372 41 Ticker ticker;
altb2 5:768e10f6d372 42 ThreadFlag threadFlag;
altb2 5:768e10f6d372 43 Timer ti;
altb2 5:768e10f6d372 44 float Ts;
altb2 5:768e10f6d372 45 void sendSignal();
altb2 6:9ebeffe446e4 46 bool is_initialized;
altb2 6:9ebeffe446e4 47 void find_index(void);
altb2 6:9ebeffe446e4 48 PIDT2_Cntrl v_cntrl[2];
altb2 6:9ebeffe446e4 49 Unwrapper_2pi uw2pi1;
altb2 6:9ebeffe446e4 50 Unwrapper_2pi uw2pi2;
altb2 5:768e10f6d372 51 };