VOXL OpenVINS Server 1.0
Visual Inertial Odometry Server for VOXL Platform
Loading...
Searching...
No Matches
ImuMinimal.h
Go to the documentation of this file.
1/**
2 * @file ImuMinimal.h
3 * @brief IMU interface and data handling for VOXL OpenVINS
4 * @author Zauberflote
5 * @date 2025
6 * @version 1.0
7 *
8 * This header defines the IMU interface and callback functions for handling
9 * inertial measurement unit data in the VOXL OpenVINS system. It provides
10 * the connection to the IMU service and data processing capabilities.
11 */
12
13#ifndef IMU_MODULE_H
14#define IMU_MODULE_H
15
16// Standard includes
17#include <mutex>
18#include <functional>
19#include <optional>
20#include <array>
21
22// Third-party includes
23#include <modal_pipe.h>
24
25// Local includes
26#include "VoxlVars.h"
27#include "VoxlCommon.h"
28#include "CameraQueueFusion.h"
29#include "VoxlHK.h"
30
31// ============================================================================
32// EXTERNAL DECLARATIONS
33// ============================================================================
34
35/** @brief Mutex for IMU data access synchronization */
36extern std::mutex imu_lock_mutex;
37
38// ============================================================================
39// CALLBACK FUNCTIONS
40// ============================================================================
41
42/**
43 * @brief Callback for IMU disconnect events
44 *
45 * This function is called when the IMU service disconnects. It handles
46 * the cleanup and state management required when IMU data becomes unavailable.
47 *
48 * @param ch Channel number (unused)
49 * @param context Context pointer (unused)
50 */
51void _imu_disconnect_cb(__attribute__((unused)) int ch,
52 __attribute__((unused)) void *context);
53
54/**
55 * @brief Handler for incoming IMU data
56 *
57 * This callback processes incoming IMU data, updates the system state,
58 * and triggers appropriate processing based on motion state. It serves
59 * as the primary entry point for all IMU data processing in the system.
60 *
61 * The function:
62 * - Extracts accelerometer and gyroscope measurements
63 * - Updates system timestamps and state
64 * - Triggers VIO processing when appropriate
65 * - Manages data synchronization with camera data
66 *
67 * @param ch Channel number (unused)
68 * @param data Pointer to IMU data buffer
69 * @param bytes Size of data buffer in bytes
70 * @param context Context pointer (unused)
71 */
72void _imu_data_handler_cb(__attribute__((unused)) int ch,
73 char *data, int bytes,
74 __attribute__((unused)) void *context);
75
76// ============================================================================
77// SERVICE MANAGEMENT
78// ============================================================================
79
80/**
81 * @brief Creates IMU pipe client and associated callbacks
82 *
83 * This function sets up the disconnect and data handler callbacks,
84 * and opens the client pipe connection to the IMU service. It initializes
85 * the complete IMU data pipeline for the VIO system.
86 *
87 * The function performs the following operations:
88 * - Sets up disconnect callback for graceful handling of service disconnection
89 * - Sets up data handler callback for processing incoming IMU measurements
90 * - Opens the client pipe connection to the IMU service
91 * - Configures the pipe for optimal data flow
92 *
93 * @return 0 on success, non-zero on failure
94 */
95int connect_imu_service(void);
96
97#endif // IMU_MODULE_H
Camera queue fusion system for VOXL OpenVINS.
void _imu_disconnect_cb(__attribute__((unused)) int ch, __attribute__((unused)) void *context)
Callback for IMU disconnect events.
void _imu_data_handler_cb(__attribute__((unused)) int ch, char *data, int bytes, __attribute__((unused)) void *context)
Handler for incoming IMU data.
int connect_imu_service(void)
Creates IMU pipe client and associated callbacks.
std::mutex imu_lock_mutex
Mutex for IMU data access synchronization.
Common definitions and utilities for the VOXL OpenVINS server.
Housekeeping and data publishing for VOXL OpenVINS.
Global variable declarations and constants for VOXL OpenVINS server.