g2o
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
g2o Namespace Reference

Namespaces

 csparse_extension
 
 deprecated
 
 internal
 
 opengl
 
 tutorial
 
 types_icp
 
 types_six_dof_expmap
 

Classes

class  AbstractHyperGraphElementCreator
 Abstract interface for allocating HyperGraphElement. More...
 
class  AbstractOptimizationAlgorithmCreator
 base for allocating an optimization algorithm More...
 
class  AbstractRobustKernelCreator
 Abstract interface for allocating a robust kernel. More...
 
struct  BackBoneTreeAction
 
class  BaseBinaryEdge
 
class  BaseEdge
 
class  BaseEdge<-1, E >
 
class  BaseMultiEdge
 base class to represent an edge connecting an arbitrary number of nodes More...
 
class  BaseMultiEdge<-1, E >
 
class  BaseProperty
 
class  BaseRobot
 
class  BaseSensor
 
class  BaseUnaryEdge
 
class  BaseVertex
 Templatized BaseVertex. More...
 
class  BaseWorldObject
 
class  BinarySensor
 
class  BlockSolver
 Implementation of a solver operating on the blocks of the Hessian. More...
 
class  BlockSolverBase
 base for the block solvers with some basic function interfaces More...
 
struct  BlockSolverTraits
 traits to summarize the properties of the fixed size optimization problem More...
 
struct  BlockSolverTraits< Eigen::Dynamic, Eigen::Dynamic >
 traits to summarize the properties of the dynamic size optimization problem More...
 
class  Cache
 
class  CacheCamera
 
class  CacheContainer
 
class  CacheSE2Offset
 caching the offset related to a vertex More...
 
class  CacheSE3Offset
 caching the offset related to a vertex More...
 
class  CameraParameters
 
struct  CholmodExt
 Our extension of the CHOLMOD matrix struct. More...
 
class  CholmodSolverCreator
 
class  ClosedFormCalibration
 Simultaneous calibration of the laser offest and the parameters of a differential drive. More...
 
struct  CmpPairFirst
 
struct  ColSort
 
class  CommandArgs
 Command line parsing of argc and argv. More...
 
struct  CSparseExt
 Our C++ version of the csparse struct. More...
 
class  CSparseSolverCreator
 
class  DataQueue
 a simple queue to store data and retrieve based on a timestamp More...
 
class  DenseSolverCreator
 
class  DlWrapper
 Loading libraries during run-time. More...
 
class  DrawAction
 draw actions More...
 
class  Edge_V_V_GICP
 
class  Edge_XYZ_VSC
 Point vertex, XYZ, is in types_sba. More...
 
struct  EdgeCreator
 
class  EdgeGICP
 
struct  EdgeLabeler
 
class  EdgeLine2D
 
class  EdgeLine2DPointXY
 
class  EdgeLine3D
 
class  EdgeNormal
 
class  EdgePlane
 
class  EdgePointXY
 
class  EdgePointXYZ
 
class  EdgeProjectP2MC
 
class  EdgeProjectP2MC_Intrinsics
 
class  EdgeProjectP2SC
 
class  EdgeProjectPSI2UV
 
class  EdgeProjectXYZ2UV
 
class  EdgeProjectXYZ2UVU
 
class  EdgeSBACam
 3D edge between two SBAcam More...
 
class  EdgeSBAScale
 edge between two SBAcam that specifies the distance between them More...
 
class  EdgeSE2
 2D edge between two Vertex2 More...
 
class  EdgeSE2Line2D
 
class  EdgeSE2LotsOfXY
 
class  EdgeSE2OdomDifferentialCalib
 
class  EdgeSE2Offset
 Offset edge. More...
 
class  EdgeSE2PointXY
 
class  EdgeSE2PointXYBearing
 
class  EdgeSE2PointXYBearingWriteGnuplotAction
 
class  EdgeSE2PointXYCalib
 Landmark measurement that also calibrates an offset for the landmark measurement. More...
 
class  EdgeSE2PointXYOffset
 
class  EdgeSE2PointXYWriteGnuplotAction
 
class  EdgeSE2Prior
 Prior for a two D pose. More...
 
class  EdgeSE2PureCalib
 calibrate odometry and laser based on a set of measurements More...
 
class  EdgeSE2Segment2D
 
class  EdgeSE2Segment2DLine
 
class  EdgeSE2Segment2DPointLine
 
class  EdgeSE2SensorCalib
 scanmatch measurement that also calibrates an offset for the laser More...
 
class  EdgeSE2TwoPointsXY
 
class  EdgeSE2WriteGnuplotAction
 
class  EdgeSE2XYPrior
 Prior for a two D pose with constraints only in xy direction (like gps) More...
 
class  EdgeSE3
 Edge between two 3D pose vertices. More...
 
class  EdgeSE3Calib
 Landmark measurement that also calibrates an offset for the landmark measurement. More...
 
class  EdgeSE3Euler
 3D edge between two VertexSE3, uses the euler angle parameterization for the read/write functions only. More...
 
class  EdgeSE3Expmap
 6D edge between two Vertex6 More...
 
class  EdgeSE3Line3D
 
class  EdgeSE3LotsOfXYZ
 
class  EdgeSE3Offset
 Offset edge. More...
 
class  EdgeSE3PlaneSensorCalib
 plane measurement that also calibrates an offset for the sensor More...
 
class  EdgeSE3PointXYZ
 g2o edge from a track to a point node More...
 
class  EdgeSE3PointXYZDepth
 
class  EdgeSE3PointXYZDisparity
 edge from a track to a depth camera node using a disparity measurement More...
 
class  EdgeSE3Prior
 prior for an SE3 element More...
 
class  EdgeSE3WriteGnuplotAction
 Output the pose-pose constraint to Gnuplot data file. More...
 
class  EdgeSim3
 7D edge between two Vertex7 More...
 
class  EdgeSim3ProjectXYZ
 
struct  EdgeTypesCostFunction
 
class  EigenSolverCreator
 
class  EstimatePropagator
 propagation of an initial guess More...
 
class  EstimatePropagatorCost
 cost for traversing along active edges in the optimizer More...
 
class  EstimatePropagatorCostOdometry
 cost for traversing only odometry edges. More...
 
class  Factory
 create vertices and edges based on TAGs in, for example, a file More...
 
struct  ForceLinker
 
struct  G2OBatchStatistics
 statistics about the optimization More...
 
class  G2oQGLViewer
 OpenGL based viewer for the graph. More...
 
class  G2oSlamInterface
 
class  GaussianSampler
 
class  Gm2dlIO
 read / write gm2dl file into / out of a SparseOptimizer More...
 
class  GuiHyperGraphAction
 action which calls an GUI update after each iteration More...
 
struct  HyperDijkstra
 
class  HyperGraph
 
class  HyperGraphAction
 Abstract action that operates on an entire graph. More...
 
class  HyperGraphActionLibrary
 library of actions, indexed by the action name; More...
 
class  HyperGraphElementAction
 Abstract action that operates on a graph entity. More...
 
class  HyperGraphElementActionCollection
 collection of actions More...
 
class  HyperGraphElementCreator
 templatized creator class which creates graph elements More...
 
class  JacobianWorkspace
 provide memory workspace for computing the Jacobians More...
 
struct  LaserParameters
 parameters for a 2D range finder More...
 
struct  Line2D
 
class  Line3D
 
class  LinearSolver
 basic solver for Ax = b More...
 
class  LinearSolverCCS
 Solver with faster iterating structure for the linear matrix. More...
 
class  LinearSolverCholmod
 basic solver for Ax = b which has to reimplemented for different linear algebra libraries More...
 
class  LinearSolverCholmodOnline
 linear solver which allows to update the cholesky factor More...
 
class  LinearSolverCholmodOnlineInterface
 generic interface for the online solver More...
 
class  LinearSolverCSparse
 linear solver which uses CSparse More...
 
class  LinearSolverDense
 linear solver using dense cholesky decomposition More...
 
class  LinearSolverEigen
 linear solver which uses the sparse Cholesky solver from Eigen More...
 
class  LinearSolverPCG
 linear solver using PCG, pre-conditioner is block Jacobi More...
 
class  MarginalCovarianceCholesky
 computing the marginal covariance given a cholesky factor (lower triangle of the factor) More...
 
struct  MatrixElem
 
class  MatrixStructure
 representing the structure of a matrix in column compressed structure (only the upper triangular part of the matrix) More...
 
struct  MotionInformation
 
class  MotionMeasurement
 A 2D odometry measurement expressed as a transformation. More...
 
struct  OdomAndLaserMotion
 
class  OdomConvert
 convert between the different types of odometry measurements More...
 
class  OnlineEdgeSE2
 
class  OnlineEdgeSE3
 
class  OnlineVertexSE2
 
class  OnlineVertexSE3
 
class  OpenMPMutex
 
struct  OptimizableGraph
 
class  OptimizationAlgorithm
 Generic interface for a non-linear solver operating on a graph. More...
 
class  OptimizationAlgorithmDogleg
 Implementation of Powell's Dogleg Algorithm. More...
 
class  OptimizationAlgorithmFactory
 create solvers based on their short name More...
 
class  OptimizationAlgorithmGaussNewton
 Implementation of the Gauss Newton Algorithm. More...
 
class  OptimizationAlgorithmLevenberg
 Implementation of the Levenberg Algorithm. More...
 
struct  OptimizationAlgorithmProperty
 describe the properties of a solver More...
 
class  OptimizationAlgorithmWithHessian
 Base for solvers operating on the approximated Hessian, e.g., Gauss-Newton, Levenberg. More...
 
class  Parameter
 
class  ParameterCamera
 parameters for a camera More...
 
class  ParameterContainer
 map id to parameters More...
 
class  ParameterSE2Offset
 offset for an SE2 More...
 
class  ParameterSE3Offset
 offset for an SE3 More...
 
class  ParameterStereoCamera
 parameters for a camera More...
 
class  PCGSolverCreator
 
class  Plane3D
 
class  PointSensorParameters
 
class  Property
 
class  PropertyMap
 a collection of properties mapping from name to the property itself More...
 
class  RawLaser
 Raw laser measuerement. More...
 
class  RegisterActionProxy
 
class  RegisterOptimizationAlgorithmProxy
 
class  RegisterRobustKernelProxy
 
class  RegisterTypeProxy
 
class  Robot
 
class  RobotData
 data recorded by the robot More...
 
class  RobotLaser
 laser measurement obtained by a robot More...
 
class  RobustKernel
 base for all robust cost functions More...
 
class  RobustKernelCauchy
 Cauchy cost function. More...
 
class  RobustKernelCreator
 templatized creator class which creates graph elements More...
 
class  RobustKernelDCS
 Dynamic covariance scaling - DCS. More...
 
class  RobustKernelFactory
 create robust kernels based on their human readable name More...
 
class  RobustKernelFair
 Fair cost function. More...
 
class  RobustKernelGemanMcClure
 Geman-McClure cost function. More...
 
class  RobustKernelHuber
 Huber Cost Function. More...
 
class  RobustKernelPseudoHuber
 Pseudo Huber Cost Function. More...
 
class  RobustKernelSaturated
 Saturated cost function. More...
 
class  RobustKernelScaleDelta
 scale a robust kernel to another delta (window size) More...
 
class  RobustKernelTukey
 Tukey Cost Function. More...
 
class  RobustKernelWelsch
 Welsch cost function. More...
 
class  RunG2OViewer
 wrapper for running the g2o viewer More...
 
class  Sampler
 
class  SBACam
 
class  ScopedArray
 a scoped pointer for an array, i.e., array will be deleted on leaving the scope More...
 
class  ScopedOpenMPMutex
 lock a mutex within a scope More...
 
class  ScopedPointer
 a scoped pointer for an objectarray, i.e., object will be deleted on leaving the scope More...
 
class  ScopedTictoc
 Simplify calls to tictoc() for a whole scope. More...
 
class  ScopeTime
 Class to measure the time spent in a scope. More...
 
class  SE2
 represent SE2 More...
 
class  SE3Quat
 
class  SensorOdometry
 
class  SensorOdometry2D
 
class  SensorOdometry3D
 
class  SensorPointLine3D
 
class  SensorPointXY
 
class  SensorPointXYBearing
 
class  SensorPointXYOffset
 
class  SensorPointXYZ
 
class  SensorPointXYZDepth
 
class  SensorPointXYZDisparity
 
class  SensorPose2D
 
class  SensorPose3D
 
class  SensorPose3DOffset
 
class  SensorSE3Prior
 
class  SensorSegment2D
 
class  SensorSegment2DLine
 
class  SensorSegment2DPointLine
 
struct  SigmaPoint
 
struct  Sim3
 
class  SLAM2DLinearSolverCreator
 
class  Slam2DViewer
 
class  SleepThread
 helper for calling usleep on any system using Qt More...
 
class  Solver
 Generic interface for a sparse solver operating on a graph which solves one iteration of the linearized objective function. More...
 
class  SolverSLAM2DLinear
 Implementation of a linear approximation for 2D pose graph SLAM. More...
 
class  SparseBlockMatrix
 Sparse matrix which uses blocks. More...
 
class  SparseBlockMatrixCCS
 Sparse matrix which uses blocks. More...
 
class  SparseBlockMatrixDiagonal
 Sparse matrix which uses blocks on the diagonal. More...
 
class  SparseBlockMatrixHashMap
 Sparse matrix which uses blocks based on hash structures. More...
 
class  SparseOptimizer
 
class  SparseOptimizerIncremental
 
class  SparseOptimizerOnline
 
class  SparseOptimizerTerminateAction
 stop iterating based on the gain which is (oldChi - currentChi) / currentChi. More...
 
struct  Star
 
class  StructureOnlyCreator
 
class  StructureOnlySolver
 This is a solver for "structure-only" optimization". More...
 
class  ThetaTreeAction
 compute the initial guess of theta while travelling along the MST More...
 
struct  TicTocElement
 Internal structure of the tictoc profiling. More...
 
struct  TicTocInitializer
 helper for printing the struct at the end of the lifetime of the program More...
 
class  UnarySensor
 
struct  UniformCostFunction
 
class  VelocityMeasurement
 velocity measurement of a differential robot More...
 
class  VertexCam
 SBACam Vertex, (x,y,z,qw,qx,qy,qz) the parameterization for the increments constructed is a 6d vector (x,y,z,qx,qy,qz) (note that we leave out the w part of the quaternion. qw is assumed to be positive, otherwise there is an ambiguity in qx,qy,qz as a rotation. More...
 
class  VertexEllipse
 string ellipse to be attached to a vertex More...
 
class  VertexIntrinsics
 Vertex encoding the intrinsics of the camera fx, fy, cx, xy, baseline;. More...
 
class  VertexLine2D
 
class  VertexLine3D
 
class  VertexOdomDifferentialParams
 
class  VertexPlane
 
class  VertexPointXY
 
class  VertexPointXYWriteGnuplotAction
 
class  VertexPointXYZ
 Vertex for a tracked point in space. More...
 
class  VertexPointXYZWriteGnuplotAction
 
class  VertexSBAPointXYZ
 Point vertex, XYZ. More...
 
class  VertexSCam
 Stereo camera vertex, derived from SE3 class. Note that we use the actual pose of the vertex as its parameterization, rather than the transform from RW to camera coords. Uses static vars for camera params, so there is a single camera setup. More...
 
class  VertexSE2
 2D pose Vertex, (x,y,theta) More...
 
class  VertexSE2WriteGnuplotAction
 
class  VertexSE3
 3D pose Vertex, represented as an Isometry3D More...
 
class  VertexSE3Euler
 3D pose Vertex, (x,y,z,roll,pitch,yaw) the internal parameterization is the same as veretx_se3_quat. Only the read/write operations are rewritten to input/output euler angles. More...
 
class  VertexSE3Expmap
 SE3 Vertex parameterized internally with a transformation matrix and externally with its exponential map. More...
 
class  VertexSE3WriteGnuplotAction
 write the vertex to some Gnuplot data file More...
 
class  VertexSegment2D
 
class  VertexSegment2DWriteGnuplotAction
 
class  VertexSim3Expmap
 Sim3 Vertex, (x,y,z,qw,qx,qy,qz) the parameterization for the increments constructed is a 7d vector (x,y,z,qx,qy,qz) (note that we leave out the w part of the quaternion. More...
 
class  VertexTag
 string tag to be attached to a vertex More...
 
class  World
 
class  WorldObject
 
class  WriteGnuplotAction
 

Typedefs

typedef SigmaPoint< VectorXd > MySigmaPoint
 
typedef std::multimap< OptimizableGraph::Vertex *, Star * > VertexStarMultimap
 
typedef std::map< OptimizableGraph::Vertex *, Star * > VertexStarMap
 
typedef std::set< Star * > StarSet
 
typedef std::map< HyperGraph::Edge *, Star * > EdgeStarMap
 
typedef WorldObject< VertexSE2WorldObjectSE2
 
typedef WorldObject< VertexPointXYWorldObjectPointXY
 
typedef WorldObject< VertexSegment2DWorldObjectSegment2D
 
typedef Robot< WorldObjectSE2Robot2D
 
typedef WorldObject< VertexSE3WorldObjectSE3
 
typedef WorldObject< VertexPointXYZWorldObjectTrackXYZ
 
typedef WorldObject< VertexLine3DWorldObjectLine3D
 
typedef Robot< WorldObjectSE3Robot3D
 
typedef std::vector< G2OBatchStatisticsBatchStatisticsContainer
 
typedef BlockSolver< BlockSolverTraits< Eigen::Dynamic, Eigen::Dynamic > > BlockSolverX
 
typedef BlockSolver< BlockSolverTraits< 6, 3 > > BlockSolver_6_3
 
typedef BlockSolver< BlockSolverTraits< 7, 3 > > BlockSolver_7_3
 
typedef BlockSolver< BlockSolverTraits< 3, 2 > > BlockSolver_3_2
 
typedef Eigen::Matrix< int, 2, 1, Eigen::ColMajor > Vector2I
 
typedef Eigen::Matrix< int, 3, 1, Eigen::ColMajor > Vector3I
 
typedef Eigen::Matrix< int, 4, 1, Eigen::ColMajor > Vector4I
 
typedef Eigen::Matrix< int, Eigen::Dynamic, 1, Eigen::ColMajor > VectorXI
 
typedef Eigen::Matrix< float, 2, 1, Eigen::ColMajor > Vector2F
 
typedef Eigen::Matrix< float, 3, 1, Eigen::ColMajor > Vector3F
 
typedef Eigen::Matrix< float, 4, 1, Eigen::ColMajor > Vector4F
 
typedef Eigen::Matrix< float, Eigen::Dynamic, 1, Eigen::ColMajor > VectorXF
 
typedef Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
 
typedef Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
 
typedef Eigen::Matrix< double, 4, 1, Eigen::ColMajor > Vector4D
 
typedef Eigen::Matrix< double, Eigen::Dynamic, 1, Eigen::ColMajor > VectorXD
 
typedef Eigen::Matrix< int, 2, 2, Eigen::ColMajor > Matrix2I
 
typedef Eigen::Matrix< int, 3, 3, Eigen::ColMajor > Matrix3I
 
typedef Eigen::Matrix< int, 4, 4, Eigen::ColMajor > Matrix4I
 
typedef Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixXI
 
typedef Eigen::Matrix< float, 2, 2, Eigen::ColMajor > Matrix2F
 
typedef Eigen::Matrix< float, 3, 3, Eigen::ColMajor > Matrix3F
 
typedef Eigen::Matrix< float, 4, 4, Eigen::ColMajor > Matrix4F
 
typedef Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixXF
 
typedef Eigen::Matrix< double, 2, 2, Eigen::ColMajor > Matrix2D
 
typedef Eigen::Matrix< double, 3, 3, Eigen::ColMajor > Matrix3D
 
typedef Eigen::Matrix< double, 4, 4, Eigen::ColMajor > Matrix4D
 
typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixXD
 
typedef Eigen::Transform< double, 2, Eigen::Isometry, Eigen::ColMajor > Isometry2D
 
typedef Eigen::Transform< double, 3, Eigen::Isometry, Eigen::ColMajor > Isometry3D
 
typedef Eigen::Transform< double, 2, Eigen::Affine, Eigen::ColMajor > Affine2D
 
typedef Eigen::Transform< double, 3, Eigen::Affine, Eigen::ColMajor > Affine3D
 
typedef std::vector< Parameter * > ParameterVector
 
typedef std::shared_ptr< RobustKernelRobustKernelPtr
 
typedef SparseBlockMatrix< MatrixXDSparseBlockMatrixXd
 
typedef std::vector< MotionInformation, Eigen::aligned_allocator< MotionInformation > > MotionInformationVector
 
typedef void(* ForceLinkFunction) (void)
 
typedef Property< int > IntProperty
 
typedef Property< bool > BoolProperty
 
typedef Property< float > FloatProperty
 
typedef Property< double > DoubleProperty
 
typedef Property< std::string > StringProperty
 
typedef std::map< std::string, TicTocElementTicTocMap
 
typedef Matrix< double, 6, 1, Eigen::ColMajor > Vector6d
 
typedef Eigen::Matrix< double, 6, 6, Eigen::ColMajor > Matrix6d
 
typedef Eigen::Matrix< double, 7, 1 > Vector7d
 
typedef Eigen::Matrix< double, 7, 7 > Matrix7d
 
typedef Eigen::Matrix< double, 7, 6, Eigen::ColMajor > Matrix7x6d
 

Enumerations

enum  CommandArgumentType {
  CAT_DOUBLE, CAT_FLOAT, CAT_INT, CAT_STRING,
  CAT_BOOL, CAT_VECTOR_INT, CAT_VECTOR_DOUBLE
}
 

Functions

void findArguments (const std::string &option, vector< string > &args, int argc, char **argv)
 
void loadStandardTypes (DlWrapper &dlTypesWrapper, int argc, char **argv)
 
void loadStandardSolver (DlWrapper &dlSolverWrapper, int argc, char **argv)
 
bool edgeAllVertsSameDim (OptimizableGraph::Edge *e, int dim)
 
bool saveGnuplot (const std::string &gnudump, const OptimizableGraph &optimizer)
 
bool saveGnuplot (const std::string &gnudump, const HyperGraph::VertexSet &vertices, const HyperGraph::EdgeSet &edges)
 
bool dumpEdges (std::ostream &os, const OptimizableGraph &optimizer)
 
double activeVertexChi (const OptimizableGraph::Vertex *v)
 
void constructEdgeStarMap (EdgeStarMap &esmap, StarSet &stars, bool low)
 
size_t vertexEdgesInStar (HyperGraph::EdgeSet &eset, HyperGraph::Vertex *v, Star *s, EdgeStarMap &esmap)
 
void starsInVertex (StarSet &stars, HyperGraph::Vertex *v, EdgeStarMap &esmap)
 
void starsInEdge (StarSet &stars, HyperGraph::Edge *e, EdgeStarMap &esmap, HyperGraph::VertexSet &gauge)
 
void assignHierarchicalEdges (StarSet &stars, EdgeStarMap &esmap, EdgeLabeler *labeler, EdgeCreator *creator, SparseOptimizer *optimizer, int minNumEdges, int maxIterations)
 
void computeBorder (StarSet &stars, EdgeStarMap &hesmap)
 
void computeSimpleStars (StarSet &stars, SparseOptimizer *optimizer, EdgeLabeler *labeler, EdgeCreator *creator, OptimizableGraph::Vertex *gauge_, std::string edgeTag, std::string vertexTag, int level, int step, int backboneIterations, int starIterations, double rejectionThreshold, bool debug)
 
int clipSegmentCircle (Eigen::Vector2d &p1, Eigen::Vector2d &p2, double r)
 
int clipSegmentLine (Eigen::Vector2d &p1, Eigen::Vector2d &p2, double a, double b, double c)
 
int clipSegmentFov (Eigen::Vector2d &p1, Eigen::Vector2d &p2, double min, double max)
 
Eigen::Vector2d computeLineParameters (const Eigen::Vector2d &p1, const Eigen::Vector2d &p2)
 
std::ostream & operator<< (std::ostream &os, const G2OBatchStatistics &st)
 
bool operator< (const HyperDijkstra::AdjacencyMapEntry &a, const HyperDijkstra::AdjacencyMapEntry &b)
 
void applyAction (HyperGraph *graph, HyperGraphElementAction *action, HyperGraphElementAction::Parameters *params, const std::string &typeName)
 
template<class MatrixType >
std::ostream & operator<< (std::ostream &, const SparseBlockMatrix< MatrixType > &m)
 
void addOdometryCalibLinksDifferential (SparseOptimizer &optimizer, const DataQueue &odomData)
 
void allocateSolverForSclam (SparseOptimizer &optimizer, bool levenberg)
 
void findConnectedEdgesWithCostLimit (HyperGraph::EdgeSet &selected, HyperGraph::EdgeSet &border, HyperGraph::Edge *start, HyperDijkstra::CostFunction *cost, double maxEdgeCost, double comparisonConditioner)
 
static OptimizationAlgorithmcreateSolver (const std::string &solverName)
 
 G2O_USE_OPTIMIZATION_LIBRARY (cholmod)
 
static SolvercreateSolver (const std::string &solverName)
 
 G2O_ATTRIBUTE_CONSTRUCTOR (init_types_interactive_online)
 
void drawDisk (GLfloat radius)
 
void drawCircle (GLfloat radius, int segments)
 
static OptimizationAlgorithmcreateSolver (const std::string &fullSolverName)
 
 G2O_REGISTER_OPTIMIZATION_LIBRARY (cholmod)
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_var_cholmod, new CholmodSolverCreator(OptimizationAlgorithmProperty("gn_var_cholmod","Gauss-Newton: Cholesky solver using CHOLMOD (variable blocksize)","CHOLMOD", false, Eigen::Dynamic, Eigen::Dynamic)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_fix3_2_cholmod, new CholmodSolverCreator(OptimizationAlgorithmProperty("gn_fix3_2_cholmod","Gauss-Newton: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 3, 2)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_fix6_3_cholmod, new CholmodSolverCreator(OptimizationAlgorithmProperty("gn_fix6_3_cholmod","Gauss-Newton: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 6, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_fix7_3_cholmod, new CholmodSolverCreator(OptimizationAlgorithmProperty("gn_fix7_3_cholmod","Gauss-Newton: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 7, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_var_cholmod, new CholmodSolverCreator(OptimizationAlgorithmProperty("lm_var_cholmod","Levenberg: Cholesky solver using CHOLMOD (variable blocksize)","CHOLMOD", false, Eigen::Dynamic, Eigen::Dynamic)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_fix3_2_cholmod, new CholmodSolverCreator(OptimizationAlgorithmProperty("lm_fix3_2_cholmod","Levenberg: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 3, 2)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_fix6_3_cholmod, new CholmodSolverCreator(OptimizationAlgorithmProperty("lm_fix6_3_cholmod","Levenberg: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 6, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_fix7_3_cholmod, new CholmodSolverCreator(OptimizationAlgorithmProperty("lm_fix7_3_cholmod","Levenberg: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 7, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (dl_var_cholmod, new CholmodSolverCreator(OptimizationAlgorithmProperty("dl_var_cholmod","Dogleg: Cholesky solver using CHOLMOD (variable blocksize)","CHOLMOD", false, Eigen::Dynamic, Eigen::Dynamic)))
 
static OptimizationAlgorithmcreateSolver (const std::string &fullSolverName)
 
 G2O_REGISTER_OPTIMIZATION_LIBRARY (csparse)
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_var, new CSparseSolverCreator(OptimizationAlgorithmProperty("gn_var","Gauss-Newton: Cholesky solver using CSparse (variable blocksize)","CSparse", false, Eigen::Dynamic, Eigen::Dynamic)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_fix3_2, new CSparseSolverCreator(OptimizationAlgorithmProperty("gn_fix3_2","Gauss-Newton: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 3, 2)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_fix6_3, new CSparseSolverCreator(OptimizationAlgorithmProperty("gn_fix6_3","Gauss-Newton: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 6, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_fix7_3, new CSparseSolverCreator(OptimizationAlgorithmProperty("gn_fix7_3","Gauss-Newton: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 7, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_var, new CSparseSolverCreator(OptimizationAlgorithmProperty("lm_var","Levenberg: Cholesky solver using CSparse (variable blocksize)","CSparse", false, Eigen::Dynamic, Eigen::Dynamic)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_fix3_2, new CSparseSolverCreator(OptimizationAlgorithmProperty("lm_fix3_2","Levenberg: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 3, 2)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_fix6_3, new CSparseSolverCreator(OptimizationAlgorithmProperty("lm_fix6_3","Levenberg: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 6, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_fix7_3, new CSparseSolverCreator(OptimizationAlgorithmProperty("lm_fix7_3","Levenberg: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 7, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (dl_var, new CSparseSolverCreator(OptimizationAlgorithmProperty("dl_var","Dogleg: Cholesky solver using CSparse (variable blocksize)","CSparse", false, Eigen::Dynamic, Eigen::Dynamic)))
 
static OptimizationAlgorithmcreateSolver (const std::string &fullSolverName)
 
 G2O_REGISTER_OPTIMIZATION_LIBRARY (dense)
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_dense, new DenseSolverCreator(OptimizationAlgorithmProperty("gn_dense","Gauss-Newton: Dense solver (variable blocksize)","Dense", false, Eigen::Dynamic, Eigen::Dynamic)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_dense3_2, new DenseSolverCreator(OptimizationAlgorithmProperty("gn_dense3_2","Gauss-Newton: Dense solver (fixed blocksize)","Dense", true, 3, 2)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_dense6_3, new DenseSolverCreator(OptimizationAlgorithmProperty("gn_dense6_3","Gauss-Newton: Dense solver (fixed blocksize)","Dense", true, 6, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_dense7_3, new DenseSolverCreator(OptimizationAlgorithmProperty("gn_dense7_3","Gauss-Newton: Dense solver (fixed blocksize)","Dense", true, 7, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_dense, new DenseSolverCreator(OptimizationAlgorithmProperty("lm_dense","Levenberg: Dense solver (variable blocksize)","Dense", false,-1,-1)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_dense3_2, new DenseSolverCreator(OptimizationAlgorithmProperty("lm_dense3_2","Levenberg: Dense solver (fixed blocksize)","Dense", true, 3, 2)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_dense6_3, new DenseSolverCreator(OptimizationAlgorithmProperty("lm_dense6_3","Levenberg: Dense solver (fixed blocksize)","Dense", true, 6, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_dense7_3, new DenseSolverCreator(OptimizationAlgorithmProperty("lm_dense7_3","Levenberg: Dense solver (fixed blocksize)","Dense", true, 7, 3)))
 
static OptimizationAlgorithmcreateSolver (const std::string &fullSolverName)
 
 G2O_REGISTER_OPTIMIZATION_LIBRARY (eigen)
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_var_eigen, new EigenSolverCreator(OptimizationAlgorithmProperty("gn_var_eigen","Gauss-Newton: Cholesky solver using Eigen's Sparse Cholesky methods (variable blocksize)","Eigen", false, Eigen::Dynamic, Eigen::Dynamic)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_var_eigen, new EigenSolverCreator(OptimizationAlgorithmProperty("lm_var_eigen","Levenberg: Cholesky solver using Eigen's Sparse Cholesky methods (variable blocksize)","Eigen", false, Eigen::Dynamic, Eigen::Dynamic)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (dl_var_eigen, new EigenSolverCreator(OptimizationAlgorithmProperty("dl_var_eigen","Dogleg: Cholesky solver using Eigen's Sparse Cholesky methods (variable blocksize)","Eigen", false, Eigen::Dynamic, Eigen::Dynamic)))
 
static OptimizationAlgorithmcreateSolver (const std::string &fullSolverName)
 
 G2O_REGISTER_OPTIMIZATION_LIBRARY (pcg)
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_pcg, new PCGSolverCreator(OptimizationAlgorithmProperty("gn_pcg","Gauss-Newton: PCG solver using block-Jacobi pre-conditioner (variable blocksize)","PCG", false, Eigen::Dynamic, Eigen::Dynamic)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_pcg3_2, new PCGSolverCreator(OptimizationAlgorithmProperty("gn_pcg3_2","Gauss-Newton: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 3, 2)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_pcg6_3, new PCGSolverCreator(OptimizationAlgorithmProperty("gn_pcg6_3","Gauss-Newton: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 6, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (gn_pcg7_3, new PCGSolverCreator(OptimizationAlgorithmProperty("gn_pcg7_3","Gauss-Newton: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 7, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_pcg, new PCGSolverCreator(OptimizationAlgorithmProperty("lm_pcg","Levenberg: PCG solver using block-Jacobi pre-conditioner (variable blocksize)","PCG", false, Eigen::Dynamic, Eigen::Dynamic)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_pcg3_2, new PCGSolverCreator(OptimizationAlgorithmProperty("lm_pcg3_2","Levenberg: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 3, 2)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_pcg6_3, new PCGSolverCreator(OptimizationAlgorithmProperty("lm_pcg6_3","Levenberg: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 6, 3)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (lm_pcg7_3, new PCGSolverCreator(OptimizationAlgorithmProperty("lm_pcg7_3","Levenberg: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 7, 3)))
 
static OptimizationAlgorithmcreateSolver (const std::string &fullSolverName)
 
 G2O_REGISTER_OPTIMIZATION_LIBRARY (slam2d_linear)
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (2dlinear, new SLAM2DLinearSolverCreator(OptimizationAlgorithmProperty("2dlinear","Solve Orientation + Gauss-Newton: Works only on 2D pose graphs!!","CSparse", false, 3, 3)))
 
static OptimizationAlgorithmcreateSolver (const std::string &fullSolverName)
 
 G2O_REGISTER_OPTIMIZATION_LIBRARY (structure_only)
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (structure_only_2, new StructureOnlyCreator(OptimizationAlgorithmProperty("structure_only_2","Optimize the landmark poses (2D)","Eigen", true, 3, 2)))
 
 G2O_REGISTER_OPTIMIZATION_ALGORITHM (structure_only_3, new StructureOnlyCreator(OptimizationAlgorithmProperty("structure_only_3","Optimize the landmark poses (3D)","Eigen", true, 6, 3)))
 
std::istream & operator>> (std::istream &is, std::vector< int > &v)
 
std::ostream & operator<< (std::ostream &os, const std::vector< int > &v)
 
std::istream & operator>> (std::istream &is, std::vector< double > &v)
 
std::ostream & operator<< (std::ostream &os, const std::vector< double > &v)
 
template<typename T >
bool convertString (const std::string &s, T &x)
 
std::string getFileExtension (const std::string &filename)
 
std::string getPureFilename (const std::string &filename)
 
std::string getBasename (const std::string &filename)
 
std::string getDirname (const std::string &filename)
 
std::string changeFileExtension (const std::string &filename, const std::string &newExt, bool stripDot)
 
bool fileExists (const char *filename)
 
std::vector< std::string > getFilesByPattern (const char *pattern)
 
template<typename T >
square (T x)
 
template<typename T >
hypot (T x, T y)
 
template<typename T >
hypot_sqr (T x, T y)
 
double deg2rad (double degree)
 
double rad2deg (double rad)
 
double normalize_theta (double theta)
 
double inverse_theta (double th)
 
double average_angle (double theta1, double theta2)
 
template<typename T >
int sign (T x)
 
template<typename T >
clamp (T l, T x, T u)
 
template<typename T >
wrap (T l, T x, T u)
 
bool arrayHasNaN (const double *array, int size, int *nanIndex=0)
 
static std::normal_distribution< double > _univariateSampler (0., 1.)
 
double sampleUniform (double min, double max, std::mt19937 *generator)
 
double sampleGaussian (std::mt19937 *generator)
 
bool writeVector (const string &filename, const double *v, int n)
 
bool writeCCSMatrix (const string &filename, int rows, int cols, const int *Ap, const int *Ai, const double *Ax, bool upperTriangleSymmetric)
 
G2O_STUFF_API bool writeVector (const std::string &filename, const double *v, int n)
 
G2O_STUFF_API bool writeCCSMatrix (const std::string &filename, int rows, int cols, const int *p, const int *i, const double *v, bool upperTriangleSymmetric=true)
 
std::string trim (const std::string &s)
 
std::string trimLeft (const std::string &s)
 
std::string trimRight (const std::string &s)
 
std::string strToLower (const std::string &s)
 
std::string strToUpper (const std::string &s)
 
std::string formatString (const char *fmt,...)
 
int strPrintf (std::string &str, const char *fmt,...)
 
std::string strExpandFilename (const std::string &filename)
 
std::vector< std::string > strSplit (const std::string &str, const std::string &delimiters)
 
bool strStartsWith (const std::string &s, const std::string &start)
 
bool strEndsWith (const std::string &s, const std::string &end)
 
int readLine (std::istream &is, std::stringstream &currentLine)
 
template<typename OutputIterator >
OutputIterator readInts (const char *str, OutputIterator out)
 
template<typename OutputIterator >
OutputIterator readFloats (const char *str, OutputIterator out)
 
template<typename T >
bool convertString (const std::string &s, T &x, bool failIfLeftoverChars=true)
 
template<typename T >
stringToType (const std::string &s, bool failIfLeftoverChars=true)
 
double tictoc (const char *algorithmPart)
 Profile the timing of certain parts of your algorithm. More...
 
double get_monotonic_time ()
 
double get_time ()
 
template<class SampleType , class CovarianceType >
bool sampleUnscented (std::vector< SigmaPoint< SampleType >, Eigen::aligned_allocator< SigmaPoint< SampleType > > > &sigmaPoints, const SampleType &mean, const CovarianceType &covariance)
 
template<class SampleType , class CovarianceType >
void reconstructGaussian (SampleType &mean, CovarianceType &covariance, const std::vector< SigmaPoint< SampleType >, Eigen::aligned_allocator< SigmaPoint< SampleType > > > &sigmaPoints)
 
 G2O_REGISTER_TYPE_GROUP (data)
 
 G2O_REGISTER_TYPE (VERTEX_TAG, VertexTag)
 
 G2O_REGISTER_TYPE (ROBOTLASER1, RobotLaser)
 
 G2O_REGISTER_TYPE (VERTEX_ELLIPSE, VertexEllipse)
 
 G2O_REGISTER_TYPE_GROUP (icp)
 
 G2O_REGISTER_TYPE (EDGE_V_V_GICP, Edge_V_V_GICP)
 
 G2O_ATTRIBUTE_CONSTRUCTOR (init_icp_types)
 
std::ostream & operator<< (std::ostream &out_str, const SBACam &cam)
 
 G2O_REGISTER_TYPE_GROUP (sba)
 
 G2O_REGISTER_TYPE (VERTEX_CAM, VertexCam)
 
 G2O_REGISTER_TYPE (VERTEX_XYZ, VertexSBAPointXYZ)
 
 G2O_REGISTER_TYPE (VERTEX_INTRINSICS, VertexIntrinsics)
 
 G2O_REGISTER_TYPE (EDGE_PROJECT_P2MC, EdgeProjectP2MC)
 
 G2O_REGISTER_TYPE (EDGE_PROJECT_P2MC_INTRINSICS, EdgeProjectP2MC_Intrinsics)
 
 G2O_REGISTER_TYPE (EDGE_PROJECT_P2SC, EdgeProjectP2SC)
 
 G2O_REGISTER_TYPE (EDGE_CAM, EdgeSBACam)
 
 G2O_REGISTER_TYPE (EDGE_SCALE, EdgeSBAScale)
 
 G2O_REGISTER_TYPE_GROUP (expmap)
 
 G2O_REGISTER_TYPE (VERTEX_SE3:EXPMAP, VertexSE3Expmap)
 
 G2O_REGISTER_TYPE (EDGE_SE3:EXPMAP, EdgeSE3Expmap)
 
 G2O_REGISTER_TYPE (EDGE_PROJECT_XYZ2UV:EXPMAP, EdgeProjectXYZ2UV)
 
 G2O_REGISTER_TYPE (EDGE_PROJECT_XYZ2UVU:EXPMAP, EdgeProjectXYZ2UVU)
 
 G2O_REGISTER_TYPE (PARAMS_CAMERAPARAMETERS, CameraParameters)
 
Vector2D project2d (const Vector3D &v)
 
Vector3D unproject2d (const Vector2D &v)
 
Vector3D invert_depth (const Vector3D &x)
 
Matrix< double, 2, 3, Eigen::ColMajor > d_proj_d_y (const double &f, const Vector3D &xyz)
 
Matrix< double, 3, 6, Eigen::ColMajor > d_expy_d_y (const Vector3D &y)
 
Matrix3D d_Tinvpsi_d_psi (const SE3Quat &T, const Vector3D &psi)
 
 G2O_USE_TYPE_GROUP (slam2d)
 
 G2O_REGISTER_TYPE_GROUP (sclam)
 
 G2O_REGISTER_TYPE (VERTEX_ODOM_DIFFERENTIAL, VertexOdomDifferentialParams)
 
 G2O_REGISTER_TYPE (EDGE_SE2_CALIB, EdgeSE2SensorCalib)
 
 G2O_REGISTER_TYPE (EDGE_SE2_ODOM_DIFFERENTIAL_CALIB, EdgeSE2OdomDifferentialCalib)
 
std::ostream & operator<< (std::ostream &out_str, const Sim3 &sim3)
 
 G2O_USE_TYPE_GROUP (sba)
 
 G2O_REGISTER_TYPE_GROUP (sim3)
 
 G2O_REGISTER_TYPE (VERTEX_SIM3:EXPMAP, VertexSim3Expmap)
 
 G2O_REGISTER_TYPE (EDGE_SIM3:EXPMAP, EdgeSim3)
 
 G2O_REGISTER_TYPE (EDGE_PROJECT_SIM3_XYZ:EXPMAP, EdgeSim3ProjectXYZ)
 
 G2O_REGISTER_TYPE_GROUP (slam2d)
 
 G2O_REGISTER_TYPE (VERTEX_SE2, VertexSE2)
 
 G2O_REGISTER_TYPE (VERTEX_XY, VertexPointXY)
 
 G2O_REGISTER_TYPE (PARAMS_SE2OFFSET, ParameterSE2Offset)
 
 G2O_REGISTER_TYPE (CACHE_SE2_OFFSET, CacheSE2Offset)
 
 G2O_REGISTER_TYPE (EDGE_PRIOR_SE2, EdgeSE2Prior)
 
 G2O_REGISTER_TYPE (EDGE_PRIOR_SE2_XY, EdgeSE2XYPrior)
 
 G2O_REGISTER_TYPE (EDGE_SE2, EdgeSE2)
 
 G2O_REGISTER_TYPE (EDGE_SE2_XY, EdgeSE2PointXY)
 
 G2O_REGISTER_TYPE (EDGE_BEARING_SE2_XY, EdgeSE2PointXYBearing)
 
 G2O_REGISTER_TYPE (EDGE_SE2_XY_CALIB, EdgeSE2PointXYCalib)
 
 G2O_REGISTER_TYPE (EDGE_SE2_OFFSET, EdgeSE2Offset)
 
 G2O_REGISTER_TYPE (EDGE_SE2_POINTXY_OFFSET, EdgeSE2PointXYOffset)
 
 G2O_REGISTER_TYPE (EDGE_POINTXY, EdgePointXY)
 
 G2O_REGISTER_TYPE (EDGE_SE2_TWOPOINTSXY, EdgeSE2TwoPointsXY)
 
 G2O_REGISTER_TYPE (EDGE_SE2_LOTSOFXY, EdgeSE2LotsOfXY)
 
 G2O_REGISTER_ACTION (VertexSE2WriteGnuplotAction)
 
 G2O_REGISTER_ACTION (VertexPointXYWriteGnuplotAction)
 
 G2O_REGISTER_ACTION (EdgeSE2WriteGnuplotAction)
 
 G2O_REGISTER_ACTION (EdgeSE2PointXYWriteGnuplotAction)
 
 G2O_REGISTER_ACTION (EdgeSE2PointXYBearingWriteGnuplotAction)
 
Line2D operator* (const SE2 &t, const Line2D &l)
 
 G2O_REGISTER_TYPE_GROUP (slam2d_segment)
 
 G2O_REGISTER_TYPE (VERTEX_SEGMENT2D, VertexSegment2D)
 
 G2O_REGISTER_TYPE (VERTEX_LINE2D, VertexLine2D)
 
 G2O_REGISTER_TYPE (EDGE_SE2_SEGMENT2D, EdgeSE2Segment2D)
 
 G2O_REGISTER_TYPE (EDGE_SE2_SEGMENT2D_LINE, EdgeSE2Segment2DLine)
 
 G2O_REGISTER_TYPE (EDGE_SE2_SEGMENT2D_POINTLINE, EdgeSE2Segment2DPointLine)
 
 G2O_REGISTER_TYPE (EDGE_SE2_LINE2D, EdgeSE2Line2D)
 
 G2O_REGISTER_TYPE (EDGE_LINE2D, EdgeLine2D)
 
 G2O_REGISTER_TYPE (EDGE_LINE2D_POINTXY, EdgeLine2DPointXY)
 
G2O_TYPES_SLAM3D_API Matrix3D skew (const Vector3D &v)
 
G2O_TYPES_SLAM3D_API Vector3D deltaR (const Matrix3D &R)
 
G2O_TYPES_SLAM3D_API Vector2D project (const Vector3D &)
 
G2O_TYPES_SLAM3D_API Vector3D project (const Vector4D &)
 
G2O_TYPES_SLAM3D_API Vector3D unproject (const Vector2D &)
 
G2O_TYPES_SLAM3D_API Vector4D unproject (const Vector3D &)
 
std::ostream & operator<< (std::ostream &out_str, const SE3Quat &se3)
 
 G2O_REGISTER_TYPE_GROUP (slam3d)
 
 G2O_REGISTER_TYPE (VERTEX_SE3:QUAT, VertexSE3)
 
 G2O_REGISTER_TYPE (EDGE_SE3:QUAT, EdgeSE3)
 
 G2O_REGISTER_TYPE (VERTEX_TRACKXYZ, VertexPointXYZ)
 
 G2O_REGISTER_TYPE (PARAMS_SE3OFFSET, ParameterSE3Offset)
 
 G2O_REGISTER_TYPE (EDGE_SE3_TRACKXYZ, EdgeSE3PointXYZ)
 
 G2O_REGISTER_TYPE (EDGE_SE3_PRIOR, EdgeSE3Prior)
 
 G2O_REGISTER_TYPE (CACHE_SE3_OFFSET, CacheSE3Offset)
 
 G2O_REGISTER_TYPE (EDGE_SE3_OFFSET, EdgeSE3Offset)
 
 G2O_REGISTER_TYPE (PARAMS_CAMERACALIB, ParameterCamera)
 
 G2O_REGISTER_TYPE (PARAMS_STEREOCAMERACALIB, ParameterStereoCamera)
 
 G2O_REGISTER_TYPE (CACHE_CAMERA, CacheCamera)
 
 G2O_REGISTER_TYPE (EDGE_PROJECT_DISPARITY, EdgeSE3PointXYZDisparity)
 
 G2O_REGISTER_TYPE (EDGE_PROJECT_DEPTH, EdgeSE3PointXYZDepth)
 
 G2O_REGISTER_TYPE (EDGE_POINTXYZ, EdgePointXYZ)
 
 G2O_REGISTER_ACTION (VertexSE3WriteGnuplotAction)
 
 G2O_REGISTER_ACTION (VertexPointXYZWriteGnuplotAction)
 
 G2O_REGISTER_ACTION (EdgeSE3WriteGnuplotAction)
 
static void jac_quat3_euler3 (Eigen::Matrix< double, 6, 6, Eigen::ColMajor > &J, const Isometry3D &t)
 
static void _skew (Matrix3D &S, const Vector3D &t)
 
static Matrix3D _skew (const Vector3D &t)
 
Line3D operator* (const Isometry3D &t, const Line3D &line)
 
Plane3D operator* (const Eigen::Isometry3d &t, const Plane3D &plane)
 
 G2O_REGISTER_TYPE_GROUP (slam3d_addons)
 
 G2O_REGISTER_TYPE (VERTEX3, VertexSE3Euler)
 
 G2O_REGISTER_TYPE (EDGE3, EdgeSE3Euler)
 
 G2O_REGISTER_TYPE (VERTEX_PLANE, VertexPlane)
 
 G2O_REGISTER_TYPE (EDGE_SE3_PLANE_CALIB, EdgeSE3PlaneSensorCalib)
 
 G2O_REGISTER_TYPE (VERTEX_LINE3D, VertexLine3D)
 
 G2O_REGISTER_TYPE (EDGE_SE3_LINE3D, EdgeSE3Line3D)
 
 G2O_REGISTER_TYPE (EDGE_LINE3D, EdgeLine3D)
 
 G2O_REGISTER_TYPE (EDGE_PLANE, EdgePlane)
 
 G2O_REGISTER_TYPE (EDGE_SE3_CALIB, EdgeSE3Calib)
 
 G2O_ATTRIBUTE_CONSTRUCTOR (init_slam3d_addons_types)
 

Variables

class G2O_CORE_API OptimizationAlgorithm
 
class G2O_CORE_API SparseOptimizer
 
static const double INFORMATION_SCALING_ODOMETRY = 100
 
static std::uniform_real_distribution< double > _uniformReal
 
static std::mt19937 _gen_real
 

Detailed Description

Basic types definitions for SBA translation to HChol

Camera nodes use camera pose in real world v3 position normalized quaternion rotation

Point nodes: v3 position

Typedef Documentation

typedef Eigen::Transform<double,2,Eigen::Affine,Eigen::ColMajor> g2o::Affine2D

Definition at line 68 of file eigen_types.h.

typedef Eigen::Transform<double,3,Eigen::Affine,Eigen::ColMajor> g2o::Affine3D

Definition at line 69 of file eigen_types.h.

Definition at line 81 of file batch_stats.h.

Definition at line 185 of file block_solver.h.

Definition at line 181 of file block_solver.h.

Definition at line 183 of file block_solver.h.

typedef BlockSolver< BlockSolverTraits<Eigen::Dynamic, Eigen::Dynamic> > g2o::BlockSolverX

Definition at line 179 of file block_solver.h.

typedef Property<bool> g2o::BoolProperty

Definition at line 153 of file property.h.

typedef Property<double> g2o::DoubleProperty

Definition at line 155 of file property.h.

typedef std::map<HyperGraph::Edge*, Star*> g2o::EdgeStarMap

Definition at line 72 of file star.h.

typedef Property<float> g2o::FloatProperty

Definition at line 154 of file property.h.

typedef void(* g2o::ForceLinkFunction) (void)

The following two functions are used to force linkage with static libraries.

Definition at line 193 of file misc.h.

typedef Property<int> g2o::IntProperty

Definition at line 152 of file property.h.

typedef Eigen::Transform<double,2,Eigen::Isometry,Eigen::ColMajor> g2o::Isometry2D

Definition at line 65 of file eigen_types.h.

typedef Eigen::Transform<double,3,Eigen::Isometry,Eigen::ColMajor> g2o::Isometry3D

Definition at line 66 of file eigen_types.h.

typedef Eigen::Matrix<double,2,2,Eigen::ColMajor> g2o::Matrix2D

Definition at line 60 of file eigen_types.h.

typedef Eigen::Matrix<float,2,2,Eigen::ColMajor> g2o::Matrix2F

Definition at line 55 of file eigen_types.h.

typedef Eigen::Matrix<int,2,2,Eigen::ColMajor> g2o::Matrix2I

Definition at line 50 of file eigen_types.h.

typedef Eigen::Matrix<double,3,3,Eigen::ColMajor> g2o::Matrix3D

Definition at line 61 of file eigen_types.h.

typedef Eigen::Matrix<float,3,3,Eigen::ColMajor> g2o::Matrix3F

Definition at line 56 of file eigen_types.h.

typedef Eigen::Matrix<int,3,3,Eigen::ColMajor> g2o::Matrix3I

Definition at line 51 of file eigen_types.h.

typedef Eigen::Matrix<double,4,4,Eigen::ColMajor> g2o::Matrix4D

Definition at line 62 of file eigen_types.h.

typedef Eigen::Matrix<float,4,4,Eigen::ColMajor> g2o::Matrix4F

Definition at line 57 of file eigen_types.h.

typedef Eigen::Matrix<int,4,4,Eigen::ColMajor> g2o::Matrix4I

Definition at line 52 of file eigen_types.h.

typedef Eigen::Matrix< double, 6, 6, Eigen::ColMajor > g2o::Matrix6d

Definition at line 41 of file types_six_dof_expmap.h.

typedef Eigen::Matrix<double, 7, 7> g2o::Matrix7d

Definition at line 36 of file sim3.h.

typedef Eigen::Matrix<double, 7, 6, Eigen::ColMajor> g2o::Matrix7x6d

Definition at line 37 of file line3d.h.

typedef Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic,Eigen::ColMajor> g2o::MatrixXD

Definition at line 63 of file eigen_types.h.

typedef Eigen::Matrix<float,Eigen::Dynamic,Eigen::Dynamic,Eigen::ColMajor> g2o::MatrixXF

Definition at line 58 of file eigen_types.h.

typedef Eigen::Matrix<int,Eigen::Dynamic,Eigen::Dynamic,Eigen::ColMajor> g2o::MatrixXI

Definition at line 53 of file eigen_types.h.

typedef std::vector<MotionInformation, Eigen::aligned_allocator<MotionInformation> > g2o::MotionInformationVector

Definition at line 46 of file motion_information.h.

typedef SigmaPoint<VectorXd> g2o::MySigmaPoint

Definition at line 10 of file edge_labeler.cpp.

typedef std::vector<Parameter*> g2o::ParameterVector

Definition at line 52 of file parameter.h.

Definition at line 42 of file simulator2d_base.h.

Definition at line 42 of file simulator3d_base.h.

typedef std::shared_ptr<RobustKernel> g2o::RobustKernelPtr

Definition at line 74 of file robust_kernel.h.

Definition at line 224 of file sparse_block_matrix.h.

typedef std::set<Star*> g2o::StarSet

Definition at line 71 of file star.h.

typedef Property<std::string> g2o::StringProperty

Definition at line 156 of file property.h.

typedef std::map<std::string, TicTocElement> g2o::TicTocMap

Definition at line 64 of file tictoc.cpp.

typedef Eigen::Matrix<double,2,1,Eigen::ColMajor> g2o::Vector2D

Definition at line 45 of file eigen_types.h.

typedef Eigen::Matrix<float,2,1,Eigen::ColMajor> g2o::Vector2F

Definition at line 40 of file eigen_types.h.

typedef Eigen::Matrix<int,2,1,Eigen::ColMajor> g2o::Vector2I

Definition at line 35 of file eigen_types.h.

typedef Eigen::Matrix<double,3,1,Eigen::ColMajor> g2o::Vector3D

Definition at line 46 of file eigen_types.h.

typedef Eigen::Matrix<float,3,1,Eigen::ColMajor> g2o::Vector3F

Definition at line 41 of file eigen_types.h.

typedef Eigen::Matrix<int,3,1,Eigen::ColMajor> g2o::Vector3I

Definition at line 36 of file eigen_types.h.

typedef Eigen::Matrix<double,4,1,Eigen::ColMajor> g2o::Vector4D

Definition at line 47 of file eigen_types.h.

typedef Eigen::Matrix<float,4,1,Eigen::ColMajor> g2o::Vector4F

Definition at line 42 of file eigen_types.h.

typedef Eigen::Matrix<int,4,1,Eigen::ColMajor> g2o::Vector4I

Definition at line 37 of file eigen_types.h.

typedef Eigen::Matrix< double, 6, 1, Eigen::ColMajor > g2o::Vector6d

Definition at line 75 of file types_icp.cpp.

typedef Eigen::Matrix< double, 7, 1, Eigen::ColMajor > g2o::Vector7d

Definition at line 35 of file sim3.h.

typedef Eigen::Matrix<double,Eigen::Dynamic,1,Eigen::ColMajor> g2o::VectorXD

Definition at line 48 of file eigen_types.h.

typedef Eigen::Matrix<float,Eigen::Dynamic,1,Eigen::ColMajor> g2o::VectorXF

Definition at line 43 of file eigen_types.h.

typedef Eigen::Matrix<int,Eigen::Dynamic,1,Eigen::ColMajor> g2o::VectorXI

Definition at line 38 of file eigen_types.h.

Definition at line 70 of file star.h.

Definition at line 69 of file star.h.

Definition at line 40 of file simulator3d_base.h.

Definition at line 38 of file simulator2d_base.h.

Definition at line 36 of file simulator2d_base.h.

Definition at line 36 of file simulator3d_base.h.

Definition at line 40 of file simulator2d_base.h.

Definition at line 38 of file simulator3d_base.h.

Enumeration Type Documentation

Enumerator
CAT_DOUBLE 
CAT_FLOAT 
CAT_INT 
CAT_STRING 
CAT_BOOL 
CAT_VECTOR_INT 
CAT_VECTOR_DOUBLE 

Definition at line 98 of file command_args.cpp.

Function Documentation

static void g2o::_skew ( Matrix3D S,
const Vector3D t 
)
inlinestatic

Definition at line 34 of file line3d.cpp.

Referenced by g2o::Line3D::jacobian(), operator*(), and g2o::Line3D::toCartesian().

34  {
35  S <<
36  0, -t.z(), t.y(),
37  t.z(), 0, -t.x(),
38  -t.y() ,t.x(), 0;
39  }
static Matrix3D g2o::_skew ( const Vector3D t)
inlinestatic

Definition at line 41 of file line3d.cpp.

41  {
42  Matrix3D S;
43  S <<
44  0, -t.z(), t.y(),
45  t.z(), 0, -t.x(),
46  -t.y(), t.x(), 0;
47  return S;
48  }
Eigen::Matrix< double, 3, 3, Eigen::ColMajor > Matrix3D
Definition: eigen_types.h:61
static std::normal_distribution<double> g2o::_univariateSampler ( 0.  ,
1.   
)
static

Referenced by sampleGaussian().

double g2o::activeVertexChi ( const OptimizableGraph::Vertex v)

Definition at line 16 of file simple_star_ops.cpp.

References g2o::SparseOptimizer::activeEdges(), g2o::OptimizableGraph::Edge::chi2(), g2o::HyperGraph::Vertex::edges(), g2o::SparseOptimizer::findActiveEdge(), and g2o::OptimizableGraph::Vertex::graph().

16  {
17  const SparseOptimizer* s = dynamic_cast<const SparseOptimizer*>(v->graph());
18  const OptimizableGraph::EdgeContainer& av = s->activeEdges();
19  double chi = 0;
20  int ne =0;
21  for (HyperGraph::EdgeSet::iterator it = v->edges().begin(); it!=v->edges().end(); it++){
22  OptimizableGraph::Edge* e = dynamic_cast <OptimizableGraph::Edge*> (*it);
23  if (!e)
24  continue;
25  if (s->findActiveEdge(e)!=av.end()) {
26  chi +=e->chi2();
27  ne++;
28  }
29  }
30  if (! ne)
31  return -1;
32  return chi/ne;
33  }
class G2O_CORE_API SparseOptimizer
G2O_CALIBRATION_ODOM_LASER_API void g2o::addOdometryCalibLinksDifferential ( SparseOptimizer optimizer,
const DataQueue odomData 
)

Definition at line 52 of file sclam_helpers.cpp.

References g2o::OptimizableGraph::addEdge(), g2o::OptimizableGraph::addVertex(), g2o::HyperGraph::edges(), g2o::DataQueue::findClosestData(), g2o::HyperGraph::Vertex::id(), g2o::BaseEdge< D, E >::information(), INFORMATION_SCALING_ODOMETRY, g2o::SE2::inverse(), g2o::RobotLaser::odomPose(), g2o::SE2::rotation(), g2o::HyperGraph::Vertex::setId(), g2o::BaseEdge< D, E >::setMeasurement(), g2o::RobotData::timestamp(), g2o::SE2::translation(), g2o::HyperGraph::DataContainer::userData(), and g2o::HyperGraph::Edge::vertices().

Referenced by main().

53  {
54  SparseOptimizer::Vertex* odomParamsVertex = 0;
55  odomParamsVertex = new VertexOdomDifferentialParams;
56  odomParamsVertex->setToOrigin();
57  odomParamsVertex->setId(Gm2dlIO::ID_ODOMCALIB);
58  optimizer.addVertex(odomParamsVertex);
59 
60  SparseOptimizer::EdgeSet odomCalibEdges;
61  for (SparseOptimizer::EdgeSet::const_iterator it = optimizer.edges().begin(); it != optimizer.edges().end(); ++it) {
62  EdgeSE2SensorCalib* scanmatchEdge = dynamic_cast<EdgeSE2SensorCalib*>(*it);
63  if (! scanmatchEdge)
64  continue;
65 
66  VertexSE2* r1 = dynamic_cast<VertexSE2*>(scanmatchEdge->vertices()[0]);
67  VertexSE2* r2 = dynamic_cast<VertexSE2*>(scanmatchEdge->vertices()[1]);
68  if (r2->id() - r1->id() != 1) { // ignore non-incremental edges
69  continue;
70  }
71 
72  RobotLaser* rl1 = dynamic_cast<RobotLaser*>(r1->userData());
73  RobotLaser* rl2 = dynamic_cast<RobotLaser*>(r2->userData());
74  RobotLaser* odom1 = dynamic_cast<RobotLaser*>(odomData.findClosestData(rl1->timestamp()));
75  RobotLaser* odom2 = dynamic_cast<RobotLaser*>(odomData.findClosestData(rl2->timestamp()));
76 
77  if (fabs(rl1->timestamp() - rl2->timestamp()) < 1e-7) {
78  cerr << "strange egde " << r1->id() << " <-> " << r2->id() << endl;
79  cerr << FIXED(PVAR(rl1->timestamp()) << "\t " << PVAR(rl2->timestamp())) << endl;
80  cerr << FIXED(PVAR(odom1->timestamp()) << "\t " << PVAR(odom2->timestamp())) << endl;
81  }
82 
83  //cerr << PVAR(odom1->odomPose().toVector().transpose()) << endl;
84 
85  SE2 odomMotion = odom1->odomPose().inverse() * odom2->odomPose();
86  //cerr << PVAR(odomMotion.toVector().transpose()) << endl;
87  //cerr << PVAR(scanmatchEdge->measurement().toVector().transpose()) << endl;
88 
89  EdgeSE2OdomDifferentialCalib* e = new EdgeSE2OdomDifferentialCalib;
90  e->vertices()[0] = r1;
91  e->vertices()[1] = r2;
92  e->vertices()[2] = odomParamsVertex;
93 
94  MotionMeasurement mm(odomMotion.translation().x(), odomMotion.translation().y(), odomMotion.rotation().angle(), odom2->timestamp() - odom1->timestamp());
95  e->setMeasurement(OdomConvert::convertToVelocity(mm));
96  //cerr << PVAR(e->measurement()) << endl;
97 
98  e->information() = Matrix3d::Identity() * INFORMATION_SCALING_ODOMETRY;
99  odomCalibEdges.insert(e);
100 
101  }
102 
103  for (SparseOptimizer::EdgeSet::iterator it = odomCalibEdges.begin(); it != odomCalibEdges.end(); ++it)
104  optimizer.addEdge(dynamic_cast<OptimizableGraph::Edge*>(*it));
105 
106  }
static const double INFORMATION_SCALING_ODOMETRY
G2O_CALIBRATION_ODOM_LASER_API void g2o::allocateSolverForSclam ( SparseOptimizer optimizer,
bool  levenberg 
)

Definition at line 108 of file sclam_helpers.cpp.

References g2o::SparseOptimizer::setAlgorithm().

Referenced by main().

109  {
110  typedef BlockSolver< BlockSolverTraits<-1, -1> > SclamBlockSolver;
111  typedef LinearSolverCSparse<SclamBlockSolver::PoseMatrixType> SclamLinearSolver;
112 
113  SclamLinearSolver* linearSolver = new SclamLinearSolver();
114  linearSolver->setBlockOrdering(false);
115  SclamBlockSolver* blockSolver = new SclamBlockSolver(linearSolver);
116  OptimizationAlgorithm* solver = 0;
117  if (levenberg) {
118  solver = new OptimizationAlgorithmLevenberg(blockSolver);
119  } else {
120  solver = new OptimizationAlgorithmGaussNewton(blockSolver);
121  }
122  optimizer.setAlgorithm(solver);
123  }
class G2O_CORE_API OptimizationAlgorithm
void G2O_CORE_API g2o::applyAction ( HyperGraph graph,
HyperGraphElementAction action,
HyperGraphElementAction::Parameters parameters = 0,
const std::string &  typeName = "" 
)

apply an action to all the elements of the graph.

Definition at line 277 of file hyper_graph_action.cpp.

References g2o::HyperGraph::edges(), g2o::HyperGraphElementAction::name(), g2o::HyperGraphElementAction::typeName(), and g2o::HyperGraph::vertices().

Referenced by g2o::G2oQGLViewer::draw().

278  {
279  for (HyperGraph::VertexIDMap::iterator it=graph->vertices().begin();
280  it!=graph->vertices().end(); ++it){
281  if ( typeName.empty() || typeid(*it->second).name()==typeName){
282  (*action)(it->second, params);
283  }
284  }
285  for (HyperGraph::EdgeSet::iterator it=graph->edges().begin();
286  it!=graph->edges().end(); ++it){
287  if ( typeName.empty() || typeid(**it).name()==typeName)
288  (*action)(*it, params);
289  }
290  }
Protocol The SLAM executable accepts such as solving the and retrieving or vertices in the graph
Definition: protocol.txt:7
bool g2o::arrayHasNaN ( const double *  array,
int  size,
int *  nanIndex = 0 
)
inline

tests whether there is a NaN in the array

Definition at line 177 of file misc.h.

References g2o_isnan.

Referenced by g2o::BlockSolver< Traits >::buildSystem(), g2o::SparseOptimizer::computeActiveErrors(), g2o::SparseOptimizer::initializeOptimization(), and g2o::SparseOptimizer::optimize().

178 {
179  for (int i = 0; i < size; ++i)
180  if (g2o_isnan(array[i])) {
181  if (nanIndex)
182  *nanIndex = i;
183  return true;
184  }
185  return false;
186 }
#define g2o_isnan(x)
Definition: macros.h:99
void g2o::assignHierarchicalEdges ( StarSet stars,
EdgeStarMap esmap,
EdgeLabeler labeler,
EdgeCreator creator,
SparseOptimizer optimizer,
int  minNumEdges,
int  maxIterations 
)

Definition at line 83 of file simple_star_ops.cpp.

References g2o::Star::_gauge, g2o::Star::_lowLevelEdges, g2o::Star::_lowLevelVertices, g2o::Star::_starEdges, g2o::OptimizableGraph::addEdge(), g2o::EdgeCreator::createEdge(), g2o::Factory::instance(), g2o::Star::labelStarEdges(), g2o::Star::lowLevelEdges(), g2o::Star::lowLevelVertices(), g2o::OptimizableGraph::saveSubset(), g2o::OptimizableGraph::Edge::setLevel(), vertexEdgesInStar(), and vertices.

83  {
84  // now construct the hierarchical edges for all the stars
85  int starNum=0;
86  for (StarSet::iterator it=stars.begin(); it!=stars.end(); it++){
87  cerr << "STAR# " << starNum << endl;
88  Star* s=*it;
89  std::vector<OptimizableGraph::Vertex*> vertices(2);
90  vertices[0]= (OptimizableGraph::Vertex*) *s->_gauge.begin();
91  cerr << "eIs" << endl;
92  HyperGraph::VertexSet vNew =s->lowLevelVertices();
93  for (HyperGraph::VertexSet::iterator vit=s->_lowLevelVertices.begin(); vit!=s->_lowLevelVertices.end(); vit++){
94  OptimizableGraph::Vertex* v=(OptimizableGraph::Vertex*)*vit;
95  vertices[1]=v;
96  if (v==vertices[0])
97  continue;
98  HyperGraph::EdgeSet eInSt;
99  int numEdges = vertexEdgesInStar(eInSt, v, s, esmap);
100  if (Factory::instance()->tag(v)==Factory::instance()->tag(vertices[0]) || numEdges>minNumEdges) {
101  OptimizableGraph::Edge* e=creator->createEdge(vertices);
102  //cerr << "creating edge" << e << endl;
103  if (e) {
104  e->setLevel(1);
105  optimizer->addEdge(e);
106  s->_starEdges.insert(e);
107  } else {
108  cerr << "THERE" << endl;
109  cerr << "FATAL, cannot create edge" << endl;
110  }
111  } else {
112  vNew.erase(v);
113  // cerr << numEdges << " ";
114  // cerr << "r " << v-> id() << endl;
115  // remove from the star all edges that are not sufficiently connected
116  for (HyperGraph::EdgeSet::iterator it=eInSt.begin(); it!=eInSt.end(); it++){
117  HyperGraph::Edge* e=*it;
118  s->lowLevelEdges().erase(e);
119  }
120  }
121  }
122  s->lowLevelVertices()=vNew;
123  //cerr << endl;
124  cerr << "gauge: " << (*s->_gauge.begin())->id()
125  << " edges:" << s->_lowLevelEdges.size()
126  << " hedges" << s->_starEdges.size() << endl;
127 
128  const bool debug = false;
129  if (debug){
130  char starLowName[100];
131  sprintf(starLowName, "star-%04d-low.g2o", starNum);
132  ofstream starLowStream(starLowName);
133  optimizer->saveSubset(starLowStream, s->_lowLevelEdges);
134  }
135  bool labelOk=s->labelStarEdges(maxIterations, labeler);
136  if (labelOk) {
137  if (debug) {
138  char starHighName[100];
139  sprintf(starHighName, "star-%04d-high.g2o", starNum);
140  ofstream starHighStream(starHighName);
141  optimizer->saveSubset(starHighStream, s->_starEdges);
142  }
143  } else {
144  cerr << "FAILURE" << endl;
145  }
146  starNum++;
147  }
148 }
Protocol The SLAM executable accepts such as solving the and retrieving or vertices in the explicitly state the reprensentation poses are represented by poses by VERTEX_XYZRPY In the Quaternions and other representations could be but note that it is up to the SLAM algorithm to choose the internal representation of the angles The keyword is followed by a unique vertex ID and an optional initialization of the or edges in the explicitly state the type of the constraint pose constraints are given by pose constraints by EDGE_XYZRPY The keyword is followed by a unique edge the IDs of the referenced vertices
Definition: protocol.txt:7
size_t vertexEdgesInStar(HyperGraph::EdgeSet &eset, HyperGraph::Vertex *v, Star *s, EdgeStarMap &esmap)
double g2o::average_angle ( double  theta1,
double  theta2 
)
inline

average two angles

Definition at line 120 of file misc.h.

121 {
122  double x, y;
123 
124  x = cos(theta1) + cos(theta2);
125  y = sin(theta1) + sin(theta2);
126  if(x == 0 && y == 0)
127  return 0;
128  else
129  return std::atan2(y, x);
130 }
G2O_STUFF_API std::string g2o::changeFileExtension ( const std::string &  filename,
const std::string &  newExt,
bool  stripDot = false 
)

change the fileextension of a given filename. Only if filename contains an extension, otherwise filename is returned.

Definition at line 104 of file filesys_tools.cpp.

105 {
106  std::string::size_type lastDot = filename.find_last_of('.');
107  if (lastDot != std::string::npos) {
108  if (stripDot)
109  return filename.substr(0, lastDot) + newExt;
110  else
111  return filename.substr(0, lastDot + 1) + newExt;
112  } else
113  return filename;
114 }
template<typename T >
T g2o::clamp ( l,
x,
u 
)
inline

clamp x to the interval [l, u]

Definition at line 151 of file misc.h.

152 {
153  if (x < l)
154  return l;
155  if (x > u)
156  return u;
157  return x;
158 }
G2O_SIMULATOR_API int g2o::clipSegmentCircle ( Eigen::Vector2d &  p1,
Eigen::Vector2d &  p2,
double  r 
)

Definition at line 11 of file simutils.cpp.

Referenced by g2o::SensorSegment2D::isVisible(), g2o::SensorSegment2DPointLine::isVisible(), and g2o::SensorSegment2DLine::isVisible().

11  {
12  double r2=r*r;
13  Eigen::Vector2d pBase=p1;
14  Eigen::Vector2d dp=p2-p1;
15  double length=dp.norm();
16  dp.normalize();
17  double p=2*dp.dot(p1);
18  double q=p1.squaredNorm()-r2;
19  double disc = p*p - 4*q;
20 
21  if (disc<=0) { // no intersection or single point intersection
22  return -1;
23  }
24  disc = sqrt(disc);
25 
26  double t1=.5*(-p-disc);
27  double t2=.5*(-p+disc);
28 
29  if ( t1 > length || t2 <0 )
30  return -1; // no intersection
31  bool clip1=false;
32  bool clip2=false;
33  if ( t1 > 0 ) {
34  p1 = pBase + dp*t1;
35  clip1 = true;
36  }
37  if ( t2 < length ) {
38  p2 = pBase + dp*t1;
39  clip2 = true;
40  }
41  if (clip1)
42  if (clip2) return 3;
43  else return 0;
44  else
45  if (clip2) return 1;
46  return 2;
47  }
G2O_SIMULATOR_API int g2o::clipSegmentFov ( Eigen::Vector2d &  p1,
Eigen::Vector2d &  p2,
double  min,
double  max 
)

Definition at line 82 of file simutils.cpp.

References clipSegmentLine().

Referenced by g2o::SensorSegment2D::isVisible(), g2o::SensorSegment2DPointLine::isVisible(), and g2o::SensorSegment2DLine::isVisible().

82  {
83  bool clip1 = false, clip2 = false;
84  // normal to the first line
85  double amin = sin(min), bmin = -cos(min);
86  int minClip=clipSegmentLine(p1,p2,amin,bmin,0);
87  switch(minClip){
88  case -1:
89  return -1;
90  case 0:
91  clip1 = true;
92  break;
93  case 1:
94  clip2 = true;
95  break;
96  default:;
97  }
98  // normal to the second line
99  double amax = -sin(max), bmax = cos(max);
100  int maxClip=clipSegmentLine(p1,p2,amax,bmax,0);
101  switch(maxClip){
102  case -1:
103  return -1;
104  case 0:
105  clip1 = true;
106  break;
107  case 1:
108  clip2 = true;
109  break;
110  default:;
111  }
112  if (clip1)
113  if (clip2) return 3;
114  else return 0;
115  else
116  if (clip2) return 1;
117  return 2;
118  }
int clipSegmentLine(Eigen::Vector2d &p1, Eigen::Vector2d &p2, double a, double b, double c)
Definition: simutils.cpp:54
G2O_SIMULATOR_API int g2o::clipSegmentLine ( Eigen::Vector2d &  p1,
Eigen::Vector2d &  p2,
double  a,
double  b,
double  c 
)

Definition at line 54 of file simutils.cpp.

Referenced by clipSegmentFov().

54  {
55  bool p1inside = true;
56  bool p2inside = true;
57  if (a*p1.x()+b*p1.y()+c < 0){
58  p1inside=false;
59  }
60  if (a*p2.x()+b*p2.y()+c < 0){
61  p2inside=false;
62  }
63  if (p1inside && p2inside)
64  return 2;
65  if (!p1inside && !p2inside)
66  return -1;
67 
68  Eigen::Vector2d dp=p2-p1;
69  double den=a*dp.x()+b*dp.y();
70  if (den==0)
71  return -1;
72  double num = c + a*p1.x()+b*p1.y();
73  double t = - num/den;
74  if (p1inside){
75  p2=p1+dp*t;
76  return 1;
77  }
78  p1=p1+dp*t;
79  return 0;
80  }
G2O_HIERARCHICAL_API void g2o::computeBorder ( StarSet stars,
EdgeStarMap hesmap 
)

Definition at line 150 of file simple_star_ops.cpp.

References g2o::Star::_starEdges, g2o::Star::gauge(), g2o::Star::starFrontierEdges(), and starsInEdge().

Referenced by main().

150  {
151  cerr << "computing edges on the border" << endl;
152  for (StarSet::iterator it=stars.begin(); it!=stars.end(); it++){
153  Star* s=*it;
154  for (HyperGraph::EdgeSet::iterator iit=s->_starEdges.begin(); iit!=s->_starEdges.end(); iit++){
155  OptimizableGraph::Edge* e= (OptimizableGraph::Edge*) *iit;
156  StarSet sset;
157  starsInEdge(sset, e, hesmap, s->gauge());
158  //cerr << "e: " << e << " l:" << e->level() << " sset.size()=" << sset.size() << endl;
159  if (sset.size()>1){
160  s->starFrontierEdges().insert(e);
161  }
162  }
163  }
164 }
std::set< Star * > StarSet
Definition: star.h:71
void starsInEdge(StarSet &stars, HyperGraph::Edge *e, EdgeStarMap &esmap, HyperGraph::VertexSet &gauge)
G2O_SIMULATOR_API Eigen::Vector2d g2o::computeLineParameters ( const Eigen::Vector2d &  p1,
const Eigen::Vector2d &  p2 
)

Definition at line 120 of file simutils.cpp.

Referenced by LineInfo::LineInfo(), and main().

120  {
121  Eigen::Vector2d lp;
122  Eigen::Vector2d dp=p2-p1;
123  lp[0]=atan2(-dp.x(), dp.y());
124  Eigen::Vector2d n(cos(lp[0]), sin(lp[0]));
125  lp[1]=n.dot(p1+p2)*.5;
126  return lp;
127  }
G2O_HIERARCHICAL_API void g2o::computeSimpleStars ( StarSet stars,
SparseOptimizer optimizer,
EdgeLabeler labeler,
EdgeCreator creator,
OptimizableGraph::Vertex gauge_,
std::string  edgeTag,
std::string  vertexTag,
int  level,
int  step,
int  backboneIterations,
int  starIterations,
double  rejectionThreshold,
bool  debug 
)

Definition at line 167 of file simple_star_ops.cpp.

References g2o::Star::_gauge, g2o::Star::_lowLevelEdges, g2o::Star::_lowLevelVertices, g2o::Star::_starEdges, g2o::SparseOptimizer::activeChi2(), g2o::OptimizableGraph::addEdge(), g2o::HyperDijkstra::adjacencyMap(), g2o::OptimizationAlgorithmWithHessian::buildLinearStructure(), g2o::SparseOptimizer::computeActiveErrors(), g2o::SparseOptimizer::computeInitialGuess(), g2o::HyperDijkstra::computeTree(), g2o::EdgeCreator::createEdge(), g2o::OptimizableGraph::Vertex::dimension(), g2o::HyperGraph::Vertex::edges(), g2o::Star::gauge(), g2o::OptimizableGraph::Vertex::hessian(), g2o::OptimizationAlgorithm::init(), g2o::SparseOptimizer::initializeOptimization(), g2o::Star::labelStarEdges(), g2o::Star::lowLevelEdges(), g2o::SparseOptimizer::optimize(), g2o::Star::optimizer(), g2o::SparseOptimizer::pop(), g2o::SparseOptimizer::push(), g2o::OptimizableGraph::saveSubset(), g2o::OptimizableGraph::setFixed(), g2o::OptimizableGraph::Edge::setLevel(), g2o::HyperDijkstra::shortestPaths(), g2o::OptimizableGraph::Vertex::solveDirect(), g2o::SparseOptimizer::solver(), g2o::OptimizationAlgorithmWithHessian::updateLinearSystem(), vertices, g2o::HyperGraph::Edge::vertices(), and g2o::HyperDijkstra::visitAdjacencyMap().

Referenced by main().

179  {
180 
181  cerr << "preforming the tree actions" << endl;
182  HyperDijkstra d(optimizer);
183  // compute a spanning tree based on the types of edges and vertices in the pool
184  EdgeTypesCostFunction f(edgeTag, vertexTag, level);
185  d.shortestPaths(gauge_,
186  &f,
187  std::numeric_limits< double >::max(),
188  1e-6,
189  false,
190  std::numeric_limits< double >::max()/2);
191 
192  HyperDijkstra::computeTree(d.adjacencyMap());
193  // constructs the stars on the backbone
194 
195  BackBoneTreeAction bact(optimizer, vertexTag, level, step);
196  bact.init();
197 
198  cerr << "free edges size " << bact.freeEdges().size() << endl;
199 
200  // perform breadth-first visit of the visit tree and create the stars on the backbone
201  d.visitAdjacencyMap(d.adjacencyMap(),&bact,true);
202  stars.clear();
203 
204  for (VertexStarMultimap::iterator it=bact.vertexStarMultiMap().begin();
205  it!=bact.vertexStarMultiMap().end(); it++){
206  stars.insert(it->second);
207  }
208  cerr << "stars.size: " << stars.size() << endl;
209  cerr << "size: " << bact.vertexStarMultiMap().size() << endl;
210 
211 
212  // for each star
213 
214  // for all vertices in the backbone, select all edges leading/leaving from that vertex
215  // that are contained in freeEdges.
216 
217  // mark the corresponding "open" vertices and add them to a multimap (vertex->star)
218 
219  // select a gauge in the backbone
220 
221  // push all vertices on the backbone
222 
223  // compute an initial guess on the backbone
224 
225  // one round of optimization backbone
226 
227  // lock all vertices in the backbone
228 
229  // push all "open" vertices
230 
231  // for each open vertex,
232  // compute an initial guess given the backbone
233  // do some rounds of solveDirect
234  // if (fail)
235  // - remove the vertex and the edges in that vertex from the star
236  // - make the structures consistent
237 
238  // pop all "open" vertices
239  // pop all "vertices" in the backbone
240  // unfix the vertices in the backbone
241 
242  int starNum=0;
243  for (StarSet::iterator it=stars.begin(); it!=stars.end(); it++){
244  Star* s =*it;
245  HyperGraph::VertexSet backboneVertices = s->_lowLevelVertices;
246  HyperGraph::EdgeSet backboneEdges = s->_lowLevelEdges;
247  if (backboneEdges.empty())
248  continue;
249 
250 
251  // cerr << "optimizing backbone" << endl;
252  // one of these should be the gauge, to be simple we select the fisrt one in the backbone
253  OptimizableGraph::VertexSet gauge;
254  gauge.insert(*backboneVertices.begin());
255  s->gauge()=gauge;
256  s->optimizer()->push(backboneVertices);
257  s->optimizer()->setFixed(gauge,true);
258  s->optimizer()->initializeOptimization(backboneEdges);
259  s->optimizer()->computeInitialGuess();
260  s->optimizer()->optimize(backboneIterations);
261  s->optimizer()->setFixed(backboneVertices, true);
262 
263  // cerr << "assignind edges.vertices not in bbone" << endl;
264  HyperGraph::EdgeSet otherEdges;
265  HyperGraph::VertexSet otherVertices;
266  std::multimap<HyperGraph::Vertex*, HyperGraph::Edge*> vemap;
267  for (HyperGraph::VertexSet::iterator bit=backboneVertices.begin(); bit!=backboneVertices.end(); bit++){
268  HyperGraph::Vertex* v=*bit;
269  for (HyperGraph::EdgeSet::iterator eit=v->edges().begin(); eit!=v->edges().end(); eit++){
270  OptimizableGraph::Edge* e = (OptimizableGraph::Edge*) *eit;
271  HyperGraph::EdgeSet::iterator feit=bact.freeEdges().find(e);
272  if (feit!=bact.freeEdges().end()){ // edge is admissible
273  otherEdges.insert(e);
274  bact.freeEdges().erase(feit);
275  for (size_t i=0; i<e->vertices().size(); i++){
276  OptimizableGraph::Vertex* ve= (OptimizableGraph::Vertex*)e->vertices()[i];
277  if (backboneVertices.find(ve)==backboneVertices.end()){
278  otherVertices.insert(ve);
279  vemap.insert(make_pair(ve,e));
280  }
281  }
282  }
283  }
284  }
285 
286  // RAINER TODO maybe need a better solution than dynamic casting here??
287  OptimizationAlgorithmWithHessian* solverWithHessian = dynamic_cast<OptimizationAlgorithmWithHessian*>(s->optimizer()->solver());
288  if (solverWithHessian) {
289  s->optimizer()->push(otherVertices);
290  // cerr << "optimizing vertices out of bbone" << endl;
291  // cerr << "push" << endl;
292  // cerr << "init" << endl;
293  s->optimizer()->initializeOptimization(otherEdges);
294  // cerr << "guess" << endl;
295  s->optimizer()->computeInitialGuess();
296  // cerr << "solver init" << endl;
297  s->optimizer()->solver()->init();
298  // cerr << "structure" << endl;
299  if (!solverWithHessian->buildLinearStructure())
300  cerr << "FATAL: failure while building linear structure" << endl;
301  // cerr << "errors" << endl;
302  s->optimizer()->computeActiveErrors();
303  // cerr << "system" << endl;
304  solverWithHessian->updateLinearSystem();
305  // cerr << "directSolove" << endl;
306  } else {
307  cerr << "FATAL: hierarchical thing cannot be used with a solver that does not support the system structure construction" << endl;
308  }
309 
310 
311  // // then optimize the vertices one at a time to check if a solution is good
312  for (HyperGraph::VertexSet::iterator vit=otherVertices.begin(); vit!=otherVertices.end(); vit++){
313  OptimizableGraph::Vertex* v=(OptimizableGraph::Vertex*)(*vit);
314  v->solveDirect();
315  // cerr << " " << d;
316  // if a solution is found, add a vertex and all the edges in
317  //othervertices that are pointing to that edge to the star
318  s->_lowLevelVertices.insert(v);
319  for (HyperGraph::EdgeSet::iterator eit=v->edges().begin(); eit!=v->edges().end(); eit++){
320  OptimizableGraph::Edge* e = (OptimizableGraph::Edge*) *eit;
321  if (otherEdges.find(e)!=otherEdges.end())
322  s->_lowLevelEdges.insert(e);
323  }
324  }
325  //cerr << endl;
326 
327  // relax the backbone and optimize it all
328  // cerr << "relax bbone" << endl;
329  s->optimizer()->setFixed(backboneVertices, false);
330  //cerr << "fox gauge bbone" << endl;
331  s->optimizer()->setFixed(s->gauge(),true);
332 
333  //cerr << "opt init" << endl;
334  s->optimizer()->initializeOptimization(s->_lowLevelEdges);
335  optimizer->computeActiveErrors();
336  double initialChi = optimizer->activeChi2();
337  int starOptResult = s->optimizer()->optimize(starIterations);
338  //cerr << starOptResult << "(" << starIterations << ") " << endl;
339  double finalchi=-1.;
340 
341  cerr << "computing star: " << starNum << endl;
342 
343  int vKept=0, vDropped=0;
344  if (!starIterations || starOptResult > 0 ){
345  optimizer->computeActiveErrors();
346  finalchi = optimizer->activeChi2();
347 
348 #if 1
349 
350  s->optimizer()->computeActiveErrors();
351  // cerr << "system" << endl;
352  solverWithHessian->updateLinearSystem();
353  HyperGraph::EdgeSet prunedStarEdges = backboneEdges;
354  HyperGraph::VertexSet prunedStarVertices = backboneVertices;
355  for (HyperGraph::VertexSet::iterator vit=otherVertices.begin(); vit!=otherVertices.end(); vit++){
356 
357  //discard the vertices whose error is too big
358 
359 
360  OptimizableGraph::Vertex* v=(OptimizableGraph::Vertex*)(*vit);
361  MatrixXd h(v->dimension(), v->dimension());
362  for (int i=0; i<v->dimension(); i++){
363  for (int j=0; j<v->dimension(); j++)
364  h(i,j)=v->hessian(i,j);
365  }
366  EigenSolver<Eigen::MatrixXd> esolver;
367  esolver.compute(h);
368  VectorXcd ev= esolver.eigenvalues();
369  double emin = std::numeric_limits<double>::max();
370  double emax = -std::numeric_limits<double>::max();
371  for (int i=0; i<ev.size(); i++){
372  emin = ev(i).real()>emin ? emin : ev(i).real();
373  emax = ev(i).real()<emax ? emax : ev(i).real();
374  }
375 
376  double d=emin/emax;
377 
378 
379  // cerr << " " << d;
380  if (d>rejectionThreshold){
381  // if a solution is found, add a vertex and all the edges in
382  //othervertices that are pointing to that edge to the star
383  prunedStarVertices.insert(v);
384  for (HyperGraph::EdgeSet::iterator eit=v->edges().begin(); eit!=v->edges().end(); eit++){
385  OptimizableGraph::Edge* e = (OptimizableGraph::Edge*) *eit;
386  if (otherEdges.find(e)!=otherEdges.end())
387  prunedStarEdges.insert(e);
388  }
389  //cerr << "K( " << v->id() << "," << d << ")" ;
390  vKept ++;
391  } else {
392  vDropped++;
393  //cerr << "R( " << v->id() << "," << d << ")" ;
394  }
395  }
396  s->_lowLevelEdges=prunedStarEdges;
397  s->_lowLevelVertices=prunedStarVertices;
398 
399 #endif
400  //cerr << "addHedges" << endl;
401  //now add to the star the hierarchical edges
402  std::vector<OptimizableGraph::Vertex*> vertices(2);
403  vertices[0]= (OptimizableGraph::Vertex*) *s->_gauge.begin();
404 
405  for (HyperGraph::VertexSet::iterator vit=s->_lowLevelVertices.begin(); vit!=s->_lowLevelVertices.end(); vit++){
406  OptimizableGraph::Vertex* v=(OptimizableGraph::Vertex*)*vit;
407  vertices[1]=v;
408  if (v==vertices[0])
409  continue;
410  OptimizableGraph::Edge* e=creator->createEdge(vertices);
411  //rr << "creating edge" << e << Factory::instance()->tag(vertices[0]) << "->" << Factory::instance()->tag(v) <endl;
412  if (e) {
413  e->setLevel(level+1);
414  optimizer->addEdge(e);
415  s->_starEdges.insert(e);
416  } else {
417  cerr << "HERE" << endl;
418  cerr << "FATAL, cannot create edge" << endl;
419  }
420  }
421  }
422 
423  cerr << " gauge: " << (*s->_gauge.begin())->id()
424  << " kept: " << vKept
425  << " dropped: " << vDropped
426  << " edges:" << s->_lowLevelEdges.size()
427  << " hedges" << s->_starEdges.size()
428  << " initial chi " << initialChi
429  << " final chi " << finalchi << endl;
430 
431  if (debug) {
432  char starLowName[100];
433  sprintf(starLowName, "star-%04d-low.g2o", starNum);
434  ofstream starLowStream(starLowName);
435  optimizer->saveSubset(starLowStream, s->_lowLevelEdges);
436  }
437  bool labelOk=false;
438  if (!starIterations || starOptResult > 0)
439  labelOk = s->labelStarEdges(0, labeler);
440  if (labelOk) {
441  if (debug) {
442  char starHighName[100];
443  sprintf(starHighName, "star-%04d-high.g2o", starNum);
444  ofstream starHighStream(starHighName);
445  optimizer->saveSubset(starHighStream, s->_starEdges);
446  }
447  } else {
448 
449  cerr << "FAILURE: " << starOptResult << endl;
450  }
451  starNum++;
452 
453  //label each hierarchical edge
454  s->optimizer()->pop(otherVertices);
455  s->optimizer()->pop(backboneVertices);
456  s->optimizer()->setFixed(s->gauge(),false);
457  }
458 
459 
460  StarSet stars2;
461  // now erase the stars that have 0 edges. They r useless
462  for (StarSet::iterator it=stars.begin(); it!=stars.end(); it++){
463  Star* s=*it;
464  if (s->lowLevelEdges().size()==0) {
465  delete s;
466  } else
467  stars2.insert(s);
468  }
469  stars=stars2;
470  }
Protocol The SLAM executable accepts such as solving the and retrieving or vertices in the explicitly state the reprensentation poses are represented by poses by VERTEX_XYZRPY In the Quaternions and other representations could be but note that it is up to the SLAM algorithm to choose the internal representation of the angles The keyword is followed by a unique vertex ID and an optional initialization of the or edges in the explicitly state the type of the constraint pose constraints are given by pose constraints by EDGE_XYZRPY The keyword is followed by a unique edge the IDs of the referenced vertices
Definition: protocol.txt:7
std::set< Star * > StarSet
Definition: star.h:71
yylloc step()
G2O_HIERARCHICAL_API void g2o::constructEdgeStarMap ( EdgeStarMap esmap,
StarSet stars,
bool  low 
)

Definition at line 35 of file simple_star_ops.cpp.

References g2o::Star::lowLevelEdges(), and g2o::Star::starEdges().

Referenced by main().

35  {
36  esmap.clear();
37  for (StarSet::iterator it=stars.begin(); it!=stars.end(); it++){
38  Star* s = *it;
39  if (low) {
40  for (HyperGraph::EdgeSet::iterator it = s->lowLevelEdges().begin();
41  it!=s->lowLevelEdges().end(); it++){
42  HyperGraph::Edge* e=*it;
43  esmap.insert(make_pair(e,s));
44  }
45  } else {
46  for (HyperGraph::EdgeSet::iterator it = s->starEdges().begin();
47  it!=s->starEdges().end(); it++){
48  HyperGraph::Edge* e=*it;
49  esmap.insert(make_pair(e,s));
50  }
51  }
52  }
53 }
template<typename T >
bool g2o::convertString ( const std::string &  s,
T &  x 
)

convert a string into an other type.

Definition at line 82 of file command_args.cpp.

Referenced by g2o::Property< bool >::fromString(), g2o::CommandArgs::str2arg(), and stringToType().

83 {
84  std::istringstream i(s);
85  if (! (i >> x))
86  return false;
87  return true;
88 }
static OptimizationAlgorithm* g2o::createSolver ( const std::string &  fullSolverName)
static

helper function for allocating

Definition at line 38 of file structure_only.cpp.

39  {
40  if (fullSolverName == "structure_only_2") {
41  OptimizationAlgorithm* optimizationAlgo = new StructureOnlySolver<2>;
42  return optimizationAlgo;
43  }
44  else if (fullSolverName == "structure_only_3") {
45  OptimizationAlgorithm* optimizationAlgo = new StructureOnlySolver<3>;
46  return optimizationAlgo;
47  }
48  else
49  return 0;
50  }
class G2O_CORE_API OptimizationAlgorithm
static OptimizationAlgorithm* g2o::createSolver ( const std::string &  fullSolverName)
static

helper function for allocating

Definition at line 47 of file solver_eigen.cpp.

References ALLOC_EIGEN_SPARSE_CHOLESKY.

Referenced by g2o::EigenSolverCreator::construct().

48  {
49  g2o::Solver* s = 0;
50 
51  string methodName = fullSolverName.substr(0, 2);
52  string solverName = fullSolverName.substr(3);
53 
54  if (solverName == "var_eigen") {
55  ALLOC_EIGEN_SPARSE_CHOLESKY(s, -1, -1, true);
56  }
57 #if 0
58  else if (solverName == "fix3_2_eigen") {
59  ALLOC_EIGEN_SPARSE_CHOLESKY(s, 3, 2, true);
60  }
61  else if (solverName == "fix6_3_eigen") {
62  ALLOC_EIGEN_SPARSE_CHOLESKY(s, 6, 3, true);
63  }
64  else if (solverName == "fix7_3_eigen") {
65  ALLOC_EIGEN_SPARSE_CHOLESKY(s, 7, 3, true);
66  }
67  else if (solverName == "fix3_2_scalar_eigen") {
68  ALLOC_EIGEN_SPARSE_CHOLESKY(s, 3, 2, false);
69  }
70  else if (solverName == "fix6_3_scalar_eigen") {
71  ALLOC_EIGEN_SPARSE_CHOLESKY(s, 6, 3, false);
72  }
73  else if (solverName == "fix7_3_scalar_eigen") {
74  ALLOC_EIGEN_SPARSE_CHOLESKY(s, 7, 3, false);
75  }
76 #endif
77 
78  OptimizationAlgorithm* snl = 0;
79  if (methodName == "gn") {
80  snl = new OptimizationAlgorithmGaussNewton(s);
81  }
82  else if (methodName == "lm") {
83  snl = new OptimizationAlgorithmLevenberg(s);
84  }
85  else if (methodName == "dl") {
86  BlockSolverBase* blockSolver = dynamic_cast<BlockSolverBase*>(s);
87  snl = new OptimizationAlgorithmDogleg(blockSolver);
88  }
89 
90  return snl;
91  }
class G2O_CORE_API OptimizationAlgorithm
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
Definition: solver.h:44
#define ALLOC_EIGEN_SPARSE_CHOLESKY(s, p, l, blockorder)
static OptimizationAlgorithm* g2o::createSolver ( const std::string &  fullSolverName)
static

helper function for allocating

Definition at line 49 of file solver_csparse.cpp.

References ALLOC_CSPARSE.

Referenced by g2o::CSparseSolverCreator::construct().

50  {
51  g2o::Solver* s = 0;
52 
53  string methodName = fullSolverName.substr(0, 2);
54  string solverName = fullSolverName.substr(3);
55 
56  if (solverName == "var") {
57  ALLOC_CSPARSE(s, -1, -1, false);
58  }
59  else if (solverName == "fix3_2") {
60  ALLOC_CSPARSE(s, 3, 2, true);
61  }
62  else if (solverName == "fix6_3") {
63  ALLOC_CSPARSE(s, 6, 3, true);
64  }
65  else if (solverName == "fix7_3") {
66  ALLOC_CSPARSE(s, 7, 3, true);
67  }
68 # ifdef ADD_SCALAR_ORDERING
69  else if (solverName == "fix3_2_scalar") {
70  ALLOC_CSPARSE(s, 3, 2, false);
71  }
72  else if (solverName == "fix6_3_scalar") {
73  ALLOC_CSPARSE(s, 6, 3, false);
74  }
75  else if (solverName == "fix7_3_scalar") {
76  ALLOC_CSPARSE(s, 7, 3, false);
77  }
78 #endif
79 
80  OptimizationAlgorithm* snl = 0;
81  if (methodName == "gn") {
82  snl = new OptimizationAlgorithmGaussNewton(s);
83  }
84  else if (methodName == "lm") {
85  snl = new OptimizationAlgorithmLevenberg(s);
86  }
87  else if (methodName == "dl") {
88  BlockSolverBase* blockSolver = dynamic_cast<BlockSolverBase*>(s);
89  snl = new OptimizationAlgorithmDogleg(blockSolver);
90  }
91 
92  return snl;
93  }
class G2O_CORE_API OptimizationAlgorithm
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
Definition: solver.h:44
#define ALLOC_CSPARSE(s, p, l, blockorder)
static OptimizationAlgorithm* g2o::createSolver ( const std::string &  fullSolverName)
static

Definition at line 50 of file solver_pcg.cpp.

References ALLOC_PCG.

Referenced by g2o::PCGSolverCreator::construct().

51  {
52  g2o::Solver* s = 0;
53 
54  string methodName = fullSolverName.substr(0, 2);
55  string solverName = fullSolverName.substr(3);
56 
57  if (solverName == "pcg") {
58  ALLOC_PCG(s, -1, -1);
59  }
60  else if (solverName == "pcg3_2") {
61  ALLOC_PCG(s, 3, 2);
62  }
63  else if (solverName == "pcg6_3") {
64  ALLOC_PCG(s, 6, 3);
65  }
66  else if (solverName == "pcg7_3") {
67  ALLOC_PCG(s, 7, 3);
68  }
69 
70  OptimizationAlgorithm* snl = 0;
71  if (methodName == "gn") {
72  snl = new OptimizationAlgorithmGaussNewton(s);
73  }
74  else if (methodName == "lm") {
75  snl = new OptimizationAlgorithmLevenberg(s);
76  }
77 
78  return snl;
79  }
#define ALLOC_PCG(s, p, l)
Definition: solver_pcg.cpp:39
class G2O_CORE_API OptimizationAlgorithm
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
Definition: solver.h:44
static OptimizationAlgorithm* g2o::createSolver ( const std::string &  fullSolverName)
static

Definition at line 50 of file solver_dense.cpp.

References ALLOC_DENSE.

Referenced by g2o::DenseSolverCreator::construct().

51  {
52  g2o::Solver* s = 0;
53 
54  string methodName = fullSolverName.substr(0, 2);
55  string solverName = fullSolverName.substr(3);
56 
57  if (solverName == "dense") {
58  ALLOC_DENSE(s, -1, -1);
59  }
60  else if (solverName == "dense3_2") {
61  ALLOC_DENSE(s, 3, 2);
62  }
63  else if (solverName == "dense6_3") {
64  ALLOC_DENSE(s, 6, 3);
65  }
66  else if (solverName == "dense7_3") {
67  ALLOC_DENSE(s, 7, 3);
68  }
69 
70  OptimizationAlgorithm* snl = 0;
71  if (methodName == "gn") {
72  snl = new OptimizationAlgorithmGaussNewton(s);
73  }
74  else if (methodName == "lm") {
75  snl = new OptimizationAlgorithmLevenberg(s);
76  }
77 
78  return snl;
79  }
class G2O_CORE_API OptimizationAlgorithm
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
Definition: solver.h:44
#define ALLOC_DENSE(s, p, l)
static OptimizationAlgorithm* g2o::createSolver ( const std::string &  fullSolverName)
static

helper function for allocating

Definition at line 54 of file slam2d_linear.cpp.

References ALLOC_CSPARSE.

55  {
56  if (fullSolverName != "2dlinear")
57  return 0;
58 
59  g2o::Solver* s = 0;
60  ALLOC_CSPARSE(s, 3, 2, true);
61  OptimizationAlgorithm* snl = 0;
62  snl = new SolverSLAM2DLinear(s);
63 
64  return snl;
65  }
#define ALLOC_CSPARSE(s, p, l, blockorder)
class G2O_CORE_API OptimizationAlgorithm
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
Definition: solver.h:44
static OptimizationAlgorithm* g2o::createSolver ( const std::string &  fullSolverName)
static

Definition at line 55 of file solver_cholmod.cpp.

References ALLOC_CHOLMOD.

Referenced by g2o::CholmodSolverCreator::construct().

56  {
57  g2o::Solver* s = 0;
58 
59  string methodName = fullSolverName.substr(0, 2);
60  string solverName = fullSolverName.substr(3);
61 
62  if (solverName == "var_cholmod") {
63  ALLOC_CHOLMOD(s, -1, -1, false);
64  }
65  else if (solverName == "fix3_2_cholmod") {
66  ALLOC_CHOLMOD(s, 3, 2, true);
67  }
68  else if (solverName == "fix6_3_cholmod") {
69  ALLOC_CHOLMOD(s, 6, 3, true);
70  }
71  else if (solverName == "fix7_3_cholmod") {
72  ALLOC_CHOLMOD(s, 7, 3, true);
73  }
74 #ifdef ADD_SCALAR_ORDERING
75  else if (solverName == "fix3_2_cholmod_scalar") {
76  ALLOC_CHOLMOD(s, 3, 2, false);
77  }
78  else if (solverName == "fix6_3_cholmod_scalar") {
79  ALLOC_CHOLMOD(s, 6, 3, false);
80  }
81  else if (solverName == "fix7_3_cholmod_scalar") {
82  ALLOC_CHOLMOD(s, 7, 3, false);
83  }
84 #endif
85 
86  OptimizationAlgorithm* snl = 0;
87  if (methodName == "gn") {
88  snl = new OptimizationAlgorithmGaussNewton(s);
89  }
90  else if (methodName == "lm") {
91  snl = new OptimizationAlgorithmLevenberg(s);
92  }
93  else if (methodName == "dl") {
94  BlockSolverBase* blockSolver = dynamic_cast<BlockSolverBase*>(s);
95  snl = new OptimizationAlgorithmDogleg(blockSolver);
96  }
97  else {
98  delete s;
99  }
100 
101  return snl;
102  }
class G2O_CORE_API OptimizationAlgorithm
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
Definition: solver.h:44
#define ALLOC_CHOLMOD(s, p, l, blockorder)
static Solver* g2o::createSolver ( const std::string &  solverName)
static

Definition at line 194 of file graph_optimizer_sparse_online.cpp.

References ALLOC_PCG.

195 {
196  g2o::Solver* s = 0;
197  if (solverName == "pcg3_2") {
198  ALLOC_PCG(s, 3, 2);
199  }
200  else if (solverName == "pcg6_3") {
201  ALLOC_PCG(s, 6, 3);
202  }
203  return s;
204 }
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
Definition: solver.h:44
#define ALLOC_PCG(s, p, l)
static OptimizationAlgorithm* g2o::createSolver ( const std::string &  solverName)
static

Definition at line 459 of file graph_optimizer_sparse_incremental.cpp.

References ALLOC_CHOLMOD.

Referenced by g2o::StructureOnlyCreator::construct(), g2o::SLAM2DLinearSolverCreator::construct(), g2o::SparseOptimizerIncremental::initSolver(), and g2o::SparseOptimizerOnline::initSolver().

460  {
461  g2o::Solver* s = 0;
462 
463  if (solverName == "fix3_2_cholmod") {
464  ALLOC_CHOLMOD(s, 3, 2);
465  }
466  else if (solverName == "fix6_3_cholmod") {
467  ALLOC_CHOLMOD(s, 6, 3);
468  }
469 
470  OptimizationAlgorithmGaussNewton* gaussNewton = new OptimizationAlgorithmGaussNewton(s);
471  return gaussNewton;
472  }
Generic interface for a sparse solver operating on a graph which solves one iteration of the lineariz...
Definition: solver.h:44
#define ALLOC_CHOLMOD(s, p, l)
Matrix<double,3,6,Eigen::ColMajor> g2o::d_expy_d_y ( const Vector3D y)
inline

Definition at line 194 of file types_six_dof_expmap.cpp.

References skew().

Referenced by g2o::EdgeProjectPSI2UV::linearizeOplus().

194  {
195  Matrix<double,3,6,Eigen::ColMajor> J;
196  J.topLeftCorner<3,3>() = -skew(y);
197  J.bottomRightCorner<3,3>().setIdentity();
198 
199  return J;
200 }
Matrix3D skew(const Vector3D &v)
Definition: se3_ops.hpp:27
Matrix<double,2,3,Eigen::ColMajor> g2o::d_proj_d_y ( const double &  f,
const Vector3D xyz 
)
inline

Definition at line 186 of file types_six_dof_expmap.cpp.

Referenced by g2o::EdgeProjectPSI2UV::linearizeOplus().

186  {
187  double z_sq = xyz[2]*xyz[2];
188  Matrix<double,2,3,Eigen::ColMajor> J;
189  J << f/xyz[2], 0, -(f*xyz[0])/z_sq,
190  0, f/xyz[2], -(f*xyz[1])/z_sq;
191  return J;
192 }
Matrix3D g2o::d_Tinvpsi_d_psi ( const SE3Quat T,
const Vector3D psi 
)
inline

Definition at line 202 of file types_six_dof_expmap.cpp.

References invert_depth(), and g2o::SE3Quat::rotation().

Referenced by g2o::EdgeProjectPSI2UV::linearizeOplus().

202  {
203  Matrix3D R = T.rotation().toRotationMatrix();
204  Vector3D x = invert_depth(psi);
205  Vector3D r1 = R.col(0);
206  Vector3D r2 = R.col(1);
207  Matrix3D J;
208  J.col(0) = r1;
209  J.col(1) = r2;
210  J.col(2) = -R*x;
211  J*=1./psi.z();
212  return J;
213 }
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
Definition: eigen_types.h:46
Eigen::Matrix< double, 3, 3, Eigen::ColMajor > Matrix3D
Definition: eigen_types.h:61
Vector3d invert_depth(const Vector3d &x)
double g2o::deg2rad ( double  degree)
inline

convert from degree to radian

Definition at line 78 of file misc.h.

79 {
80  return degree * 0.01745329251994329576;
81 }
Vector3D g2o::deltaR ( const Matrix3D R)
inline

Definition at line 41 of file se3_ops.h.

Referenced by g2o::Sim3::log(), g2o::SE3Quat::log(), and skew().

void g2o::drawCircle ( GLfloat  radius,
int  segments = 32 
)

draw a circle using GL_LINES

Definition at line 72 of file draw_helpers.cpp.

References M_PI.

73  {
74  double angleStep = (2 * M_PI / (segments));
75  glBegin(GL_LINE_STRIP);
76  for (int i = 0; i <= segments; i++) {
77  double angle = i * angleStep;
78  float x = radius * cos(angle);
79  float y = radius * sin(angle);
80  glVertex3f(x, y, 0.f);
81  }
82  glEnd();
83  }
#define M_PI
Definition: misc.h:34
void g2o::drawDisk ( GLfloat  radius)

draw a disk

Definition at line 67 of file draw_helpers.cpp.

68  {
69  gluDisk(GLUWrapper::getQuadradic(), 0, radius, 32, 1);
70  }
G2O_CLI_API bool g2o::dumpEdges ( std::ostream &  os,
const OptimizableGraph optimizer 
)

dump the edges to a stream, e.g., cout and redirect to gnuplot

Definition at line 180 of file output_helper.cpp.

References __PRETTY_FUNCTION__, g2o::HyperGraph::edges(), g2o::WriteGnuplotAction::Parameters::os, and saveGnuplot().

Referenced by main().

181 {
182  // seek for an action whose name is writeGnuplot in the library
183  HyperGraphElementAction* saveGnuplot = HyperGraphActionLibrary::instance()->actionByName("writeGnuplot");
184  if (! saveGnuplot ){
185  cerr << __PRETTY_FUNCTION__ << ": no action \"writeGnuplot\" registered" << endl;
186  return false;
187  }
188  WriteGnuplotAction::Parameters params;
189  params.os = &os;
190 
191  // writing all edges
192  os << "set terminal x11 noraise" << endl;
193  os << "set size ratio -1" << endl;
194  os << "plot \"-\" w l" << endl;
195  for (HyperGraph::EdgeSet::const_iterator it = optimizer.edges().begin(); it != optimizer.edges().end(); ++it) {
196  OptimizableGraph::Edge* e = static_cast<OptimizableGraph::Edge*>(*it);
197  (*saveGnuplot)(e, &params);
198  }
199  os << "e" << endl;
200 
201  return true;
202 }
#define __PRETTY_FUNCTION__
Definition: macros.h:89
bool saveGnuplot(const std::string &gnudump, const HyperGraph::VertexSet &vertices, const HyperGraph::EdgeSet &edges)
bool g2o::edgeAllVertsSameDim ( OptimizableGraph::Edge e,
int  dim 
)

Definition at line 43 of file output_helper.cpp.

References g2o::OptimizableGraph::Vertex::dimension(), and g2o::HyperGraph::Edge::vertices().

Referenced by saveGnuplot().

44 {
45  for (size_t i = 0; i < e->vertices().size(); ++i) {
46  OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(e->vertices()[i]);
47  if (v->dimension() != dim)
48  return false;
49  }
50  return true;
51 }
G2O_STUFF_API bool g2o::fileExists ( const char *  filename)

check if file exists (note a directory is also a file)

Definition at line 116 of file filesys_tools.cpp.

117 {
118  struct stat statInfo;
119  return (stat(filename, &statInfo) == 0);
120 }
void g2o::findArguments ( const std::string &  option,
vector< string > &  args,
int  argc,
char **  argv 
)

Definition at line 86 of file g2o_common.cpp.

Referenced by loadStandardSolver(), and loadStandardTypes().

87 {
88  args.clear();
89  for (int i = 0; i < argc; ++i) {
90  if (argv[i] == option && i + 1 < argc) {
91  args.push_back(argv[i+1]);
92  }
93  }
94 }
void g2o::findConnectedEdgesWithCostLimit ( HyperGraph::EdgeSet selected,
HyperGraph::EdgeSet border,
HyperGraph::Edge start,
HyperDijkstra::CostFunction cost,
double  maxEdgeCost,
double  comparisonConditioner 
)

Definition at line 17 of file tools.cpp.

References g2o::BaseVertex< D, T >::push(), and g2o::HyperGraph::Edge::vertices().

Referenced by main().

22  {
23 
24  (void) comparisonConditioner; // no warning (unused)
25  typedef std::queue<HyperGraph::Edge*> EdgeDeque;
26  EdgeDeque frontier;
27  frontier.push(start);
28 
29  selected.clear();
30  border.clear();
31 
32  while (! frontier.empty()){
33  HyperGraph::Edge* e=frontier.front();
34  frontier.pop();
35 
36  const VertexSE2* from = dynamic_cast<const VertexSE2*>(e->vertices()[0]);
37  const VertexSE2* to = dynamic_cast<const VertexSE2*>(e->vertices()[1]);
38 
39  if (!(from && to))
40  continue;
41 
42  double edgecost=(*cost)(e, e->vertices()[0], e->vertices()[1]);
43  if (edgecost != std::numeric_limits< double >::max()) {
44 
45  if (edgecost > maxEdgeCost) {// + comparisonConditioner) {
46  border.insert(e);
47  }
48  else if (edgecost <= maxEdgeCost) {
49  selected.insert(e);
50 
51  for (HyperGraph::EdgeSet::iterator it=e->vertices()[0]->edges().begin();
52  it!=e->vertices()[0]->edges().end(); ++it) {
53  if (selected.find(*it)==selected.end())
54  frontier.push(dynamic_cast<HyperGraph::Edge*>(*it));
55  }
56  for (HyperGraph::EdgeSet::iterator it=e->vertices()[1]->edges().begin();
57  it!=e->vertices()[1]->edges().end(); ++it) {
58  if (selected.find(*it)==selected.end())
59  frontier.push(dynamic_cast<HyperGraph::Edge*>(*it));
60  }
61  }
62  else
63  cerr << "? nan ?" << endl;
64  }
65  else
66  cerr << "? max ?" << endl;
67  }
68  }
g2o::G2O_ATTRIBUTE_CONSTRUCTOR ( init_types_interactive_online  )

Definition at line 37 of file types_online.cpp.

References g2o::Factory::instance(), and g2o::Factory::registerType().

38  {
39  Factory* factory = Factory::instance();
40  //cerr << "Calling " << __FILE__ << " " << __PRETTY_FUNCTION__ << endl;
41 
42  factory->registerType("ONLINE_EDGE_SE2", new HyperGraphElementCreator<OnlineEdgeSE2>);
43  factory->registerType("ONLINE_VERTEX_SE2", new HyperGraphElementCreator<OnlineVertexSE2>);
44 
45  factory->registerType("ONLINE_VERTEX_SE3:QUAT", new HyperGraphElementCreator<OnlineVertexSE3>);
46  factory->registerType("ONLINE_EDGE_SE3:QUAT", new HyperGraphElementCreator<OnlineEdgeSE3>);
47  }
g2o::G2O_ATTRIBUTE_CONSTRUCTOR ( init_slam3d_addons_types  )

Definition at line 55 of file types_slam3d_addons.cpp.

References g2o::types_icp::initialized, g2o::HyperGraphActionLibrary::instance(), g2o::HyperGraphActionLibrary::registerAction(), and g2o::HyperGraphElementAction::setTypeName().

56  {
57  static bool initialized = false;
58  if (initialized)
59  return;
60  initialized = true;
61 
62 #ifdef G2O_HAVE_OPENGL
63  HyperGraphActionLibrary* actionLib = HyperGraphActionLibrary::instance();
64  HyperGraphElementAction* vertexse3eulerdraw=new g2o::VertexSE3DrawAction;
65  vertexse3eulerdraw->setTypeName(typeid(VertexSE3Euler).name());
66  actionLib->registerAction(vertexse3eulerdraw);
67 
68  HyperGraphElementAction* edgese3eulerdraw=new g2o::EdgeSE3DrawAction;
69  edgese3eulerdraw->setTypeName(typeid(EdgeSE3Euler).name());
70  actionLib->registerAction(edgese3eulerdraw);
71 #endif
72  }
g2o::G2O_ATTRIBUTE_CONSTRUCTOR ( init_icp_types  )

Definition at line 87 of file types_icp.cpp.

References g2o::types_icp::init().

88  {
90  }
g2o::G2O_REGISTER_ACTION ( VertexSE3WriteGnuplotAction  )
g2o::G2O_REGISTER_ACTION ( VertexPointXYZWriteGnuplotAction  )
g2o::G2O_REGISTER_ACTION ( EdgeSE3WriteGnuplotAction  )
g2o::G2O_REGISTER_ACTION ( VertexSE2WriteGnuplotAction  )
g2o::G2O_REGISTER_ACTION ( VertexPointXYWriteGnuplotAction  )
g2o::G2O_REGISTER_ACTION ( EdgeSE2WriteGnuplotAction  )
g2o::G2O_REGISTER_ACTION ( EdgeSE2PointXYWriteGnuplotAction  )
g2o::G2O_REGISTER_ACTION ( EdgeSE2PointXYBearingWriteGnuplotAction  )
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( structure_only_2  ,
new   StructureOnlyCreatorOptimizationAlgorithmProperty("structure_only_2","Optimize the landmark poses (2D)","Eigen", true, 3, 2) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( structure_only_3  ,
new   StructureOnlyCreatorOptimizationAlgorithmProperty("structure_only_3","Optimize the landmark poses (3D)","Eigen", true, 6, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( 2dlinear  ,
new   SLAM2DLinearSolverCreatorOptimizationAlgorithmProperty("2dlinear","Solve Orientation + Gauss-Newton: Works only on 2D pose graphs!!","CSparse", false, 3, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_pcg  ,
new   PCGSolverCreatorOptimizationAlgorithmProperty("gn_pcg","Gauss-Newton: PCG solver using block-Jacobi pre-conditioner (variable blocksize)","PCG", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_dense  ,
new   DenseSolverCreatorOptimizationAlgorithmProperty("gn_dense","Gauss-Newton: Dense solver (variable blocksize)","Dense", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_pcg3_2  ,
new   PCGSolverCreatorOptimizationAlgorithmProperty("gn_pcg3_2","Gauss-Newton: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 3, 2) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_dense3_2  ,
new   DenseSolverCreatorOptimizationAlgorithmProperty("gn_dense3_2","Gauss-Newton: Dense solver (fixed blocksize)","Dense", true, 3, 2) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_pcg6_3  ,
new   PCGSolverCreatorOptimizationAlgorithmProperty("gn_pcg6_3","Gauss-Newton: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 6, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_dense6_3  ,
new   DenseSolverCreatorOptimizationAlgorithmProperty("gn_dense6_3","Gauss-Newton: Dense solver (fixed blocksize)","Dense", true, 6, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_pcg7_3  ,
new   PCGSolverCreatorOptimizationAlgorithmProperty("gn_pcg7_3","Gauss-Newton: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 7, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_dense7_3  ,
new   DenseSolverCreatorOptimizationAlgorithmProperty("gn_dense7_3","Gauss-Newton: Dense solver (fixed blocksize)","Dense", true, 7, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_pcg  ,
new   PCGSolverCreatorOptimizationAlgorithmProperty("lm_pcg","Levenberg: PCG solver using block-Jacobi pre-conditioner (variable blocksize)","PCG", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_dense  ,
new   DenseSolverCreatorOptimizationAlgorithmProperty("lm_dense","Levenberg: Dense solver (variable blocksize)","Dense", false,-1,-1) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_pcg3_2  ,
new   PCGSolverCreatorOptimizationAlgorithmProperty("lm_pcg3_2","Levenberg: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 3, 2) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_dense3_2  ,
new   DenseSolverCreatorOptimizationAlgorithmProperty("lm_dense3_2","Levenberg: Dense solver (fixed blocksize)","Dense", true, 3, 2) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_pcg6_3  ,
new   PCGSolverCreatorOptimizationAlgorithmProperty("lm_pcg6_3","Levenberg: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 6, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_dense6_3  ,
new   DenseSolverCreatorOptimizationAlgorithmProperty("lm_dense6_3","Levenberg: Dense solver (fixed blocksize)","Dense", true, 6, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_dense7_3  ,
new   DenseSolverCreatorOptimizationAlgorithmProperty("lm_dense7_3","Levenberg: Dense solver (fixed blocksize)","Dense", true, 7, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_pcg7_3  ,
new   PCGSolverCreatorOptimizationAlgorithmProperty("lm_pcg7_3","Levenberg: PCG solver using block-Jacobi pre-conditioner (fixed blocksize)","PCG", true, 7, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_var_eigen  ,
new   EigenSolverCreatorOptimizationAlgorithmProperty("gn_var_eigen","Gauss-Newton: Cholesky solver using Eigen's Sparse Cholesky methods (variable blocksize)","Eigen", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_var_eigen  ,
new   EigenSolverCreatorOptimizationAlgorithmProperty("lm_var_eigen","Levenberg: Cholesky solver using Eigen's Sparse Cholesky methods (variable blocksize)","Eigen", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_var  ,
new   CSparseSolverCreatorOptimizationAlgorithmProperty("gn_var","Gauss-Newton: Cholesky solver using CSparse (variable blocksize)","CSparse", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_fix3_2  ,
new   CSparseSolverCreatorOptimizationAlgorithmProperty("gn_fix3_2","Gauss-Newton: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 3, 2) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( dl_var_eigen  ,
new   EigenSolverCreatorOptimizationAlgorithmProperty("dl_var_eigen","Dogleg: Cholesky solver using Eigen's Sparse Cholesky methods (variable blocksize)","Eigen", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_fix6_3  ,
new   CSparseSolverCreatorOptimizationAlgorithmProperty("gn_fix6_3","Gauss-Newton: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 6, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_fix7_3  ,
new   CSparseSolverCreatorOptimizationAlgorithmProperty("gn_fix7_3","Gauss-Newton: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 7, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_var  ,
new   CSparseSolverCreatorOptimizationAlgorithmProperty("lm_var","Levenberg: Cholesky solver using CSparse (variable blocksize)","CSparse", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_fix3_2  ,
new   CSparseSolverCreatorOptimizationAlgorithmProperty("lm_fix3_2","Levenberg: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 3, 2) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_fix6_3  ,
new   CSparseSolverCreatorOptimizationAlgorithmProperty("lm_fix6_3","Levenberg: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 6, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_fix7_3  ,
new   CSparseSolverCreatorOptimizationAlgorithmProperty("lm_fix7_3","Levenberg: Cholesky solver using CSparse (fixed blocksize)","CSparse", true, 7, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_var_cholmod  ,
new   CholmodSolverCreatorOptimizationAlgorithmProperty("gn_var_cholmod","Gauss-Newton: Cholesky solver using CHOLMOD (variable blocksize)","CHOLMOD", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_fix3_2_cholmod  ,
new   CholmodSolverCreatorOptimizationAlgorithmProperty("gn_fix3_2_cholmod","Gauss-Newton: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 3, 2) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_fix6_3_cholmod  ,
new   CholmodSolverCreatorOptimizationAlgorithmProperty("gn_fix6_3_cholmod","Gauss-Newton: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 6, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( gn_fix7_3_cholmod  ,
new   CholmodSolverCreatorOptimizationAlgorithmProperty("gn_fix7_3_cholmod","Gauss-Newton: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 7, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_var_cholmod  ,
new   CholmodSolverCreatorOptimizationAlgorithmProperty("lm_var_cholmod","Levenberg: Cholesky solver using CHOLMOD (variable blocksize)","CHOLMOD", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_fix3_2_cholmod  ,
new   CholmodSolverCreatorOptimizationAlgorithmProperty("lm_fix3_2_cholmod","Levenberg: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 3, 2) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_fix6_3_cholmod  ,
new   CholmodSolverCreatorOptimizationAlgorithmProperty("lm_fix6_3_cholmod","Levenberg: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 6, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( lm_fix7_3_cholmod  ,
new   CholmodSolverCreatorOptimizationAlgorithmProperty("lm_fix7_3_cholmod","Levenberg: Cholesky solver using CHOLMOD (fixed blocksize)","CHOLMOD", true, 7, 3) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( dl_var  ,
new   CSparseSolverCreatorOptimizationAlgorithmProperty("dl_var","Dogleg: Cholesky solver using CSparse (variable blocksize)","CSparse", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_ALGORITHM ( dl_var_cholmod  ,
new   CholmodSolverCreatorOptimizationAlgorithmProperty("dl_var_cholmod","Dogleg: Cholesky solver using CHOLMOD (variable blocksize)","CHOLMOD", false, Eigen::Dynamic, Eigen::Dynamic) 
)
g2o::G2O_REGISTER_OPTIMIZATION_LIBRARY ( structure_only  )
g2o::G2O_REGISTER_OPTIMIZATION_LIBRARY ( slam2d_linear  )
g2o::G2O_REGISTER_OPTIMIZATION_LIBRARY ( pcg  )
g2o::G2O_REGISTER_OPTIMIZATION_LIBRARY ( dense  )
g2o::G2O_REGISTER_OPTIMIZATION_LIBRARY ( eigen  )
g2o::G2O_REGISTER_OPTIMIZATION_LIBRARY ( csparse  )
g2o::G2O_REGISTER_OPTIMIZATION_LIBRARY ( cholmod  )
g2o::G2O_REGISTER_TYPE ( VERTEX_SE3:QUAT  ,
VertexSE3   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE3:QUAT  ,
EdgeSE3   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_TRACKXYZ  ,
VertexPointXYZ   
)
g2o::G2O_REGISTER_TYPE ( PARAMS_SE3OFFSET  ,
ParameterSE3Offset   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE3_TRACKXYZ  ,
EdgeSE3PointXYZ   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE3_PRIOR  ,
EdgeSE3Prior   
)
g2o::G2O_REGISTER_TYPE ( CACHE_SE3_OFFSET  ,
CacheSE3Offset   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE3_OFFSET  ,
EdgeSE3Offset   
)
g2o::G2O_REGISTER_TYPE ( PARAMS_CAMERACALIB  ,
ParameterCamera   
)
g2o::G2O_REGISTER_TYPE ( EDGE_V_V_GICP  ,
Edge_V_V_GICP   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_SE3:EXPMAP  ,
VertexSE3Expmap   
)
g2o::G2O_REGISTER_TYPE ( PARAMS_STEREOCAMERACALIB  ,
ParameterStereoCamera   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_SIM3:EXPMAP  ,
VertexSim3Expmap   
)
g2o::G2O_REGISTER_TYPE ( VERTEX3  ,
VertexSE3Euler   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE3:EXPMAP  ,
EdgeSE3Expmap   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SIM3:EXPMAP  ,
EdgeSim3   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_SE2  ,
VertexSE2   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_SEGMENT2D  ,
VertexSegment2D   
)
g2o::G2O_REGISTER_TYPE ( CACHE_CAMERA  ,
CacheCamera   
)
g2o::G2O_REGISTER_TYPE ( EDGE3  ,
EdgeSE3Euler   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_CAM  ,
VertexCam   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PROJECT_XYZ2UV:EXPMAP  ,
EdgeProjectXYZ2UV   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PROJECT_DISPARITY  ,
EdgeSE3PointXYZDisparity   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PROJECT_SIM3_XYZ:EXPMAP  ,
EdgeSim3ProjectXYZ   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_XY  ,
VertexPointXY   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_LINE2D  ,
VertexLine2D   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_PLANE  ,
VertexPlane   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_XYZ  ,
VertexSBAPointXYZ   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PROJECT_XYZ2UVU:EXPMAP  ,
EdgeProjectXYZ2UVU   
)
g2o::G2O_REGISTER_TYPE ( PARAMS_SE2OFFSET  ,
ParameterSE2Offset   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PROJECT_DEPTH  ,
EdgeSE3PointXYZDepth   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE3_PLANE_CALIB  ,
EdgeSE3PlaneSensorCalib   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_TAG  ,
VertexTag   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_INTRINSICS  ,
VertexIntrinsics   
)
g2o::G2O_REGISTER_TYPE ( PARAMS_CAMERAPARAMETERS  ,
CameraParameters   
)
g2o::G2O_REGISTER_TYPE ( CACHE_SE2_OFFSET  ,
CacheSE2Offset   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_SEGMENT2D  ,
EdgeSE2Segment2D   
)
g2o::G2O_REGISTER_TYPE ( ROBOTLASER1  ,
RobotLaser   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_ODOM_DIFFERENTIAL  ,
VertexOdomDifferentialParams   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PRIOR_SE2  ,
EdgeSE2Prior   
)
g2o::G2O_REGISTER_TYPE ( EDGE_POINTXYZ  ,
EdgePointXYZ   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_LINE3D  ,
VertexLine3D   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_SEGMENT2D_LINE  ,
EdgeSE2Segment2DLine   
)
g2o::G2O_REGISTER_TYPE ( VERTEX_ELLIPSE  ,
VertexEllipse   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PROJECT_P2MC  ,
EdgeProjectP2MC   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PRIOR_SE2_XY  ,
EdgeSE2XYPrior   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE3_LINE3D  ,
EdgeSE3Line3D   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_SEGMENT2D_POINTLINE  ,
EdgeSE2Segment2DPointLine   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_CALIB  ,
EdgeSE2SensorCalib   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PROJECT_P2MC_INTRINSICS  ,
EdgeProjectP2MC_Intrinsics   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_ODOM_DIFFERENTIAL_CALIB  ,
EdgeSE2OdomDifferentialCalib   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2  ,
EdgeSE2   
)
g2o::G2O_REGISTER_TYPE ( EDGE_LINE3D  ,
EdgeLine3D   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_LINE2D  ,
EdgeSE2Line2D   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PROJECT_P2SC  ,
EdgeProjectP2SC   
)
g2o::G2O_REGISTER_TYPE ( EDGE_LINE2D  ,
EdgeLine2D   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_XY  ,
EdgeSE2PointXY   
)
g2o::G2O_REGISTER_TYPE ( EDGE_PLANE  ,
EdgePlane   
)
g2o::G2O_REGISTER_TYPE ( EDGE_CAM  ,
EdgeSBACam   
)
g2o::G2O_REGISTER_TYPE ( EDGE_BEARING_SE2_XY  ,
EdgeSE2PointXYBearing   
)
g2o::G2O_REGISTER_TYPE ( EDGE_LINE2D_POINTXY  ,
EdgeLine2DPointXY   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE3_CALIB  ,
EdgeSE3Calib   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SCALE  ,
EdgeSBAScale   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_XY_CALIB  ,
EdgeSE2PointXYCalib   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_OFFSET  ,
EdgeSE2Offset   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_POINTXY_OFFSET  ,
EdgeSE2PointXYOffset   
)
g2o::G2O_REGISTER_TYPE ( EDGE_POINTXY  ,
EdgePointXY   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_TWOPOINTSXY  ,
EdgeSE2TwoPointsXY   
)
g2o::G2O_REGISTER_TYPE ( EDGE_SE2_LOTSOFXY  ,
EdgeSE2LotsOfXY   
)
g2o::G2O_REGISTER_TYPE_GROUP ( slam3d  )
g2o::G2O_REGISTER_TYPE_GROUP ( sim3  )
g2o::G2O_REGISTER_TYPE_GROUP ( slam3d_addons  )
g2o::G2O_REGISTER_TYPE_GROUP ( expmap  )
g2o::G2O_REGISTER_TYPE_GROUP ( slam2d_segment  )
g2o::G2O_REGISTER_TYPE_GROUP ( slam2d  )
g2o::G2O_REGISTER_TYPE_GROUP ( icp  )
g2o::G2O_REGISTER_TYPE_GROUP ( sba  )
g2o::G2O_REGISTER_TYPE_GROUP ( data  )
g2o::G2O_REGISTER_TYPE_GROUP ( sclam  )
g2o::G2O_USE_OPTIMIZATION_LIBRARY ( cholmod  )
g2o::G2O_USE_TYPE_GROUP ( sba  )
g2o::G2O_USE_TYPE_GROUP ( slam2d  )
G2O_STUFF_API double g2o::get_monotonic_time ( )

return a monotonic increasing time which basically does not need to have a reference point. Consider this for measuring how long some code fragments required to execute.

On Linux we call clock_gettime() on other systems we currently call get_time().

Definition at line 113 of file timeutil.cpp.

References get_time().

Referenced by g2o::BlockSolver< Traits >::computeMarginals(), g2o::LinearSolverEigen< MatrixType >::computeSymbolicDecomposition(), g2o::LinearSolverCholmodOnline< MatrixType >::computeSymbolicDecomposition(), g2o::LinearSolverCSparse< MatrixType >::computeSymbolicDecomposition(), g2o::LinearSolverCholmod< MatrixType >::computeSymbolicDecomposition(), get_time(), main(), g2o::SparseOptimizer::optimize(), g2o::OptimizationAlgorithmGaussNewton::solve(), g2o::OptimizationAlgorithmLevenberg::solve(), g2o::OptimizationAlgorithmDogleg::solve(), g2o::LinearSolverCholmodOnline< MatrixType >::solve(), g2o::LinearSolverEigen< MatrixType >::solve(), g2o::LinearSolverCSparse< MatrixType >::solve(), g2o::LinearSolverCholmod< MatrixType >::solve(), g2o::BlockSolver< Traits >::solve(), tictoc(), and g2o::ScopeTime::~ScopeTime().

114 {
115 #if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0) && defined(_POSIX_MONOTONIC_CLOCK))
116  struct timespec ts;
117  clock_gettime(CLOCK_MONOTONIC, &ts);
118  return ts.tv_sec + ts.tv_nsec*1e-9;
119 #else
120  return get_time();
121 #endif
122 }
double get_time()
Definition: timeutil.h:92
double g2o::get_time ( )
inline

return the current time in seconds since 1. Jan 1970

Definition at line 92 of file timeutil.h.

References G2O_STUFF_API, and get_monotonic_time().

Referenced by get_monotonic_time().

93 {
94  struct timeval ts;
95  gettimeofday(&ts,0);
96  return ts.tv_sec + ts.tv_usec*1e-6;
97 }
G2O_STUFF_API std::string g2o::getBasename ( const std::string &  filename)

return the basename of the given filename /etc/fstab -> fstab

Definition at line 78 of file filesys_tools.cpp.

79 {
80 #ifdef WINDOWS
81  std::string::size_type lastSlash = filename.find_last_of('\\');
82 #else
83  std::string::size_type lastSlash = filename.find_last_of('/');
84 #endif
85  if (lastSlash != std::string::npos)
86  return filename.substr(lastSlash + 1);
87  else
88  return filename;
89 }
G2O_STUFF_API std::string g2o::getDirname ( const std::string &  filename)

return the directory of a given filename /etc/fstab -> /etc

Definition at line 91 of file filesys_tools.cpp.

Referenced by loadStandardSolver(), and loadStandardTypes().

92 {
93 #ifdef WINDOWS
94  std::string::size_type lastSlash = filename.find_last_of('\\');
95 #else
96  std::string::size_type lastSlash = filename.find_last_of('/');
97 #endif
98  if (lastSlash != std::string::npos)
99  return filename.substr(0, lastSlash);
100  else
101  return "";
102 }
G2O_STUFF_API std::string g2o::getFileExtension ( const std::string &  filename)

get filename extension (the part after the last .), e.g. the extension of file.txt is txt

Definition at line 60 of file filesys_tools.cpp.

Referenced by gnudump_edges(), gnudump_features(), and saveGnuplot().

61 {
62  std::string::size_type lastDot = filename.find_last_of('.');
63  if (lastDot != std::string::npos)
64  return filename.substr(lastDot + 1);
65  else
66  return "";
67 }
G2O_STUFF_API std::vector< std::string > g2o::getFilesByPattern ( const char *  pattern)

return all files that match a given pattern, e.g., ~/blaa*.txt, /tmp/a*

Definition at line 122 of file filesys_tools.cpp.

Referenced by g2o::DlWrapper::openLibraries().

123 {
124  std::vector<std::string> result;
125 
126 #ifdef WINDOWS
127 
128  HANDLE hFind;
129  WIN32_FIND_DATA FData;
130  if ((hFind = FindFirstFile(pattern, &FData)) != INVALID_HANDLE_VALUE) {
131  do {
132  result.push_back(FData.cFileName);
133  } while (FindNextFile(hFind, &FData));
134  FindClose(hFind);
135  }
136 
137 #elif (defined (UNIX) || defined (CYGWIN)) && !defined(ANDROID)
138 
139  wordexp_t p;
140  wordexp(pattern, &p, 0);
141 
142  // For some reason, wordexp sometimes fails on an APPLE machine to
143  // return anything; therefore, run it several times until we do find
144  // something - or give up
145 #ifdef __APPLE__
146  for (int k = 0; (k < 100) && (p.we_wordc == 0); k++) {
147  //chrono::milliseconds duration(20);
148  //this_thread::sleep_for(duration);
149  wordexp(pattern, &p, WRDE_APPEND);
150  }
151 #endif
152 
153  result.reserve(p.we_wordc);
154  for (size_t i = 0; i < p.we_wordc; ++i)
155  result.push_back(p.we_wordv[i]);
156 
157  wordfree(&p);
158 
159 #endif
160 
161  return result;
162 }
G2O_STUFF_API std::string g2o::getPureFilename ( const std::string &  filename)

get the filename without the extension. file.txt -> file

Definition at line 69 of file filesys_tools.cpp.

Referenced by gnudump_edges(), gnudump_features(), and saveGnuplot().

70 {
71  std::string::size_type lastDot = filename.find_last_of('.');
72  if (lastDot != std::string::npos)
73  return filename.substr(0, lastDot);
74  else
75  return filename;
76 }
template<typename T >
T g2o::hypot ( x,
y 
)
inline

return the hypot of x and y

Definition at line 61 of file misc.h.

Referenced by g2o::OdomConvert::convertToVelocity().

62 {
63  return (T) (sqrt(x*x + y*y));
64 }
template<typename T >
T g2o::hypot_sqr ( x,
y 
)
inline

return the squared hypot of x and y

Definition at line 70 of file misc.h.

Referenced by g2o::tutorial::Simulator::simulate().

71 {
72  return x*x + y*y;
73 }
double g2o::inverse_theta ( double  th)
inline

inverse of an angle, i.e., +180 degree

Definition at line 112 of file misc.h.

References M_PI, and normalize_theta().

113 {
114  return normalize_theta(th + M_PI);
115 }
double normalize_theta(double theta)
Definition: misc.h:94
#define M_PI
Definition: misc.h:34
Vector3D g2o::invert_depth ( const Vector3D x)
inline

Definition at line 66 of file types_six_dof_expmap.cpp.

References unproject2d().

Referenced by g2o::EdgeProjectPSI2UV::computeError(), d_Tinvpsi_d_psi(), and g2o::EdgeProjectPSI2UV::linearizeOplus().

66  {
67  return unproject2d(x.head<2>())/x[2];
68 }
Vector3d unproject2d(const Vector2d &v)
static void g2o::jac_quat3_euler3 ( Eigen::Matrix< double, 6, 6, Eigen::ColMajor > &  J,
const Isometry3D t 
)
static

conversion code from Euler angles

Definition at line 37 of file edge_se3_euler.cpp.

References g2o::internal::fromVectorQT(), g2o::internal::toVectorET(), and g2o::internal::toVectorQT().

Referenced by g2o::G2oSlamInterface::addEdge(), g2o::EdgeSE3Euler::read(), and g2o::EdgeSE3Euler::write().

38 {
40 
41  double delta=1e-6;
42  double idelta= 1. / (2. * delta);
43 
44  Vector7d ta = t0;
45  Vector7d tb = t0;
46  for (int i=0; i<6; i++){
47  ta=tb=t0;
48  ta[i]-=delta;
49  tb[i]+=delta;
52  J.col(3)=(eb-ea)*idelta;
53  }
54 }
Isometry3D fromVectorQT(const Vector7d &v)
Eigen::Matrix< double, 7, 1 > Vector7d
Definition: sim3.h:35
Vector6d toVectorET(const Isometry3D &t)
Eigen::Matrix< double, 6, 1 > Vector6d
Vector7d toVectorQT(const Isometry3D &t)
G2O_CLI_API void g2o::loadStandardSolver ( DlWrapper dlSolverWrapper,
int  argc = 0,
char **  argv = 0 
)

will also look for -solverlib in (argc, argv) and load that solver

Definition at line 133 of file g2o_common.cpp.

References findArguments(), getDirname(), getMyInstance(), g2o::DlWrapper::openLibraries(), g2o::DlWrapper::openLibrary(), PATH_SEPARATOR, SOLVERS_PATTERN, and strSplit().

Referenced by main().

134 {
135  char * envSolversPath = getenv("G2O_SOLVERS_DIR");
136  string solversPath = G2O_DEFAULT_SOLVERS_DIR_;
137 
138  if (envSolversPath != NULL) {
139  solversPath = envSolversPath;
140  } else {
141 #if (defined UNIX)
142  if (dladdr(&info, &info) != 0) {
143  solversPath = getDirname(info.dli_fname);
144  }
145 #elif (defined WINDOWS)
146  char libFilename[MAX_PATH + 1];
147  HMODULE instance = getMyInstance();
148  if (instance && GetModuleFileName(instance, libFilename, MAX_PATH) > 0) {
149  solversPath = getDirname(libFilename);
150  }
151 #endif
152  }
153 
154  vector<string> paths = strSplit(solversPath, PATH_SEPARATOR);
155  for (vector<string>::const_iterator it = paths.begin(); it != paths.end(); ++it) {
156  if (it->size() > 0)
157  dlSolverWrapper.openLibraries(*it, SOLVERS_PATTERN);
158  }
159 
160  vector<string> libs;
161  if (argc > 0 && argv != 0)
162  findArguments("-solverlib", libs, argc, argv);
163  for (vector<string>::const_iterator it = libs.begin(); it != libs.end(); ++it) {
164  cerr << "Loading solver " << *it << endl;
165  dlSolverWrapper.openLibrary(*it);
166  }
167 }
static const string SOLVERS_PATTERN
Definition: g2o_common.cpp:82
#define PATH_SEPARATOR
Definition: g2o_common.cpp:61
HMODULE getMyInstance()
Definition: g2o_common.cpp:65
void findArguments(const std::string &option, vector< string > &args, int argc, char **argv)
Definition: g2o_common.cpp:86
std::string getDirname(const std::string &filename)
std::vector< std::string > strSplit(const std::string &str, const std::string &delimiters)
G2O_CLI_API void g2o::loadStandardTypes ( DlWrapper dlWrapper,
int  argc = 0,
char **  argv = 0 
)

will also look for -typeslib in (argc, argv) and load that types

Definition at line 96 of file g2o_common.cpp.

References findArguments(), getDirname(), getMyInstance(), g2o::DlWrapper::openLibraries(), g2o::DlWrapper::openLibrary(), PATH_SEPARATOR, strSplit(), and TYPES_PATTERN.

Referenced by main().

97 {
98  char * envTypesPath = getenv("G2O_TYPES_DIR");
99  string typesPath;
100 
101  if (envTypesPath != NULL) {
102  typesPath = envTypesPath;
103  } else {
104  typesPath = G2O_DEFAULT_TYPES_DIR_;
105 #if (defined UNIX)
106  if (dladdr(&info, &info) != 0) {
107  typesPath = getDirname(info.dli_fname);
108  }
109 #elif (defined WINDOWS)
110  char libFilename[MAX_PATH + 1];
111  HMODULE instance = getMyInstance();
112  if (instance && GetModuleFileName(instance, libFilename, MAX_PATH) > 0) {
113  typesPath = getDirname(libFilename);
114  }
115 #endif
116  }
117 
118  vector<string> paths = strSplit(typesPath, PATH_SEPARATOR);
119  for (vector<string>::const_iterator it = paths.begin(); it != paths.end(); ++it) {
120  if (it->size() > 0)
121  dlTypesWrapper.openLibraries(*it, TYPES_PATTERN);
122  }
123 
124  vector<string> libs;
125  if (argc > 0 && argv != 0)
126  findArguments("-typeslib", libs, argc, argv);
127  for (vector<string>::const_iterator it = libs.begin(); it != libs.end(); ++it) {
128  cerr << "Loading types " << *it << endl;
129  dlTypesWrapper.openLibrary(*it);
130  }
131 }
#define PATH_SEPARATOR
Definition: g2o_common.cpp:61
HMODULE getMyInstance()
Definition: g2o_common.cpp:65
void findArguments(const std::string &option, vector< string > &args, int argc, char **argv)
Definition: g2o_common.cpp:86
std::string getDirname(const std::string &filename)
std::vector< std::string > strSplit(const std::string &str, const std::string &delimiters)
static const string TYPES_PATTERN
Definition: g2o_common.cpp:81
double g2o::normalize_theta ( double  theta)
inline

normalize the angle

Definition at line 94 of file misc.h.

References M_PI.

Referenced by g2o::EdgeSE2PointXYBearing::computeError(), g2o::EdgeSE2Line2D::computeError(), g2o::EdgeSE2Segment2DLine::computeError(), g2o::EdgeSE2Segment2DPointLine::computeError(), g2o::EdgeSE2Line2D::initialEstimate(), g2o::tutorial::SE2::inverse(), g2o::SE2::inverse(), inverse_theta(), operator*(), g2o::tutorial::SE2::operator*(), g2o::tutorial::SE2::operator*=(), g2o::SE2::operator*=(), g2o::VertexSE2::oplusImpl(), g2o::VertexLine2D::oplusImpl(), g2o::OnlineVertexSE2::oplusUpdatedEstimate(), g2o::EdgeSE2Line2D::setMeasurementFromState(), and g2o::SolverSLAM2DLinear::solveOrientation().

95 {
96  if (theta >= -M_PI && theta < M_PI)
97  return theta;
98 
99  double multiplier = floor(theta / (2*M_PI));
100  theta = theta - multiplier*2*M_PI;
101  if (theta >= M_PI)
102  theta -= 2*M_PI;
103  if (theta < -M_PI)
104  theta += 2*M_PI;
105 
106  return theta;
107 }
#define M_PI
Definition: misc.h:34
Line2D g2o::operator* ( const SE2 t,
const Line2D l 
)
inline

Definition at line 48 of file line_2d.h.

References normalize_theta(), g2o::SE2::rotation(), and g2o::SE2::translation().

48  {
49  Line2D est = l;
50  est[0] += t.rotation().angle();
51  est[0] = normalize_theta(est[0]);
52  Vector2D n(cos(est[0]), sin(est[0]));
53  est[1] += n.dot(t.translation());
54  return est;
55  }
Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
Definition: eigen_types.h:45
double normalize_theta(double theta)
Definition: misc.h:94
G2O_TYPES_SLAM3D_ADDONS_API Line3D g2o::operator* ( const Isometry3D t,
const Line3D line 
)

Definition at line 94 of file line3d.cpp.

References _skew().

94  {
95  Matrix6d A=Matrix6d::Zero();
96  A.block<3,3>(0,0)=t.linear();
97  A.block<3,3>(0,3)= _skew(t.translation())*t.linear();
98  A.block<3,3>(3,3)=t.linear();
99  Vector6d v = (Vector6d)line;
100  // cout << "v" << endl << v << endl;
101  // cout << "A" << endl << A << endl;
102  // cout << "Av" << endl << A*v << endl;
103  return Line3D(A*v);
104  }
Eigen::Matrix< double, 6, 6 > Matrix6d
static Matrix3D _skew(const Vector3D &t)
Definition: line3d.cpp:41
Eigen::Matrix< double, 6, 1 > Vector6d
Plane3D g2o::operator* ( const Eigen::Isometry3d &  t,
const Plane3D plane 
)
inline

Definition at line 120 of file plane3d.h.

References g2o::Plane3D::_coeffs.

120  {
121  Eigen::Vector4d v=plane._coeffs;
122  Eigen::Vector4d v2;
123  Eigen::Matrix3d R=t.rotation();
124  v2.head<3>() = R*v.head<3>();
125  v2(3)=v(3) - t.translation().dot(v2.head<3>());
126  return Plane3D(v2);
127  };
bool g2o::operator< ( const HyperDijkstra::AdjacencyMapEntry a,
const HyperDijkstra::AdjacencyMapEntry b 
)

Definition at line 80 of file hyper_dijkstra.cpp.

References g2o::HyperDijkstra::AdjacencyMapEntry::distance().

81  {
82  return a.distance()>b.distance();
83  }
std::ostream & g2o::operator<< ( std::ostream &  os,
const std::vector< int > &  v 
)

Definition at line 68 of file command_args.cpp.

68  {
69  if (v.size()){
70  os << v[0];
71  }
72  for (size_t i=1; i<v.size(); i++){
73  os << "," << v[i];
74  }
75  return os;
76 }
std::ostream & g2o::operator<< ( std::ostream &  os,
const std::vector< double > &  v 
)

Definition at line 539 of file command_args.cpp.

540 {
541  if (v.size())
542  os << v[0];
543  for (size_t i=1; i<v.size(); i++)
544  os << ";" << v[i];
545  return os;
546 }
G2O_CORE_API std::ostream & g2o::operator<< ( std::ostream &  os,
const G2OBatchStatistics st 
)

timings

Definition at line 48 of file batch_stats.cpp.

References PTHING.

49  {
50  os << PTHING(iteration);
51 
52  os << PTHING( numVertices ); // how many vertices are involved
53  os << PTHING( numEdges ); // hoe many edges
54  os << PTHING( chi2 ); // total chi2
55 
57  // nonlinear part
58  os << PTHING( timeResiduals );
59  os << PTHING( timeLinearize ); // jacobians
60  os << PTHING( timeQuadraticForm ); // construct the quadratic form in the graph
61 
62  // block_solver (constructs Ax=b, plus maybe schur);
63  os << PTHING( timeSchurComplement ); // compute schur complement (0 if not done);
64 
65  // linear solver (computes Ax=b); );
66  os << PTHING( timeSymbolicDecomposition ); // symbolic decomposition (0 if not done);
67  os << PTHING( timeNumericDecomposition ); // numeric decomposition (0 if not done);
68  os << PTHING( timeLinearSolution ); // total time for solving Ax=b
69  os << PTHING( iterationsLinearSolver ); // iterations of PCG
70  os << PTHING( timeUpdate ); // oplus
71  os << PTHING( timeIteration ); // total time );
72 
73  os << PTHING( levenbergIterations );
74  os << PTHING( timeLinearSolver);
75 
76  os << PTHING(hessianDimension);
77  os << PTHING(hessianPoseDimension);
78  os << PTHING(hessianLandmarkDimension);
79  os << PTHING(choleskyNNZ);
80  os << PTHING(timeMarginals);
81 
82  return os;
83  };
#define PTHING(s)
Definition: batch_stats.cpp:36
std::ostream& g2o::operator<< ( std::ostream &  out_str,
const SBACam cam 
)
inline

Definition at line 184 of file sbacam.h.

References g2o::SBACam::Kcam, g2o::SE3Quat::rotation(), g2o::SE3Quat::translation(), g2o::SBACam::w2i, and g2o::SBACam::w2n.

186  {
187  out_str << cam.translation().transpose() << std::endl;
188  out_str << cam.rotation().coeffs().transpose() << std::endl << std::endl;
189  out_str << cam.Kcam << std::endl << std::endl;
190  out_str << cam.w2n << std::endl << std::endl;
191  out_str << cam.w2i << std::endl << std::endl;
192 
193  return out_str;
194  };
template<class MatrixType >
std::ostream & g2o::operator<< ( std::ostream &  os,
const SparseBlockMatrix< MatrixType > &  m 
)

Definition at line 378 of file sparse_block_matrix.hpp.

References g2o::SparseBlockMatrix< MatrixType >::blockCols().

378  {
379  os << "RBI: " << m.rowBlockIndices().size();
380  for (size_t i=0; i<m.rowBlockIndices().size(); ++i)
381  os << " " << m.rowBlockIndices()[i];
382  os << std::endl;
383  os << "CBI: " << m.colBlockIndices().size();
384  for (size_t i=0; i<m.colBlockIndices().size(); ++i)
385  os << " " << m.colBlockIndices()[i];
386  os << std::endl;
387 
388  for (size_t i=0; i<m.blockCols().size(); ++i){
389  for (typename SparseBlockMatrix<MatrixType>::IntBlockMap::const_iterator it=m.blockCols()[i].begin(); it!=m.blockCols()[i].end(); ++it){
390  const typename SparseBlockMatrix<MatrixType>::SparseMatrixBlock* b=it->second;
391  os << "BLOCK: " << it->first << " " << i << std::endl;
392  os << *b << std::endl;
393  }
394  }
395  return os;
396  }
std::ostream& g2o::operator<< ( std::ostream &  out_str,
const Sim3 sim3 
)
inline

Definition at line 285 of file sim3.h.

References g2o::Sim3::rotation(), g2o::Sim3::scale(), and g2o::Sim3::translation().

287  {
288  out_str << sim3.rotation().coeffs() << std::endl;
289  out_str << sim3.translation() << std::endl;
290  out_str << sim3.scale() << std::endl;
291 
292  return out_str;
293  }
std::ostream& g2o::operator<< ( std::ostream &  out_str,
const SE3Quat se3 
)
inline

Definition at line 295 of file se3quat.h.

References g2o::SE3Quat::to_homogeneous_matrix().

296  {
297  out_str << se3.to_homogeneous_matrix() << std::endl;
298  return out_str;
299  }
std::istream & g2o::operator>> ( std::istream &  is,
std::vector< int > &  v 
)

Definition at line 46 of file command_args.cpp.

46  {
47  string s;
48  if (! (is >> s) )
49  return is;
50 
51  const char* c = s.c_str();
52  char* caux = const_cast<char*>(c);
53 
54  v.clear();
55  bool hasNextValue=true;
56  while(hasNextValue){
57  int i = static_cast<int>(strtol(c,&caux,10));
58  if (c!=caux){
59  c=caux;
60  c++;
61  v.push_back(i);
62  } else
63  hasNextValue = false;
64  }
65  return is;
66 }
std::istream & g2o::operator>> ( std::istream &  is,
std::vector< double > &  v 
)

Definition at line 517 of file command_args.cpp.

517  {
518  string s;
519  if (! (is >> s) )
520  return is;
521 
522  const char* c = s.c_str();
523  char* caux = const_cast<char*>(c);
524 
525  v.clear();
526  bool hasNextValue=true;
527  while(hasNextValue){
528  double i=strtod(c,&caux);
529  if (c!=caux){
530  c=caux;
531  c++;
532  v.push_back(i);
533  } else
534  hasNextValue = false;
535  }
536  return is;
537 }
Vector2D g2o::project ( const Vector3D v)
inline

Definition at line 50 of file se3_ops.h.

Referenced by g2o::EdgeSim3ProjectXYZ::computeError(), and skew().

Vector3D g2o::project ( const Vector4D v)
inline

Definition at line 58 of file se3_ops.h.

Vector2D g2o::project2d ( const Vector3D v)

Definition at line 51 of file types_six_dof_expmap.cpp.

Referenced by g2o::CameraParameters::cam_map().

51  {
52  Vector2D res;
53  res(0) = v(0)/v(2);
54  res(1) = v(1)/v(2);
55  return res;
56 }
Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
Definition: eigen_types.h:45
double g2o::rad2deg ( double  rad)
inline

convert from radian to degree

Definition at line 86 of file misc.h.

87 {
88  return rad * 57.29577951308232087721;
89 }
template<class SampleType , class CovarianceType >
void g2o::reconstructGaussian ( SampleType &  mean,
CovarianceType &  covariance,
const std::vector< SigmaPoint< SampleType >, Eigen::aligned_allocator< SigmaPoint< SampleType > > > &  sigmaPoints 
)

Definition at line 78 of file unscented.h.

Referenced by g2o::EdgeLabeler::labelEdge(), testMarginals(), and unscentedTest().

79  {
80 
81  mean.fill(0);
82  covariance.fill(0);
83  for (size_t i=0; i<sigmaPoints.size(); i++){
84  mean += sigmaPoints[i]._wi * sigmaPoints[i]._sample;
85  }
86  for (size_t i=0; i<sigmaPoints.size(); i++){
87  SampleType delta = sigmaPoints[i]._sample - mean;
88  covariance += sigmaPoints[i]._wp * ( delta* delta.transpose() ) ;
89  }
90 
91  }
double G2O_STUFF_API g2o::sampleGaussian ( std::mt19937 *  generator)

Definition at line 41 of file sampler.cpp.

References _univariateSampler().

Referenced by g2o::GaussianSampler< typename EdgeType::ErrorVector, InformationType >::generateSample(), and main().

41  {
42  if (generator)
43  return _univariateSampler(*generator);
45  }
static std::normal_distribution< double > _univariateSampler(0., 1.)
static std::mt19937 _gen_real
Definition: sampler.cpp:33
double G2O_STUFF_API g2o::sampleUniform ( double  min,
double  max,
std::mt19937 *  generator 
)

Definition at line 35 of file sampler.cpp.

References _uniformReal.

Referenced by main().

35  {
36  if (generator)
37  return _uniformReal(*generator)*(max-min)+min;
38  return _uniformReal(_gen_real)*(max-min)+min;
39  }
static std::uniform_real_distribution< double > _uniformReal
Definition: sampler.cpp:32
static std::mt19937 _gen_real
Definition: sampler.cpp:33
template<class SampleType , class CovarianceType >
bool g2o::sampleUnscented ( std::vector< SigmaPoint< SampleType >, Eigen::aligned_allocator< SigmaPoint< SampleType > > > &  sigmaPoints,
const SampleType &  mean,
const CovarianceType &  covariance 
)

Definition at line 49 of file unscented.h.

Referenced by g2o::EdgeLabeler::labelEdge(), testMarginals(), and unscentedTest().

49  {
50 
51  const int dim = mean.size();
52  const int numPoints = 2 * dim + 1;
53  assert (covariance.rows() == covariance.cols() && covariance.cols() == mean.size() && "Dimension Mismatch");
54  const double alpha = 1e-3;
55  const double beta = 2.;
56  const double lambda = alpha * alpha * dim;
57  const double wi = 1./(2. * (dim + lambda) );
58 
59  sigmaPoints.resize(numPoints);
60  sigmaPoints[0] = SigmaPoint<SampleType>(mean,
61  lambda/(dim + lambda),
62  lambda/(dim + lambda) + (1.-alpha*alpha+beta) );
63  Eigen::LLT<CovarianceType> cholDecomp;
64  cholDecomp.compute(covariance*(dim+lambda));
65  if (cholDecomp.info()==Eigen::NumericalIssue)
66  return false;
67  const CovarianceType& L=cholDecomp.matrixL();
68  int k=1;
69  for (int i=0; i<dim; i++) {
70  SampleType s(L.col(i));
71  sigmaPoints[k++]=SigmaPoint<SampleType>(mean + s, wi, wi);
72  sigmaPoints[k++]=SigmaPoint<SampleType>(mean - s, wi, wi);
73  }
74  return true;
75  }
G2O_CLI_API bool g2o::saveGnuplot ( const std::string &  gnudump,
const OptimizableGraph optimizer 
)

save the state of the optimizer into files for visualizing using Gnuplot

Definition at line 53 of file output_helper.cpp.

References g2o::HyperGraph::edges(), saveGnuplot(), and g2o::HyperGraph::vertices().

Referenced by main().

54 {
55  HyperGraph::VertexSet vset;
56  for (HyperGraph::VertexIDMap::const_iterator it=optimizer.vertices().begin(); it!=optimizer.vertices().end(); it++){
57  vset.insert(it->second);
58  }
59  return saveGnuplot(gnudump, vset, optimizer.edges());
60 }
bool saveGnuplot(const std::string &gnudump, const HyperGraph::VertexSet &vertices, const HyperGraph::EdgeSet &edges)
G2O_CLI_API bool g2o::saveGnuplot ( const std::string &  gnudump,
const HyperGraph::VertexSet vertices,
const HyperGraph::EdgeSet edges 
)

Definition at line 62 of file output_helper.cpp.

References __PRETTY_FUNCTION__, g2o::OptimizableGraph::Vertex::dimension(), edgeAllVertsSameDim(), getFileExtension(), getPureFilename(), g2o::WriteGnuplotAction::Parameters::os, and g2o::HyperGraph::Edge::vertices().

Referenced by dumpEdges(), and saveGnuplot().

63 {
64  // seek for an action whose name is writeGnuplot in the library
65  HyperGraphElementAction* saveGnuplot = HyperGraphActionLibrary::instance()->actionByName("writeGnuplot");
66  if (! saveGnuplot ){
67  cerr << __PRETTY_FUNCTION__ << ": no action \"writeGnuplot\" registered" << endl;
68  return false;
69  }
70  WriteGnuplotAction::Parameters params;
71 
72  int maxDim = -1;
73  int minDim = numeric_limits<int>::max();
74  for (HyperGraph::VertexSet::const_iterator it = vertices.begin(); it != vertices.end(); ++it){
75  OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(*it);
76  int vdim = v->dimension();
77  maxDim = (std::max)(vdim, maxDim);
78  minDim = (std::min)(vdim, minDim);
79  }
80 
81  string extension = getFileExtension(gnudump);
82  if (extension.size() == 0)
83  extension = "dat";
84  string baseFilename = getPureFilename(gnudump);
85 
86  // check for odometry edges
87  bool hasOdomEdge = false;
88  bool hasLandmarkEdge = false;
89  for (HyperGraph::EdgeSet::const_iterator it = edges.begin(); it != edges.end(); ++it) {
90  OptimizableGraph::Edge* e = static_cast<OptimizableGraph::Edge*>(*it);
91  if (e->vertices().size() == 2) {
92  if (edgeAllVertsSameDim(e, maxDim))
93  hasOdomEdge = true;
94  else
95  hasLandmarkEdge = true;
96  }
97  if (hasOdomEdge && hasLandmarkEdge)
98  break;
99  }
100 
101  bool fileStatus = true;
102  if (hasOdomEdge) {
103  string odomFilename = baseFilename + "_odom_edges." + extension;
104  cerr << "# saving " << odomFilename << " ... ";
105  ofstream fout(odomFilename.c_str());
106  if (! fout) {
107  cerr << "Unable to open file" << endl;
108  return false;
109  }
110  params.os = &fout;
111 
112  // writing odometry edges
113  for (HyperGraph::EdgeSet::const_iterator it = edges.begin(); it != edges.end(); ++it) {
114  OptimizableGraph::Edge* e = static_cast<OptimizableGraph::Edge*>(*it);
115  if (e->vertices().size() != 2 || ! edgeAllVertsSameDim(e, maxDim))
116  continue;
117  (*saveGnuplot)(e, &params);
118  }
119  cerr << "done." << endl;
120  }
121 
122  if (hasLandmarkEdge) {
123  string filename = baseFilename + "_landmarks_edges." + extension;
124  cerr << "# saving " << filename << " ... ";
125  ofstream fout(filename.c_str());
126  if (! fout) {
127  cerr << "Unable to open file" << endl;
128  return false;
129  }
130  params.os = &fout;
131 
132  // writing landmark edges
133  for (HyperGraph::EdgeSet::const_iterator it = edges.begin(); it != edges.end(); ++it) {
134  OptimizableGraph::Edge* e = static_cast<OptimizableGraph::Edge*>(*it);
135  if (e->vertices().size() != 2 || edgeAllVertsSameDim(e, maxDim))
136  continue;
137  (*saveGnuplot)(e, &params);
138  }
139  cerr << "done." << endl;
140  }
141 
142  if (1) {
143  string filename = baseFilename + "_edges." + extension;
144  cerr << "# saving " << filename << " ... ";
145  ofstream fout(filename.c_str());
146  if (! fout) {
147  cerr << "Unable to open file" << endl;
148  return false;
149  }
150  params.os = &fout;
151 
152  // writing all edges
153  for (HyperGraph::EdgeSet::const_iterator it = edges.begin(); it != edges.end(); ++it) {
154  OptimizableGraph::Edge* e = static_cast<OptimizableGraph::Edge*>(*it);
155  (*saveGnuplot)(e, &params);
156  }
157  cerr << "done." << endl;
158  }
159 
160  if (1) {
161  string filename = baseFilename + "_vertices." + extension;
162  cerr << "# saving " << filename << " ... ";
163  ofstream fout(filename.c_str());
164  if (! fout) {
165  cerr << "Unable to open file" << endl;
166  return false;
167  }
168  params.os = &fout;
169 
170  for (HyperGraph::VertexSet::const_iterator it = vertices.begin(); it != vertices.end(); ++it){
171  OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(*it);
172  (*saveGnuplot)(v, &params);
173  }
174  cerr << "done." << endl;
175  }
176 
177  return fileStatus;
178 }
std::string getFileExtension(const std::string &filename)
#define __PRETTY_FUNCTION__
Definition: macros.h:89
Protocol The SLAM executable accepts such as solving the and retrieving or vertices in the explicitly state the reprensentation poses are represented by poses by VERTEX_XYZRPY In the Quaternions and other representations could be but note that it is up to the SLAM algorithm to choose the internal representation of the angles The keyword is followed by a unique vertex ID and an optional initialization of the or edges in the explicitly state the type of the constraint pose constraints are given by pose constraints by EDGE_XYZRPY The keyword is followed by a unique edge the IDs of the referenced vertices
Definition: protocol.txt:7
std::string getPureFilename(const std::string &filename)
bool edgeAllVertsSameDim(OptimizableGraph::Edge *e, int dim)
bool saveGnuplot(const std::string &gnudump, const HyperGraph::VertexSet &vertices, const HyperGraph::EdgeSet &edges)
template<typename T >
int g2o::sign ( x)
inline

sign function.

Returns
the sign of x. +1 for x > 0, -1 for x < 0, 0 for x == 0

Definition at line 137 of file misc.h.

138 {
139  if (x > 0)
140  return 1;
141  else if (x < 0)
142  return -1;
143  else
144  return 0;
145 }
Matrix3D g2o::skew ( const Vector3D v)
inline

Definition at line 28 of file se3_ops.h.

References deltaR(), G2O_TYPES_SLAM3D_API, and project().

Referenced by g2o::SE3Quat::adj(), d_expy_d_y(), g2o::SE3Quat::exp(), g2o::Sim3::log(), g2o::SE3Quat::log(), and g2o::Sim3::Sim3().

35  {
36 
Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
Definition: eigen_types.h:45
G2O_TYPES_SLAM3D_API Vector3D project(const Vector4D &)
Definition: se3_ops.h:58
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
Definition: eigen_types.h:46
Matrix3D skew(const Vector3D &v)
Definition: se3_ops.hpp:27
#define G2O_TYPES_SLAM3D_API
Eigen::Matrix< double, 3, 3, Eigen::ColMajor > Matrix3D
Definition: eigen_types.h:61
Vector3D deltaR(const Matrix3D &R)
Definition: se3_ops.hpp:40
template<typename T >
T g2o::square ( x)
inline

return the square value

Definition at line 52 of file misc.h.

53 {
54  return x*x;
55 }
void g2o::starsInEdge ( StarSet stars,
HyperGraph::Edge e,
EdgeStarMap esmap,
HyperGraph::VertexSet gauge 
)

Definition at line 75 of file simple_star_ops.cpp.

References starsInVertex(), and g2o::HyperGraph::Edge::vertices().

Referenced by computeBorder().

75  {
76  for (size_t i=0; i<e->vertices().size(); i++){
77  OptimizableGraph::Vertex* v=(OptimizableGraph::Vertex*)e->vertices()[i];
78  if (gauge.find(v)==gauge.end())
79  starsInVertex(stars, v, esmap);
80  }
81 }
void starsInVertex(StarSet &stars, HyperGraph::Vertex *v, EdgeStarMap &esmap)
void g2o::starsInVertex ( StarSet stars,
HyperGraph::Vertex v,
EdgeStarMap esmap 
)

Definition at line 66 of file simple_star_ops.cpp.

References g2o::HyperGraph::Vertex::edges().

Referenced by starsInEdge().

66  {
67  for (HyperGraph::EdgeSet::iterator it=v->edges().begin(); it!=v->edges().end(); it++){
68  HyperGraph::Edge* e=*it;
69  EdgeStarMap::iterator eit=esmap.find(e);
70  if (eit!=esmap.end())
71  stars.insert(eit->second);
72  }
73 }
G2O_STUFF_API double g2o::tictoc ( const char *  algorithmPart)

Profile the timing of certain parts of your algorithm.

Profile the timing of certain parts of your algorithm. A typical use-case is as follows:

tictoc("doSomething"); // place the code here. tictoc("doSomething");

This will calculate statistics for the operations within the two calls to tictoc()

If the environment variable G2O_ENABLE_TICTOC is defined, the timing will be performed.

Definition at line 115 of file tictoc.cpp.

References g2o::TicTocElement::algorithmPart, g2o::TicTocInitializer::enabled, get_monotonic_time(), g2o::TicTocElement::ticTime, and g2o::TicTocInitializer::tictocElements.

Referenced by ADD_LIBRARY(), main(), g2o::ScopedTictoc::ScopedTictoc(), and g2o::ScopedTictoc::~ScopedTictoc().

116  {
117  static TicTocInitializer initializer;
118  if (! initializer.enabled)
119  return 0.;
120 
121  TicTocMap& tictocElements = initializer.tictocElements;
122  static double alpha = 0.01;
123  double now = get_monotonic_time();
124 
125  double dt = 0.;
126  TicTocMap::iterator foundIt = tictocElements.find(algorithmPart);
127  if (foundIt == tictocElements.end()) {
128  // insert element
129  TicTocElement e;
130  e.ticTime = now;
131  e.algorithmPart = algorithmPart;
132  tictocElements[e.algorithmPart] = e;
133  } else {
134  if (foundIt->second.clockIsRunning) {
135  dt = now - foundIt->second.ticTime;
136  foundIt->second.totalTime += dt;
137  foundIt->second.minTime = std::min(foundIt->second.minTime, dt);
138  foundIt->second.maxTime = std::max(foundIt->second.maxTime, dt);
139  if (foundIt->second.numCalls == 0)
140  foundIt->second.exponentialMovingAverage = dt;
141  else
142  foundIt->second.exponentialMovingAverage = (1. - alpha) * foundIt->second.exponentialMovingAverage + alpha*dt;
143  foundIt->second.numCalls++;
144  } else {
145  foundIt->second.ticTime = now;
146  }
147  foundIt->second.clockIsRunning = !foundIt->second.clockIsRunning;
148  }
149  return dt;
150  }
double get_monotonic_time()
Definition: timeutil.cpp:113
std::map< std::string, TicTocElement > TicTocMap
Definition: tictoc.cpp:64
Vector3D g2o::unproject ( const Vector2D v)
inline

Definition at line 67 of file se3_ops.h.

Vector4D g2o::unproject ( const Vector3D v)
inline

Definition at line 76 of file se3_ops.h.

Vector3D g2o::unproject2d ( const Vector2D v)

Definition at line 58 of file types_six_dof_expmap.cpp.

Referenced by invert_depth().

58  {
59  Vector3D res;
60  res(0) = v(0);
61  res(1) = v(1);
62  res(2) = 1;
63  return res;
64 }
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
Definition: eigen_types.h:46
size_t g2o::vertexEdgesInStar ( HyperGraph::EdgeSet eset,
HyperGraph::Vertex v,
Star s,
EdgeStarMap esmap 
)

Definition at line 55 of file simple_star_ops.cpp.

References g2o::HyperGraph::Vertex::edges().

Referenced by assignHierarchicalEdges().

55  {
56  eset.clear();
57  for (HyperGraph::EdgeSet::iterator it=v->edges().begin(); it!=v->edges().end(); it++){
58  HyperGraph::Edge* e=*it;
59  EdgeStarMap::iterator eit=esmap.find(e);
60  if (eit!=esmap.end() && eit->second == s)
61  eset.insert(e);
62  }
63  return eset.size();
64 }
template<typename T >
T g2o::wrap ( l,
x,
u 
)
inline

wrap x to be in the interval [l, u]

Definition at line 164 of file misc.h.

165 {
166  T intervalWidth = u - l;
167  while (x < l)
168  x += intervalWidth;
169  while (x > u)
170  x -= intervalWidth;
171  return x;
172 }
G2O_STUFF_API bool g2o::writeCCSMatrix ( const std::string &  filename,
int  rows,
int  cols,
const int *  p,
const int *  i,
const double *  v,
bool  upperTriangleSymmetric = true 
)

write a CCS matrix given by pointer to column, row, and values

bool g2o::writeCCSMatrix ( const string &  filename,
int  rows,
int  cols,
const int *  Ap,
const int *  Ai,
const double *  Ax,
bool  upperTriangleSymmetric 
)

Definition at line 64 of file sparse_helper.cpp.

Referenced by g2o::LinearSolverCholmodOnline< MatrixType >::choleskyUpdate(), g2o::LinearSolverCholmod< MatrixType >::saveMatrix(), and g2o::LinearSolverCholmodOnline< MatrixType >::solve().

65  {
66  vector<TripletEntry> entries;
67  entries.reserve((size_t)Ap[cols]);
68  for (int i=0; i < cols; i++) {
69  const int& rbeg = Ap[i];
70  const int& rend = Ap[i+1];
71  for (int j = rbeg; j < rend; j++) {
72  entries.push_back(TripletEntry(Ai[j], i, Ax[j]));
73  if (upperTriangleSymmetric && Ai[j] != i)
74  entries.push_back(TripletEntry(i, Ai[j], Ax[j]));
75  }
76  }
77  sort(entries.begin(), entries.end(), TripletColSort());
78 
79  string name = filename;
80  std::string::size_type lastDot = name.find_last_of('.');
81  if (lastDot != std::string::npos)
82  name = name.substr(0, lastDot);
83 
84  std::ofstream fout(filename.c_str());
85  fout << "# name: " << name << std::endl;
86  fout << "# type: sparse matrix" << std::endl;
87  fout << "# nnz: " << entries.size() << std::endl;
88  fout << "# rows: " << rows << std::endl;
89  fout << "# columns: " << cols << std::endl;
90  //fout << fixed;
91  fout << setprecision(9) << endl;
92  for (vector<TripletEntry>::const_iterator it = entries.begin(); it != entries.end(); ++it) {
93  const TripletEntry& entry = *it;
94  fout << entry.r+1 << " " << entry.c+1 << " " << entry.x << std::endl;
95  }
96  return fout.good();
97  }
G2O_STUFF_API bool g2o::writeVector ( const std::string &  filename,
const double *  v,
int  n 
)

write an array to a file, debugging

bool g2o::writeVector ( const string &  filename,
const double *  v,
int  n 
)

Definition at line 55 of file sparse_helper.cpp.

56  {
57  ofstream os(filename.c_str());
58  os << fixed;
59  for (int i=0; i<n; i++)
60  os << *v++ << endl;
61  return os.good();
62  }

Variable Documentation

std::mt19937 g2o::_gen_real
static

Definition at line 33 of file sampler.cpp.

std::uniform_real_distribution<double> g2o::_uniformReal
static

Definition at line 32 of file sampler.cpp.

Referenced by sampleUniform().

const double g2o::INFORMATION_SCALING_ODOMETRY = 100
static

Definition at line 50 of file sclam_helpers.cpp.

Referenced by addOdometryCalibLinksDifferential().

Definition at line 46 of file optimization_algorithm_factory.h.

Definition at line 47 of file optimization_algorithm_factory.h.

Referenced by main(), and g2o::RunG2OViewer::run().