RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
SensorCapture.h
1/*
2Copyright (c) 2010-2022, Mathieu Labbe
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 names of its contributors may be used to endorse or promote products
13 derived from this software without specific prior written permission.
14
15THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
19DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*/
26
27#pragma once
28
29#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
30
31#include <opencv2/highgui/highgui.hpp>
32#include <rtabmap/core/SensorCaptureInfo.h>
33#include "rtabmap/core/SensorData.h"
34#include <set>
35#include <stack>
36#include <list>
37#include <vector>
38
39class UDirectory;
40class UTimer;
41
42namespace rtabmap
43{
44
78class RTABMAP_CORE_EXPORT SensorCapture
79{
80public:
84 virtual ~SensorCapture();
85
108
126 virtual bool init(const std::string & calibrationFolder = ".", const std::string & cameraName = "") = 0;
127
137 virtual std::string getSerial() const = 0;
138
152 virtual bool odomProvided() const { return false; }
153
172 virtual bool getPose(double stamp, Transform & pose, cv::Mat & covariance, double maxWaitTime = 0.06) { return false; }
173
174 // Getters
175
180 float getFrameRate() const {return _frameRate;}
181
186 const Transform & getLocalTransform() const {return _localTransform;}
187
188 // Setters
189
200 void setFrameRate(float frameRate) {_frameRate = frameRate;}
201
210 void setLocalTransform(const Transform & localTransform) {_localTransform= localTransform;}
211
219
220protected:
231 SensorCapture(float frameRate = 0, const Transform & localTransform = Transform::getIdentity());
232
254 virtual SensorData captureData(SensorCaptureInfo * info = 0) = 0;
255
264 int getNextSeqID() {return ++_seq;}
265
266private:
267 float _frameRate;
268 Transform _localTransform;
269 UTimer * _frameRateTimer;
270 int _seq;
271};
272
273
274} // namespace rtabmap
Metadata structure for sensor data capture and processing.
Abstract base class for sensor data capture (cameras, lidars, etc.)
virtual ~SensorCapture()
Virtual destructor.
void setLocalTransform(const Transform &localTransform)
Sets the local transform from base frame to sensor frame.
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")=0
Initializes the sensor.
void setFrameRate(float frameRate)
Sets the target frame rate.
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 =0
Returns the sensor's serial number or unique identifier.
virtual SensorData captureData(SensorCaptureInfo *info=0)=0
Pure virtual method to capture sensor data.
const Transform & getLocalTransform() const
Returns the local transform from base frame to sensor frame.
SensorData takeData(SensorCaptureInfo *info=0)
Captures sensor data with frame rate control.
int getNextSeqID()
Gets the next sequence ID.
SensorCapture(float frameRate=0, const Transform &localTransform=Transform::getIdentity())
Protected constructor.
virtual bool odomProvided() const
Checks if the sensor provides odometry poses.
float getFrameRate() const
Returns the target frame rate.
void resetTimer()
Resets the frame rate timer.
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