RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
Odometry.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 ODOMETRY_H_
29#define ODOMETRY_H_
30
31#include <rtabmap/core/rtabmap_core_export.h>
32
33#include <rtabmap/core/Transform.h>
34#include <rtabmap/core/SensorData.h>
35#include <rtabmap/core/Parameters.h>
36
37namespace rtabmap {
38
39class OdometryInfo;
40class ParticleFilter;
41
56class RTABMAP_CORE_EXPORT Odometry
57{
58public:
60 enum Type {
61 kTypeUndef = -1,
62 kTypeF2M = 0,
63 kTypeF2F = 1,
64 kTypeFovis = 2,
65 kTypeViso2 = 3,
66 kTypeDVO = 4,
67 kTypeORBSLAM = 5,
68 kTypeOkvis = 6,
69 kTypeLOAM = 7,
70 kTypeMSCKF = 8,
71 kTypeVINSFusion = 9,
72 kTypeOpenVINS = 10,
73 kTypeFLOAM = 11,
74 kTypeOpen3D = 12,
75 kTypeCuVSLAM = 13,
76 kTypeLIOSAM = 14
77 };
78
84 static Odometry * create(const ParametersMap & parameters = ParametersMap());
90 static Odometry * create(Type & type, const ParametersMap & parameters = ParametersMap());
91
92 virtual ~Odometry();
108 Transform process(SensorData & data, const Transform & guess, OdometryInfo * info = 0);
113 virtual void reset(const Transform & initialPose = Transform::getIdentity());
115 virtual Odometry::Type getType() = 0;
117 virtual bool canProcessRawImages() const {return false;}
119 virtual bool canProcessAsyncIMU() const {return false;}
120
122 const Transform & getPose() const {return _pose;}
124 bool isInfoDataFilled() const {return _fillInfoData;}
126 RTABMAP_DEPRECATED const Transform & previousVelocityTransform() const;
128 const Transform & getVelocityGuess() const {return velocityGuess_;}
130 double previousStamp() const {return previousStamp_;}
132 unsigned int framesProcessed() const {return framesProcessed_;}
134 bool imagesAlreadyRectified() const {return _imagesAlreadyRectified;}
135
136protected:
138 const std::map<double, Transform> & imus() const {return imus_;}
139
141 Odometry(const rtabmap::ParametersMap & parameters);
142
143private:
151 virtual Transform computeTransform(SensorData & data, const Transform & guess = Transform(), OdometryInfo * info = 0) = 0;
152
153 void initKalmanFilter(const Transform & initialPose = Transform::getIdentity(), float vx=0.0f, float vy=0.0f, float vz=0.0f, float vroll=0.0f, float vpitch=0.0f, float vyaw=0.0f);
154 void predictKalmanFilter(float dt, float * vx=0, float * vy=0, float * vz=0, float * vroll=0, float * vpitch=0, float * vyaw=0);
155 void updateKalmanFilter(float & vx, float & vy, float & vz, float & vroll, float & vpitch, float & vyaw);
156
157private:
158 int _resetCountdown;
159 bool _force3DoF;
160 bool _holonomic;
161 bool guessFromMotion_;
162 float guessSmoothingDelay_;
163 int _filteringStrategy;
164 int _particleSize;
165 float _particleNoiseT;
166 float _particleLambdaT;
167 float _particleNoiseR;
168 float _particleLambdaR;
169 bool _fillInfoData;
170 float _kalmanProcessNoise;
171 float _kalmanMeasurementNoise;
172 unsigned int _imageDecimation;
173 bool _alignWithGround;
174 bool _publishRAMUsage;
175 bool _imagesAlreadyRectified;
176 bool _deskewing;
177 Transform _pose;
178 int _resetCurrentCount;
179 double previousStamp_;
180 std::list<std::pair<std::vector<float>, double> > previousVelocities_;
181 Transform velocityGuess_;
182 Transform imuLastTransform_;
183 Transform previousGroundTruthPose_;
184 float distanceTravelled_;
185 unsigned int framesProcessed_;
186
187 std::vector<ParticleFilter *> particleFilters_;
188 cv::KalmanFilter kalmanFilter_;
189 std::vector<StereoCameraModel> stereoModels_;
190 std::vector<CameraModel> models_;
191 std::map<double, Transform> imus_;
192};
193
194} /* namespace rtabmap */
195#endif /* ODOMETRY_H_ */
What one Odometry iteration produced, beyond the pose.
Abstract base class for visual, lidar and visual-inertial odometry backends.
Definition Odometry.h:57
Transform process(SensorData &data, OdometryInfo *info=0)
Processes a sensor frame and updates the integrated pose.
virtual void reset(const Transform &initialPose=Transform::getIdentity())
Resets internal state and sets the initial pose.
static Odometry * create(Type &type, const ParametersMap &parameters=ParametersMap())
Creates an odometry instance of a given type.
bool isInfoDataFilled() const
Definition Odometry.h:124
RTABMAP_DEPRECATED const Transform & previousVelocityTransform() const
double previousStamp() const
Definition Odometry.h:130
Transform process(SensorData &data, const Transform &guess, OdometryInfo *info=0)
Processes a sensor frame with an external motion guess.
Type
Odometry backend selected by Parameters::kOdomStrategy().
Definition Odometry.h:60
virtual bool canProcessRawImages() const
Definition Odometry.h:117
const std::map< double, Transform > & imus() const
Definition Odometry.h:138
unsigned int framesProcessed() const
Definition Odometry.h:132
virtual bool canProcessAsyncIMU() const
Definition Odometry.h:119
const Transform & getPose() const
Definition Odometry.h:122
virtual Odometry::Type getType()=0
const Transform & getVelocityGuess() const
Definition Odometry.h:128
static Odometry * create(const ParametersMap &parameters=ParametersMap())
Creates an odometry instance from Parameters::kOdomStrategy() in parameters.
bool imagesAlreadyRectified() const
Definition Odometry.h:134
Odometry(const rtabmap::ParametersMap &parameters)
Constructs the base odometry state from RTAB-Map parameters.
Container class for all sensor data captured at a specific time.
Definition SensorData.h:97
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53
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