|
VOXL OpenVINS Server 1.0
Visual Inertial Odometry Server for VOXL Platform
|
Base class for all camera implementations. More...
#include <CameraBase.h>


Public Member Functions | |
| CameraBase (const cam_info &camera_info) | |
| Constructor. | |
| virtual | ~CameraBase ()=default |
| Virtual destructor. | |
| virtual bool | connect () |
| Initialize the camera pipe connection. | |
| virtual void | disconnect () |
| Disconnect and clean up resources. | |
| const cam_info & | get_camera_info () const |
| Get the camera information. | |
| bool | popCameraData (ov_core::CameraData &out) |
| Pop camera data from the queue. | |
| int | get_channel () const |
| Get the camera pipe channel. | |
| size_t | get_id () const |
| Get the camera identifier. | |
Protected Member Functions | |
| virtual void | process_image (const camera_image_metadata_t &meta, voxl::ImageType img_type, void *frame)=0 |
| Process incoming image data. | |
Static Protected Member Functions | |
| static void | camera_callback (int ch, camera_image_metadata_t meta, char *frame, void *context) |
| Common callback function for pipe client. | |
| static void | camera_device_buffer_callback (int ch, mpa_ion_buf_t *data, void *context) |
Protected Attributes | |
| cam_info | camera_info_ |
| Camera configuration information. | |
| int | channel_ {-1} |
| Channel used for pipe communication. | |
| bool | is_connected_ {false} |
| Indicates if camera is connected to pipe. | |
| std::mutex | mutex_ |
| Mutex for thread-safe operations. | |
| cl_context | ctx_ {nullptr} |
| OpenCL context used if GPU is enabled. | |
| cl_command_queue | q_ {nullptr} |
| OpenCL command queue used if GPU is enabled. | |
| boost::lockfree::spsc_queue< ov_core::CameraData, boost::lockfree::capacity< 64 > > | camera_queue |
| Lock-free SPSC queue for camera data. | |
| img_ringbuf_packet | curr_message_ |
| Instance-local buffer for image processing. | |
| cv::Mat | use_mask_ |
| Per-instance reusable mask for feature tracking. | |
| bool | drop_frames {false} |
| Indicates if frames should be dropped. | |
| bool | skip_jerk_detection {true} |
| Indicates if jerk detection should be skipped. | |
Base class for all camera implementations.
This abstract class defines the interface for camera handlers in the system. It provides the foundation for different camera types (mono, stereo, etc.) and handles pipe communication, image processing, and VIO integration.
The class manages:
Definition at line 56 of file CameraBase.h.
|
explicit |
Constructor.
Constructor for CameraBase.
| camera_info | Camera configuration information |
Initializes a camera instance with the provided configuration information. Sets up the camera with default values and prepares it for connection.
| camera_info | Camera configuration and calibration information |
Definition at line 41 of file CameraBase.cpp.
|
virtualdefault |
Virtual destructor.
|
staticprotected |
Common callback function for pipe client.
This function receives raw image data from the pipe and dispatches it to the appropriate processing method. It serves as the entry point for all camera data processing.
| ch | Channel number |
| meta | Image metadata |
| frame | Pointer to image data |
| context | Context pointer (the CameraBase instance) |
This function receives raw image data from the pipe and dispatches it to the appropriate processing method. It serves as the entry point for all camera data processing.
The callback performs the following operations:
| ch | Channel number (unused) |
| meta | Image metadata containing timestamp and format information |
| frame | Pointer to image data buffer |
| context | Context pointer (the CameraBase instance) |
Definition at line 186 of file CameraBase.cpp.
References main_running, process_image(), and vio_error_codes.
Referenced by connect().


|
staticprotected |
Definition at line 213 of file CameraBase.cpp.
|
virtual |
Initialize the camera pipe connection.
Connect to the camera pipe service.
This method establishes the connection to the camera pipe service and sets up the necessary callbacks for image data reception.
This method establishes the connection to the camera pipe service and sets up the necessary callbacks for image data reception.
The connection process includes:
Definition at line 60 of file CameraBase.cpp.
References camera_callback(), camera_info_, channel_, en_debug, is_connected_, mutex_, cam_info::name, PROCESS_NAME, cam_info::tracking_name, and vio_error_codes.

|
virtual |
Disconnect and clean up resources.
This method properly closes the pipe connection and cleans up any allocated resources.
This method properly closes the pipe connection and cleans up any allocated resources. It ensures a clean shutdown of the camera connection.
The disconnection process includes:
The method is thread-safe and handles cases where the camera is already disconnected.
Definition at line 139 of file CameraBase.cpp.
References camera_info_, channel_, en_debug, is_connected_, mutex_, and cam_info::name.
|
inline |
Get the camera information.
Definition at line 92 of file CameraBase.h.
References camera_info_.
|
inline |
Get the camera pipe channel.
Definition at line 113 of file CameraBase.h.
References channel_.
|
inline |
Get the camera identifier.
Definition at line 119 of file CameraBase.h.
References cam_info::cam_id, and camera_info_.
|
inline |
Pop camera data from the queue.
Retrieves the next available camera data from the internal queue. This method is used to get processed image data for VIO processing.
The method uses a lock-free SPSC (Single Producer, Single Consumer) queue for efficient thread-safe data transfer between the camera callback thread and the VIO processing thread.
| out | Reference to store the popped data |
Definition at line 107 of file CameraBase.h.
References camera_queue.
|
protectedpure virtual |
Process incoming image data.
This method is called by the pipe callback when new image data arrives. Derived classes must implement this method to handle their specific image processing requirements.
| meta | Image metadata containing timestamp and other information |
| frame | Pointer to image data buffer |
Implemented in voxl::MonoCamera, and voxl::StereoCamera.
Referenced by camera_callback().

|
protected |
Camera configuration information.
Definition at line 155 of file CameraBase.h.
Referenced by connect(), disconnect(), get_camera_info(), and get_id().
|
protected |
Lock-free SPSC queue for camera data.
Used for efficient communication between camera thread and VIO thread. Capacity of 64 provides approximately 2.4 seconds of buffering at 30fps.
Definition at line 178 of file CameraBase.h.
Referenced by popCameraData().
|
protected |
Channel used for pipe communication.
Definition at line 158 of file CameraBase.h.
Referenced by connect(), disconnect(), and get_channel().
|
protected |
OpenCL context used if GPU is enabled.
Definition at line 167 of file CameraBase.h.
|
protected |
Instance-local buffer for image processing.
Definition at line 181 of file CameraBase.h.
|
protected |
Indicates if frames should be dropped.
Definition at line 187 of file CameraBase.h.
Referenced by voxl::MonoCamera::process_image().
|
protected |
Indicates if camera is connected to pipe.
Definition at line 161 of file CameraBase.h.
Referenced by connect(), and disconnect().
|
protected |
Mutex for thread-safe operations.
Definition at line 164 of file CameraBase.h.
Referenced by connect(), and disconnect().
|
protected |
OpenCL command queue used if GPU is enabled.
Definition at line 170 of file CameraBase.h.
|
protected |
Indicates if jerk detection should be skipped.
Definition at line 190 of file CameraBase.h.
Referenced by voxl::MonoCamera::process_image().
|
protected |
Per-instance reusable mask for feature tracking.
Definition at line 184 of file CameraBase.h.