VOXL OpenVINS Server 1.0
Visual Inertial Odometry Server for VOXL Platform
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
CameraQueueFusion Class Reference

Camera queue fusion system for multi-camera synchronization. More...

#include <CameraQueueFusion.h>

Public Member Functions

void start (size_t num_cams)
 Start the fusion system.
 
void markCameraReady (size_t cam_id)
 Mark a camera as ready with new data.
 
bool getSortedBatch (double timestamp_cutoff, std::vector< ov_core::CameraData > &out)
 Get sorted batch of camera data.
 

Static Public Member Functions

static CameraQueueFusiongetInstance ()
 Get singleton instance.
 

Detailed Description

Camera queue fusion system for multi-camera synchronization.

This class implements a sophisticated system for synchronizing and fusing data from multiple cameras. It uses a mask-based approach to track camera readiness and provides temporal alignment of camera data.

Features:

The system works by:

  1. Tracking which cameras have new data available
  2. Waiting for all expected cameras to be ready
  3. Fusing the synchronized data into batches
  4. Providing sorted output for VIO processing

Definition at line 71 of file CameraQueueFusion.h.

Member Function Documentation

◆ getInstance()

CameraQueueFusion & CameraQueueFusion::getInstance ( )
static

Get singleton instance.

Returns
Reference to the singleton CameraQueueFusion instance

Returns the single instance of the CameraQueueFusion, creating it if it doesn't exist (lazy initialization). This ensures that only one fusion system exists throughout the application lifecycle.

Returns
Reference to the singleton CameraQueueFusion instance

Definition at line 33 of file CameraQueueFusion.cpp.

Referenced by _imu_data_handler_cb(), and voxl::CameraManager::initialize().

Here is the caller graph for this function:

◆ getSortedBatch()

bool CameraQueueFusion::getSortedBatch ( double  timestamp_cutoff,
std::vector< ov_core::CameraData > &  out 
)

Get sorted batch of camera data.

Retrieves a batch of synchronized camera data that is sorted by timestamp and filtered by the specified cutoff time.

Parameters
timestamp_cutoffTimestamp cutoff for data inclusion
outOutput vector to store the sorted camera data
Returns
true if data was retrieved, false if no data available

Retrieves a batch of synchronized camera data that is sorted by timestamp and filtered by the specified cutoff time.

The method performs the following operations:

  • Locks the fusion mutex for thread-safe access
  • Checks if fused frames are available
  • Finds frames with timestamps greater than the cutoff
  • Moves qualifying frames to the output vector
  • Removes processed frames from the internal queue
Parameters
timestamp_cutoffTimestamp cutoff for data inclusion
outOutput vector to store the sorted camera data
Returns
true if data was retrieved, false if no data available

Definition at line 126 of file CameraQueueFusion.cpp.

Referenced by _imu_data_handler_cb().

Here is the caller graph for this function:

◆ markCameraReady()

void CameraQueueFusion::markCameraReady ( size_t  cam_id)

Mark a camera as ready with new data.

This method is called when a camera has new data available. It updates the camera ready mask and may trigger fusion processing.

Parameters
cam_idCamera identifier (0-based)

This method is called when a camera has new data available. It updates the camera ready mask and may trigger fusion processing.

The method performs the following operations:

  • Validates the camera ID to prevent buffer overflow
  • Sets the corresponding bit in the camera ready mask
  • Notifies the fusion thread that data is available

The camera ready mask uses a bit field where each bit represents whether a specific camera has new data available.

Parameters
cam_idCamera identifier (0-based)

Definition at line 93 of file CameraQueueFusion.cpp.

References MAX_CAMERA_COUNT.

◆ start()

void CameraQueueFusion::start ( size_t  num_cams)

Start the fusion system.

Initializes the fusion system with the specified number of cameras and starts the background fusion thread.

Parameters
num_camsNumber of cameras to synchronize

Initializes the fusion system with the specified number of cameras and starts the background fusion thread.

The initialization process includes:

  • Validating the number of cameras (must be > 0 and <= MAX_CAMERA_COUNT)
  • Setting up the expected mask for camera readiness tracking
  • Starting the background fusion thread
  • Setting the running flag

The expected mask is calculated as (1 << num_cams) - 1, which creates a bit mask with the lowest num_cams bits set to 1.

Parameters
num_camsNumber of cameras to synchronize

Definition at line 56 of file CameraQueueFusion.cpp.

References MAX_CAMERA_COUNT.

Referenced by voxl::CameraManager::initialize().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: