Simple program for introduction of mirror actuator.
Embed:
(wiki syntax)
Show/hide line numbers
ControllerLoop.cpp
00001 #include "ControllerLoop.h" 00002 using namespace std; 00003 00004 // contructor for controller loop 00005 ControllerLoop::ControllerLoop(float Ts) : thread(osPriorityHigh,4096) 00006 { 00007 this->Ts = Ts; 00008 } 00009 00010 // decontructor for controller loop 00011 ControllerLoop::~ControllerLoop() {} 00012 00013 // ---------------------------------------------------------------------------- 00014 // this is the main loop called every Ts with high priority 00015 void ControllerLoop::loop(void){ 00016 while(1) 00017 { 00018 ThisThread::flags_wait_any(threadFlag); 00019 // THE LOOP ------------------------------------------------------------ 00020 printf("I am called!\r\n"); 00021 }// endof the main loop 00022 } 00023 00024 void ControllerLoop::sendSignal() { 00025 thread.flags_set(threadFlag); 00026 } 00027 void ControllerLoop::start_loop(void) 00028 { 00029 thread.start(callback(this, &ControllerLoop::loop)); 00030 ticker.attach(callback(this, &ControllerLoop::sendSignal), Ts); 00031 } 00032 00033 void ControllerLoop::init_controllers(void) 00034 { 00035 // set values for your velocity and position controller here! 00036 }
Generated on Sun Jul 17 2022 14:09:45 by
1.7.2