27{
28
31
32
33 std::shared_ptr<ZEDCamera> ExampleZEDCam1 = globals::g_pCameraHandler->GetZED(CameraHandler::ZEDCamName::eHeadMainCam);
34
35 ExampleZEDCam1->Start();
36
37
38 std::shared_ptr<TagDetector> ExampleTagDetector1 = globals::g_pTagDetectionHandler->GetTagDetector(TagDetectionHandler::TagDetectors::eHeadMainCam);
39
40 ExampleTagDetector1->Start();
41
42
46
47 std::vector<tagdetectutils::ArucoTag> vTagDetections1;
48
49
51
52
53 while (true)
54 {
55
56 std::future<bool> fuCopyStatus1;
57 std::future<bool> fuDetectionCopyStatus1;
58 std::future<bool> fuDetectionFrameCopyStatus1;
59
60
61 if (ExampleZEDCam1->GetUsingGPUMem())
62 {
63
64 fuCopyStatus1 = ExampleZEDCam1->RequestFrameCopy(cvGPUNormalFrame1);
65 }
66 else
67 {
68
69 fuCopyStatus1 = ExampleZEDCam1->RequestFrameCopy(cvNormalFrame1);
70 }
71
72 fuDetectionFrameCopyStatus1 = ExampleTagDetector1->RequestDetectionOverlayFrame(cvDetectionsFrame1);
73
74 fuDetectionCopyStatus1 = ExampleTagDetector1->RequestDetectedArucoTags(vTagDetections1);
75
76
77 if (fuCopyStatus1.get())
78 {
79
80 if (ExampleZEDCam1->GetUsingGPUMem())
81 {
82
83 cvGPUNormalFrame1.
download(cvNormalFrame1);
84 }
85
86
88 std::to_string(ExampleZEDCam1->GetIPS().GetExactIPS()),
91 1,
93
94
95 cv::imshow(
"BasicCamExample Frame1", cvNormalFrame1);
96 }
97
98
99 if (fuDetectionFrameCopyStatus1.get() && !cvDetectionsFrame1.
empty())
100 {
101
103 std::to_string(ExampleTagDetector1->GetIPS().GetExactIPS()),
106 1,
108
109
110 cv::imshow(
"Detections Overlay Frame1", cvDetectionsFrame1);
111 }
112
113
114 if (fuDetectionCopyStatus1.get())
115 {
116
117 LOG_INFO(logging::g_qConsoleLogger, "Detections1 vector length: {}", vTagDetections1.size());
118 }
119
120
122
123 LOG_INFO(logging::g_qConsoleLogger,
"Main FPS: {}", FPS.
GetAverageIPS());
124
126 if (chKey == 27)
127 break;
128 }
129
130
132
134
136
137 network::g_bRoveCommUDPStatus = false;
138 network::g_bRoveCommTCPStatus = false;
139
140
141 globals::g_pTagDetectionHandler->StopAllDetectors();
142 globals::g_pCameraHandler->StopAllCameras();
143}
The CameraHandler class is responsible for managing all of the camera feeds that Autonomy_Software us...
Definition CameraHandler.h:34
This util class provides an easy way to keep track of iterations per second for any body of code.
Definition IPS.hpp:30
double GetAverageIPS() const
Calculates the average iterations per second.
Definition IPS.hpp:180
void Tick()
This method is used to update the iterations per second counter and recalculate all of the IPS metric...
Definition IPS.hpp:138
The TagDetectionHandler class is responsible for managing all of the different detectors that Autonom...
Definition TagDetectionHandler.h:28
void download(OutputArray dst) const
void imshow(const String &winname, InputArray mat)
void putText(InputOutputArray img, const String &text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, int lineType=LINE_8, bool bottomLeftOrigin=false)