51 int numberOfTimeSteps = 1000;
52 const double processNoiseSigma = 1;
53 const double accelerometerNoiseSigma = 1;
54 const double gpsNoiseSigma = 1;
72 for (
int k = 0; k < 3; k++) {
87 for (
int k = 1; k <= numberOfTimeSteps; ++k) {
93 for (
int m = 0; m < 3; m++) {
94 state[m] += dt * (state[m + 3] + 0.5 * dt * processNoise[m]);
97 for (
int m = 0; m < 3; m++) {
98 state[m + 3] += dt * processNoise[m];
102 Vector3d accelerometerMeasurement;
103 for (
int m = 0; m < 3; m++) {
104 accelerometerMeasurement[m] =
109 Vector3d gpsMeasurement;
110 for (
int m = 0; m < 3; m++) {
134 vPrevSet.insert(vPrev);
137 lastStateNode = stateNode;
150 cerr <<
"number of vertices:" << optimizer.
vertices().size() << endl;
151 cerr <<
"number of edges:" << optimizer.
edges().size() << endl;
155 cout <<
"state=\n" << state << endl;
158 for (
int k = 0; k < numberOfTimeSteps; k++)
160 cout <<
"computed estimate " << k <<
"\n"
167 .find((std::max)(numberOfTimeSteps - 2, 0))
172 .find((std::max)(numberOfTimeSteps - 1, 0))
175 cout <<
"v1=\n" << v1 << endl;
176 cout <<
"v2=\n" << v2 << endl;
177 cout <<
"delta state=\n" << v2 - v1 << endl;
virtual void initialEstimate(const g2o::OptimizableGraph::VertexSet &from, g2o::OptimizableGraph::Vertex *to)
virtual void setMeasurement(const Measurement &m)
const EstimateType & estimate() const
return the current estimate of the vertex
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.
void setVertex(size_t i, Vertex *v)
std::set< Vertex * > VertexSet
const EdgeSet & edges() const
const VertexIDMap & vertices() const
linear solver which uses the sparse Cholesky solver from Eigen
virtual void setId(int id)
void setMarginalized(bool marginalized)
true => this node should be marginalized out during the optimization
Implementation of the Gauss Newton Algorithm.
Generic interface for a non-linear solver operating on a graph.
int optimize(int iterations, bool online=false)
void setVerbose(bool verbose)
virtual bool initializeOptimization(HyperGraph::EdgeSet &eset)
void setAlgorithm(OptimizationAlgorithm *algorithm)
double sampleGaussian(std::mt19937 *generator)
virtual bool addEdge(HyperGraph::Edge *e)
virtual bool addVertex(HyperGraph::Vertex *v, Data *userData)
Eigen::Matrix< double, 6, 1 > Vector6d