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

@@ -2,10 +2,11 @@
#include <lfr.h>
#include <lfr_socket.h>
#include <uart_communication.h>
#include "lfr_state_machine.h"

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

const int thresholdBinary = 140;
const int videoHeight = 720;
@@ -14,6 +15,11 @@ int main(void)

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;
LFR lfr(videoHeight, videoWidth, thresholdBinary, gaussKernelSize, [&](std::exception const &ex)
{
@@ -22,9 +28,11 @@ int main(void)
return false;
});

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

// Init Socket Communication
std::cout << "create socket" << std::endl;
LFR_Socket socket([&](std::exception const &ex)
{
@@ -33,5 +41,25 @@ int main(void)
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;
}

Loading…
Cancel
Save