Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
rtabmap::RtabmapThread Class Reference

#include <RtabmapThread.h>

Inheritance diagram for rtabmap::RtabmapThread:
Inheritance graph
[legend]

Public Types

enum  State { kStateDetecting, kStateProcessCommand }
 
- Public Types inherited from UThread
enum  Priority {
  kPLow, kPBelowNormal, kPNormal, kPAboveNormal,
  kPRealTime
}
 
- Public Types inherited from UThreadC< void >
typedef THREAD_HANDLE Handle
 
typedef THREAD_HANDLE Handle
 
typedef void(* Handler) ()
 
typedef void(* Handler) ()
 

Public Member Functions

void clearBufferedData ()
 
void close (bool databaseSaved, const std::string &databasePath="")
 
void createIntermediateNodes (bool enabled)
 
bool getCreateIntermediateNodes () const
 
unsigned int getDataBufferSize () const
 
float getDetectorRate () const
 
 RtabmapThread (Rtabmap *rtabmap)
 
void setDataBufferSize (unsigned int bufferSize)
 
void setDetectorRate (float rate)
 
virtual ~RtabmapThread ()
 
- Public Member Functions inherited from UThread
Handle getThreadHandle () const
 
unsigned long getThreadId () const
 
bool isCreating () const
 
bool isIdle () const
 
bool isKilled () const
 
bool isRunning () const
 
void join (bool killFirst=false)
 
void kill ()
 
void setAffinity (int cpu=0)
 
void setPriority (Priority priority)
 
void start ()
 
 UThread (Priority priority=kPNormal)
 
virtual ~UThread ()
 
- 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 (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 (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
 
virtual ~UThreadC ()
 
virtual ~UThreadC ()
 
- Public Member Functions inherited from UEventsHandler
void registerToEventsManager ()
 
void unregisterFromEventsManager ()
 
- Public Member Functions inherited from UEventsSender
 UEventsSender ()
 
virtual ~UEventsSender ()
 

Protected Member Functions

virtual bool handleEvent (UEvent *anEvent)
 
- Protected Member Functions inherited from UThreadC< void >
 UThreadC ()
 
 UThreadC ()
 
- Protected Member Functions inherited from UEventsHandler
 UEventsHandler ()
 
virtual ~UEventsHandler ()
 
- Protected Member Functions inherited from UEventsSender
void post (UEvent *event, bool async=true) const
 

Private Member Functions

void addData (const OdometryEvent &odomEvent)
 
bool getData (OdometryEvent &data)
 
virtual void mainLoop ()
 
virtual void mainLoopBegin ()
 
virtual void mainLoopKill ()
 
void process ()
 
void publishMap (bool optimized, bool full, bool graphOnly) const
 
void pushNewState (State newState, const RtabmapEventCmd &cmdEvent=RtabmapEventCmd(RtabmapEventCmd::kCmdUndef))
 

Private Attributes

bool _createIntermediateNodes
 
USemaphore _dataAdded
 
std::list< OdometryEvent_dataBuffer
 
unsigned int _dataBufferMaxSize
 
UMutex _dataMutex
 
UTimer_frameRateTimer
 
std::list< double > _newMapEvents
 
bool _paused
 
double _previousStamp
 
float _rate
 
Rtabmap_rtabmap
 
std::queue< State_state
 
UMutex _stateMutex
 
std::queue< RtabmapEventCmd_stateParam
 
cv::Mat _userData
 
UMutex _userDataMutex
 
cv::Mat covariance_
 
Transform lastPose_
 

Additional Inherited Members

- 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 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 Detach (const Handle &H)
 
static int Detach (Handle H)
 
static int Join (const Handle &H)
 
static int Join (Handle H)
 
static int Kill (const Handle &H)
 
static int Kill (Handle H)
 
- Static Protected Member Functions inherited from UThreadC< void >
static void Exit ()
 
static void Exit ()
 
static Handle Self ()
 
static int Self ()
 
static void TestCancel ()
 
static void TestCancel ()
 

Detailed Description

Definition at line 51 of file RtabmapThread.h.

Member Enumeration Documentation

◆ State

Enumerator
kStateDetecting 
kStateProcessCommand 

Definition at line 56 of file RtabmapThread.h.

Constructor & Destructor Documentation

◆ RtabmapThread()

rtabmap::RtabmapThread::RtabmapThread ( Rtabmap rtabmap)

Definition at line 46 of file RtabmapThread.cpp.

◆ ~RtabmapThread()

rtabmap::RtabmapThread::~RtabmapThread ( )
virtual

Definition at line 60 of file RtabmapThread.cpp.

Member Function Documentation

◆ addData()

void rtabmap::RtabmapThread::addData ( const OdometryEvent odomEvent)
private

Definition at line 494 of file RtabmapThread.cpp.

◆ clearBufferedData()

void rtabmap::RtabmapThread::clearBufferedData ( )

Definition at line 83 of file RtabmapThread.cpp.

◆ close()

void rtabmap::RtabmapThread::close ( bool  databaseSaved,
const std::string databasePath = "" 
)

Close rtabmap. This will delete rtabmap object if set.

Parameters
databaseSavedtrue=database saved, false=database discarded.
databasePathoutput database file name, ignored if Db/Sqlite3InMemory=false (opened database is then overwritten).

Definition at line 118 of file RtabmapThread.cpp.

◆ createIntermediateNodes()

void rtabmap::RtabmapThread::createIntermediateNodes ( bool  enabled)

Definition at line 113 of file RtabmapThread.cpp.

◆ getCreateIntermediateNodes()

bool rtabmap::RtabmapThread::getCreateIntermediateNodes ( ) const
inline

Definition at line 73 of file RtabmapThread.h.

◆ getData()

bool rtabmap::RtabmapThread::getData ( OdometryEvent data)
private

Definition at line 588 of file RtabmapThread.cpp.

◆ getDataBufferSize()

unsigned int rtabmap::RtabmapThread::getDataBufferSize ( ) const
inline

Definition at line 72 of file RtabmapThread.h.

◆ getDetectorRate()

float rtabmap::RtabmapThread::getDetectorRate ( ) const
inline

Definition at line 71 of file RtabmapThread.h.

◆ handleEvent()

bool rtabmap::RtabmapThread::handleEvent ( UEvent event)
protectedvirtual

Method called by the UEventsManager to handle an event. Important : this method must do a minimum of work because the faster the dispatching loop is done; the faster the events are received. If a handling function takes too much time, the events list can grow faster than it is emptied. The event can be modified.

Returns
"true" to notify UEventsManager that this handler took ownership of the event (meaning it must delete it). The event will not be dispatched to next handlers.
"false" to let event be dispatched to next handlers (default behavior). UEventsManager will take care of deleting the event.

Implements UEventsHandler.

Definition at line 365 of file RtabmapThread.cpp.

◆ mainLoop()

void rtabmap::RtabmapThread::mainLoop ( )
privatevirtual

Pure virtual method mainLoop(). The inner loop of the thread. This method is called repetitively until the thread is killed. Note that if kill() is called in mainLoopBegin(), mainLoop() is not called, terminating immediately the thread.

See also
mainLoop()
kill()

Implements UThread.

Definition at line 180 of file RtabmapThread.cpp.

◆ mainLoopBegin()

void rtabmap::RtabmapThread::mainLoopBegin ( )
privatevirtual

Virtual method mainLoopBegin(). User can implement this function to add a behavior before the main loop is started. It is called once (before entering mainLoop()).

Reimplemented from UThread.

Definition at line 163 of file RtabmapThread.cpp.

◆ mainLoopKill()

void rtabmap::RtabmapThread::mainLoopKill ( )
privatevirtual

Virtual method mainLoopKill(). User can implement this function to add a behavior before the thread is killed. When this function is called, the state of the thread is set to kSKilled. It is useful to wake up a sleeping thread to finish his loop and to avoid a deadlock.

Reimplemented from UThread.

Definition at line 173 of file RtabmapThread.cpp.

◆ process()

void rtabmap::RtabmapThread::process ( )
private

Definition at line 465 of file RtabmapThread.cpp.

◆ publishMap()

void rtabmap::RtabmapThread::publishMap ( bool  optimized,
bool  full,
bool  graphOnly 
) const
private

Definition at line 129 of file RtabmapThread.cpp.

◆ pushNewState()

void rtabmap::RtabmapThread::pushNewState ( State  newState,
const RtabmapEventCmd cmdEvent = RtabmapEventCmd(RtabmapEventCmd::kCmdUndef) 
)
private

Definition at line 69 of file RtabmapThread.cpp.

◆ setDataBufferSize()

void rtabmap::RtabmapThread::setDataBufferSize ( unsigned int  bufferSize)

Definition at line 108 of file RtabmapThread.cpp.

◆ setDetectorRate()

void rtabmap::RtabmapThread::setDetectorRate ( float  rate)

Definition at line 102 of file RtabmapThread.cpp.

Member Data Documentation

◆ _createIntermediateNodes

bool rtabmap::RtabmapThread::_createIntermediateNodes
private

Definition at line 108 of file RtabmapThread.h.

◆ _dataAdded

USemaphore rtabmap::RtabmapThread::_dataAdded
private

Definition at line 105 of file RtabmapThread.h.

◆ _dataBuffer

std::list<OdometryEvent> rtabmap::RtabmapThread::_dataBuffer
private

Definition at line 102 of file RtabmapThread.h.

◆ _dataBufferMaxSize

unsigned int rtabmap::RtabmapThread::_dataBufferMaxSize
private

Definition at line 106 of file RtabmapThread.h.

◆ _dataMutex

UMutex rtabmap::RtabmapThread::_dataMutex
private

Definition at line 104 of file RtabmapThread.h.

◆ _frameRateTimer

UTimer* rtabmap::RtabmapThread::_frameRateTimer
private

Definition at line 109 of file RtabmapThread.h.

◆ _newMapEvents

std::list<double> rtabmap::RtabmapThread::_newMapEvents
private

Definition at line 103 of file RtabmapThread.h.

◆ _paused

bool rtabmap::RtabmapThread::_paused
private

Definition at line 113 of file RtabmapThread.h.

◆ _previousStamp

double rtabmap::RtabmapThread::_previousStamp
private

Definition at line 110 of file RtabmapThread.h.

◆ _rate

float rtabmap::RtabmapThread::_rate
private

Definition at line 107 of file RtabmapThread.h.

◆ _rtabmap

Rtabmap* rtabmap::RtabmapThread::_rtabmap
private

Definition at line 112 of file RtabmapThread.h.

◆ _state

std::queue<State> rtabmap::RtabmapThread::_state
private

Definition at line 99 of file RtabmapThread.h.

◆ _stateMutex

UMutex rtabmap::RtabmapThread::_stateMutex
private

Definition at line 98 of file RtabmapThread.h.

◆ _stateParam

std::queue<RtabmapEventCmd> rtabmap::RtabmapThread::_stateParam
private

Definition at line 100 of file RtabmapThread.h.

◆ _userData

cv::Mat rtabmap::RtabmapThread::_userData
private

Definition at line 117 of file RtabmapThread.h.

◆ _userDataMutex

UMutex rtabmap::RtabmapThread::_userDataMutex
private

Definition at line 118 of file RtabmapThread.h.

◆ covariance_

cv::Mat rtabmap::RtabmapThread::covariance_
private

Definition at line 115 of file RtabmapThread.h.

◆ lastPose_

Transform rtabmap::RtabmapThread::lastPose_
private

Definition at line 114 of file RtabmapThread.h.


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


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:28