|
RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
|
Runs a Rtabmap instance in its own thread, driven by events. More...
#include <RtabmapThread.h>


Public Types | |
| enum | State { kStateDetecting , kStateProcessCommand } |
| What the main loop does on its next wake-up. More... | |
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) () |
Public Member Functions | |
| RtabmapThread (Rtabmap *rtabmap) | |
| Constructor. | |
| void | clearBufferedData () |
| Drops the buffered frames, the pending user data and the odometry state. | |
| void | setDetectorRate (float rate) |
| Sets the maximum rate at which frames are processed (Hz, 0 = unlimited). | |
| void | setDataBufferSize (unsigned int bufferSize) |
| Sets how many frames may wait in the buffer (0 = unlimited). | |
| void | createIntermediateNodes (bool enabled) |
| Keeps the frames skipped by setDetectorRate() as intermediate nodes. | |
| float | getDetectorRate () const |
| unsigned int | getDataBufferSize () const |
| bool | getCreateIntermediateNodes () const |
| void | close (bool databaseSaved, const std::string &databasePath="") |
| Joins the thread and closes rtabmap. This will delete rtabmap object if set. | |
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 |
Public Member Functions inherited from UEventsHandler | |
| void | registerToEventsManager () |
| void | unregisterFromEventsManager () |
Protected Member Functions | |
| virtual bool | handleEvent (UEvent *anEvent) |
| Receives the events listed in the class description. | |
Protected Member Functions inherited from UEventsHandler | |
| UEventsHandler () | |
| virtual | ~UEventsHandler () |
Protected Member Functions inherited from UEventsSender | |
| void | post (UEvent *event, bool async=true) const |
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 | 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) |
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 () |
Runs a Rtabmap instance in its own thread, driven by events.
The thread owns the Rtabmap object and calls Rtabmap::process() on the data it receives, so that mapping never blocks the sensor or odometry threads. It is the last stage of the event-based pipeline: SensorCaptureThread → OdometryThread → RtabmapThread.
Input events (handled in handleEvent(), i.e. in the caller's thread):
Output events, posted from the thread:
Input regulation, on top of what Rtabmap does:
The object registers itself as a UEventsHandler, so posting an event to UEventsManager is enough to feed it:
Definition at line 104 of file RtabmapThread.h.
What the main loop does on its next wake-up.
| Enumerator | |
|---|---|
| kStateDetecting | Process the next buffered frame. |
| kStateProcessCommand | Execute the next queued RtabmapEventCmd. |
Definition at line 110 of file RtabmapThread.h.
| rtabmap::RtabmapThread::RtabmapThread | ( | Rtabmap * | rtabmap | ) |
Constructor.
| rtabmap | The map to run; must not be null. The thread takes ownership and deletes it in close(), which the destructor calls. |
The buffer size, detection rate and intermediate node settings are taken from the default parameters here, then updated by every RtabmapEventCmd::kCmdInit and RtabmapEventCmd::kCmdUpdateParams command.
| void rtabmap::RtabmapThread::setDetectorRate | ( | float | rate | ) |
Sets the maximum rate at which frames are processed (Hz, 0 = unlimited).
Same setting as Parameters::kRtabmapDetectionRate(). Frames arriving faster are dropped, or added as intermediate nodes if createIntermediateNodes() is enabled.
| void rtabmap::RtabmapThread::setDataBufferSize | ( | unsigned int | bufferSize | ) |
Sets how many frames may wait in the buffer (0 = unlimited).
Same setting as Parameters::kRtabmapImageBufferSize(). Once full, the oldest frame is dropped to make room for the new one.
| void rtabmap::RtabmapThread::createIntermediateNodes | ( | bool | enabled | ) |
Keeps the frames skipped by setDetectorRate() as intermediate nodes.
Same setting as Parameters::kRtabmapCreateIntermediateNodes(). Those nodes carry the odometry link but take no part in loop closure detection.
|
inline |
Definition at line 155 of file RtabmapThread.h.
|
inline |
Definition at line 157 of file RtabmapThread.h.
|
inline |
Definition at line 159 of file RtabmapThread.h.
| void rtabmap::RtabmapThread::close | ( | bool | databaseSaved, |
| const std::string & | databasePath = "" |
||
| ) |
Joins the thread and closes rtabmap. This will delete rtabmap object if set.
| databaseSaved | true=database saved, false=database discarded. |
| databasePath | output database file name, ignored if Db/Sqlite3InMemory=false (opened database is then overwritten). |
Called by the destructor with databaseSaved true. The object cannot be used afterwards: the Rtabmap instance it owned is gone.
|
protectedvirtual |
Receives the events listed in the class description.
Runs in the posting thread: data events are only queued here, the work happens in the thread's main loop. Events are ignored until the thread is started.
Implements UEventsHandler.