OKVIS ROS
|
#include <MarginalizationError.hpp>
Classes | |
struct | ParameterBlockInfo |
Book-keeping of the ordering. More... | |
Public Member Functions | |
virtual | ~MarginalizationError () |
Trivial destructor. More... | |
MarginalizationError () | |
Default constructor. Initialises a new okvis::ceres::Map. More... | |
MarginalizationError (Map &map) | |
Constructor from okvis::ceres::Map. More... | |
MarginalizationError (Map &map, std::vector< ::ceres::ResidualBlockId > &residualBlockIds) | |
Constructor from okvis::ceres::Map and directly add some residuals. More... | |
void | setMap (Map &map) |
Set the underlying okvis::ceres::Map. More... | |
bool | addResidualBlocks (const std::vector< ::ceres::ResidualBlockId > &residualBlockIds, const std::vector< bool > &keepResidualBlocks=std::vector< bool >()) |
Add some residuals to this marginalisation error. This means, they will get linearised. More... | |
bool | addResidualBlock (::ceres::ResidualBlockId residualBlockId, bool keepResidualBlock=false) |
Add one residual to this marginalisation error. This means, it will get linearised. More... | |
bool | isParameterBlockConnected (uint64_t parameterBlockId) |
Info: is this parameter block connected to this marginalization error? More... | |
bool | marginalizeOut (const std::vector< uint64_t > ¶meterBlockIds, const std::vector< bool > &keepParameterBlocks=std::vector< bool >()) |
Marginalise out a set of parameter blocks. More... | |
void | updateErrorComputation () |
This must be called before optimization after adding residual blocks and/or marginalizing, since it performs all the lhs and rhs computations on from a given _H and _b. More... | |
void | getParameterBlockPtrs (std::vector< std::shared_ptr< okvis::ceres::ParameterBlock > > ¶meterBlockPtrs) |
Call this in order to (re-)add this error term after whenever it had been modified. More... | |
virtual bool | Evaluate (double const *const *parameters, double *residuals, double **jacobians) const |
This evaluates the error term and additionally computes the Jacobians. More... | |
bool | EvaluateWithMinimalJacobians (double const *const *parameters, double *residuals, double **jacobians, double **jacobiansMinimal) const |
This evaluates the error term and additionally computes the Jacobians in the minimal internal representation. More... | |
size_t | residualDim () const |
Residual dimension. More... | |
size_t | parameterBlocks () const |
Number of parameter blocks. More... | |
size_t | parameterBlockDim (size_t parameterBlockId) const |
Dimension of an individual parameter block. More... | |
virtual std::string | typeInfo () const |
Return parameter block type as string. More... | |
Public Member Functions inherited from okvis::ceres::ErrorInterface | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ErrorInterface () |
Constructor. More... | |
virtual | ~ErrorInterface () |
Destructor (does nothing). More... | |
Static Public Member Functions | |
template<typename Derived > | |
static bool | pseudoInverseSymm (const Eigen::MatrixBase< Derived > &a, const Eigen::MatrixBase< Derived > &result, double epsilon=std::numeric_limits< typename Derived::Scalar >::epsilon(), int *rank=0) |
Pseudo inversion of a symmetric matrix. More... | |
template<typename Derived > | |
static bool | pseudoInverseSymmSqrt (const Eigen::MatrixBase< Derived > &a, const Eigen::MatrixBase< Derived > &result, double epsilon=std::numeric_limits< typename Derived::Scalar >::epsilon(), int *rank=NULL) |
Pseudo inversion and square root (Cholesky decomposition) of a symmetric matrix. More... | |
template<typename Derived , int blockDim> | |
static void | blockPinverse (const Eigen::MatrixBase< Derived > &M_in, const Eigen::MatrixBase< Derived > &M_out, double epsilon=std::numeric_limits< typename Derived::Scalar >::epsilon()) |
Block-wise pseudo inversion of a symmetric matrix with non-zero diagonal blocks. More... | |
template<typename Derived , int blockDim> | |
static void | blockPinverseSqrt (const Eigen::MatrixBase< Derived > &M_in, const Eigen::MatrixBase< Derived > &M_out, double epsilon=std::numeric_limits< typename Derived::Scalar >::epsilon()) |
Block-wise pseudo inversion and square root (Cholesky decomposition) of a symmetric matrix with non-zero diagonal blocks. More... | |
Public Attributes | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef::ceres::CostFunction | base_t |
The base class type. More... | |
Protected Member Functions | |
void | check () |
Checks the internal datastructure (debug) More... | |
bool | computeDeltaChi (Eigen::VectorXd &DeltaChi) const |
Computes the linearized deviation from the references (linearization points) More... | |
bool | computeDeltaChi (double const *const *parameters, Eigen::VectorXd &DeltaChi) const |
Computes the linearized deviation from the references (linearization points) More... | |
Static Protected Member Functions | |
template<typename Derived_A , typename Derived_U , typename Derived_W , typename Derived_V > | |
static void | splitSymmetricMatrix (const std::vector< std::pair< int, int > > &marginalizationStartIdxAndLengthPairs, const Eigen::MatrixBase< Derived_A > &A, const Eigen::MatrixBase< Derived_U > &U, const Eigen::MatrixBase< Derived_W > &W, const Eigen::MatrixBase< Derived_V > &V) |
Split for Schur complement op. More... | |
template<typename Derived_b , typename Derived_b_a , typename Derived_b_b > | |
static void | splitVector (const std::vector< std::pair< int, int > > &marginalizationStartIdxAndLengthPairs, const Eigen::MatrixBase< Derived_b > &b, const Eigen::MatrixBase< Derived_b_a > &b_a, const Eigen::MatrixBase< Derived_b_b > &b_b) |
Split for Schur complement op. More... | |
Protected Attributes | |
Map * | mapPtr_ |
The underlying map. More... | |
::ceres::ResidualBlockId | residualBlockId_ |
The residual block id of this. More... | |
The internal storage of the linearised system. | |
lhs and rhs: H_*delta_Chi = b - H*Delta_Chi . the lhs Hessian matrix is decomposed as _H = J^T*J = _U*S*_U^T , the rhs is decomposed as _b - _H*Delta_Chi = -J^T * (-pinv(J^T) * _b + J*Delta_Chi) , i.e. we have the ceres standard form with weighted Jacobians _J, an identity information matrix, and an error _e = -pinv(J^T) * _b + J*Delta_Chi . _e = _e0 + J*Delta_Chi . | |
Eigen::MatrixXd | H_ |
lhs - Hessian More... | |
Eigen::VectorXd | b0_ |
rhs constant part More... | |
Eigen::VectorXd | e0_ |
_e0 := pinv(J^T) * _b0 More... | |
Eigen::MatrixXd | J_ |
Jacobian such that _J^T * J == _H. More... | |
Eigen::MatrixXd | U_ |
H_ = _U*_S*_U^T lhs Eigen decomposition. More... | |
Eigen::VectorXd | S_ |
singular values More... | |
Eigen::VectorXd | S_sqrt_ |
cwise sqrt of _S, i.e. _S_sqrt*_S_sqrt=_S; _J=_U^T*_S_sqrt More... | |
Eigen::VectorXd | S_pinv_ |
pseudo inverse of _S More... | |
Eigen::VectorXd | S_pinv_sqrt_ |
cwise sqrt of _S_pinv, i.e. pinv(J^T)=_U^T*_S_pinv_sqrt More... | |
Eigen::VectorXd | p_ |
Eigen::VectorXd | p_inv_ |
volatile bool | errorComputationValid_ |
adding residual blocks will invalidate this. before optimizing, call updateErrorComputation() More... | |
std::vector< ParameterBlockInfo > | parameterBlockInfos_ |
Book keeper. More... | |
std::map< uint64_t, size_t > | parameterBlockId2parameterBlockInfoIdx_ |
Maps parameter block Ids to index in _parameterBlockInfos. More... | |
size_t | denseIndices_ |
Keep track of the size of the dense part of the equation system. More... | |
|
inlinevirtual |
Trivial destructor.
okvis::ceres::MarginalizationError::MarginalizationError | ( | ) |
Default constructor. Initialises a new okvis::ceres::Map.
okvis::ceres::MarginalizationError::MarginalizationError | ( | Map & | map | ) |
Constructor from okvis::ceres::Map.
[in] | map | The underlying okvis::ceres::Map. |
okvis::ceres::MarginalizationError::MarginalizationError | ( | Map & | map, |
std::vector< ::ceres::ResidualBlockId > & | residualBlockIds | ||
) |
Constructor from okvis::ceres::Map and directly add some residuals.
[in] | map | The underlying okvis::ceres::Map. |
[in] | residualBlockIds | Residual block IDs to be added directly ( |
bool okvis::ceres::MarginalizationError::addResidualBlock | ( | ::ceres::ResidualBlockId | residualBlockId, |
bool | keepResidualBlock = false |
||
) |
Add one residual to this marginalisation error. This means, it will get linearised.
[in] | residualBlockId | Residual block id, the corresponding term of which will be added. |
[in] | keepResidualBlock | Currently not in use. |
bool okvis::ceres::MarginalizationError::addResidualBlocks | ( | const std::vector< ::ceres::ResidualBlockId > & | residualBlockIds, |
const std::vector< bool > & | keepResidualBlocks = std::vector<bool>() |
||
) |
Add some residuals to this marginalisation error. This means, they will get linearised.
[in] | residualBlockIds | Vector of residual block ids, the corresponding terms of which will be added. |
[in] | keepResidualBlocks | Currently not in use. |
|
static |
Block-wise pseudo inversion of a symmetric matrix with non-zero diagonal blocks.
Derived | Matrix type (auto-deducible). |
blockDim | The block size of the diagonal blocks. |
[in] | M_in | Input Matrix |
[out] | M_out | Output, i.e. thepseudo-inverse. |
[in] | epsilon | The tolerance. |
|
static |
Block-wise pseudo inversion and square root (Cholesky decomposition) of a symmetric matrix with non-zero diagonal blocks.
Derived | Matrix type (auto-deducible). |
blockDim | The block size of the diagonal blocks. |
[in] | M_in | Input Matrix |
[out] | M_out | Output, i.e. the Cholesky decomposition of a pseudo-inverse. |
[in] | epsilon | The tolerance. |
|
protected |
Checks the internal datastructure (debug)
|
protected |
Computes the linearized deviation from the references (linearization points)
|
protected |
Computes the linearized deviation from the references (linearization points)
|
virtual |
This evaluates the error term and additionally computes the Jacobians.
parameters | Pointer to the parameters (see ceres) |
residuals | Pointer to the residual vector (see ceres) |
jacobians | Pointer to the Jacobians (see ceres) |
|
virtual |
This evaluates the error term and additionally computes the Jacobians in the minimal internal representation.
parameters | Pointer to the parameters (see ceres) |
residuals | Pointer to the residual vector (see ceres) |
jacobians | Pointer to the Jacobians (see ceres) |
jacobiansMinimal | Pointer to the minimal Jacobians (equivalent to jacobians). |
Implements okvis::ceres::ErrorInterface.
void okvis::ceres::MarginalizationError::getParameterBlockPtrs | ( | std::vector< std::shared_ptr< okvis::ceres::ParameterBlock > > & | parameterBlockPtrs | ) |
Call this in order to (re-)add this error term after whenever it had been modified.
[in] | parameterBlockPtrs | Parameter block pointers in question. |
bool okvis::ceres::MarginalizationError::isParameterBlockConnected | ( | uint64_t | parameterBlockId | ) |
Info: is this parameter block connected to this marginalization error?
[in] | parameterBlockId | Parameter block id of interest. |
bool okvis::ceres::MarginalizationError::marginalizeOut | ( | const std::vector< uint64_t > & | parameterBlockIds, |
const std::vector< bool > & | keepParameterBlocks = std::vector<bool>() |
||
) |
Marginalise out a set of parameter blocks.
|
inlinevirtual |
Dimension of an individual parameter block.
[in] | parameterBlockId | ID of the parameter block of interest. |
Implements okvis::ceres::ErrorInterface.
|
inlinevirtual |
Number of parameter blocks.
Implements okvis::ceres::ErrorInterface.
|
static |
Pseudo inversion of a symmetric matrix.
Derived | Matrix type (auto-deducible). |
[in] | a | Input Matrix |
[out] | result | Output, i.e. pseudo-inverse. |
[in] | epsilon | The tolerance. |
[out] | rank | Optional rank. |
|
static |
Pseudo inversion and square root (Cholesky decomposition) of a symmetric matrix.
Derived | Matrix type (auto-deducible). |
[in] | a | Input Matrix |
[out] | result | Output, i.e. the Cholesky decomposition of a pseudo-inverse. |
[in] | epsilon | The tolerance. |
[out] | rank | The rank, if of interest. |
|
inlinevirtual |
Residual dimension.
Implements okvis::ceres::ErrorInterface.
void okvis::ceres::MarginalizationError::setMap | ( | Map & | map | ) |
Set the underlying okvis::ceres::Map.
[in] | map | The underlying okvis::ceres::Map. |
|
staticprotected |
Split for Schur complement op.
|
staticprotected |
Split for Schur complement op.
|
inlinevirtual |
Return parameter block type as string.
Implements okvis::ceres::ErrorInterface.
void okvis::ceres::MarginalizationError::updateErrorComputation | ( | ) |
This must be called before optimization after adding residual blocks and/or marginalizing, since it performs all the lhs and rhs computations on from a given _H and _b.
|
protected |
rhs constant part
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef ::ceres::CostFunction okvis::ceres::MarginalizationError::base_t |
The base class type.
|
protected |
Keep track of the size of the dense part of the equation system.
|
protected |
_e0 := pinv(J^T) * _b0
|
protected |
adding residual blocks will invalidate this. before optimizing, call updateErrorComputation()
|
protected |
lhs - Hessian
|
protected |
Jacobian such that _J^T * J == _H.
|
protected |
The underlying map.
|
protected |
|
protected |
|
protected |
Maps parameter block Ids to index in _parameterBlockInfos.
|
protected |
Book keeper.
|
protected |
The residual block id of this.
|
protected |
singular values
|
protected |
pseudo inverse of _S
|
protected |
cwise sqrt of _S_pinv, i.e. pinv(J^T)=_U^T*_S_pinv_sqrt
|
protected |
cwise sqrt of _S, i.e. _S_sqrt*_S_sqrt=_S; _J=_U^T*_S_sqrt
|
protected |
H_ = _U*_S*_U^T lhs Eigen decomposition.