54 if (!vParent)
return 0.;
61 bool direct = odom->
vertices()[0] == from;
84 if (!status)
return OptimizationAlgorithm::Fail;
93 "Needs to operate on full graph");
99 typedef Eigen::Matrix<double, 1, 1, Eigen::ColMajor> ScalarMatrix;
103 blockIndices[i] = i + 1;
113 ScalarMatrix* m = H.
block(poseIdx, poseIdx,
true);
120 for (SparseOptimizer::EdgeContainer::const_iterator it =
125 assert(e &&
"Active edges contain non-odometry edge");
136 if (ind1 == -1 || ind2 == -1) {
137 if (ind1 == -1) fixedSet.insert(from);
138 if (ind2 == -1) fixedSet.insert(to);
142 bool transposedBlock = ind1 > ind2;
143 if (transposedBlock) {
144 std::swap(ind1, ind2);
147 ScalarMatrix* m = H.
block(ind1, ind2,
true);
153 assert(fixedSet.size() == 1);
167 for (SparseOptimizer::EdgeContainer::const_iterator it =
176 double fromThetaGuess =
178 double toThetaGuess =
181 toThetaGuess - fromThetaGuess);
183 bool fromNotFixed = !(from->
fixed());
184 bool toNotFixed = !(to->
fixed());
186 if (fromNotFixed || toNotFixed) {
187 double omega_r = -omega * error;
207 SystemSolver linearSystemSolver;
208 linearSystemSolver.
init();
209 bool ok = linearSystemSolver.solve(H, x.data(), b.data());
EIGEN_STRONG_INLINE const Measurement & measurement() const
accessor functions for the measurement represented by the edge
EIGEN_STRONG_INLINE const InformationType & information() const
information matrix of the constraint
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
2D edge between two Vertex2
const VertexContainer & vertices() const
abstract Vertex, your types must derive from that one
std::set< Vertex * > VertexSet
const VertexIDMap & vertices() const
linear solver which uses the sparse Cholesky solver from Eigen
A general case Vertex for optimization.
bool fixed() const
true => this node is fixed during the optimization
void setToOrigin()
sets the node to the origin (used in the multilevel stuff)
Implementation of the Gauss Newton Algorithm.
virtual SolverResult solve(int iteration, bool online=false)
SparseOptimizer * _optimizer
the optimizer the solver is working on
virtual OptimizationAlgorithm::SolverResult solve(int iteration, bool online=false)
virtual ~SolverSLAM2DLinear()
SolverSLAM2DLinear(std::unique_ptr< Solver > solver)
Sparse matrix which uses blocks.
SparseMatrixBlock * block(int r, int c, bool alloc=false)
const EdgeContainer & activeEdges() const
the edges active in the current optimization
const VertexContainer & indexMapping() const
the index mapping of the vertices
compute the initial guess of theta while traveling along the MST
virtual double perform(HyperGraph::Vertex *v, HyperGraph::Vertex *vParent, HyperGraph::Edge *e)
ThetaTreeAction(VectorX &theta)
2D pose Vertex, (x,y,theta)
#define __PRETTY_FUNCTION__
some general case utility functions
double normalize_theta(double theta)
VectorN< Eigen::Dynamic > VectorX
static void computeTree(AdjacencyMap &amap)
static void visitAdjacencyMap(AdjacencyMap &amap, TreeAction *action, bool useDistance=false)
void shortestPaths(HyperGraph::Vertex *v, HyperDijkstra::CostFunction *cost, double maxDistance=std::numeric_limits< double >::max(), double comparisonConditioner=1e-3, bool directed=false, double maxEdgeCost=std::numeric_limits< double >::max())
AdjacencyMap & adjacencyMap()
Vertex * vertex(int id)
returns the vertex number id appropriately casted