|
My Project 1.0
Holistic Fusion: A Generic Framework for Multimodal Sensor Fusion
|
GraphManager class. More...
#include <GraphManager.h>

Public Types | |
| typedef gtsam::Key(* | F) (std::uint64_t) |
Public Member Functions | |
| GraphManager (std::shared_ptr< GraphConfig > graphConfigPtr, std::string imuFrame, std::string worldFrame) | |
| ~GraphManager () | |
| bool | initImuIntegrators (double gravityValue) |
| bool | initPoseVelocityBiasGraph (double timeStamp, const gtsam::Pose3 &T_W_I0, const gtsam::Pose3 &T_O_I0, const gtsam::Vector3 &imuAngularVelocity) |
| void | addImuFactorAndGetState (SafeIntegratedNavState &returnPreIntegratedNavState, std::shared_ptr< SafeNavStateWithCovarianceAndBias > &newOptimizedNavStatePtr, const std::shared_ptr< ImuBuffer > &imuBufferPtr, double imuTimeK, bool createNewStateFlag) |
| bool | getUnaryFactorGeneralKey (gtsam::Key &returnedKey, double &returnedGraphTime, const UnaryMeasurement &unaryMeasurement) |
| bool | hasReferenceFrameKeyframe (const std::string &worldFrame, const std::string &fixedFrame) |
| template<class MEASUREMENT_TYPE, int NOISE_DIM, class FACTOR_TYPE, F SYMBOL_SHORTHAND, class... FACTOR_ARGS> | |
| void | addUnaryClassicFactor (const MEASUREMENT_TYPE &unaryMeasurement, const Eigen::Matrix< double, NOISE_DIM, 1 > &unaryNoiseDensity, double measurementTime, const FACTOR_ARGS &... factorArgs) |
| template<class GMSF_EXPRESSION_TYPE> | |
| void | addUnaryHolisticFactor (const std::shared_ptr< GMSF_EXPRESSION_TYPE > gmsfUnaryExpressionPtr, const bool addToOnlineSmootherFlag=true) |
| gtsam::Key | addPoseBetweenFactor (const gtsam::Pose3 &deltaPose, const Eigen::Matrix< double, 6, 1 > &poseBetweenNoiseDensity, double lidarTimeKm1, double lidarTimeK, double rate, const RobustNormEnum &robustNormEnum, const double robustNormConstant) |
| bool | setInitialWorldFrameToFixedFrameTransform (const Eigen::Isometry3d &T_W_F, const std::string &fixedFrame) |
| void | updateGraph () |
| bool | optimizeSlowBatchSmoother (int maxIterations, const std::string &savePath, const bool saveCovarianceFlag) |
| std::optional< BatchOptimizationResult > | optimizeSlowBatchSmoother (int maxIterations, const bool computePoseCovarianceFlag) |
| bool | logRealTimeNavStates (const std::string &savePath, const std::string &timeString) |
| bool | logRealTimeReferenceFrameStates (const std::string &savePath, const std::string &timeString) |
| bool | logLatencyAndUpdateDuration (const std::string &savePath, const std::string &timeString) |
| void | saveOptimizedValuesToFile (const gtsam::Values &optimizedValues, const std::map< gtsam::Key, double > &keyTimestampMap, const std::string &savePath, const bool saveCovarianceFlag) |
| gtsam::NavState | calculateStateAtGeneralKey (bool &computeSuccessfulFlag, const gtsam::Key &generalKey) |
| Eigen::Vector3d & | getInitAccBiasReference () |
| Getters. | |
| Eigen::Vector3d & | getInitGyrBiasReference () |
| const GraphState & | getOptimizedGraphState () |
| const gtsam::Key | getPropagatedStateKey () |
Static Public Member Functions | |
| static void | saveOptimizedGraphToG2o (const OptimizerBase &optimizedGraph, const gtsam::Values &optimizedValues, const std::string &saveFileName) |
Static Protected Member Functions | |
| static gtsam::NavState | calculateNavStateAtGeneralKey (bool &computeSuccessfulFlag, std::shared_ptr< holistic_fusion::OptimizerBase > graphPtr, const gtsam::Key &generalKey, const char *callingFunctionName) |
| static Eigen::Matrix< double, 6, 6 > | calculatePoseCovarianceAtKeyInWorldFrame (std::shared_ptr< holistic_fusion::OptimizerBase > graphPtr, const gtsam::Key &graphKey, const char *callingFunctionName, std::optional< const gtsam::NavState > optionalNavState=std::nullopt) |
Private Member Functions | |
| bool | runSlowBatchSmootherOptimization_ (int maxIterations) |
| BatchOptimizationResult | extractBatchOptimizationResult_ (const bool computePoseCovarianceFlag) |
| template<class CHILDPTR> | |
| bool | addFactorToRtAndBatchGraph_ (const gtsam::NoiseModelFactor *noiseModelFactorPtr, const bool addToOnlineSmootherFlag=true) |
| template<class CHILDPTR> | |
| bool | addFactorToRtAndBatchGraph_ (const gtsam::NoiseModelFactor *noiseModelFactorPtr, double measurementTimestamp, const std::string &measurementName, const bool addToOnlineSmootherFlag=true) |
| template<class CHILDPTR> | |
| bool | addFactorSafelyToRtAndBatchGraph_ (const gtsam::NoiseModelFactor *noiseModelFactorPtr, double measurementTimestamp) |
| void | updateImuIntegrators_ (const TimeToImuMap &imuMeas) |
| Update IMU integrators. | |
| bool | addFactorsToRtSmootherAndOptimize (const gtsam::NonlinearFactorGraph &newRtGraphFactors, const gtsam::Values &newRtGraphValues, const std::map< gtsam::Key, double > &newRtGraphKeysTimestampsMap, const std::shared_ptr< GraphConfig > &graphConfigPtr, const int additionalIterations) |
| bool | addFactorsToBatchSmootherAndOptimize (const gtsam::NonlinearFactorGraph &newBatchGraphFactors, const gtsam::Values &newBatchGraphValues, const std::map< gtsam::Key, double > &newBatchGraphKeysTimestampsMap, const std::shared_ptr< GraphConfig > &graphConfigPtr) |
| bool | findGraphKeys_ (gtsam::Key &closestKeyKm1, gtsam::Key &closestKeyK, double &keyTimeStampDistance, double maxTimestampDistance, double timeKm1, double timeK, const std::string &name) |
| Find graph keys for timestamps. | |
| const uint64_t | newPropagatedStateKey_ () |
| Generate new key. | |
| void | writeKeyToKeyTimeStampMap_ (const gtsam::Key &key, double measurementTime, std::shared_ptr< std::map< gtsam::Key, double > > keyTimestampMapPtr) |
| Associate timestamp to each 'value key', e.g. for graph key 0, value keys (x0,v0,b0) need to be associated. | |
| void | writeValueKeysToKeyTimeStampMap_ (const gtsam::Values &values, double measurementTime, std::shared_ptr< std::map< gtsam::Key, double > > keyTimestampMapPtr) |
Private Attributes | |
| std::shared_ptr< TimeGraphKeyBuffer > | timeToKeyBufferPtr_ |
| std::string | imuFrame_ |
| std::string | worldFrame_ |
| DynamicDictionaryContainer | gtsamDynamicExpressionKeys_ |
| FileLogger | fileLogger_ |
| std::shared_ptr< gtsam::PreintegratedCombinedMeasurements::Params > | imuParamsPtr_ |
| std::shared_ptr< gtsam::imuBias::ConstantBias > | imuBiasPriorPtr_ |
| holistic_fusion::GraphState | optimizedGraphState_ |
| gtsam::NavState | W_imuPropagatedState_ = gtsam::NavState(gtsam::Pose3(), gtsam::Vector3(0, 0, 0)) |
| Propagated state (at IMU frequency). | |
| gtsam::NavState | O_imuPropagatedState_ = gtsam::NavState(gtsam::Pose3(), gtsam::Vector3(0, 0, 0)) |
| Eigen::Isometry3d | T_W_O_ = Eigen::Isometry3d::Identity() |
| gtsam::Key | propagatedStateKey_ = 0 |
| double | propagatedImuSampleTime_ = 0.0 |
| double | latestGraphStateKeyTime_ = 0.0 |
| double | lastOptimizedStateTime_ = 0.0 |
| gtsam::Vector3 | latestGraphStateKeyAngularVelocity_ = gtsam::Vector3(0, 0, 0) |
| std::shared_ptr< OptimizerBase > | rtOptimizerPtr_ |
| std::shared_ptr< OptimizerBase > | batchOptimizerPtr_ |
| std::shared_ptr< gtsam::NonlinearFactorGraph > | rtFactorGraphBufferPtr_ |
| Data buffer. | |
| std::shared_ptr< gtsam::NonlinearFactorGraph > | batchFactorGraphBufferPtr_ |
| std::shared_ptr< gtsam::Values > | rtGraphValuesBufferPtr_ |
| std::shared_ptr< gtsam::Values > | batchGraphValuesBufferPtr_ |
| std::shared_ptr< std::map< gtsam::Key, double > > | rtGraphKeysTimestampsMapBufferPtr_ |
| std::shared_ptr< std::map< gtsam::Key, double > > | batchGraphKeysTimestampsMapBufferPtr_ |
| std::shared_ptr< gtsam::PreintegratedCombinedMeasurements > | imuStepPreintegratorPtr_ |
| Step Preintegrator. | |
| std::shared_ptr< gtsam::PreintegratedCombinedMeasurements > | imuBufferPreintegratorPtr_ |
| Buffer Preintegrator. | |
| gtsam::Vector6 | lastImuVector_ |
| IMU Buffer. | |
| std::shared_ptr< holistic_fusion::GraphConfig > | graphConfigPtr_ = nullptr |
| Config. | |
| std::map< double, gtsam::Pose3 > | realTimeWorldPoseContainer_ = {} |
| std::map< double, gtsam::Pose3 > | realTimeOdomPoseContainer_ = {} |
| std::map< double, TransformsDictionary< Eigen::Isometry3d > > | realTimeReferenceFrameContainer_ = {} |
| std::set< std::pair< std::string, std::string > > | realTimeReferenceFrameNamePairs_ = {} |
| std::chrono::time_point< std::chrono::high_resolution_clock > | latencyStartTime_ |
| std::chrono::time_point< std::chrono::high_resolution_clock > | latencyEndTime_ |
| std::map< double, double > | latencyContainer_ = {} |
| std::chrono::time_point< std::chrono::high_resolution_clock > | updateDurationStartTime_ |
| std::chrono::time_point< std::chrono::high_resolution_clock > | updateDurationEndTime_ |
| std::map< double, double > | updateDurationContainer_ = {} |
| std::mutex | operateOnGraphDataMutex_ |
| Mutex. | |
| std::mutex | optimizationRunningMutex_ |
GraphManager class.
The GraphManager class is the central class of the HolisticFusion library. It manages the graph, the optimization, and the real-time and batch optimization. It also provides the interface to add measurements to the graph and to retrieve the optimized states.
Definition at line 51 of file GraphManager.h.
| typedef gtsam::Key(* holistic_fusion::GraphManager::F) (std::uint64_t) |
Definition at line 83 of file GraphManager.h.
| holistic_fusion::GraphManager::GraphManager | ( | std::shared_ptr< GraphConfig > | graphConfigPtr, |
| std::string | imuFrame, | ||
| std::string | worldFrame ) |
Definition at line 61 of file GraphManager.cpp.
|
inline |
Definition at line 54 of file GraphManager.h.
|
private |
|
private |
Definition at line 1362 of file GraphManager.cpp.
|
private |
Definition at line 1332 of file GraphManager.cpp.
|
private |
|
private |
| void holistic_fusion::GraphManager::addImuFactorAndGetState | ( | SafeIntegratedNavState & | returnPreIntegratedNavState, |
| std::shared_ptr< SafeNavStateWithCovarianceAndBias > & | newOptimizedNavStatePtr, | ||
| const std::shared_ptr< ImuBuffer > & | imuBufferPtr, | ||
| double | imuTimeK, | ||
| bool | createNewStateFlag ) |
Definition at line 229 of file GraphManager.cpp.
| gtsam::Key holistic_fusion::GraphManager::addPoseBetweenFactor | ( | const gtsam::Pose3 & | deltaPose, |
| const Eigen::Matrix< double, 6, 1 > & | poseBetweenNoiseDensity, | ||
| double | lidarTimeKm1, | ||
| double | lidarTimeK, | ||
| double | rate, | ||
| const RobustNormEnum & | robustNormEnum, | ||
| const double | robustNormConstant ) |
Definition at line 418 of file GraphManager.cpp.
| void holistic_fusion::GraphManager::addUnaryClassicFactor | ( | const MEASUREMENT_TYPE & | unaryMeasurement, |
| const Eigen::Matrix< double, NOISE_DIM, 1 > & | unaryNoiseDensity, | ||
| double | measurementTime, | ||
| const FACTOR_ARGS &... | factorArgs ) |
| void holistic_fusion::GraphManager::addUnaryHolisticFactor | ( | const std::shared_ptr< GMSF_EXPRESSION_TYPE > | gmsfUnaryExpressionPtr, |
| const bool | addToOnlineSmootherFlag = true ) |
|
staticprotected |
Definition at line 482 of file GraphManager.cpp.
|
staticprotected |
Definition at line 504 of file GraphManager.cpp.
| gtsam::NavState holistic_fusion::GraphManager::calculateStateAtGeneralKey | ( | bool & | computeSuccessfulFlag, |
| const gtsam::Key & | generalKey ) |
Definition at line 1250 of file GraphManager.cpp.
|
private |
Definition at line 1270 of file GraphManager.cpp.
|
private |
Find graph keys for timestamps.
Definition at line 1380 of file GraphManager.cpp.
|
inline |
Getters.
Definition at line 132 of file GraphManager.h.
|
inline |
Definition at line 133 of file GraphManager.h.
|
inline |
Definition at line 136 of file GraphManager.h.
|
inline |
Definition at line 137 of file GraphManager.h.
| bool holistic_fusion::GraphManager::getUnaryFactorGeneralKey | ( | gtsam::Key & | returnedKey, |
| double & | returnedGraphTime, | ||
| const UnaryMeasurement & | unaryMeasurement ) |
Definition at line 380 of file GraphManager.cpp.
| bool holistic_fusion::GraphManager::hasReferenceFrameKeyframe | ( | const std::string & | worldFrame, |
| const std::string & | fixedFrame ) |
Definition at line 374 of file GraphManager.cpp.
| bool holistic_fusion::GraphManager::initImuIntegrators | ( | double | gravityValue | ) |
Position
Rotation
Earth rotation: angular velocity of the (gravity-aligned, z-up) world frame w.r.t. the inertial frame, expressed in the world frame. Setting it makes GTSAM (>= 4.3) use the exact rotating-frame model (Coriolis, centrifugal and Earth-rate terms). If left unset, the inertial model is used.
Bias
Definition at line 92 of file GraphManager.cpp.
| bool holistic_fusion::GraphManager::initPoseVelocityBiasGraph | ( | double | timeStamp, |
| const gtsam::Pose3 & | T_W_I0, | ||
| const gtsam::Pose3 & | T_O_I0, | ||
| const gtsam::Vector3 & | imuAngularVelocity ) |
Prior factor noise
Timestamp mapping for incremental fixed lag smoother
Add prior factor to graph and optimize for the first time -------------—
Definition at line 131 of file GraphManager.cpp.
| bool holistic_fusion::GraphManager::logLatencyAndUpdateDuration | ( | const std::string & | savePath, |
| const std::string & | timeString ) |
Definition at line 985 of file GraphManager.cpp.
| bool holistic_fusion::GraphManager::logRealTimeNavStates | ( | const std::string & | savePath, |
| const std::string & | timeString ) |
Definition at line 879 of file GraphManager.cpp.
| bool holistic_fusion::GraphManager::logRealTimeReferenceFrameStates | ( | const std::string & | savePath, |
| const std::string & | timeString ) |
Definition at line 925 of file GraphManager.cpp.
|
inlineprivate |
Generate new key.
Definition at line 178 of file GraphManager.h.
| std::optional< BatchOptimizationResult > holistic_fusion::GraphManager::optimizeSlowBatchSmoother | ( | int | maxIterations, |
| const bool | computePoseCovarianceFlag ) |
Definition at line 871 of file GraphManager.cpp.
| bool holistic_fusion::GraphManager::optimizeSlowBatchSmoother | ( | int | maxIterations, |
| const std::string & | savePath, | ||
| const bool | saveCovarianceFlag ) |
Definition at line 862 of file GraphManager.cpp.
|
private |
Definition at line 1256 of file GraphManager.cpp.
|
static |
Definition at line 1243 of file GraphManager.cpp.
| void holistic_fusion::GraphManager::saveOptimizedValuesToFile | ( | const gtsam::Values & | optimizedValues, |
| const std::map< gtsam::Key, double > & | keyTimestampMap, | ||
| const std::string & | savePath, | ||
| const bool | saveCovarianceFlag ) |
Definition at line 1029 of file GraphManager.cpp.
| bool holistic_fusion::GraphManager::setInitialWorldFrameToFixedFrameTransform | ( | const Eigen::Isometry3d & | T_W_F, |
| const std::string & | fixedFrame ) |
Definition at line 364 of file GraphManager.cpp.
| void holistic_fusion::GraphManager::updateGraph | ( | ) |
Definition at line 534 of file GraphManager.cpp.
|
private |
Update IMU integrators.
Definition at line 1304 of file GraphManager.cpp.
|
inlineprivate |
Associate timestamp to each 'value key', e.g. for graph key 0, value keys (x0,v0,b0) need to be associated.
|
private |
Definition at line 1413 of file GraphManager.cpp.
|
private |
Definition at line 216 of file GraphManager.h.
|
private |
Definition at line 222 of file GraphManager.h.
|
private |
Definition at line 219 of file GraphManager.h.
|
private |
Definition at line 213 of file GraphManager.h.
|
private |
Definition at line 195 of file GraphManager.h.
|
private |
Config.
Definition at line 234 of file GraphManager.h.
|
private |
Definition at line 192 of file GraphManager.h.
|
private |
Definition at line 199 of file GraphManager.h.
|
private |
Buffer Preintegrator.
Definition at line 228 of file GraphManager.h.
|
private |
Definition at line 190 of file GraphManager.h.
|
private |
Definition at line 198 of file GraphManager.h.
|
private |
Step Preintegrator.
Definition at line 226 of file GraphManager.h.
|
private |
IMU Buffer.
Definition at line 231 of file GraphManager.h.
|
private |
Definition at line 208 of file GraphManager.h.
|
private |
Definition at line 246 of file GraphManager.h.
|
private |
Definition at line 244 of file GraphManager.h.
|
private |
Definition at line 243 of file GraphManager.h.
|
private |
Definition at line 209 of file GraphManager.h.
|
private |
Definition at line 207 of file GraphManager.h.
|
private |
Definition at line 203 of file GraphManager.h.
|
private |
Mutex.
Definition at line 255 of file GraphManager.h.
|
private |
Definition at line 256 of file GraphManager.h.
|
private |
Definition at line 200 of file GraphManager.h.
|
private |
Definition at line 206 of file GraphManager.h.
|
private |
Definition at line 205 of file GraphManager.h.
|
private |
Definition at line 238 of file GraphManager.h.
|
private |
Definition at line 240 of file GraphManager.h.
|
private |
Definition at line 241 of file GraphManager.h.
|
private |
Definition at line 237 of file GraphManager.h.
|
private |
Data buffer.
Definition at line 215 of file GraphManager.h.
|
private |
Definition at line 221 of file GraphManager.h.
|
private |
Definition at line 218 of file GraphManager.h.
|
private |
Definition at line 212 of file GraphManager.h.
|
private |
Definition at line 204 of file GraphManager.h.
|
private |
Definition at line 187 of file GraphManager.h.
|
private |
Definition at line 251 of file GraphManager.h.
|
private |
Definition at line 249 of file GraphManager.h.
|
private |
Definition at line 248 of file GraphManager.h.
|
private |
Propagated state (at IMU frequency).
Definition at line 202 of file GraphManager.h.
|
private |
Definition at line 191 of file GraphManager.h.