g2o
Loading...
Searching...
No Matches
g2o::G2oSlamInterface Class Reference

#include <g2o_slam_interface.h>

Inheritance diagram for g2o::G2oSlamInterface:
Collaboration diagram for g2o::G2oSlamInterface:

Public Types

enum  SolveResult { SOLVED , SOLVED_BATCH , NOOP , ERROR }

Public Member Functions

 G2oSlamInterface (SparseOptimizerOnline *optimizer)
bool addNode (const std::string &tag, int id, int dimension, const std::vector< double > &values)
bool addEdge (const std::string &tag, int id, int dimension, int v1, int v2, const std::vector< double > &measurement, const std::vector< double > &information)
bool fixNode (const std::vector< int > &nodes)
bool queryState (const std::vector< int > &nodes)
bool solveState ()
SolveResult solve ()
int updatedGraphEachN () const
void setUpdateGraphEachN (int n)
int batchSolveEachN () const
void setBatchSolveEachN (int n)
SparseOptimizerOnline * optimizer ()

Protected Member Functions

OptimizableGraph::Vertex * addVertex (int dimension, int id)
bool printVertex (OptimizableGraph::Vertex *v)

Protected Attributes

SparseOptimizerOnline * _optimizer
bool _firstOptimization
int _nodesAdded
int _incIterations
int _updateGraphEachN
int _batchEveryN
int _lastBatchStep
bool _initSolverDone
HyperGraph::VertexSet _verticesAdded
HyperGraph::EdgeSet _edgesAdded

Detailed Description

Definition at line 41 of file g2o_slam_interface.h.

Member Enumeration Documentation

◆ SolveResult

Enumerator
SOLVED 
SOLVED_BATCH 
NOOP 
ERROR 

Definition at line 44 of file g2o_slam_interface.h.

Constructor & Destructor Documentation

◆ G2oSlamInterface()

g2o::G2oSlamInterface::G2oSlamInterface ( SparseOptimizerOnline * optimizer)

Member Function Documentation

◆ addEdge()

bool g2o::G2oSlamInterface::addEdge ( const std::string & tag,
int id,
int dimension,
int v1,
int v2,
const std::vector< double > & measurement,
const std::vector< double > & information )
virtual

adding an edge to the SLAM engine.

Parameters
tagthe tag specifying the type of the vertex
idthe unique id of the edge.
dimensionthe dimension of the edge.
v1the unique id of the edge of the first vertex
v2the unique id of the edge of the second vertex
measurementthe measurement of the constraint
informationthe information matrix (inverse of the covariance) representing the uncertainty of the measurement (row-major upper triangular and diagonal)
Returns
true, if adding was successful

Implements SlamParser::AbstractSlamInterface.

Definition at line 133 of file g2o_slam_interface.cpp.

References __PRETTY_FUNCTION__, _edgesAdded, _nodesAdded, _optimizer, _verticesAdded, addVertex(), g2o::internal::fromVectorET(), g2o::internal::fromVectorQT(), g2o::HyperGraph::Vertex::id(), g2o::OnlineEdgeSE2::initialEstimate(), g2o::OnlineEdgeSE3::initialEstimate(), g2o::EdgeSE2::initialEstimatePossible(), g2o::EdgeSE3::initialEstimatePossible(), g2o::jac_quat3_euler3(), g2o::BaseEdge< D, E >::setInformation(), g2o::EdgeSE2::setMeasurement(), g2o::EdgeSE3::setMeasurement(), and g2o::HyperGraph::Edge::vertices().

Referenced by main().

◆ addNode()

bool g2o::G2oSlamInterface::addNode ( const std::string & tag,
int id,
int dimension,
const std::vector< double > & values )
virtual

adding a node to the SLAM engine.

Parameters
tagthe tag specifying the type of the vertex
idthe unique id of the node.
dimensionthe dimension of the node.
valuesthe pose of the node, may be empty (i.e., the engine should initialize the node itself)
Returns
true, if adding was successful

Implements SlamParser::AbstractSlamInterface.

Definition at line 117 of file g2o_slam_interface.cpp.

References _batchEveryN, _initSolverDone, and _optimizer.

Referenced by main().

◆ addVertex()

OptimizableGraph::Vertex * g2o::G2oSlamInterface::addVertex ( int dimension,
int id )
protected

Definition at line 369 of file g2o_slam_interface.cpp.

References _optimizer, and g2o::OptimizableGraph::Vertex::setId().

Referenced by addEdge().

◆ batchSolveEachN()

int g2o::G2oSlamInterface::batchSolveEachN ( ) const
inline

Definition at line 67 of file g2o_slam_interface.h.

References _batchEveryN.

◆ fixNode()

bool g2o::G2oSlamInterface::fixNode ( const std::vector< int > & nodes)
virtual

set some nodes to a fixed position

Parameters
nodesthe list of vertex IDs to fix
Returns
true, if successful

Implements SlamParser::AbstractSlamInterface.

Definition at line 332 of file g2o_slam_interface.cpp.

References _optimizer, and g2o::OptimizableGraph::Vertex::setFixed().

◆ optimizer()

SparseOptimizerOnline * g2o::G2oSlamInterface::optimizer ( )
inline

Definition at line 70 of file g2o_slam_interface.h.

References _optimizer.

Referenced by G2oSlamInterface(), and solveAndPrint().

◆ printVertex()

◆ queryState()

bool g2o::G2oSlamInterface::queryState ( const std::vector< int > & nodes)
virtual

Ask the SLAM engine to print the current estimate of the variables

Parameters
nodesthe list of vertex IDs to print, if empty print all variables
Returns
true, if successful

Implements SlamParser::AbstractSlamInterface.

Definition at line 340 of file g2o_slam_interface.cpp.

References _optimizer, and printVertex().

◆ setBatchSolveEachN()

void g2o::G2oSlamInterface::setBatchSolveEachN ( int n)

Definition at line 469 of file g2o_slam_interface.cpp.

References _batchEveryN.

Referenced by main().

◆ setUpdateGraphEachN()

void g2o::G2oSlamInterface::setUpdateGraphEachN ( int n)

Definition at line 433 of file g2o_slam_interface.cpp.

References _updateGraphEachN.

Referenced by main().

◆ solve()

◆ solveState()

bool g2o::G2oSlamInterface::solveState ( )
virtual

ask the engine to solve

Returns
true, if successful

Implements SlamParser::AbstractSlamInterface.

Definition at line 364 of file g2o_slam_interface.cpp.

References ERROR, and solve().

◆ updatedGraphEachN()

int g2o::G2oSlamInterface::updatedGraphEachN ( ) const
inline

Definition at line 64 of file g2o_slam_interface.h.

References _updateGraphEachN.

Member Data Documentation

◆ _batchEveryN

int g2o::G2oSlamInterface::_batchEveryN
protected

◆ _edgesAdded

HyperGraph::EdgeSet g2o::G2oSlamInterface::_edgesAdded
protected

Definition at line 83 of file g2o_slam_interface.h.

Referenced by addEdge(), and solve().

◆ _firstOptimization

bool g2o::G2oSlamInterface::_firstOptimization
protected

Definition at line 74 of file g2o_slam_interface.h.

Referenced by G2oSlamInterface(), and solve().

◆ _incIterations

int g2o::G2oSlamInterface::_incIterations
protected

Definition at line 76 of file g2o_slam_interface.h.

Referenced by G2oSlamInterface(), and solve().

◆ _initSolverDone

bool g2o::G2oSlamInterface::_initSolverDone
protected

Definition at line 80 of file g2o_slam_interface.h.

Referenced by addNode(), and G2oSlamInterface().

◆ _lastBatchStep

int g2o::G2oSlamInterface::_lastBatchStep
protected

Definition at line 79 of file g2o_slam_interface.h.

Referenced by G2oSlamInterface(), and solve().

◆ _nodesAdded

int g2o::G2oSlamInterface::_nodesAdded
protected

Definition at line 75 of file g2o_slam_interface.h.

Referenced by addEdge(), G2oSlamInterface(), and solve().

◆ _optimizer

SparseOptimizerOnline* g2o::G2oSlamInterface::_optimizer
protected

◆ _updateGraphEachN

int g2o::G2oSlamInterface::_updateGraphEachN
protected

◆ _verticesAdded

HyperGraph::VertexSet g2o::G2oSlamInterface::_verticesAdded
protected

Definition at line 82 of file g2o_slam_interface.h.

Referenced by addEdge(), and solve().


The documentation for this class was generated from the following files: