RTAB-Map 0.24.1
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#include <rtabmap/core/ImuMotionPredictor.h>
37
38namespace rtabmap {
39
40class OdometryInfo;
41class ParticleFilter;
42
57class RTABMAP_CORE_EXPORT Odometry
58{
59public:
61 enum Type {
62 kTypeUndef = -1,
63 kTypeF2M = 0,
64 kTypeF2F = 1,
65 kTypeFovis = 2,
66 kTypeViso2 = 3,
67 kTypeDVO = 4,
68 kTypeORBSLAM = 5,
69 kTypeOkvis = 6,
70 kTypeLOAM = 7,
71 kTypeMSCKF = 8,
72 kTypeVINSFusion = 9,
73 kTypeOpenVINS = 10,
74 kTypeFLOAM = 11,
75 kTypeOpen3D = 12,
76 kTypeCuVSLAM = 13,
77 kTypeLIOSAM = 14
78 };
79
85 static Odometry * create(const ParametersMap & parameters = ParametersMap());
91 static Odometry * create(Type & type, const ParametersMap & parameters = ParametersMap());
92
93 virtual ~Odometry();
109 Transform process(SensorData & data, const Transform & guess, OdometryInfo * info = 0);
114 virtual void reset(const Transform & initialPose = Transform::getIdentity());
116 virtual Odometry::Type getType() = 0;
118 virtual bool canProcessRawImages() const {return false;}
120 virtual bool canProcessAsyncIMU() const {return false;}
121
123 const Transform & getPose() const {return _pose;}
125 bool isInfoDataFilled() const {return _fillInfoData;}
127 RTABMAP_DEPRECATED const Transform & previousVelocityTransform() const;
129 const Transform & getVelocityGuess() const {return velocityGuess_;}
131 double previousStamp() const {return previousStamp_;}
133 unsigned int framesProcessed() const {return framesProcessed_;}
135 bool imagesAlreadyRectified() const {return _imagesAlreadyRectified;}
136
137protected:
139 const std::map<double, Transform> & imus() const {return imus_;}
140
142 Odometry(const rtabmap::ParametersMap & parameters);
143
144private:
152 virtual Transform computeTransform(SensorData & data, const Transform & guess = Transform(), OdometryInfo * info = 0) = 0;
153
154 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);
155 void predictKalmanFilter(float dt, float * vx=0, float * vy=0, float * vz=0, float * vroll=0, float * vpitch=0, float * vyaw=0);
156 void updateKalmanFilter(float & vx, float & vy, float & vz, float & vroll, float & vpitch, float & vyaw);
157
158private:
159 int _resetCountdown;
160 bool _force3DoF;
161 bool _holonomic;
162 bool guessFromMotion_;
163 bool guessImuAcceleration_;
164 float guessSmoothingDelay_;
165 int _filteringStrategy;
166 int _particleSize;
167 float _particleNoiseT;
168 float _particleLambdaT;
169 float _particleNoiseR;
170 float _particleLambdaR;
171 bool _fillInfoData;
172 float _kalmanProcessNoise;
173 float _kalmanMeasurementNoise;
174 unsigned int _imageDecimation;
175 bool _alignWithGround;
176 bool _publishRAMUsage;
177 bool _imagesAlreadyRectified;
178 bool _deskewing;
179 Transform _pose;
180 int _resetCurrentCount;
181 double previousStamp_;
182 std::list<std::pair<std::vector<float>, double> > previousVelocities_;
183 Transform velocityGuess_;
184 Transform imuLastTransform_;
185 Transform previousGroundTruthPose_;
186 float distanceTravelled_;
187 unsigned int framesProcessed_;
188
189 std::vector<ParticleFilter *> particleFilters_;
190 cv::KalmanFilter kalmanFilter_;
191 std::vector<StereoCameraModel> stereoModels_;
192 std::vector<CameraModel> models_;
193 std::map<double, Transform> imus_;
194 ImuMotionPredictor imuMotionPredictor_; // used with Odom/GuessImuAcceleration only
195};
196
197} /* namespace rtabmap */
198#endif /* ODOMETRY_H_ */
Predicts the pose of the base frame from the last odometry pose and the IMU.
What one Odometry iteration produced, beyond the pose.
Abstract base class for visual, lidar and visual-inertial odometry backends.
Definition Odometry.h:58
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:125
RTABMAP_DEPRECATED const Transform & previousVelocityTransform() const
double previousStamp() const
Definition Odometry.h:131
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:61
virtual bool canProcessRawImages() const
Definition Odometry.h:118
const std::map< double, Transform > & imus() const
Definition Odometry.h:139
unsigned int framesProcessed() const
Definition Odometry.h:133
virtual bool canProcessAsyncIMU() const
Definition Odometry.h:120
const Transform & getPose() const
Definition Odometry.h:123
virtual Odometry::Type getType()=0
const Transform & getVelocityGuess() const
Definition Odometry.h:129
static Odometry * create(const ParametersMap &parameters=ParametersMap())
Creates an odometry instance from Parameters::kOdomStrategy() in parameters.
bool imagesAlreadyRectified() const
Definition Odometry.h:135
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