47 _dataBufferMaxSize(
Parameters::defaultRtabmapImageBufferSize()),
48 _rate(
Parameters::defaultRtabmapDetectionRate()),
49 _createIntermediateNodes(
Parameters::defaultRtabmapCreateIntermediateNodes()),
50 _frameRateTimer(new
UTimer()),
131 UDEBUG(
"optimized=%s, full=%s, graphOnly=%s", optimized?
"true":
"false", full?
"true":
"false", graphOnly?
"true":
"false");
134 std::map<int, Signature> signatures;
135 std::map<int, Transform> poses;
136 std::multimap<int, Link> constraints;
137 std::map<int, int> mapIds;
138 std::map<int, double> stamps;
139 std::map<int, std::string> labels;
140 std::map<int, std::vector<unsigned char> > userDatas;
159 UERROR(
"Rtabmap is null!");
168 UERROR(
"Cannot start rtabmap thread if no rtabmap object is set! Stopping the thread...");
222 UWARN(
"Closing... %d data still buffered! They will be cleared.", (
int)
_dataBuffer.size());
302 UERROR(
"Failed to find a node with label \"%s\".", cmdEvent.
value1().
toStr().c_str());
312 UERROR(
"Failed to set a goal. ID (%d) should be positive > 0",
id);
317 UERROR(
"Failed to compute a path to goal %d.",
id);
343 if(id <= 0 || !_rtabmap->labelLocation(
id,
""))
355 UWARN(
"Cmd %d unknown!", cmd);
359 UFATAL(
"Invalid state !?!?");
374 else if(event->
getClassName().compare(
"CameraEvent") == 0)
413 else if(event->
getClassName().compare(
"OdometryEvent") == 0)
426 else if(event->
getClassName().compare(
"UserDataEvent") == 0)
431 bool updated =
false;
434 if(!e->
data().empty())
442 UWARN(
"New user data received before the last one was processed... replacing " 443 "user data with this new one. Note that UserDataEvent should be used only " 444 "if the rate of UserDataEvent is lower than RTAB-Map's detection rate (%f Hz).",
_rate);
448 else if(event->
getClassName().compare(
"RtabmapEventCmd") == 0)
453 else if(event->
getClassName().compare(
"ParamEvent") == 0)
489 UERROR(
"RTAB-Map is not initialized! Ignoring received data...");
500 bool ignoreFrame =
false;
515 UWARN(
"Odometry is reset (identity pose detected). Increment map id! (stamp=%fs)", odomEvent.
data().
stamp());
519 UWARN(
"Odometry is reset (high variance (%f >=9999 detected, stamp=%fs). Increment map id!", odomEvent.
info().
reg.
covariance.at<
double>(0,0), odomEvent.
data().
stamp());
540 else if(!ignoreFrame)
561 tmp.
setFeatures(std::vector<cv::KeyPoint>(), std::vector<cv::Point3f>(), cv::Mat());
575 ULOGGER_WARN(
"Data buffer is full, the oldest data is removed to add the new one.");
596 bool dataFilled =
false;
597 bool triggerNewMap =
false;
618 triggerNewMap =
true;
static bool parse(const ParametersMap ¶meters, const std::string &key, bool &value)
const ParametersMap & getParameters() const
std::list< OdometryEvent > _dataBuffer
const cv::Mat & covariance() const
void clearPath(int status)
bool _createIntermediateNodes
void exportPoses(const std::string &path, bool optimized, bool global, int format)
#define ULOGGER_INFO(...)
bool computePath(int targetNode, bool global)
const Statistics & getStatistics() const
void dumpPrediction() const
bool isIncremental() const
void generateDOTGraph(const std::string &path, int id=0, int margin=5)
bool labelLocation(int id, const std::string &label)
unsigned int _dataBufferMaxSize
GLM_FUNC_DECL genType e()
std::vector< int > toIntArray(bool *ok=0) const
void init(const ParametersMap ¶meters, const std::string &databasePath="", bool loadDatabaseParameters=false)
const UVariant & value4() const
std::vector< float > odomVelocity
Some conversion functions.
int getSignatureIdByLabel(const std::string &label, bool lookInDatabase=true) const
void addNodesToRepublish(const std::vector< int > &ids)
bool acquire(int n=1, int ms=0)
void post(UEvent *event, bool async=true) const
std::queue< RtabmapEventCmd > _stateParam
const cv::Mat & data() const
virtual void mainLoopBegin()
bool uIsFinite(const T &value)
int toInt(bool *ok=0) const
#define UASSERT(condition)
Wrappers of STL for convenient functions.
void close(bool databaseSaved=true, const std::string &ouputDatabasePath="")
#define ULOGGER_DEBUG(...)
const UVariant & value3() const
virtual std::string getClassName() const =0
const Memory * getMemory() const
bool getData(OdometryEvent &data)
static void registerCurrentThread(const std::string &name)
bool process(const SensorData &data, Transform odomPose, const cv::Mat &odomCovariance=cv::Mat::eye(6, 6, CV_64FC1), const std::vector< float > &odomVelocity=std::vector< float >(), const std::map< std::string, float > &externalStats=std::map< std::string, float >())
Main loop of rtabmap.
int getPathStatus() const
virtual void mainLoopKill()
const std::vector< std::pair< int, Transform > > & getPath() const
OdometryInfo copyWithoutData() const
RecoveryProgressState state
void parseParameters(const ParametersMap ¶meters)
std::vector< float > velocity() const
void setUserData(const cv::Mat &userData, bool clearPreviousData=true)
void publishMap(bool optimized, bool full, bool graphOnly) const
void setDetectorRate(float rate)
std::string toStr(bool *ok=0) const
const OdometryInfo & info() const
const UVariant & value2() const
void setDataBufferSize(unsigned int bufferSize)
#define ULOGGER_WARN(...)
ULogger class and convenient macros.
const CameraInfo & info() const
void close(bool databaseSaved, const std::string &databasePath="")
void getGraph(std::map< int, Transform > &poses, std::multimap< int, Link > &constraints, bool optimized, bool global, std::map< int, Signature > *signatures=0, bool withImages=false, bool withScan=false, bool withUserData=false, bool withGrid=false, bool withWords=true, bool withGlobalDescriptors=true) const
void addData(const OdometryEvent &odomEvent)
void createIntermediateNodes(bool enabled)
void pushNewState(State newState, const RtabmapEventCmd &cmdEvent=RtabmapEventCmd(RtabmapEventCmd::kCmdUndef))
virtual bool handleEvent(UEvent *anEvent)
static void removeHandler(UEventsHandler *handler)
void join(bool killFirst=false)
std::list< double > _newMapEvents
const Transform & pose() const
const UVariant & value1() const
RtabmapThread(Rtabmap *rtabmap)
void setFeatures(const std::vector< cv::KeyPoint > &keypoints, const std::vector< cv::Point3f > &keypoints3D, const cv::Mat &descriptors)
const SensorData & data() const
void addStatistic(const std::string &name, float value)
std::queue< State > _state