-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
33 lines (30 loc) · 1.34 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "thread.h"
int main()
{
// 工厂模板类
Factory<TaskData> task_factory(3);
Factory<VisionSendData> data_transmit_factory(5);
Factory<VisionRecvData> data_receive_factory(6);
ThreadManager thread_manager;
thread_manager.InitManager("/home/wpj/RM_Vision_code_US/auto_aim_HDUS/config.yaml");
/*--------串口发送线程--------*/
thread transmitter(&ThreadManager::dataTransmitter, &thread_manager, std::ref(data_transmit_factory));
fmt::print(fmt::fg(fmt::color::blue), "Transmitter start !!!!!!!!!!\n");
/*--------相机更新线程--------*/
thread task_producer(&ThreadManager::producer, &thread_manager, std::ref(task_factory));
fmt::print(fmt::fg(fmt::color::blue), "Producer start !!!!!!!!!!\n");
/*--------自瞄线程-----------*/
thread task_consumer(&ThreadManager::consumer, &thread_manager, std::ref(task_factory), std::ref(data_transmit_factory), std::ref(data_receive_factory));
fmt::print(fmt::fg(fmt::color::blue), "Consumer start !!!!!!!!!!\n");
/*--------接受线程----000----*/
thread receiver(&ThreadManager::dataReceiver, &thread_manager, std::ref(data_receive_factory));
fmt::print(fmt::fg(fmt::color::blue), "Receiver start !!!!!!!!!!\n");
transmitter.join();
task_producer.join();
task_consumer.join();
#ifdef isIMU
printf("IMU start !!!!!!!!!!\n");
receiver.join();
#endif
return 0;
}