Central engineering reference and operations manual for the MRDT Autonomy Software.
View the Project on GitHub MissouriMRDT/Autonomy_Software
Return to RoveSoDocs Guides for Today, Tomorrow, and Forever.
The CameraHandler class (src/handlers/CameraHandler.h & CameraHandler.cpp) manages camera hardware lifecycle, initializes camera worker threads, provides centralized access to video feeds, and controls asynchronous video recording.
BUILD_SIM_MODE) and configuration settings (MODE_REAR_ZED).GetZED(), GetBasicCam()) accessible via globals::g_pCameraHandler to allow detector handlers to retrieve shared pointers to active camera streams.SIMZEDCam (WebRTC / LibDataChannel) when BUILD_SIM_MODE is enabled, or physical ZEDCam (ZED SDK 4.x) when running on physical hardware.RecordingHandler instance to write raw camera feeds to disk without blocking computer vision processing.The handler manages cameras designated by ZEDCamName and BasicCamName enumerations:
ZEDCamName::eHeadMainCam: The forward-facing ZED 2i stereoscopic camera mounted on the rover mast. Used as the primary feed for ArUco tag detection, YOLO object detection, visual odometry, and 3D geolocation.ZEDCamName::eRearCam: An optional rear-facing ZED stereoscopic camera (enabled when constants::MODE_REAR_ZED is true). Used for reversing maneuvers and rear situational awareness.BasicCamName: Extensible interface for standard V4L2 USB cameras or virtual simulation webcams (BasicCam / SIMBasicCam).CameraHandler inherits from AutonomyThread<void>.RequestFrameCopy(), RequestDepthCopy(), RequestPointCloudCopy(), RequestSensorsCopy()), preventing downstream inference latency from stalling hardware capture.// Startup sequence (in main.cpp)
globals::g_pCameraHandler = new CameraHandler();
globals::g_pCameraHandler->StartAllCameras();
globals::g_pCameraHandler->StartRecording();
// Accessing cameras in downstream modules:
std::shared_ptr<ZEDCamera> pMainCam = globals::g_pCameraHandler->GetZED(CameraHandler::ZEDCamName::eHeadMainCam);
// Asynchronously request color frame and point cloud
cv::Mat cvFrame;
cv::Mat cvPointCloud;
std::future<bool> fuFrame = pMainCam->RequestFrameCopy(cvFrame);
std::future<bool> fuCloud = pMainCam->RequestPointCloudCopy(cvPointCloud);
if (fuFrame.get() && fuCloud.get())
{
// Execute computer vision and 3D geolocation
}