|
RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
|
Abstract base class for sensor data capture (cameras, lidars, etc.) More...
#include <SensorCapture.h>

Public Member Functions | |
| virtual | ~SensorCapture () |
| Virtual destructor. | |
| SensorData | takeData (SensorCaptureInfo *info=0) |
| Captures sensor data with frame rate control. | |
| virtual bool | init (const std::string &calibrationFolder=".", const std::string &cameraName="")=0 |
| Initializes the sensor. | |
| virtual std::string | getSerial () const =0 |
| Returns the sensor's serial number or unique identifier. | |
| virtual bool | odomProvided () const |
| Checks if the sensor provides odometry poses. | |
| virtual bool | getPose (double stamp, Transform &pose, cv::Mat &covariance, double maxWaitTime=0.06) |
| Gets the sensor's pose estimate at a specific timestamp. | |
| float | getFrameRate () const |
| Returns the target frame rate. | |
| const Transform & | getLocalTransform () const |
| Returns the local transform from base frame to sensor frame. | |
| void | setFrameRate (float frameRate) |
| Sets the target frame rate. | |
| void | setLocalTransform (const Transform &localTransform) |
| Sets the local transform from base frame to sensor frame. | |
| void | resetTimer () |
| Resets the frame rate timer. | |
Protected Member Functions | |
| SensorCapture (float frameRate=0, const Transform &localTransform=Transform::getIdentity()) | |
| Protected constructor. | |
| virtual SensorData | captureData (SensorCaptureInfo *info=0)=0 |
| Pure virtual method to capture sensor data. | |
| int | getNextSeqID () |
| Gets the next sequence ID. | |
Abstract base class for sensor data capture (cameras, lidars, etc.)
SensorCapture provides a unified interface for capturing sensor data from various sensor types including cameras (RGB-D, stereo, mono) and lidars. It handles frame rate control, local transform management, and provides a common API for sensor initialization and data capture.
The class implements the Template Method pattern:
takeData() handles frame rate control and timing, then calls the pure virtual captureData() method implemented by derived classescaptureData() to perform the actual sensor captureKey features:
Derived classes include:
Definition at line 78 of file SensorCapture.h.
|
protected |
Protected constructor.
Creates a SensorCapture instance with the specified frame rate and local transform. This constructor is protected because SensorCapture is an abstract base class and should not be instantiated directly.
| frameRate | Target frame rate in Hz (0 = unlimited, capture as fast as possible) |
| localTransform | Transform from base frame to sensor frame (default: identity) |
| SensorData rtabmap::SensorCapture::takeData | ( | SensorCaptureInfo * | info = 0 | ) |
Captures sensor data with frame rate control.
This method handles frame rate throttling and timing, then calls the pure virtual captureData() method to perform the actual capture.
The method:
| info | Optional pointer to SensorCaptureInfo to fill with capture metadata (ID, timestamp, capture time). If null, no info is filled. |
|
pure virtual |
Initializes the sensor.
Pure virtual method that must be implemented by derived classes to initialize the sensor hardware or data source. This typically involves:
| calibrationFolder | Directory path where calibration files are located (default: current directory ".") |
| cameraName | Base name of the camera for loading calibration files (default: empty string) |
Implemented in rtabmap::CameraDepthAI, rtabmap::CameraFreenect, rtabmap::CameraFreenect2, rtabmap::CameraImages, rtabmap::CameraK4A, rtabmap::CameraK4W2, rtabmap::CameraMyntEye, rtabmap::CameraOpenni, rtabmap::CameraOpenNI2, rtabmap::CameraOpenNICV, rtabmap::CameraOrbbecSDK, rtabmap::CameraRealSense, rtabmap::CameraRealSense2, rtabmap::CameraRGBDImages, rtabmap::CameraSeerSense, rtabmap::CameraStereoDC1394, rtabmap::CameraStereoFlyCapture2, rtabmap::CameraStereoImages, rtabmap::CameraStereoTara, rtabmap::CameraStereoVideo, rtabmap::CameraStereoZed, rtabmap::CameraStereoZedOC, rtabmap::CameraVideo, rtabmap::DBReader, and rtabmap::LidarVLP16.
|
pure virtual |
Returns the sensor's serial number or unique identifier.
Pure virtual method that must be implemented by derived classes to return a unique identifier for the sensor (e.g., device serial number, file path, or other identifier).
Implemented in rtabmap::CameraDepthAI, rtabmap::CameraFreenect, rtabmap::CameraFreenect2, rtabmap::CameraImages, rtabmap::CameraK4A, rtabmap::CameraK4W2, rtabmap::CameraMyntEye, rtabmap::CameraOpenni, rtabmap::CameraOpenNI2, rtabmap::CameraOpenNICV, rtabmap::CameraOrbbecSDK, rtabmap::CameraRealSense, rtabmap::CameraRealSense2, rtabmap::CameraSeerSense, rtabmap::CameraStereoDC1394, rtabmap::CameraStereoFlyCapture2, rtabmap::CameraStereoImages, rtabmap::CameraStereoTara, rtabmap::CameraStereoVideo, rtabmap::CameraStereoZed, rtabmap::CameraStereoZedOC, rtabmap::CameraVideo, rtabmap::DBReader, and rtabmap::LidarVLP16.
|
inlinevirtual |
Checks if the sensor provides odometry poses.
Some sensors (e.g., visual-inertial cameras) can provide pose estimates directly. This method indicates whether the sensor supports pose queries.
Reimplemented in rtabmap::CameraImages, rtabmap::CameraMyntEye, rtabmap::CameraRealSense, rtabmap::CameraRealSense2, rtabmap::CameraSeerSense, rtabmap::CameraStereoZed, and rtabmap::DBReader.
Definition at line 152 of file SensorCapture.h.
|
inlinevirtual |
Gets the sensor's pose estimate at a specific timestamp.
Queries the sensor for its pose estimate at the given timestamp. This is typically used for sensors that provide visual-inertial odometry or other pose estimation capabilities.
| stamp | Timestamp in seconds for which to query the pose | |
| [out] | pose | Output transform representing the sensor pose |
| [out] | covariance | Output covariance matrix (6x6) representing twist uncertainty |
| maxWaitTime | Maximum time in seconds to wait for pose data (default: 0.06) |
Reimplemented in rtabmap::CameraSeerSense, rtabmap::CameraStereoZed, rtabmap::CameraRealSense2, and rtabmap::DBReader.
Definition at line 172 of file SensorCapture.h.
|
inline |
Returns the target frame rate.
Definition at line 180 of file SensorCapture.h.
|
inline |
Returns the local transform from base frame to sensor frame.
Definition at line 186 of file SensorCapture.h.
|
inline |
Sets the target frame rate.
Controls how often takeData() will capture data. The method will throttle captures to maintain the target rate.
| frameRate | Target frame rate in Hz (0 = unlimited, capture as fast as possible) |
Definition at line 200 of file SensorCapture.h.
|
inline |
Sets the local transform from base frame to sensor frame.
The local transform represents the pose of the sensor relative to the robot's base frame. This is used to transform sensor data into the robot's coordinate system.
| localTransform | Transform from base frame to sensor frame |
Definition at line 210 of file SensorCapture.h.
| void rtabmap::SensorCapture::resetTimer | ( | ) |
Resets the frame rate timer.
Resets the internal timer used for frame rate control. This is useful when starting a new capture session or after a pause.
|
protectedpure virtual |
Pure virtual method to capture sensor data.
This method must be implemented by derived classes to perform the actual sensor data capture. It is called by takeData() after frame rate throttling.
The returned SensorData should:
init()| info | Optional pointer to SensorCaptureInfo to fill with capture metadata. The base class will fill ID, timestamp, and capture time, but derived classes can add additional information. |
Implemented in rtabmap::LidarVLP16.
|
inlineprotected |
Gets the next sequence ID.
Returns and increments the internal sequence counter. This is used to assign unique sequence numbers to captured data.
Definition at line 264 of file SensorCapture.h.