|
VOXL OpenVINS Server 0.7.0
Visual Inertial Odometry Server for VOXL Platform
|
Singleton class for publishing VIO data. More...
#include <VoxlHK.h>
Public Member Functions | |
| Publisher (const Publisher &)=delete | |
| Publisher & | operator= (const Publisher &)=delete |
| void | start () |
| Start the publisher. | |
| void | publish (std::shared_ptr< ov_msckf::State > state, const std::map< double, std::vector< std::shared_ptr< ov_core::Feature > > > &used_features_map={}) |
| Publish VIO data. | |
| void | stop () |
| Stop the publisher. | |
| bool | should_auto_reset (std::shared_ptr< ov_msckf::State > state, int quality, int n_features, double yawrate, double current_velocity, double vel_x, double vel_y) |
| Check if auto-reset should be triggered. | |
| double | calcQuality (const std::map< double, std::vector< std::shared_ptr< ov_core::Feature > > > &used_features_map, std::unordered_map< size_t, std::shared_ptr< ov_type::Landmark > > &slam_features, std::shared_ptr< ov_msckf::State > state) |
| Calculate Quality of the VIO state (async-aware per-camera freshness ledger) | |
| void | set_first_packet (bool first_packet_) |
| Set the first packet flag. | |
| void | publishBlank () |
Static Public Member Functions | |
| static Publisher & | getInstance () |
| Get singleton instance. | |
| static void | ov_vio_control_pipe_cb (int ch, char *string, int bytes, void *context) |
| Control pipe callback function. | |
Singleton class for publishing VIO data.
This class manages the publication of VIO data to external systems through pipe interfaces. It implements the singleton pattern to ensure only one instance exists throughout the application lifecycle.
The publisher handles:
| double Publisher::calcQuality | ( | const std::map< double, std::vector< std::shared_ptr< ov_core::Feature > > > & | used_features_map, |
| std::unordered_map< size_t, std::shared_ptr< ov_type::Landmark > > & | slam_features, | ||
| std::shared_ptr< ov_msckf::State > | state | ||
| ) |
Calculate Quality of the VIO state (async-aware per-camera freshness ledger)
Pools all used-feature entries from the last QUAL_UNION_WINDOW_S (dedup by featid) and scores each camera over the pooled set with the unchanged synced-path grid metric (5x5 grid, SLAM features weighted by covariance largest eigenvalue + quality field, MSCKF by quality field + track length), sum-then-clamp as sync always fused. The union gives each camera its full recent track set – one update's used list is a sparse, noisy sample – so async ticks score like synced batches; a time-constant EMA smooths the published value against single weak updates. Floor is 10 while running (the metric alone must not trip the sustained quality<1 auto-reset timers); resets/FAILED force 0/-1 in publish() itself.
Must only be called from the VIO thread (publish); uses the qual_ema state with no locks by design.
| used_features_map | Map of used features keyed by update (epoch) timestamp |
| slam_features | Map of SLAM features from the state |
| state | Current VIO state for covariance access |
Definition at line 1541 of file VoxlPublisher.cpp.
References vio_manager.
Referenced by publish().

|
inlinestatic |
Get singleton instance.
Definition at line 137 of file VoxlHK.h.
Referenced by main(), and voxl::register_vio_camera_callback().

|
static |
Control pipe callback function.
Control-pipe callback for VIO commands.
Callback function to handle control pipe messages
This function is invoked every time a message is received on the VIO control pipe.
| ch | Channel id supplied by the pipe framework. |
| string | Pointer to the received buffer. |
| bytes | Number of valid bytes in string. |
| context | User context pointer supplied during registration. |
STR_MATCH() macro, which compares the prefix of string against the command literal. Definition at line 93 of file VoxlPublisher.cpp.
References is_resetting, reset_requested, and soft_reset_requested.
| void Publisher::publish | ( | std::shared_ptr< ov_msckf::State > | state, |
| const std::map< double, std::vector< std::shared_ptr< ov_core::Feature > > > & | used_features_map = {} |
||
| ) |
Publish VIO data.
Publish VIO data to external systems.
Publishes the current VIO state and tracking information to external systems through the configured pipe interfaces.
| state | Current VIO state |
| used_features_map | Used-features map, by reference (no copy). The caller runs on the VIO thread synchronously after the update, so the reference stays valid for the whole call; publish must never re-enter feed/drain. |
This method formats and publishes the current VIO state and tracking information to external systems through the configured pipe interfaces.
The function performs the following operations:
The coordinate frame transformation involves:
| state | Current VIO state containing pose, velocity, and covariance |
Definition at line 151 of file VoxlPublisher.cpp.
References alt_z, auto_reset_max_v_cov_timeout_s, auto_reset_max_velocity, auto_reset_min_feature_timeout_s, auto_reset_min_features, calcQuality(), voxl::dirtyOmega(), en_debug, EXTENDED_CH, fast_yaw_thresh, fast_yaw_timeout_s, frame_transform, has_acc_jerk, is_resetting, non_static, ok_state_grace_timeout_s, quality_bad_to_good_count, quality_good_to_bad_count, quality_high_thresh, quality_initial_to_bad_count, quality_initial_to_good_count, quality_low_thresh_good, quality_low_thresh_initial, voxl::R_OV_FRD(), reset_num_counter, reset_requested, should_auto_reset(), SIMPLE_CH, vio_error_codes, vio_manager, and vio_state.
Referenced by voxl::register_vio_camera_callback().


| void Publisher::publishBlank | ( | ) |
Definition at line 1654 of file VoxlPublisher.cpp.
|
inline |
| bool Publisher::should_auto_reset | ( | std::shared_ptr< ov_msckf::State > | state, |
| int | quality, | ||
| int | n_features, | ||
| double | yawrate, | ||
| double | current_velocity, | ||
| double | vel_x, | ||
| double | vel_y | ||
| ) |
Check if auto-reset should be triggered.
Evaluates current VIO state and error conditions to determine if an automatic reset should be triggered.
| state | Current VIO state |
| quality | Current quality value |
| n_features | Number of tracked features |
| yawrate | Calculated yaw rate from angular velocity |
| current_velocity | Current velocity magnitude |
| vel_x | X-component of velocity |
| vel_y | Y-component of velocity |
This function evaluates the current VIO state and various error conditions to determine if an automatic reset should be triggered. It implements the same logic as the legacy code but in a more modular way.
| state | Current VIO state |
| quality | Current quality value |
| n_features | Number of tracked features |
Definition at line 1147 of file VoxlPublisher.cpp.
References auto_reset_max_v_cov_timeout_s, auto_reset_max_velocity, auto_reset_min_feature_timeout_s, auto_reset_min_features, en_auto_reset, en_debug, fast_yaw_thresh, fast_yaw_timeout_s, and reset_num_counter.
Referenced by publish().

| void Publisher::start | ( | ) |
Start the publisher.
Initializes the publisher and prepares it for data transmission.
Initializes the publisher and prepares it for data transmission. Sets the first_packet flag to true to handle the initial angular velocity calculation.
Definition at line 53 of file VoxlPublisher.cpp.
References voxl::HealthCheck::getInstance(), voxl::HealthCheck::start(), and vio_state.
Referenced by main().


| void Publisher::stop | ( | ) |
Stop the publisher.
Stops the publisher and cleans up resources.
Stops the publisher and cleans up resources. Currently a placeholder for future cleanup operations.
Definition at line 71 of file VoxlPublisher.cpp.
References voxl::HealthCheck::getInstance(), and voxl::HealthCheck::stop().
