37 using namespace Eigen;
41 Vector3D rotAxisAngle = Vector3D::Random();
42 rotAxisAngle += Vector3D::Random();
43 Eigen::AngleAxisd rotation(rotAxisAngle.norm(), rotAxisAngle.normalized());
45 result.translation() = Vector3D::Random();
54 offsetParam->
setId(0);
61 OptimizableGraph::VertexSet auxSet;
66 cout << PVAR(priorEdge->
measurement().matrix()) << endl;
69 Eigen::Matrix<double,6,6,Eigen::ColMajor> information = Eigen::Matrix<double,6,6,Eigen::ColMajor>::Identity();
71 cout <<
"Full information" << endl;
75 cout << PVAR(priorEdge->
chi2()) << endl;
76 cout << v1->
estimate().matrix() << endl << endl;
79 cout <<
"Only translation" << endl;
81 information.block<3,3>(0,0) = Matrix3D::Identity();
82 information.block<3,3>(3,3) = Matrix3D::Zero();
85 cout << PVAR(priorEdge->
chi2()) << endl;
86 cout << v1->
estimate().matrix() << endl << endl;
89 cout <<
"Only rotation" << endl;
91 information.block<3,3>(0,0) = Matrix3D::Zero();
92 information.block<3,3>(3,3) = Matrix3D::Identity();
95 cout << PVAR(priorEdge->
chi2()) << endl;
96 cout << v1->
estimate().matrix() << endl << endl;
110 e.
setInformation(Eigen::Matrix<double,6,6,Eigen::ColMajor>::Identity());
115 numericJacobianWorkspace.
allocate();
117 for (
int k = 0; k < 100000; ++k) {
124 e.BaseBinaryEdge<6, Isometry3D, VertexSE3, VertexSE3>::linearizeOplus(numericJacobianWorkspace);
126 jacobianWorkspace = numericJacobianWorkspace;
129 e.BaseBinaryEdge<6, Isometry3D, VertexSE3, VertexSE3>::linearizeOplus();
132 const double allowedDifference = 1e-6;
133 for (
int i = 0; i < 2; ++i) {
136 for (
int j = 0; j < 6*6; ++j) {
137 double d = fabs(n[j] - a[j]);
138 if (d > allowedDifference) {
139 cerr <<
"\ndetected difference in the Jacobians " << d << endl;
140 cerr << PVAR(v1.
estimate().matrix()) << endl << endl;
141 cerr << PVAR(v2.
estimate().matrix()) << endl << endl;
142 cerr << PVAR(e.
measurement().matrix()) << endl << endl;
Isometry3D randomIsometry3d()
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
double * workspaceForVertex(int vertexIndex)
virtual double chi2() const
computes the chi2 based on the cached error value, only valid after computeError has been called...
void setVertex(size_t i, Vertex *v)
Edge between two 3D pose vertices.
virtual void setId(int id)
sets the id of the node in the graph be sure that the graph keeps consistent after changing the id ...
bool setParameterId(int argNum, int paramId)
virtual void setMeasurement(const Isometry3D &m)
void updateSize(const HyperGraph::Edge *e)
EIGEN_STRONG_INLINE void setInformation(const InformationType &information)
Eigen::Transform< double, 3, Eigen::Isometry, Eigen::ColMajor > Isometry3D
bool addParameter(Parameter *p)
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
const EstimateType & estimate() const
return the current estimate of the vertex
3D pose Vertex, represented as an Isometry3D
virtual void setMeasurement(const Isometry3D &m)
provide memory workspace for computing the Jacobians
virtual bool addEdge(HyperGraph::Edge *e)
virtual bool addVertex(HyperGraph::Vertex *v, Data *userData)
Protocol The SLAM executable accepts such as solving the and retrieving or vertices in the graph
EIGEN_STRONG_INLINE const Measurement & measurement() const
accessor functions for the measurement represented by the edge
virtual void initialEstimate(const OptimizableGraph::VertexSet &from, OptimizableGraph::Vertex *to)