Ruprecht Altenburger
/
mirror_actuator_V1
Mirror actuator for RT2 lab
Diff: main.cpp
- Revision:
- 7:942fd77d5e19
- Parent:
- 6:9ebeffe446e4
- Child:
- 8:49ac75c42da0
diff -r 9ebeffe446e4 -r 942fd77d5e19 main.cpp --- a/main.cpp Thu Apr 01 13:38:54 2021 +0000 +++ b/main.cpp Thu Apr 15 05:36:55 2021 +0000 @@ -20,15 +20,15 @@ static BufferedSerial serial_port(USBTX, USBRX); InterruptIn button(USER_BUTTON); // User Button, short and long presses! bool key_was_pressed = false; -float Ts=.0002f; // sampling time +float Ts=.0005f; // sampling time void pressed(void); void released(void); -DigitalOut led1(LED1); -DigitalOut led2(LED2); +//DigitalOut led1(LED1); +//DigitalOut led2(LED2); //------------- DEFINE FILTERS ---------------- // missing //------------- Define In/Out ----------------- -//AnalogOut i_des1(PA_5); +AnalogOut i_des1(PA_5); AnalogOut i_des2(PA_4); DigitalOut i_enable(PC_4); DigitalOut laser_on(PB_0); @@ -51,7 +51,7 @@ //------------------------------------------ // ----- User defined functions ----------- ControllerLoop loop(Ts); -uart_comm_thread uart_com(&serial_port,.5f); +uart_comm_thread uart_com(&serial_port,.1f); Ticker do_referencing; Timer glob_ti; path_1d p1; @@ -59,7 +59,7 @@ path_1d *current_path; float A = 2.7; float dc=0.0; -Mirror_Kinematic mc; +Mirror_Kinematic mk; DATA_Xchange data; //GPA myGPA(1, 2500, 100, 30, 20, Ts); @@ -87,17 +87,15 @@ counter1.reset(); // encoder reset counter2.reset(); // encoder reset i_enable = 0; - mc.set_offsets(2956,2343); + mk.set_offsets(0,0); glob_ti.start(); glob_ti.reset(); printf("Start Mirroractuator 1.0\r\n"); loop.init_controllers(); uart_com.start_uart(); loop.start_loop(); - //i_des1.write(i2u(0)); + i_des1.write(i2u(0)); i_des2.write(i2u(0)); - led1 = 1; - led2 = 1; /* p1.initialize(300,10,A,0,0,0); p2.initialize(300,10,-A,0,0,A); laser_on = 0;