87 std::shared_ptr<ZEDCamera> ExampleZEDCam1 = globals::g_pCameraHandler->GetZED(CameraHandler::ZEDCamName::eHeadMainCam);
89 ExampleZEDCam1->Start();
92 ExampleZEDCam1->EnablePositionalTracking();
94 if (ENABLE_SPATIAL_MAPPING)
97 ExampleZEDCam1->EnableSpatialMapping();
110 sl::SensorsData slSensors;
119 std::future<bool> fuFrameCopyStatus;
120 std::future<bool> fuDepthCopyStatus;
121 std::future<bool> fuPointCloudCopyStatus;
124 if (ExampleZEDCam1->GetUsingGPUMem())
127 fuFrameCopyStatus = ExampleZEDCam1->RequestFrameCopy(cvGPUNormalFrame1);
128 fuDepthCopyStatus = ExampleZEDCam1->RequestDepthCopy(cvGPUDepthFrame1,
false);
129 fuPointCloudCopyStatus = ExampleZEDCam1->RequestPointCloudCopy(cvGPUPointCloud1);
134 fuFrameCopyStatus = ExampleZEDCam1->RequestFrameCopy(cvNormalFrame1);
135 fuDepthCopyStatus = ExampleZEDCam1->RequestDepthCopy(cvDepthFrame1,
false);
136 fuPointCloudCopyStatus = ExampleZEDCam1->RequestPointCloudCopy(cvPointCloud1);
139 std::future<bool> fuPoseCopyStatus = ExampleZEDCam1->RequestPositionalPoseCopy(stPose);
140 std::future<bool> fuSensorsCopyStatus = ExampleZEDCam1->RequestSensorsCopy(slSensors);
143 if (fuFrameCopyStatus.get() && fuDepthCopyStatus.get() && fuPointCloudCopyStatus.get())
146 if (ExampleZEDCam1->GetUsingGPUMem())
149 cvGPUNormalFrame1.
download(cvNormalFrame1);
150 cvGPUDepthFrame1.
download(cvDepthFrame1);
151 cvGPUPointCloud1.
download(cvPointCloud1);
156 std::to_string(ExampleZEDCam1->GetIPS().GetExactIPS()),
169 if (fuPoseCopyStatus.get())
171 LOG_INFO(logging::g_qConsoleLogger,
172 "Positional Tracking: X: {} | Y: {} | Z: {}",
173 stPose.stTranslation.dX,
174 stPose.stTranslation.dY,
175 stPose.stTranslation.dZ);
176 LOG_INFO(logging::g_qConsoleLogger,
177 "Positional Orientation: Roll: {} | Pitch: {} | Yaw:{}",
178 stPose.stEulerAngles.dXO,
179 stPose.stEulerAngles.dYO,
180 stPose.stEulerAngles.dZO);
184 if (fuSensorsCopyStatus.get())
187 double dRelativeAltitude = slSensors.barometer.relative_altitude;
188 float fTemperature = 0.0;
189 slSensors.temperature.get(sl::SensorsData::TemperatureData::SENSOR_LOCATION::IMU, fTemperature);
190 float fMagHeading = slSensors.magnetometer.magnetic_heading;
191 float fIMUVelocityX = slSensors.imu.angular_velocity.x;
192 float fIMUVelocityY = slSensors.imu.angular_velocity.y;
193 float fIMUVelocityZ = slSensors.imu.angular_velocity.z;
194 sl::Matrix3f slIMUVelocityCov = slSensors.imu.angular_velocity_covariance.r;
195 float fAccelX = slSensors.imu.linear_acceleration.x;
196 float fAccelY = slSensors.imu.linear_acceleration.y;
197 float fAccelZ = slSensors.imu.linear_acceleration.z;
198 sl::Matrix3f slAccelCov = slSensors.imu.angular_velocity_covariance.r;
200 LOG_INFO(logging::g_qConsoleLogger,
201 "Sensors Data: Altitude: {} | Temperature: {} | Mag Heading: {}\nIMU VelX: {}\nIMU VelY: {}\nIMU VelZ: {}\nIMU AccelX: {}\nIMU AccelY: {}\n"
202 "IMU AccelZ: {}\nIMU VelCov: {}\nIMU AccelCov: {}",
217 LOG_INFO(logging::g_qConsoleLogger,
"ZED Getter FPS: {} | 1% Low: {}", ExampleZEDCam1->GetIPS().GetAverageIPS(), ExampleZEDCam1->GetIPS().Get1PercentLow());
219 if (ENABLE_SPATIAL_MAPPING)
221 LOG_INFO(logging::g_qConsoleLogger,
"Spatial Mapping State: {}", sl::toString(ExampleZEDCam1->GetSpatialMappingState()).get());
227 cv::imshow(
"POINT CLOUD COLOR 1", cvPointCloudColor1);
233 LOG_INFO(logging::g_qConsoleLogger,
"Main FPS: {}", FPS.
GetAverageIPS());
244 if (ENABLE_SPATIAL_MAPPING)
247 std::future<sl::Mesh> fuSpatialMap;
248 ExampleZEDCam1->ExtractSpatialMapAsync(fuSpatialMap);
249 sl::Mesh slSpatialMap = fuSpatialMap.get();
250 slSpatialMap.save(
"test.obj", sl::MESH_FILE_FORMAT::PLY);
257 network::g_bRoveCommUDPStatus =
false;
258 network::g_bRoveCommTCPStatus =
false;
261 globals::g_pCameraHandler->StopAllCameras();
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)
void SplitPointCloudColors(cv::Mat &cvInputPointCloud, cv::Mat &cvOutputColors)
Given a cv::Mat containing X, Y, Z, and BGRA values for each pixel in the third dimension,...
Definition ImageOperations.hpp:181