33 #include <Eigen/Dense> 38 using namespace Eigen;
43 cerr <<
"Projecting marginals" << endl;
44 std::vector<std::pair<int, int> > blockIndices;
58 cerr <<
"Vertex id:" << v->
id() << endl;
66 std::vector<MySigmaPoint, Eigen::aligned_allocator<MySigmaPoint> > spts;
73 std::vector<MySigmaPoint, Eigen::aligned_allocator<MySigmaPoint> > tspts = spts;
75 for (
size_t j=0; j<spts.size(); j++) {
82 v->
oplus(&(spts[j]._sample[0]));
84 tspts[j]._sample=mean;
92 cerr <<
"mean: " << endl;
94 cerr <<
"oldMean: " << endl;
95 cerr << oldMean << endl;
96 cerr <<
"cov: " << endl;
110 MatrixXd m=MatrixXd(6,6);
111 for (
int i=0; i<6; i++){
112 for (
int j=i; j<6; j++){
116 m+=MatrixXd::Identity(6,6);
121 std::vector<MySigmaPoint, Eigen::aligned_allocator<MySigmaPoint> > spts;
123 for (
size_t i =0; i<spts.size(); i++){
124 cerr <<
"Point " << i <<
" " << endl <<
"wi=" << spts[i]._wi <<
" wp=" << spts[i]._wp <<
" " << endl;
125 cerr << spts[i]._sample << endl;
129 MatrixXd recCov(6,6);
133 cerr <<
"recMean" << endl;
134 cerr << recMean << endl;
136 cerr <<
"recCov" << endl;
137 cerr << recCov << endl;
int id() const
returns the id
void testMarginals(SparseOptimizer &optimizer)
SparseMatrixBlock * block(int r, int c, bool alloc=false)
returns the block at location r,c. if alloc=true he block is created if it does not exist ...
void reconstructGaussian(SampleType &mean, CovarianceType &covariance, const std::vector< SigmaPoint< SampleType >, Eigen::aligned_allocator< SigmaPoint< SampleType > > > &sigmaPoints)
int hessianIndex() const
temporary index of this node in the parameter vector obtained from linearization
utility functions for handling time related stuff
void oplus(const double *v)
virtual void push()=0
backup the position of the vertex to a stack
virtual void pop()=0
restore the position of the vertex by retrieving the position from the stack
virtual int minimalEstimateDimension() const
virtual bool getMinimalEstimateData(double *estimate) const
bool sampleUnscented(std::vector< SigmaPoint< SampleType >, Eigen::aligned_allocator< SigmaPoint< SampleType > > > &sigmaPoints, const SampleType &mean, const CovarianceType &covariance)
A general case Vertex for optimization.
const VertexContainer & activeVertices() const
the vertices active in the current optimization
bool computeMarginals(SparseBlockMatrix< MatrixXD > &spinv, const std::vector< std::pair< int, int > > &blockIndices)
Sparse matrix which uses blocks.
SigmaPoint< VectorXd > MySigmaPoint