NDEVR
API Documentation
base_edge.h
1#pragma once
2#include <limits>
3#include <Eigen/Core>
4#include "optimizable_graph.h"
5
6namespace NDEVR
7{
8 using namespace Eigen;
15 template <sint04 t_dims, typename E>
17 {
18 public:
19 static constexpr sint04 Dimension = t_dims;
20 typedef E Measurement;
21 typedef Eigen::Matrix<g_type, t_dims, 1> ErrorVector;
22 typedef Eigen::Matrix<g_type, t_dims, t_dims> InformationType;
23
26 : OptimizableGraph::OGEdge()
27 {}
28
30 virtual sint04 dimension() const final override
31 {
32 return t_dims;
33 }
34
37 g_type chi2() const final override
38 {
39 return _error.dot(information() * _error);
40 }
41
43 const ErrorVector& error() const { return _error; }
44 //ErrorVector& error() { return _error; }
45
47
48 g_type scalerInformation() const { return _information.data()[0]; }
50 const InformationType& information() const { return _information; }
56 void setInformation(g_type information) { _information = InformationType::Identity() * information; }
57
59 const g_type* informationData() const final override { return _information.data(); }
61 g_type* informationData() final override { return _information.data(); }
62
64 const Measurement& measurement() const { return _measurement; }
67 void setMeasurement(const Measurement& m) { _measurement = m; }
68
71 int rank() const { return t_dims; }
72
73 protected:
77 //bool m_scaler_info = false;
81 InformationType robustInformation(const Eigen::Vector3<g_type>& rho) const
82 {
83 InformationType result = rho[1] * _information;
84 //ErrorVector weightedErrror = _information * _error;
85 //result.noalias() += 2 * rho[2] * (weightedErrror * weightedErrror.transpose());
86 return result;
87 }
88 public:
89 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
90 };
91}
g_type * informationData() final override
Returns a mutable pointer to the raw information matrix data.
Definition base_edge.h:61
const Measurement & measurement() const
accessor functions for the measurement represented by the edge
Definition base_edge.h:64
g_type chi2() const final override
Computes the chi-squared error: e^T * Omega * e.
Definition base_edge.h:37
BaseEdge()
Default constructor.
Definition base_edge.h:25
g_type scalerInformation() const
information matrix of the constraint
Definition base_edge.h:48
InformationType robustInformation(const Eigen::Vector3< g_type > &rho) const
calculate the robust information matrix by updating the information matrix of the error
Definition base_edge.h:81
void setInformation(g_type information)
Sets the information matrix to a scaled identity.
Definition base_edge.h:56
static constexpr sint04 Dimension
Definition base_edge.h:19
InformationType _information
Definition base_edge.h:74
int rank() const
Returns the rank (dimension) of the error.
Definition base_edge.h:71
Eigen::Matrix< g_type, t_dims, t_dims > InformationType
Definition base_edge.h:22
const InformationType & information() const
Returns a const reference to the information matrix.
Definition base_edge.h:50
const g_type * informationData() const final override
Returns a const pointer to the raw information matrix data.
Definition base_edge.h:59
Measurement _measurement
Definition base_edge.h:75
const ErrorVector & error() const
Returns a const reference to the error vector.
Definition base_edge.h:43
void setMeasurement(const Measurement &m)
Sets the measurement for this edge.
Definition base_edge.h:67
ErrorVector _error
Definition base_edge.h:76
Eigen::Matrix< g_type, t_dims, 1 > ErrorVector
Definition base_edge.h:21
void setInformation(const InformationType &information)
Sets the information matrix.
Definition base_edge.h:53
virtual sint04 dimension() const final override
Returns the dimension of the error vector.
Definition base_edge.h:30
Base edge class for the optimizable graph, adding error computation and robust kernels.
OGEdge()
Default constructor.
The primary namespace for the NDEVR SDK.
int32_t sint04
-Defines an alias representing a 4 byte, signed integer.