|
RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
|
Thread-based sensor data capture and event posting for RTAB-Map. More...
#include <SensorCaptureThread.h>


Public Member Functions | |
| SensorCaptureThread (Camera *camera, const ParametersMap ¶meters=ParametersMap()) | |
| Constructor for camera-only capture. | |
| SensorCaptureThread (Camera *camera, SensorCapture *odomSensor, const Transform &extrinsics, double poseTimeOffset=0.0, float poseScaleFactor=1.0f, double poseWaitTime=0.1, const ParametersMap ¶meters=ParametersMap()) | |
| Constructor for camera with odometry sensor. | |
| SensorCaptureThread (Lidar *lidar, const ParametersMap ¶meters=ParametersMap()) | |
| Constructor for lidar-only capture. | |
| SensorCaptureThread (Lidar *lidar, Camera *camera, const ParametersMap ¶meters=ParametersMap()) | |
| Constructor for lidar with camera. | |
| SensorCaptureThread (Lidar *lidar, SensorCapture *odomSensor, double poseTimeOffset=0.0, float poseScaleFactor=1.0f, double poseWaitTime=0.1, const ParametersMap ¶meters=ParametersMap()) | |
| Constructor for lidar with odometry sensor. | |
| SensorCaptureThread (Lidar *lidar, Camera *camera, SensorCapture *odomSensor, const Transform &extrinsics, double poseTimeOffset=0.0, float poseScaleFactor=1.0f, double poseWaitTime=0.1, const ParametersMap ¶meters=ParametersMap()) | |
| Constructor for lidar with camera and odometry sensor. | |
| virtual | ~SensorCaptureThread () |
| Virtual destructor. | |
| void | setMirroringEnabled (bool enabled) |
| Enables or disables image mirroring (horizontal flip) | |
| void | setStereoExposureCompensation (bool enabled) |
| Enables or disables stereo exposure compensation. | |
| void | setColorOnly (bool colorOnly) |
| Sets whether to capture color images only (skip depth) | |
| void | setImageDecimation (int decimation) |
| Sets image decimation factor. | |
| void | setHistogramMethod (int histogramMethod) |
| Sets histogram equalization method. | |
| void | setStereoToDepth (bool enabled) |
| Enables or disables stereo-to-depth conversion. | |
| void | setFrameRate (float frameRate) |
| Sets the target frame rate for capture. | |
| RTABMAP_DEPRECATED void | setImageRate (float frameRate) |
| Sets the target image capture rate (deprecated) | |
| void | setDistortionModel (const std::string &path) |
| Sets the depth distortion model file path. | |
| void | setOdomAsGroundTruth (bool enabled) |
| Sets whether odometry poses should be treated as ground truth. | |
| void | enableBilateralFiltering (float sigmaS, float sigmaR) |
| Enables bilateral filtering for depth images. | |
| void | disableBilateralFiltering () |
| Disables bilateral filtering. | |
| void | enableIMUFiltering (int filteringStrategy=1, const ParametersMap ¶meters=ParametersMap(), bool baseFrameConversion=false) |
| Enables IMU data filtering. | |
| void | disableIMUFiltering () |
| Disables IMU data filtering. | |
| void | enableFeatureDetection (const ParametersMap ¶meters=ParametersMap()) |
| Enables automatic feature detection on captured images. | |
| void | disableFeatureDetection () |
| Disables automatic feature detection. | |
| 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 | 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. | |
| void | postUpdate (SensorData *data, SensorCaptureInfo *info=0) const |
| Post-processing hook called before posting SensorEvent. | |
| bool | isPaused () const |
| Checks if the capture thread is paused. | |
| bool | isCapturing () const |
| Checks if the capture thread is actively capturing. | |
| bool | odomProvided () const |
| Checks if odometry is provided by the sensors. | |
| Camera * | camera () |
| Returns the camera pointer. | |
| SensorCapture * | odomSensor () |
| Returns the odometry sensor pointer. | |
| Lidar * | lidar () |
| Returns the lidar pointer. | |
Public Member Functions inherited from UThread | |
| UThread (Priority priority=kPNormal) | |
| virtual | ~UThread () |
| void | start () |
| void | kill () |
| void | join (bool killFirst=false) |
| void | setPriority (Priority priority) |
| void | setAffinity (int cpu=0) |
| bool | isCreating () const |
| bool | isRunning () const |
| bool | isIdle () const |
| bool | isKilled () const |
| Handle | getThreadHandle () const |
| unsigned long | getThreadId () const |
Public Member Functions inherited from UThreadC< void > | |
| int | Create (Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const |
| int | Create (unsigned long &ThreadId, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const |
| int | Create (Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const |
| int | Create (unsigned long &ThreadId, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const |
Additional Inherited Members | |
Public Types inherited from UThread | |
| enum | Priority { kPLow , kPBelowNormal , kPNormal , kPAboveNormal , kPRealTime } |
Public Types inherited from UThreadC< void > | |
| typedef THREAD_HANDLE | Handle |
| typedef void(* | Handler) () |
| typedef THREAD_HANDLE | Handle |
| typedef void(* | Handler) () |
Static Public Member Functions inherited from UThread | |
| static unsigned long | currentThreadId () |
Static Public Member Functions inherited from UThreadC< void > | |
| static int | Create (const Handler &Function, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) |
| static int | Join (Handle H) |
| static int | Kill (Handle H) |
| static int | Detach (Handle H) |
| static int | Create (const Handler &Function, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) |
| static int | Join (const Handle &H) |
| static int | Kill (const Handle &H) |
| static int | Detach (const Handle &H) |
Protected Member Functions inherited from UEventsSender | |
| void | post (UEvent *event, bool async=true) const |
Static Protected Member Functions inherited from UThreadC< void > | |
| static void | Exit () |
| static void | TestCancel () |
| static Handle | Self () |
| static void | Exit () |
| static void | TestCancel () |
| static int | Self () |
Thread-based sensor data capture and event posting for RTAB-Map.
SensorCaptureThread is a multi-threaded class that continuously captures sensor data from cameras and/or lidars in a background thread. It processes the data, optionally applies filtering and transformations, and posts SensorEvent events to registered handlers through RTAB-Map's event system.
The class supports various sensor configurations:
Key features:
The class inherits from UThread (for threading) and UEventsSender (for event posting).
Definition at line 97 of file SensorCaptureThread.h.
| rtabmap::SensorCaptureThread::SensorCaptureThread | ( | Camera * | camera, |
| const ParametersMap & | parameters = ParametersMap() |
||
| ) |
Constructor for camera-only capture.
Creates a SensorCaptureThread that captures images from a single camera. The camera can be RGB-D, stereo, or mono.
| camera | Pointer to the camera to capture from (ownership transferred) |
| parameters | Optional parameters map for configuration |
| rtabmap::SensorCaptureThread::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.
Creates a SensorCaptureThread that captures images from a camera and uses an odometry sensor for pose estimation. The odometry sensor can be the same as the camera or a different sensor.
| camera | Pointer to the camera to capture images from (ownership transferred) |
| odomSensor | Pointer to the odometry sensor for pose estimation (can be the same as camera) |
| extrinsics | Static transform from odometry sensor's left lens frame to camera's left lens frame (without optical rotation applied) |
| poseTimeOffset | Time offset in seconds to add to data timestamp when querying pose (default: 0.0) |
| poseScaleFactor | Scale factor to apply to pose translation (default: 1.0, no scaling) |
| poseWaitTime | Maximum time in seconds to wait for pose data (default: 0.1) |
| parameters | Optional parameters map for configuration |
| rtabmap::SensorCaptureThread::SensorCaptureThread | ( | Lidar * | lidar, |
| const ParametersMap & | parameters = ParametersMap() |
||
| ) |
Constructor for lidar-only capture.
Creates a SensorCaptureThread that captures 3D point clouds from a lidar.
| lidar | Pointer to the lidar to capture scans from (ownership transferred) |
| parameters | Optional parameters map for configuration |
| rtabmap::SensorCaptureThread::SensorCaptureThread | ( | Lidar * | lidar, |
| Camera * | camera, | ||
| const ParametersMap & | parameters = ParametersMap() |
||
| ) |
Constructor for lidar with camera.
Creates a SensorCaptureThread that captures both lidar scans and camera images. If the camera provides pose information, it can be used for deskewing lidar scans.
| lidar | Pointer to the lidar to capture scans from (ownership transferred) |
| camera | Pointer to the camera to capture images from (ownership transferred). If the camera provides pose, it can be used for deskewing. |
| parameters | Optional parameters map for configuration |
| rtabmap::SensorCaptureThread::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.
Creates a SensorCaptureThread that captures lidar scans and uses an odometry sensor for pose estimation and deskewing. The odometry sensor can be the same as the lidar or a different sensor.
| lidar | Pointer to the lidar to capture scans from (ownership transferred) |
| odomSensor | Pointer to the odometry sensor for pose estimation and deskewing (can be the same as lidar) |
| poseTimeOffset | Time offset in seconds to add to data timestamp when querying pose (default: 0.0) |
| poseScaleFactor | Scale factor to apply to pose translation (default: 1.0, no scaling) |
| poseWaitTime | Maximum time in seconds to wait for pose data (default: 0.1) |
| parameters | Optional parameters map for configuration |
| rtabmap::SensorCaptureThread::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.
Creates a SensorCaptureThread that captures both lidar scans and camera images, and uses an odometry sensor for pose estimation and deskewing. This is the most comprehensive configuration, supporting multi-modal sensing with pose correction.
| lidar | Pointer to the lidar to capture scans from (ownership transferred) |
| camera | Pointer to the camera to capture images from (ownership transferred) |
| odomSensor | Pointer to the odometry sensor for pose estimation and deskewing (can be the same as camera or lidar) |
| extrinsics | Static transform from odometry frame to camera frame (without optical rotation applied) |
| poseTimeOffset | Time offset in seconds to add to data timestamp when querying pose (default: 0.0) |
| poseScaleFactor | Scale factor to apply to pose translation (default: 1.0, no scaling) |
| poseWaitTime | Maximum time in seconds to wait for pose data (default: 0.1) |
| parameters | Optional parameters map for configuration |
|
virtual |
Virtual destructor.
Stops the capture thread if running and deletes owned sensor pointers.
|
inline |
Enables or disables image mirroring (horizontal flip)
| enabled | True to enable mirroring, false to disable |
Definition at line 245 of file SensorCaptureThread.h.
|
inline |
Enables or disables stereo exposure compensation.
When enabled, adjusts exposure between left and right stereo cameras to improve matching quality.
| enabled | True to enable exposure compensation, false to disable |
Definition at line 255 of file SensorCaptureThread.h.
|
inline |
Sets whether to capture color images only (skip depth)
| colorOnly | True to capture color only, false to capture both color and depth |
Definition at line 261 of file SensorCaptureThread.h.
|
inline |
Sets image decimation factor.
Decimation reduces image resolution by skipping pixels. A decimation of N means every Nth pixel is kept (e.g., 2 = half resolution, 4 = quarter resolution).
| decimation | Decimation factor (1 = no decimation, 2 = half resolution, etc.) |
Definition at line 271 of file SensorCaptureThread.h.
|
inline |
Sets histogram equalization method.
Controls the type of histogram equalization applied to captured images. Histogram equalization improves image contrast by redistributing pixel intensities.
| histogramMethod | Histogram equalization method:
|
Definition at line 287 of file SensorCaptureThread.h.
|
inline |
Enables or disables stereo-to-depth conversion.
When enabled, converts stereo images to depth images using dense stereo matching.
| enabled | True to enable stereo-to-depth conversion, false to disable |
Definition at line 296 of file SensorCaptureThread.h.
| void rtabmap::SensorCaptureThread::setFrameRate | ( | float | frameRate | ) |
Sets the target frame rate for capture.
Controls how often the capture loop runs. A frame rate of 0 means capture as fast as possible.
| frameRate | Target frame rate in Hz (0 = unlimited) |
|
inline |
Sets the target image capture rate (deprecated)
Definition at line 312 of file SensorCaptureThread.h.
| void rtabmap::SensorCaptureThread::setDistortionModel | ( | const std::string & | path | ) |
Sets the depth distortion model file path.
Loads a discrete depth distortion model from the specified file path. This is used to correct systematic depth errors at longer ranges using the CLAMS (Calibration, Localization, And Mapping System) approach.
The distortion model is typically created using RTAB-Map's depth calibration tool, which uses visual odometry and 3D mapping to generate ground truth depth for calibration.
| path | Path to the distortion model file |
|
inline |
Sets whether odometry poses should be treated as ground truth.
When enabled, odometry poses from the odometry sensor are stored as ground truth poses instead of odometry poses in the SensorData.
| enabled | True to use odometry as ground truth, false to use as odometry |
Definition at line 340 of file SensorCaptureThread.h.
| void rtabmap::SensorCaptureThread::enableBilateralFiltering | ( | float | sigmaS, |
| float | sigmaR | ||
| ) |
Enables bilateral filtering for depth images.
Bilateral filtering reduces noise in depth images while preserving edges.
| sigmaS | Spatial standard deviation (pixels) |
| sigmaR | Range standard deviation (depth units) |
|
inline |
Disables bilateral filtering.
Definition at line 355 of file SensorCaptureThread.h.
| void rtabmap::SensorCaptureThread::enableIMUFiltering | ( | int | filteringStrategy = 1, |
| const ParametersMap & | parameters = ParametersMap(), |
||
| bool | baseFrameConversion = false |
||
| ) |
Enables IMU data filtering.
Enables filtering and fusion of IMU data from the sensor. The filtering strategy determines how IMU data is processed to estimate orientation.
| filteringStrategy | Filtering strategy:
|
| parameters | Optional parameters map for IMU filter configuration |
| baseFrameConversion | If true, converts IMU data to base frame |
| void rtabmap::SensorCaptureThread::enableFeatureDetection | ( | const ParametersMap & | parameters = ParametersMap() | ) |
Enables automatic feature detection on captured images.
When enabled, automatically detects and extracts visual features (keypoints, descriptors) from captured images.
| parameters | Optional parameters map for feature detector configuration. Parameters from the "Vis/" group (e.g., Vis/FeatureType, Vis/MaxFeatures) are automatically converted to "Kp/" parameters internally. If both Vis/ and Kp/ parameters are provided, Vis/ parameters take precedence. |
| RTABMAP_DEPRECATED void rtabmap::SensorCaptureThread::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)
Use the new version with groundNormalsUp parameter:
| void rtabmap::SensorCaptureThread::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.
Configures how lidar scans are processed, including conversion from depth images, filtering, normal estimation, and deskewing.
| fromDepth | If true, generate scans from depth images instead of raw lidar data |
| downsampleStep | Downsampling step:
|
| rangeMin | Minimum range in meters (points closer are filtered out, 0 = no minimum) |
| rangeMax | Maximum range in meters (points farther are filtered out, 0 = no maximum) |
| voxelSize | Voxel size in meters for downsampling (0 = no voxelization) |
| normalsK | Number of neighbors for K-nearest neighbors normal estimation (0 = no normals) |
| normalsRadius | Radius in meters for radius-based normal estimation (0 = use K-nearest) |
| groundNormalsUp | Threshold for forcing ground normals upward (0.0-1.0, 0.8 = strong, 0.0 = disabled) |
| deskewing | If true, apply deskewing using odometry poses |
| void rtabmap::SensorCaptureThread::postUpdate | ( | SensorData * | data, |
| SensorCaptureInfo * | info = 0 |
||
| ) | const |
Post-processing hook called before posting SensorEvent.
This method is called after all processing is complete but before the SensorEvent is posted. Derived classes can override this to perform additional processing or modifications to the data.
| data | Pointer to the processed sensor data (can be modified) |
| info | Pointer to the sensor capture info (can be modified, may be null) |
|
inline |
Checks if the capture thread is paused.
Definition at line 469 of file SensorCaptureThread.h.
|
inline |
Checks if the capture thread is actively capturing.
Definition at line 475 of file SensorCaptureThread.h.
| bool rtabmap::SensorCaptureThread::odomProvided | ( | ) | const |
Checks if odometry is provided by the sensors.
|
inline |
Returns the camera pointer.
Definition at line 487 of file SensorCaptureThread.h.
|
inline |
Returns the odometry sensor pointer.
Definition at line 493 of file SensorCaptureThread.h.
|
inline |
Returns the lidar pointer.
Definition at line 499 of file SensorCaptureThread.h.