RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
SensorCaptureThread.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#pragma once
29
30#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
31
32#include <rtabmap/core/Parameters.h>
33#include <rtabmap/core/Transform.h>
34#include <rtabmap/utilite/UThread.h>
35#include <rtabmap/utilite/UEventsSender.h>
36
37namespace clams
38{
39class DiscreteDepthDistortionModel;
40}
41
42namespace rtabmap
43{
44
45class Camera;
46class Lidar;
47class SensorCapture;
48class SensorCaptureInfo;
49class SensorData;
50class StereoDense;
51class IMUFilter;
52class Feature2D;
53
97class RTABMAP_CORE_EXPORT SensorCaptureThread :
98 public UThread,
99 public UEventsSender
100{
101public:
114 Camera * camera,
115 const ParametersMap & parameters = ParametersMap());
116
137 Camera * camera,
138 SensorCapture * odomSensor,
139 const Transform & extrinsics,
140 double poseTimeOffset = 0.0,
141 float poseScaleFactor = 1.0f,
142 double poseWaitTime = 0.1,
143 const ParametersMap & parameters = ParametersMap());
144
156 Lidar * lidar,
157 const ParametersMap & parameters = ParametersMap());
158
171 Lidar * lidar,
172 Camera * camera,
173 const ParametersMap & parameters = ParametersMap());
174
195 Lidar * lidar,
196 SensorCapture * odomSensor,
197 double poseTimeOffset = 0.0,
198 float poseScaleFactor = 1.0f,
199 double poseWaitTime = 0.1,
200 const ParametersMap & parameters = ParametersMap());
201
225 Lidar * lidar,
226 Camera * camera,
227 SensorCapture * odomSensor,
228 const Transform & extrinsics,
229 double poseTimeOffset = 0.0,
230 float poseScaleFactor = 1.0f,
231 double poseWaitTime = 0.1,
232 const ParametersMap & parameters = ParametersMap());
233
240
245 void setMirroringEnabled(bool enabled) {_mirroring = enabled;}
246
255 void setStereoExposureCompensation(bool enabled) {_stereoExposureCompensation = enabled;}
256
261 void setColorOnly(bool colorOnly) {_colorOnly = colorOnly;}
262
271 void setImageDecimation(int decimation) {_imageDecimation = decimation;}
272
287 void setHistogramMethod(int histogramMethod) {_histogramMethod = histogramMethod;}
288
296 void setStereoToDepth(bool enabled) {_stereoToDepth = enabled;}
297
306 void setFrameRate(float frameRate);
307
312 RTABMAP_DEPRECATED void setImageRate(float frameRate) {setFrameRate(frameRate);}
313
330 void setDistortionModel(const std::string & path);
331
340 void setOdomAsGroundTruth(bool enabled) {_odomAsGt = enabled;}
341
350 void enableBilateralFiltering(float sigmaS, float sigmaR);
351
355 void disableBilateralFiltering() {_bilateralFiltering = false;}
356
374 void enableIMUFiltering(int filteringStrategy=1, const ParametersMap & parameters = ParametersMap(), bool baseFrameConversion = false);
375
380
395
400
409 RTABMAP_DEPRECATED void setScanParameters(
410 bool fromDepth,
411 int downsampleStep, // decimation of the depth image in case the scan is from depth image
412 float rangeMin,
413 float rangeMax,
414 float voxelSize,
415 int normalsK,
416 float normalsRadius,
417 bool forceGroundNormalsUp,
418 bool deskewing);
419
441 bool fromDepth,
442 int downsampleStep=1, // decimation of the depth image in case the scan is from depth image
443 float rangeMin=0.0f,
444 float rangeMax=0.0f,
445 float voxelSize = 0.0f,
446 int normalsK = 0,
447 float normalsRadius = 0.0f,
448 float groundNormalsUp = 0.0f,
449 bool deskewing = false);
450
461 void postUpdate(SensorData * data, SensorCaptureInfo * info = 0) const;
462
463 // Getters
464
469 bool isPaused() const {return !this->isRunning();}
470
475 bool isCapturing() const {return this->isRunning();}
476
481 bool odomProvided() const;
482
487 Camera * camera() {return _camera;}
488
493 SensorCapture * odomSensor() {return _odomSensor;}
494
499 Lidar * lidar() {return _lidar;}
500
501private:
507 virtual void mainLoopBegin();
508
515 virtual void mainLoop();
516
522 virtual void mainLoopKill();
523
524private:
525 Camera * _camera;
526 SensorCapture * _odomSensor;
527 Lidar * _lidar;
528 Transform _extrinsicsOdomToCamera;
529 bool _odomAsGt;
530 double _poseTimeOffset;
531 float _poseScaleFactor;
532 double _poseWaitTime;
533 bool _mirroring;
534 bool _stereoExposureCompensation;
535 bool _colorOnly;
536 int _imageDecimation;
537 int _histogramMethod;
538 bool _stereoToDepth;
539 bool _scanDeskewing;
540 bool _scanFromDepth;
541 int _scanDownsampleStep;
542 float _scanRangeMin;
543 float _scanRangeMax;
544 float _scanVoxelSize;
545 int _scanNormalsK;
546 float _scanNormalsRadius;
547 float _scanForceGroundNormalsUp;
548 StereoDense * _stereoDense;
549 clams::DiscreteDepthDistortionModel * _distortionModel;
550 bool _bilateralFiltering;
551 float _bilateralSigmaS;
552 float _bilateralSigmaR;
553 IMUFilter * _imuFilter;
554 bool _imuBaseFrameConversion;
555 Feature2D * _featureDetector;
556 bool _depthAsMask;
557};
558
565RTABMAP_DEPRECATED typedef SensorCaptureThread CameraThread;
566
567} // namespace rtabmap
Abstract 2D feature detector and descriptor extractor for visual SLAM.
Definition Features2d.h:145
Fuses gyroscope and accelerometer samples into an orientation quaternion.
Definition IMUFilter.h:59
Metadata structure for sensor data capture and processing.
Thread-based sensor data capture and event posting for RTAB-Map.
void setScanParameters(bool fromDepth, int downsampleStep=1, float rangeMin=0.0f, float rangeMax=0.0f, float voxelSize=0.0f, int normalsK=0, float normalsRadius=0.0f, float groundNormalsUp=0.0f, bool deskewing=false)
Sets lidar scan processing parameters.
SensorCapture * odomSensor()
Returns the odometry sensor pointer.
void setMirroringEnabled(bool enabled)
Enables or disables image mirroring (horizontal flip)
RTABMAP_DEPRECATED void setImageRate(float frameRate)
Sets the target image capture rate (deprecated)
SensorCaptureThread(Lidar *lidar, Camera *camera, SensorCapture *odomSensor, const Transform &extrinsics, double poseTimeOffset=0.0, float poseScaleFactor=1.0f, double poseWaitTime=0.1, const ParametersMap &parameters=ParametersMap())
Constructor for lidar with camera and odometry sensor.
void setStereoExposureCompensation(bool enabled)
Enables or disables stereo exposure compensation.
void setHistogramMethod(int histogramMethod)
Sets histogram equalization method.
RTABMAP_DEPRECATED void setScanParameters(bool fromDepth, int downsampleStep, float rangeMin, float rangeMax, float voxelSize, int normalsK, float normalsRadius, bool forceGroundNormalsUp, bool deskewing)
Sets lidar scan processing parameters (deprecated)
void setFrameRate(float frameRate)
Sets the target frame rate for capture.
void enableBilateralFiltering(float sigmaS, float sigmaR)
Enables bilateral filtering for depth images.
bool isPaused() const
Checks if the capture thread is paused.
void postUpdate(SensorData *data, SensorCaptureInfo *info=0) const
Post-processing hook called before posting SensorEvent.
void disableBilateralFiltering()
Disables bilateral filtering.
SensorCaptureThread(Lidar *lidar, SensorCapture *odomSensor, double poseTimeOffset=0.0, float poseScaleFactor=1.0f, double poseWaitTime=0.1, const ParametersMap &parameters=ParametersMap())
Constructor for lidar with odometry sensor.
void setOdomAsGroundTruth(bool enabled)
Sets whether odometry poses should be treated as ground truth.
void setColorOnly(bool colorOnly)
Sets whether to capture color images only (skip depth)
void setImageDecimation(int decimation)
Sets image decimation factor.
void disableIMUFiltering()
Disables IMU data filtering.
SensorCaptureThread(Camera *camera, SensorCapture *odomSensor, const Transform &extrinsics, double poseTimeOffset=0.0, float poseScaleFactor=1.0f, double poseWaitTime=0.1, const ParametersMap &parameters=ParametersMap())
Constructor for camera with odometry sensor.
SensorCaptureThread(Lidar *lidar, const ParametersMap &parameters=ParametersMap())
Constructor for lidar-only capture.
bool odomProvided() const
Checks if odometry is provided by the sensors.
void enableIMUFiltering(int filteringStrategy=1, const ParametersMap &parameters=ParametersMap(), bool baseFrameConversion=false)
Enables IMU data filtering.
SensorCaptureThread(Lidar *lidar, Camera *camera, const ParametersMap &parameters=ParametersMap())
Constructor for lidar with camera.
void enableFeatureDetection(const ParametersMap &parameters=ParametersMap())
Enables automatic feature detection on captured images.
Lidar * lidar()
Returns the lidar pointer.
void setDistortionModel(const std::string &path)
Sets the depth distortion model file path.
bool isCapturing() const
Checks if the capture thread is actively capturing.
SensorCaptureThread(Camera *camera, const ParametersMap &parameters=ParametersMap())
Constructor for camera-only capture.
Camera * camera()
Returns the camera pointer.
void setStereoToDepth(bool enabled)
Enables or disables stereo-to-depth conversion.
void disableFeatureDetection()
Disables automatic feature detection.
virtual ~SensorCaptureThread()
Virtual destructor.
Abstract base class for sensor data capture (cameras, lidars, etc.)
Container class for all sensor data captured at a specific time.
Definition SensorData.h:97
Abstract base class for dense stereo matching algorithms.
Definition StereoDense.h:53
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53
RTABMAP_DEPRECATED typedef SensorCaptureThread CameraThread
Backward compatibility typedef.
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