SaDVIO
|
Abstract class for optimization pipeline based on CERES. More...
#include <AOptimizer.h>
Public Member Functions | |
AOptimizer () | |
void | resetMarginalization () |
bool | landmarkOptimization (std::shared_ptr< Frame > &frame) |
Structure only Bundle Adjustment for a frame. More... | |
bool | singleFrameOptimization (std::shared_ptr< Frame > &moving_frame) |
Motion only Bundle Adjustment for a frame. More... | |
bool | singleFrameVIOptimization (std::shared_ptr< isae::Frame > &moving_frame) |
Visual-Inertial Motion only Bundle Adjustment for a frame. More... | |
bool | localMapBA (std::shared_ptr< isae::LocalMap > &local_map, const size_t fixed_frame_number=0) |
Bundle Adjustment for a local map. More... | |
bool | localMapVIOptimization (std::shared_ptr< isae::LocalMap > &local_map, const size_t fixed_frame_number=0) |
Visual-Inertial Bundle Adjustment for a local map. More... | |
double | VIInit (std::shared_ptr< isae::LocalMap > &local_map, Eigen::Matrix3d &R_w_i, bool optim_scale=false) |
Visual-Inertial Initialization for a local map. More... | |
virtual bool | landmarkOptimizationNoFov (std::shared_ptr< Frame > &f, std::shared_ptr< Frame > &fp, Eigen::Affine3d &T_cam0_cam0p, double info_scale) |
Structure only Bundle Adjustment for a frame with non overlapping fields of view sensors. More... | |
virtual bool | marginalize (std::shared_ptr< Frame > &frame0, std::shared_ptr< Frame > &frame1, bool enable_sparsif) |
Marginalization of a frame and its landmarks. More... | |
virtual Eigen::MatrixXd | marginalizeRelative (std::shared_ptr< Frame > &frame0, std::shared_ptr< Frame > &frame1) |
Marginalization of all the landmarks linked to two frame and computation of the information matrix of the relative pose. More... | |
Protected Member Functions | |
virtual uint | addResidualsLocalMap (ceres::Problem &problem, ceres::LossFunction *loss_function, ceres::ParameterBlockOrdering *ordering, std::vector< std::shared_ptr< Frame >> &frame_vector, size_t fixed_frame_number, std::shared_ptr< isae::LocalMap > &local_map)=0 |
Add visual residuals to a CERES problem for a local map. More... | |
virtual uint | addLandmarkResiduals (ceres::Problem &problem, ceres::LossFunction *loss_function, typed_vec_landmarks &cloud_to_optimize)=0 |
Add visual residuals to a CERES problem for structure only BA. More... | |
virtual uint | addSingleFrameResiduals (ceres::Problem &problem, ceres::LossFunction *loss_function, std::shared_ptr< Frame > &frame, typed_vec_landmarks &cloud_to_optimize)=0 |
Add visual residuals to a CERES problem for a motion only BA. More... | |
virtual uint | addMarginalizationResiduals (ceres::Problem &problem, ceres::LossFunction *loss_function, ceres::ParameterBlockOrdering *ordering) |
Add marginalization residuals to a CERES problem. More... | |
uint | addIMUResiduals (ceres::Problem &problem, ceres::LossFunction *loss_function, ceres::ParameterBlockOrdering *ordering, std::vector< std::shared_ptr< Frame >> &frame_vector, size_t fixed_frame_number) |
Add IMU residuals to a CERES problem. More... | |
Protected Attributes | |
std::unordered_map< std::shared_ptr< Frame >, PoseParametersBlock > | _map_frame_posepar |
map for pose parameters More... | |
std::unordered_map< std::shared_ptr< Frame >, PointXYZParametersBlock > | _map_frame_velpar |
map for velocity parameters More... | |
std::unordered_map< std::shared_ptr< Frame >, PointXYZParametersBlock > | _map_frame_dbapar |
map for accelerometer bias parameters More... | |
std::unordered_map< std::shared_ptr< Frame >, PointXYZParametersBlock > | _map_frame_dbgpar |
map for gyroscope bias parameters More... | |
std::unordered_map< std::shared_ptr< ALandmark >, PointXYZParametersBlock > | _map_lmk_ptpar |
map for landmark point parameters More... | |
std::unordered_map< std::shared_ptr< ALandmark >, PoseParametersBlock > | _map_lmk_posepar |
map for landmark pose parameters More... | |
bool | _enable_sparsif = false |
enable sparsification of the marginalization More... | |
std::shared_ptr< Marginalization > | _marginalization |
marginalization object More... | |
std::shared_ptr< Marginalization > | _marginalization_last |
marginalization object of the last optimization More... | |
Abstract class for optimization pipeline based on CERES.
This class provides methods for optimizing frames, landmarks, and local maps. It also implements methods involving factors such as initialization and marginalization. This virtual formulation allows for different optimization scheme with different cost functions, different parameterization or different CERES settings (e.g. numerical or analytic Jacobians).
|
inline |
|
protected |
Add IMU residuals to a CERES problem.
problem | The CERES problem to which the residuals will be added. |
loss_function | The loss function to be used for the residuals. |
ordering | The parameter block ordering for the problem. |
frame_vector | The vector of frames in the local map. |
fixed_frame_number | The number of frames to fix during optimization. |
|
protectedpure virtual |
Add visual residuals to a CERES problem for structure only BA.
problem | The CERES problem to which the residuals will be added. |
loss_function | The loss function to be used for the residuals. |
cloud_to_optimize | The landmarks to be optimized. |
Implemented in isae::AngularAdjustmentCERESAnalytic, isae::BundleAdjustmentCERESAnalytic, and isae::BundleAdjustmentCERESNumeric.
|
inlineprotectedvirtual |
Add marginalization residuals to a CERES problem.
problem | The CERES problem to which the residuals will be added. |
loss_function | The loss function to be used for the residuals. |
ordering | The parameter block ordering for the problem. |
Reimplemented in isae::AngularAdjustmentCERESAnalytic, and isae::BundleAdjustmentCERESAnalytic.
|
protectedpure virtual |
Add visual residuals to a CERES problem for a local map.
problem | The CERES problem to which the residuals will be added. |
loss_function | The loss function to be used for the residuals. |
ordering | The parameter block ordering for the problem. |
frame_vector | The vector of frames in the local map. |
fixed_frame_number | The number of frames to fix during optimization. |
local_map | The local map to which the residuals will be added. |
Implemented in isae::AngularAdjustmentCERESAnalytic, isae::BundleAdjustmentCERESAnalytic, and isae::BundleAdjustmentCERESNumeric.
|
protectedpure virtual |
Add visual residuals to a CERES problem for a motion only BA.
problem | The CERES problem to which the residuals will be added. |
loss_function | The loss function to be used for the residuals. |
frame | The frame to which the residuals will be added. |
cloud_to_optimize | The landmarks belonging to the frame. |
Implemented in isae::AngularAdjustmentCERESAnalytic, isae::BundleAdjustmentCERESAnalytic, and isae::BundleAdjustmentCERESNumeric.
bool isae::AOptimizer::landmarkOptimization | ( | std::shared_ptr< Frame > & | frame | ) |
Structure only Bundle Adjustment for a frame.
frame | The frame to optimize. |
This method optimize the landmarks associated to the frame, setting static the pose parameters. It can be used to refine the triangulation of new landmarks.
|
virtual |
Structure only Bundle Adjustment for a frame with non overlapping fields of view sensors.
f | The frame to optimize. |
fp | The previous frame to optimize. |
T_cam0_cam0p | The transformation from the current frame to the previous frame. |
info_scale | The scale factor for the information matrix. |
Reimplemented in isae::AngularAdjustmentCERESAnalytic.
bool isae::AOptimizer::localMapBA | ( | std::shared_ptr< isae::LocalMap > & | local_map, |
const size_t | fixed_frame_number = 0 |
||
) |
Bundle Adjustment for a local map.
local_map | The local map to optimize. |
fixed_frame_number | The frame number to fix during optimization (default is 0). |
bool isae::AOptimizer::localMapVIOptimization | ( | std::shared_ptr< isae::LocalMap > & | local_map, |
const size_t | fixed_frame_number = 0 |
||
) |
Visual-Inertial Bundle Adjustment for a local map.
local_map | The local map to optimize. |
fixed_frame_number | The frame number to fix during optimization (default is 0). |
|
inlinevirtual |
Marginalization of a frame and its landmarks.
frame0 | The frame to marginalize. |
frame1 | The frame to keep connected to frame0. |
enable_sparsif | Whether to enable sparsification (default is false). |
Perform all the marginalization steps for a given frame. A marginalization object deals with all these steps
Reimplemented in isae::AngularAdjustmentCERESAnalytic, and isae::BundleAdjustmentCERESAnalytic.
|
inlinevirtual |
Marginalization of all the landmarks linked to two frame and computation of the information matrix of the relative pose.
frame0 | The first frame to marginalize. |
frame1 | The second frame to marginalize. |
This method computes the information matrix of the relative pose between two frames and marginalizes the landmarks linked to them. It uses NFR to extract a relative pose factor and to derive its information matrix.
Reimplemented in isae::AngularAdjustmentCERESAnalytic, and isae::BundleAdjustmentCERESAnalytic.
|
inline |
bool isae::AOptimizer::singleFrameOptimization | ( | std::shared_ptr< Frame > & | moving_frame | ) |
Motion only Bundle Adjustment for a frame.
moving_frame | The frame to optimize. |
This method optimizes the frame's pose parameters only, setting static the landmarks.
bool isae::AOptimizer::singleFrameVIOptimization | ( | std::shared_ptr< isae::Frame > & | moving_frame | ) |
Visual-Inertial Motion only Bundle Adjustment for a frame.
moving_frame | The frame to optimize. |
This method optimizes the frame's pose and velocity parameters.
double isae::AOptimizer::VIInit | ( | std::shared_ptr< isae::LocalMap > & | local_map, |
Eigen::Matrix3d & | R_w_i, | ||
bool | optim_scale = false |
||
) |
Visual-Inertial Initialization for a local map.
local_map | The local map to initialize. |
R_w_i | The initial rotation of the world frame with respect to the inertial frame. |
optim_scale | Whether to optimize the scale (default is false). |
|
protected |
enable sparsification of the marginalization
|
protected |
map for accelerometer bias parameters
|
protected |
map for gyroscope bias parameters
|
protected |
map for pose parameters
|
protected |
map for velocity parameters
|
protected |
map for landmark pose parameters
|
protected |
map for landmark point parameters
|
protected |
marginalization object
|
protected |
marginalization object of the last optimization