Browse Source

lfr_central

master
Tim Zeuner 1 year ago
parent
commit
6e4500d932
2 changed files with 61 additions and 0 deletions
  1. 24
    0
      CMakeLists.txt
  2. 37
    0
      main.cpp

+ 24
- 0
CMakeLists.txt View File

@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.1.0)
project(lfr_central VERSION 0.1.0)

include(CTest)
enable_testing()

set(THREADS_PREFER_PTHREAD_FLAG ON)

add_subdirectory(AutonomousMode)
add_subdirectory(Communication)
add_subdirectory(Socket)

add_executable(lfr_central main.cpp)

target_include_directories(lfr_central PRIVATE ${lfr_image_processing_SOURCE_DIRS})
target_include_directories(lfr_central PRIVATE ${lfr_uart_SOURCE_DIRS})
target_include_directories(lfr_central PRIVATE ${lfr_socket_SOURCE_DIRS})


target_link_libraries( lfr_central lfr_image_processing_lib lfr_uart_lib lfr_socket_lib)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

+ 37
- 0
main.cpp View File

@@ -0,0 +1,37 @@
#include <iostream>
#include <lfr.h>
#include <lfr_socket.h>
#include <uart_communication.h>

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

const int thresholdBinary = 140;
const int videoHeight = 720;
const int videoWidth = 1280;
const int gaussKernelSize = 11;

std::mutex mutex;

std::cout << "create lfr" << std::endl;
LFR lfr(videoHeight, videoWidth, thresholdBinary, gaussKernelSize, [&](std::exception const &ex)
{
std::unique_lock<std::mutex> lock(mutex);
std::cerr<<"camera exception:"<<ex.what()<<std::endl;
return false;
});

std::cout << "create uart" << std::endl;
LFR_UART uartCommunicator;

std::cout << "create socket" << std::endl;
LFR_Socket socket([&](std::exception const &ex)
{
std::unique_lock<std::mutex> lock(mutex);
std::cerr<<"socket exception:"<<ex.what()<<std::endl;
return false;
});

return 0;
}

Loading…
Cancel
Save