Simple program for introduction of mirror actuator.

ControllerLoop.cpp

Committer:
altb2
Date:
2021-05-01
Revision:
14:1be03d1c45c7
Parent:
13:1bf960928a93

File content as of revision 14:1be03d1c45c7:

#include "ControllerLoop.h"
using namespace std;

// contructor for controller loop
ControllerLoop::ControllerLoop(float Ts) : thread(osPriorityHigh,4096)
{
   this->Ts = Ts; 
}

// decontructor for controller loop
ControllerLoop::~ControllerLoop() {}

// ----------------------------------------------------------------------------
// this is the main loop called every Ts with high priority
void ControllerLoop::loop(void){
    while(1)
        {
        ThisThread::flags_wait_any(threadFlag);
        // THE LOOP ------------------------------------------------------------
        printf("I am called!\r\n");
        }// endof the main loop
}

void ControllerLoop::sendSignal() {
    thread.flags_set(threadFlag);
}
void ControllerLoop::start_loop(void)
{
    thread.start(callback(this, &ControllerLoop::loop));
    ticker.attach(callback(this, &ControllerLoop::sendSignal), Ts);
}

void ControllerLoop::init_controllers(void)
{
    // set values for your velocity and position controller here!
}