50 SE2 sensorOffsetTransf(0.2, 0.1, -0.1);
53 simulator.simulate(numNodes, sensorOffsetTransf);
64 auto linearSolver = std::make_unique<SlamLinearSolver>();
65 linearSolver->setBlockOrdering(
false);
68 std::make_unique<SlamBlockSolver>(std::move(linearSolver)));
74 sensorOffset->
setOffset(sensorOffsetTransf);
75 sensorOffset->
setId(0);
80 cerr <<
"Optimization: Adding robot poses ... ";
81 for (
size_t i = 0; i < simulator.poses().size(); ++i) {
89 cerr <<
"done." << endl;
92 cerr <<
"Optimization: Adding odometry measurements ... ";
93 for (
size_t i = 0; i < simulator.odometry().size(); ++i) {
103 cerr <<
"done." << endl;
106 cerr <<
"Optimization: add landmark vertices ... ";
107 for (
size_t i = 0; i < simulator.landmarks().size(); ++i) {
114 cerr <<
"done." << endl;
116 cerr <<
"Optimization: add landmark observations ... ";
117 for (
size_t i = 0; i < simulator.landmarkObservations().size(); ++i) {
119 simulator.landmarkObservations()[i];
126 optimizer.
addEdge(landmarkObservation);
128 cerr <<
"done." << endl;
135 optimizer.
save(
"tutorial_before.g2o");
143 cerr <<
"Optimizing" << endl;
146 cerr <<
"done." << endl;
148 optimizer.
save(
"tutorial_after.g2o");
virtual void setMeasurement(const Measurement &m)
void setInformation(const InformationType &information)
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
Implementation of a solver operating on the blocks of the Hessian.
const VertexContainer & vertices() const
linear solver which uses the sparse Cholesky solver from Eigen
bool setParameterId(int argNum, int paramId)
virtual void setId(int id)
void setFixed(bool fixed)
true => this node should be considered fixed during the optimization
Implementation of the Gauss Newton Algorithm.
int optimize(int iterations, bool online=false)
void setVerbose(bool verbose)
virtual bool initializeOptimization(HyperGraph::EdgeSet &eset)
void setAlgorithm(OptimizationAlgorithm *algorithm)
2D edge between two Vertex2, i.e., the odometry
void setMeasurement(const SE2 &m)
void setOffset(const SE2 &offset=SE2())
2D pose Vertex, (x,y,theta)
traits to summarize the properties of the fixed size optimization problem
virtual bool addEdge(HyperGraph::Edge *e)
virtual bool save(std::ostream &os, int level=0) const
save the graph to a stream. Again uses the Factory system.
bool addParameter(Parameter *p)
virtual bool addVertex(HyperGraph::Vertex *v, Data *userData)
Vertex * vertex(int id)
returns the vertex number id appropriately casted
Eigen::Matrix3d information
Eigen::Vector2d simulatorMeas
Eigen::Matrix2d information
Eigen::Vector2d simulatedPose