Browse Source

Start state machine

master
Tim Zeuner 1 year ago
parent
commit
7c8dc41063
1 changed files with 29 additions and 1 deletions
  1. 29
    1
      main.cpp

+ 29
- 1
main.cpp View File

#include <lfr.h> #include <lfr.h>
#include <lfr_socket.h> #include <lfr_socket.h>
#include <uart_communication.h> #include <uart_communication.h>
#include "lfr_state_machine.h"


int main(void) int main(void)
{ {
std::cout << "hello central" << std::endl;
std::cout << "started central" << std::endl;


const int thresholdBinary = 140; const int thresholdBinary = 140;
const int videoHeight = 720; const int videoHeight = 720;


std::mutex mutex; std::mutex mutex;


// Init State Machine;
std::cout << "create State Machine" << std::endl;
LFR_StateMachine stateMachine();

// Init LFR Autonomous mode
std::cout << "create lfr" << std::endl; std::cout << "create lfr" << std::endl;
LFR lfr(videoHeight, videoWidth, thresholdBinary, gaussKernelSize, [&](std::exception const &ex) LFR lfr(videoHeight, videoWidth, thresholdBinary, gaussKernelSize, [&](std::exception const &ex)
{ {
return false; return false;
}); });


// Init UART Communication
std::cout << "create uart" << std::endl; std::cout << "create uart" << std::endl;
LFR_UART uartCommunicator; LFR_UART uartCommunicator;


// Init Socket Communication
std::cout << "create socket" << std::endl; std::cout << "create socket" << std::endl;
LFR_Socket socket([&](std::exception const &ex) LFR_Socket socket([&](std::exception const &ex)
{ {
return false; return false;
}); });


// Connect String parser to socket
socket.addListener([&](LFR_Socket::LFR_Telegram telegram)
{
std::unique_lock<std::mutex> lock(mutex);
std::cout << telegram;
}, &mutex);
socket.startLoop();


//Start the permanent loop
char input;
std::cout << "fress q to quit" << std::endl;
std::cin >> input;
std::cout << "cinned" << std::endl;
while (input != 'q')
{
std::cin >> input;
std::cout << "cinned" << std::endl;
}
std::cout << "Exiting central" << std::endl;
return 0; return 0;
} }

Loading…
Cancel
Save