14#include "../../../interfaces/AutonomyThread.hpp"
15#include "../../../interfaces/ZEDCamera.hpp"
19#include <RoveComm/RoveComm.h>
20#include <RoveComm/RoveCommManifest.h>
21#include <opencv2/opencv.hpp>
43 const int nPropResolutionX,
44 const int nPropResolutionY,
45 const int nPropFramesPerSecond,
46 const double dPropHorizontalFOV,
47 const double dPropVerticalFOV,
48 const bool bEnableRecordingFlag,
49 const int nNumFrameRetrievalThreads = 10,
50 const unsigned int unCameraSerialNumber = 0);
64 sl::ERROR_CODE
EnablePositionalTracking(
const float fExpectedCameraHeightFromFloorTolerance = constants::ZED_DEFAULT_FLOOR_PLANE_ERROR)
override;
66 void SetPositionalPose(
const double dX,
const double dY,
const double dZ,
const double dXO,
const double dYO,
const double dZO)
override;
96 const std::function<void(
const rovecomm::RoveCommPacket<double>&,
const sockaddr_in&)>
ProcessIMUData =
97 [
this](
const rovecomm::RoveCommPacket<double>& stPacket,
const sockaddr_in& stdAddr)
103 std::unique_lock<std::shared_mutex> lkSensorsProcessLock(m_muSensorsCopyMutex);
105 m_stIMUData.imu.linear_acceleration.x =
static_cast<float>(stPacket.vData[0]);
106 m_stIMUData.imu.linear_acceleration.y =
static_cast<float>(stPacket.vData[1]);
107 m_stIMUData.imu.linear_acceleration.z =
static_cast<float>(stPacket.vData[2]);
108 m_stIMUData.imu.angular_velocity.x =
static_cast<float>(stPacket.vData[3]);
109 m_stIMUData.imu.angular_velocity.y =
static_cast<float>(stPacket.vData[4]);
110 m_stIMUData.imu.angular_velocity.z =
static_cast<float>(stPacket.vData[5]);
114 double dQx = stPacket.vData[6];
115 double dQy = stPacket.vData[7];
116 double dQz = stPacket.vData[8];
117 double dQw = stPacket.vData[9];
118 double dRoll = std::atan2(2.0 * (dQw * dQx + dQy * dQz), 1.0 - 2.0 * (dQx * dQx + dQy * dQy));
119 double dPitch = std::asin(2.0 * (dQw * dQy - dQz * dQx));
120 double dYaw = std::atan2(2.0 * (dQw * dQz + dQx * dQy), 1.0 - 2.0 * (dQy * dQy + dQz * dQz));
122 sl::float3 slEulerAngles(
static_cast<float>(dRoll),
static_cast<float>(dPitch),
static_cast<float>(dYaw));
123 sl::Transform slIMUTransform;
124 slIMUTransform.setEulerAngles(slEulerAngles);
125 m_stIMUData.imu.pose = slIMUTransform;
128 lkSensorsProcessLock.unlock();
131 LOG_DEBUG(logging::g_qSharedLogger,
132 "Incoming IMU data processed from RoveComm for SIM ZED Camera: (AccelX {}, AccelY {}, AccelZ {}, GyroX {}, GyroY {}, GyroZ {})",
147 std::string m_szCameraPath;
148 std::atomic<bool> m_bCameraPositionalTrackingEnabled;
149 std::string m_szFullStreamName;
152 sl::SensorsData m_stIMUData;
156 std::unique_ptr<WebRTC> m_pRGBStream;
157 std::unique_ptr<WebRTC> m_pDepthImageStream;
161 double m_dPoseOffsetX;
162 double m_dPoseOffsetY;
163 double m_dPoseOffsetZ;
164 double m_dPoseOffsetXO;
165 double m_dPoseOffsetYO;
166 double m_dPoseOffsetZO;
171 std::shared_mutex m_muCurrentRoverPoseMutex;
181 std::queue<containers::DataFetchContainer<Pose>> m_qPoseCopySchedule;
182 std::queue<containers::DataFetchContainer<sl::SensorsData>> m_qSensorsCopySchedule;
186 std::shared_mutex m_muWebRTCRGBImageCopyMutex;
187 std::shared_mutex m_muWebRTCDepthImageCopyMutex;
190 std::shared_mutex m_muPoseCopyMutex;
191 std::shared_mutex m_muSensorsCopyMutex;
195 bool m_bQueueTogglesAlreadyReset;
196 std::atomic<bool> m_bPosesQueued;
197 std::atomic<bool> m_bSensorsQueued;
This class implements and interfaces with the SIM cameras and data. It is designed in such a way that...
Definition SIMZEDCam.h:36
void CalculatePointCloud(const cv::Mat &cvDepthMeasure, cv::Mat &cvPointCloud)
This method calculates a point cloud from the decoded depth measure use some simple trig and the came...
Definition SIMZEDCam.cpp:244
void EstimateDepthMeasure(const cv::Mat &cvDepthImage, cv::Mat &cvDepthMeasure)
This method estimates the depth measure from the depth image.
Definition SIMZEDCam.cpp:197
std::future< bool > RequestDepthCopy(cv::Mat &cvDepth, const bool bRetrieveMeasure=true)
Requests a depth measure or image from the camera. Puts a frame pointer into a queue so a copy of a f...
Definition SIMZEDCam.cpp:542
~SIMZEDCam()
Destroy the SIM Cam:: SIM Cam object.
Definition SIMZEDCam.cpp:133
void ThreadedContinuousCode() override
The code inside this private method runs in a separate thread, but still has access to this*....
Definition SIMZEDCam.cpp:296
sl::ERROR_CODE RebootCamera() override
This method is used to reboot the camera. This method will stop the camera thread,...
Definition SIMZEDCam.cpp:711
sl::ERROR_CODE EnablePositionalTracking(const float fExpectedCameraHeightFromFloorTolerance=constants::ZED_DEFAULT_FLOOR_PLANE_ERROR) override
This method is used to enable positional tracking on the camera. Since this is a simulation camera,...
Definition SIMZEDCam.cpp:745
std::future< bool > RequestFrameCopy(cv::Mat &cvFrame) override
Puts a frame pointer into a queue so a copy of a frame from the camera can be written to it....
Definition SIMZEDCam.cpp:511
void SetCallbacks()
This method sets the callbacks for the WebRTC connections.
Definition SIMZEDCam.cpp:157
std::string GetCameraModel() override
Accessor for the name of this model of camera.
Definition SIMZEDCam.cpp:834
std::future< bool > RequestPositionalPoseCopy(Pose &stPose) override
Puts a sl::GeoPose pointer into a queue so a copy of a GeoPose from the camera can be written to it.
Definition SIMZEDCam.cpp:603
std::future< bool > RequestPointCloudCopy(cv::Mat &cvPointCloud)
Requests a point cloud image from the camera. This image has the same resolution as a normal image bu...
Definition SIMZEDCam.cpp:578
sl::ERROR_CODE ResetPositionalTracking() override
This method is used to reset the positional tracking of the camera. Because this is a simulation came...
Definition SIMZEDCam.cpp:686
bool GetUsingGPUMem() const override
Returns if the camera is using GPU memory. This is a simulation camera, so this method will always re...
Definition SIMZEDCam.cpp:821
const std::function< void(const rovecomm::RoveCommPacket< double > &, const sockaddr_in &)> ProcessIMUData
Callback function to process incoming IMU data from RoveComm for the SIM ZED Camera....
Definition SIMZEDCam.h:96
bool GetPositionalTrackingEnabled() override
Accessor for the if the camera's positional tracking is enabled. Since this is a simulation camera,...
Definition SIMZEDCam.cpp:849
void SetPositionalPose(const double dX, const double dY, const double dZ, const double dXO, const double dYO, const double dZO) override
This method is used to set the positional pose of the camera. Since this is a simulation camera,...
Definition SIMZEDCam.cpp:783
bool GetCameraIsOpen() override
Accessor for the camera open status.
Definition SIMZEDCam.cpp:806
void DisablePositionalTracking() override
This method is used to disable positional tracking on the camera. Since this is a simulation camera,...
Definition SIMZEDCam.cpp:763
void PooledLinearCode() override
This method holds the code that is ran in the thread pool started by the ThreadedLinearCode() method....
Definition SIMZEDCam.cpp:386
std::future< bool > RequestSensorsCopy(sl::SensorsData &slSensorsData) override
Requests a copy of the sensors data from the camera.
Definition SIMZEDCam.cpp:653
This class serves as a middle inheritor between the Camera interface and the ZEDCam class....
Definition ZEDCamera.hpp:33
This struct is used within the ZEDCam class to store the camera pose with high precision....
Definition ZEDCamera.hpp:77
This struct is used by the WaypointHandler to provide an easy way to store all pose data about the ro...
Definition GeospatialOperations.hpp:708