RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
rtabmap::IMUThread Class Reference

Background thread that replays IMU measurements from a CSV file. More...

#include <IMUThread.h>

Inheritance diagram for rtabmap::IMUThread:
Collaboration diagram for rtabmap::IMUThread:

Public Member Functions

 IMUThread (int rate, const Transform &localTransform)
 Constructs the replay thread.
 
bool init (const std::string &path)
 Opens and validates an IMU CSV file.
 
void setRate (int rate)
 Sets the target playback rate in Hz.
 
void enableIMUFiltering (int filteringStrategy=1, const ParametersMap &parameters=ParametersMap(), bool baseFrameConversion=false)
 Enables orientation fusion on replayed samples.
 
void disableIMUFiltering ()
 Disables fusion and deletes the internal IMUFilter.
 
- 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 ()
 

Detailed Description

Background thread that replays IMU measurements from a CSV file.

Reads gyroscope and accelerometer samples from a comma-separated file (EuRoC-style or epoch timestamps), optionally fuses them with IMUFilter, and posts IMUEvent on each step.

CSV format:

  • First line: header (skipped).
  • Following lines: stamp,gx,gy,gz,ax,ay,az (stamp in seconds with a decimal point, or EuRoC nanoseconds without one).

Playback rate is limited by setRate() when rate > 0; otherwise samples are read as fast as possible (or spaced using inter-sample timestamps after the first pair). When the file ends, the thread posts an empty IMUEvent and stops.

See also
IMUEvent
IMUFilter
SensorCaptureThread::enableIMUFiltering()

Definition at line 65 of file IMUThread.h.

Constructor & Destructor Documentation

◆ IMUThread()

rtabmap::IMUThread::IMUThread ( int  rate,
const Transform localTransform 
)

Constructs the replay thread.

Parameters
rateTarget playback rate in Hz (0 = no rate cap until timestamps apply).
localTransformIMU frame relative to the robot base (stored in each IMU).

Member Function Documentation

◆ init()

bool rtabmap::IMUThread::init ( const std::string &  path)

Opens and validates an IMU CSV file.

Parameters
pathPath to the CSV file.
Returns
False if the file is missing or contains no data rows.

◆ enableIMUFiltering()

void rtabmap::IMUThread::enableIMUFiltering ( int  filteringStrategy = 1,
const ParametersMap parameters = ParametersMap(),
bool  baseFrameConversion = false 
)

Enables orientation fusion on replayed samples.

Parameters
filteringStrategyIMUFilter::Type index (0 = Madgwick, 1 = complementary).
parametersOptional ImuFilter/... tuning parameters.
baseFrameConversionIf true, rotate IMU vectors into the base frame before filtering.

The documentation for this class was generated from the following file: