RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
DBReader.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 DBREADER_H_
29#define DBREADER_H_
30
31#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
32
33#include <rtabmap/utilite/UTimer.h>
34#include <rtabmap/core/Transform.h>
35#include <rtabmap/core/Camera.h>
36
37#include <opencv2/core/core.hpp>
38
39#include <set>
40#include <list>
41
42namespace rtabmap {
43
44class DBDriver;
45
46class RTABMAP_CORE_EXPORT DBReader : public Camera {
47public:
48 DBReader(const std::string & databasePath,
49 float frameRate = 0.0f, // -1 = use Database stamps, 0 = inf
50 bool odometryIgnored = false,
51 bool ignoreGoalDelay = false,
52 bool goalsIgnored = false,
53 int startId = 0,
54 const std::vector<unsigned int> & cameraIndices = std::vector<unsigned int>(),
55 int stopId = 0,
56 bool intermediateNodesIgnored = false,
57 bool landmarksIgnored = false,
58 bool featuresIgnored = false,
59 int startMapId = 0,
60 int stopMapId = -1,
61 bool priorsIgnored = false,
62 bool imuIgnored = false,
63 bool intermediateNodesAreNormalNodes = false,
64 const std::vector<Transform> & cameraLocalTransformOverrides = std::vector<Transform>());
65 DBReader(const std::list<std::string> & databasePaths,
66 float frameRate = 0.0f, // -1 = use Database stamps, 0 = inf
67 bool odometryIgnored = false,
68 bool ignoreGoalDelay = false,
69 bool goalsIgnored = false,
70 int startId = 0,
71 const std::vector<unsigned int> & cameraIndices = std::vector<unsigned int>(),
72 int stopId = 0,
73 bool intermediateNodesIgnored = false,
74 bool landmarksIgnored = false,
75 bool featuresIgnored = false,
76 int startMapId = 0,
77 int stopMapId = -1,
78 bool priorsIgnored = false,
79 bool imuIgnored = false,
80 bool intermediateNodesAreNormalNodes = false,
81 const std::vector<Transform> & cameraLocalTransformOverrides = std::vector<Transform>());
82 virtual ~DBReader();
83
84 virtual bool init(
85 const std::string & calibrationFolder = ".",
86 const std::string & cameraName = "");
87
88 virtual bool isCalibrated() const;
89 virtual std::string getSerial() const;
90 virtual bool odomProvided() const {return !_odometryIgnored;}
91 virtual bool getPose(double stamp, Transform & pose, cv::Mat & covariance, double maxWaitTime = 0.06);
92
93 const DBDriver * driver() const {return _dbDriver;}
94
95protected:
96 virtual SensorData captureImage(SensorCaptureInfo * info = 0);
97
98private:
99 SensorData getNextData(SensorCaptureInfo * info = 0);
100 void checkArguments();
101
102private:
103 std::list<std::string> _paths;
104 bool _odometryIgnored;
105 bool _ignoreGoalDelay;
106 bool _goalsIgnored;
107 int _startId;
108 int _stopId;
109 std::vector<unsigned int> _cameraIndices;
110 bool _intermediateNodesIgnored;
111 bool _intermediateNodesAreNormalNodes;
112 bool _landmarksIgnored;
113 bool _featuresIgnored;
114 bool _priorsIgnored;
115 bool _imuIgnored;
116 int _startMapId;
117 int _stopMapId;
118 std::vector<Transform> _cameraLocalTransformOverrides;
119
120 DBDriver * _dbDriver;
121 UTimer _timer;
122 std::set<int> _ids;
123 std::set<int>::iterator _currentId;
124 int _previousMapId;
125 cv::Mat _previousInfMatrix;
126 double _previousStamp;
127 int _previousMapID;
128 bool _calibrated;
129};
130
131} /* namespace rtabmap */
132#endif /* DBREADER_H_ */
Abstract database driver for RTAB-Map maps (signatures, links, words, statistics).
Definition DBDriver.h:72
virtual bool odomProvided() const
Checks if the sensor provides odometry poses.
Definition DBReader.h:90
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
Initializes the sensor.
virtual bool getPose(double stamp, Transform &pose, cv::Mat &covariance, double maxWaitTime=0.06)
Gets the sensor's pose estimate at a specific timestamp.
virtual std::string getSerial() const
Returns the sensor's serial number or unique identifier.
Metadata structure for sensor data capture and processing.
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