32#include <condition_variable>
35#include <core/VioManager.h>
36#include <core/VioManagerOptions.h>
37#include <modal_pipe.h>
38#include <modal_json.h>
39#include <voxl_common_config.h>
44#define GYRO_VAR_THRESHOLD 0.09f
45#define ACC_VAR_THRESHOLD 0.09f
46#define VEL_MAG_JERK_THRESHOLD 0.02f
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;
190#define FEAT_OVERLAY_CH 9
218#define OV_VIO_CONTROL_COMMANDS (RESET_VIO_SOFT "," RESET_VIO_HARD)
226#define OV_VIO_EXTENDED_NAME "ov_extended"
233#define OV_VIO_EXTENDED_LOCATION MODAL_PIPE_DEFAULT_BASE_DIR OV_VIO_EXTENDED_NAME "/"
241#define OV_VIO_SIMPLE_NAME "ov"
248#define OV_VIO_SIMPLE_LOCATION MODAL_PIPE_DEFAULT_BASE_DIR OV_VIO_SIMPLE_NAME "/"
256#define OV_VIO_OVERLAY_NAME "ov_overlay"
263#define OV_VIO_OVERLAY_LOCATION MODAL_PIPE_DEFAULT_BASE_DIR OV_VIO_OVERLAY_NAME "/"
270#define OV_STATUS_NAME "ov_status"
277#define OV_STATUS_LOCATION MODAL_PIPE_DEFAULT_BASE_DIR OV_STATUS_NAME "/"
288#define PROCESS_NAME "voxl-open-vins-server"
303#define CHAR_BUF_SIZE 128
324extern std::unique_ptr<ov_msckf::VioManager>
vio_manager;
400extern std::condition_variable
reset_cv;
667 IMU_MODEL_UNKNOWN = 0,
793extern std::atomic<float>
alt_z;
796extern std::atomic<float>
vel_mag;
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.
float fusion_rate_dt_ms
Fusion rate in milliseconds.
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 takeoff_cam
Takeoff camera identifier.
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_fallback_timeout_s
Timeout for auto-fallback mode.
float auto_reset_max_velocity
Maximum velocity threshold for auto-reset.
std::atomic< uint8_t > vio_state
Current VIO system state.
std::atomic< bool > is_armed
System armed state.
char imu_name[64]
IMU service name.
voxl::FrameTransform frame_transform
Global frame transform instance.
std::atomic< float > alt_z
Altitude z.
std::atomic< bool > has_acc_jerk
Flag indicating if accelerometer jerk is detected.
bool en_cont_yaw_checks
Enable continuous yaw checks.
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.
std::atomic< float > vel_mag
Velocity Magnitude.
double window_size_s
Window size in seconds for jerk detection.
std::mutex reset_mtx
Mutex for reset.
float auto_reset_max_v_cov
Maximum velocity covariance for auto-reset.
int using_stereo
Using stereo camera configuration.
float ok_state_grace_timeout_s
Grace period timeout after entering OK state.
voxl::img_ringbuf_packet * img_ringbuf
Image ring buffer pointer.
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 auto_fallback_min_v
Minimum velocity for auto-fallback.
std::atomic< bool > has_gyro_jerk
Flag indicating if gyroscope jerk is detected.
std::atomic< double > imu_rate_hz
Estimated IMU sampling rate in Hz.
float takeoff_alt_threshold
Takeoff altitude threshold.
imu_model_t imu_model
Active IMU model detected from pipe info JSON.
int en_takeoff_cam
Enable takeoff camera functionality.
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.
std::vector< int > takeoff_cams
Vector of takeoff camera identifiers.
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.
float auto_reset_max_v_cov_instant
Maximum instantaneous velocity covariance for auto-reset.
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.