Start state machine
This commit is contained in:
parent
7411bdc628
commit
7c8dc41063
30
main.cpp
30
main.cpp
@ -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…
x
Reference in New Issue
Block a user