32#include <condition_variable>
35#include <core/VioManager.h>
36#include <modal_flow/StereoMatcher.hpp>
37#include <core/VioManagerOptions.h>
38#include <modal_pipe.h>
39#include <modal_json.h>
40#include <voxl_common_config.h>
45#define GYRO_VAR_THRESHOLD 0.09f
46#define ACC_VAR_THRESHOLD 0.09f
106 Axis gravity_axis{Axis::Z};
107 Direction gravity_direction{Direction::NEGATIVE};
108 bool is_initialized{
false};
110 Eigen::Matrix3d correction_matrix{Eigen::Matrix3d::Identity()};
111 Eigen::Vector3d avg_acc_1t0{Eigen::Vector3d::Zero()};
112 Eigen::Vector3d avg_gyro_1t0{Eigen::Vector3d::Zero()};
113 Eigen::Vector3d avg_acc_2t1{Eigen::Vector3d::Zero()};
114 Eigen::Vector3d avg_gyro_2t1{Eigen::Vector3d::Zero()};
115 float expected_total_samples{1024.0f};
116 float current_total_samples{0.0f};
117 std::deque<Eigen::Vector3d> acc1t0_samples;
118 std::deque<Eigen::Vector3d> gyro1t0_samples;
119 std::deque<Eigen::Vector3d> acc2t1_samples;
120 std::deque<Eigen::Vector3d> gyro2t1_samples;
121 JerkOption jerk_opt{JerkOption::ACCEL_ONLY};
123 void update(
const imu_data_t &data);
125 void detectJerk(
const imu_data_t &data);
127 void resetJerkDetection();
129 Eigen::Vector3d transform(
const Eigen::Vector3d &v)
const
131 return correction_matrix * v;
186#define OV_VIO_CONTROL_COMMANDS (RESET_VIO_SOFT "," RESET_VIO_HARD)
194#define OV_VIO_EXTENDED_NAME "ov_extended"
201#define OV_VIO_EXTENDED_LOCATION MODAL_PIPE_DEFAULT_BASE_DIR OV_VIO_EXTENDED_NAME "/"
209#define OV_VIO_SIMPLE_NAME "ov"
216#define OV_VIO_SIMPLE_LOCATION MODAL_PIPE_DEFAULT_BASE_DIR OV_VIO_SIMPLE_NAME "/"
223#define OV_STATUS_NAME "ov_status"
230#define OV_STATUS_LOCATION MODAL_PIPE_DEFAULT_BASE_DIR OV_STATUS_NAME "/"
241#define PROCESS_NAME "voxl-open-vins-server"
256#define CHAR_BUF_SIZE 128
277extern std::unique_ptr<ov_msckf::VioManager>
vio_manager;
364extern std::condition_variable
reset_cv;
575 IMU_MODEL_UNKNOWN = 0,
666extern std::atomic<float>
alt_z;
707extern bool g_stereo_calib_valid;
Common definitions and utilities for the VOXL OpenVINS server.
constexpr size_t MAX_IMAGE_SIZE
Maximum size for image data buffer.
int en_verbose
Enable verbose output.
bool occlude_stereo_right
Occlude stereo right.
int cameras_used
Number of cameras currently in use.
volatile int64_t last_cam_time
Last camera timestamp.
std::atomic< bool > non_static
Non-static flag for jerk detection.
volatile int64_t last_imu_timestamp_ns
Last IMU timestamp in nanoseconds.
int camera_pipe_channels[MAX_CAM_CNT]
Camera pipe channel array.
volatile int main_running
Main server running state.
char folder_base[CHAR_BUF_SIZE]
Base folder for yaml configuration files.
std::atomic< uint32_t > active_callbacks
Number of callbacks inside the system.
ov_msckf::VioManagerOptions vio_manager_options
VIO manager options.
int quality_initial_to_bad_count
Consecutive samples for INITIAL→BAD transition.
std::atomic< bool > is_resetting
VIO reset state flag.
int quality_low_thresh_initial
Quality low threshold for INITIAL state.
int quality_bad_to_good_count
Consecutive samples for BAD→GOOD transition.
float fast_yaw_thresh
Fast yaw threshold.
int en_auto_reset
Enable automatic VIO reset.
float auto_reset_max_velocity
Maximum velocity threshold for auto-reset.
std::atomic< uint8_t > vio_state
Current VIO system state.
float stereo_z_max
far depth bound for epipolar search (m)
char imu_name[64]
IMU service name.
voxl::FrameTransform frame_transform
Global frame transform instance.
std::atomic< float > alt_z
Altitude z.
modal_flow::StereoCalib g_stereo_calib
composed by VoxlConfigure
std::atomic< bool > has_acc_jerk
Flag indicating if accelerometer jerk is detected.
bool occlude_stereo_left
Occlude stereo left.
int quality_good_to_bad_count
Consecutive samples for GOOD→BAD transition.
std::atomic< uint32_t > vio_error_codes
VIO error codes.
float auto_reset_max_v_cov_timeout_s
Timeout for velocity covariance auto-reset.
float stereo_z_min
near depth bound for epipolar search (m)
std::mutex reset_mtx
Mutex for reset.
int using_stereo
Using stereo camera configuration.
float imu_init_max_gravity_angle_deg
Server-side IMU frame-transform bring-up gravity gate (degrees)
float ok_state_grace_timeout_s
Grace period timeout after entering OK state.
bool en_imu_body
Enable IMU body measurements.
float auto_reset_min_feature_timeout_s
Timeout for minimum features auto-reset.
imu_model_t
Enumeration of supported IMU models.
std::atomic< bool > is_imu_connected
IMU connection state.
std::atomic< bool > reset_requested
Should reset floag.
float takeoff_alt_threshold
Takeoff altitude threshold.
imu_model_t imu_model
Active IMU model detected from pipe info JSON.
std::atomic< uint32_t > soft_reset_num_counter
Counter which increments only on SOFT (front-end-preserving) resets.
std::atomic< bool > soft_reset_requested
Flag indicating that a front-end-preserving SOFT reset was requested.
std::atomic< uint32_t > reset_num_counter
Counter which increments on resets.
float fast_yaw_timeout_s
Fast yaw timeout.
int auto_reset_min_features
Minimum number of features for auto-reset.
std::unique_ptr< ov_msckf::VioManager > vio_manager
Global VIO manager instance.
std::atomic< bool > is_cam_connected
Camera connection state.
int quality_high_thresh
Quality high threshold for recovery.
#define CHAR_BUF_SIZE
Standard character buffer size.
std::mutex imu_lock_mutex
Mutex for IMU data access synchronization.
int en_debug
Enable debug output.
std::vector< cam_info > cam_info_vec
Camera information vector.
int quality_low_thresh_good
Quality low threshold for GOOD state.
int quality_initial_to_good_count
Consecutive samples for INITIAL→GOOD transition.
int config_only
Configuration only mode.
#define MAX_CAM_CNT
Maximum number of cameras supported by VOXL2.
std::condition_variable reset_cv
Reset conditional variable.
bool sync_config
Flag to indicate if configuration synchronization is enabled.
Main namespace for VOXL OpenVINS server components.
Structure to hold image data packet for the ring buffer.
uint8_t image_pixels[MAX_IMAGE_SIZE]
Raw image pixel data.
camera_image_metadata_t metadata
Image metadata (timestamp, format, etc.)
int camid
Camera identifier.