RTAB-Map 0.24.5
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 bool occupancyGridsIgnored = false);
66 DBReader(const std::list<std::string> & databasePaths,
67 float frameRate = 0.0f, // -1 = use Database stamps, 0 = inf
68 bool odometryIgnored = false,
69 bool ignoreGoalDelay = false,
70 bool goalsIgnored = false,
71 int startId = 0,
72 const std::vector<unsigned int> & cameraIndices = std::vector<unsigned int>(),
73 int stopId = 0,
74 bool intermediateNodesIgnored = false,
75 bool landmarksIgnored = false,
76 bool featuresIgnored = false,
77 int startMapId = 0,
78 int stopMapId = -1,
79 bool priorsIgnored = false,
80 bool imuIgnored = false,
81 bool intermediateNodesAreNormalNodes = false,
82 const std::vector<Transform> & cameraLocalTransformOverrides = std::vector<Transform>(),
83 bool occupancyGridsIgnored = false);
84 virtual ~DBReader();
85
86 virtual bool init(
87 const std::string & calibrationFolder = ".",
88 const std::string & cameraName = "");
89
90 virtual bool isCalibrated() const;
91 virtual std::string getSerial() const;
92 virtual bool odomProvided() const {return !_odometryIgnored;}
93 virtual bool getPose(double stamp, Transform & pose, cv::Mat & covariance, double maxWaitTime = 0.06);
94
95 const DBDriver * driver() const {return _dbDriver;}
96
97protected:
98 virtual SensorData captureImage(SensorCaptureInfo * info = 0);
99
100private:
101 SensorData getNextData(SensorCaptureInfo * info = 0);
102 void checkArguments();
103
104private:
105 std::list<std::string> _paths;
106 bool _odometryIgnored;
107 bool _ignoreGoalDelay;
108 bool _goalsIgnored;
109 int _startId;
110 int _stopId;
111 std::vector<unsigned int> _cameraIndices;
112 bool _intermediateNodesIgnored;
113 bool _intermediateNodesAreNormalNodes;
114 bool _landmarksIgnored;
115 bool _featuresIgnored;
116 bool _priorsIgnored;
117 bool _imuIgnored;
118 int _startMapId;
119 int _stopMapId;
120 std::vector<Transform> _cameraLocalTransformOverrides;
121 bool _occupancyGridsIgnored;
122
123 DBDriver * _dbDriver;
124 UTimer _timer;
125 std::set<int> _ids;
126 std::set<int>::iterator _currentId;
127 int _previousMapId;
128 cv::Mat _previousInfMatrix;
129 double _previousStamp;
130 int _previousMapID;
131 bool _calibrated;
132};
133
134} /* namespace rtabmap */
135#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:92
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