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.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;
|
||||||
@ -14,6 +15,11 @@ int main(void)
|
|||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@ -22,9 +28,11 @@ int main(void)
|
|||||||
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)
|
||||||
{
|
{
|
||||||
@ -33,5 +41,25 @@ int main(void)
|
|||||||
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…
x
Reference in New Issue
Block a user