RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
OptimizerG2O.h
1/*
2Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 * Neither the name of the Universite de Sherbrooke nor the
13 names of its contributors may be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef OPTIMIZERG2O_H_
29#define OPTIMIZERG2O_H_
30
31#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
32
33#include <rtabmap/core/Optimizer.h>
34
35namespace rtabmap {
36
37class RTABMAP_CORE_EXPORT OptimizerG2O : public Optimizer
38{
39public:
40 static bool available();
41 static bool isCSparseAvailable();
42 static bool isCholmodAvailable();
43
44public:
45 static bool loadGraph(
46 const std::string & fileName,
47 std::map<int, Transform> & poses,
48 std::multimap<int, Link> & edgeConstraints);
49
50public:
51 OptimizerG2O(const ParametersMap & parameters = ParametersMap());
52 virtual ~OptimizerG2O() {}
53
54 virtual Type type() const {return kTypeG2O;}
55
56 virtual void parseParameters(const ParametersMap & parameters);
57
58 virtual std::map<int, Transform> optimize(
59 int rootId,
60 const std::map<int, Transform> & poses,
61 const std::multimap<int, Link> & edgeConstraints,
62 cv::Mat & outputCovariance,
63 std::list<std::map<int, Transform> > * intermediateGraphes = 0,
64 double * finalError = 0,
65 int * iterationsDone = 0);
66
67 virtual std::map<int, Transform> optimizeBA(
68 int rootId,
69 const std::map<int, Transform> & poses,
70 const std::multimap<int, Link> & links,
71 const std::map<int, std::vector<CameraModel> > & models, // in case of stereo, Tx should be set
72 std::map<int, cv::Point3f> & points3DMap,
73 const std::map<int, std::map<int, FeatureBA> > & wordReferences, // <ID words, IDs frames + keypoint(x,y,depth)>
74 BAOutliers * outliers = 0);
75
76 bool saveGraph(
77 const std::string & fileName,
78 const std::map<int, Transform> & poses,
79 const std::multimap<int, Link> & edgeConstraints);
80
81private:
82 int solver_;
83 int optimizer_;
84 double pixelVariance_;
85 double disparityVariance_;
86 double robustKernelDelta_;
87 double baseline_;
88};
89
90} /* namespace rtabmap */
91#endif /* OPTIMIZERG2O_H_ */
virtual void parseParameters(const ParametersMap &parameters)
Reads shared knobs from parameters and applies them to this instance.
virtual std::map< int, Transform > optimize(int rootId, const std::map< int, Transform > &poses, const std::multimap< int, Link > &edgeConstraints, cv::Mat &outputCovariance, std::list< std::map< int, Transform > > *intermediateGraphes=0, double *finalError=0, int *iterationsDone=0)
Pose-graph optimization with marginal covariance of rootId.
virtual Type type() const
Returns the concrete back-end identifier (one of Type).
virtual std::map< int, Transform > optimizeBA(int rootId, const std::map< int, Transform > &poses, const std::multimap< int, Link > &links, const std::map< int, std::vector< CameraModel > > &models, std::map< int, cv::Point3f > &points3DMap, const std::map< int, std::map< int, FeatureBA > > &wordReferences, BAOutliers *outliers=0)
Bundle adjustment: jointly refine poses and 3D points (back-end-level entry point).
Abstract base for pose-graph and bundle-adjustment optimizers.
Definition Optimizer.h:91
Type
Graph-optimizer back-end identifier.
Definition Optimizer.h:94
std::map< std::string, std::string > ParametersMap
Parameter keys mapped to their values, as used by every configurable class (see Parameters).
Definition Parameters.h:44