RtabmapThread.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #include "rtabmap/core/Rtabmap.h"
31 #include "rtabmap/core/Camera.h"
36 #include "rtabmap/core/Memory.h"
37 
40 #include <rtabmap/utilite/UStl.h>
41 #include <rtabmap/utilite/UTimer.h>
43 
44 namespace rtabmap {
45 
47  _dataBufferMaxSize(Parameters::defaultRtabmapImageBufferSize()),
48  _rate(Parameters::defaultRtabmapDetectionRate()),
49  _createIntermediateNodes(Parameters::defaultRtabmapCreateIntermediateNodes()),
50  _frameRateTimer(new UTimer()),
51  _previousStamp(0.0),
52  _rtabmap(rtabmap),
53  _paused(false),
54  lastPose_(Transform::getIdentity())
55 
56 {
57  UASSERT(rtabmap != 0);
58 }
59 
61 {
63 
64  close(true);
65 
66  delete _frameRateTimer;
67 }
68 
69 void RtabmapThread::pushNewState(State newState, const ParametersMap & parameters)
70 {
71  ULOGGER_DEBUG("to %d", newState);
72 
73  _stateMutex.lock();
74  {
75  _state.push(newState);
76  _stateParam.push(parameters);
77  }
79 
81 }
82 
84 {
85  _dataMutex.lock();
86  {
87  _dataBuffer.clear();
88  _newMapEvents.clear();
90  covariance_ = cv::Mat();
91  _previousStamp = 0;
92  }
94 
96  {
97  _userData = cv::Mat();
98  }
100 }
101 
103 {
104  UASSERT(rate >= 0.0f);
105  _rate = rate;
106 }
107 
108 void RtabmapThread::setDataBufferSize(unsigned int size)
109 {
110  _dataBufferMaxSize = size;
111 }
112 
114 {
115  _createIntermediateNodes = enabled;
116 }
117 
118 void RtabmapThread::close(bool databaseSaved, const std::string & ouputDatabasePath)
119 {
120  this->join(true);
121  if(_rtabmap)
122  {
123  _rtabmap->close(databaseSaved, ouputDatabasePath);
124  delete _rtabmap;
125  _rtabmap = 0;
126  }
127 }
128 
129 void RtabmapThread::publishMap(bool optimized, bool full, bool graphOnly) const
130 {
131  if(_rtabmap)
132  {
133  std::map<int, Signature> signatures;
134  std::map<int, Transform> poses;
135  std::multimap<int, Link> constraints;
136  std::map<int, int> mapIds;
137  std::map<int, double> stamps;
138  std::map<int, std::string> labels;
139  std::map<int, std::vector<unsigned char> > userDatas;
140 
141  if(graphOnly)
142  {
143  _rtabmap->getGraph(poses,
144  constraints,
145  optimized,
146  full,
147  &signatures);
148  }
149  else
150  {
152  signatures,
153  poses,
154  constraints,
155  optimized,
156  full);
157  }
158 
159  this->post(new RtabmapEvent3DMap(
160  signatures,
161  poses,
162  constraints));
163  }
164  else
165  {
166  UERROR("Rtabmap is null!");
167  }
168 }
169 
171 {
173  if(_rtabmap == 0)
174  {
175  UERROR("Cannot start rtabmap thread if no rtabmap object is set! Stopping the thread...");
176  this->kill();
177  }
178 }
179 
181 {
182  this->clearBufferedData();
183  // this will post the newData semaphore
185 }
186 
188 {
190  ParametersMap parameters;
191 
192  _stateMutex.lock();
193  {
194  if(!_state.empty() && !_stateParam.empty())
195  {
196  state = _state.front();
197  _state.pop();
198  parameters = _stateParam.front();
199  _stateParam.pop();
200  }
201  }
203 
204  int id = 0;
205  cv::Mat userData;
206  UTimer timer;
207  std::string str;
208  switch(state)
209  {
210  case kStateDetecting:
211  this->process();
212  break;
213  case kStateInit:
214  UASSERT(!parameters.at("RtabmapThread/DatabasePath").empty());
215  str = parameters.at("RtabmapThread/DatabasePath");
216  parameters.erase("RtabmapThread/DatabasePath");
217  Parameters::parse(parameters, Parameters::kRtabmapImageBufferSize(), _dataBufferMaxSize);
218  Parameters::parse(parameters, Parameters::kRtabmapDetectionRate(), _rate);
219  Parameters::parse(parameters, Parameters::kRtabmapCreateIntermediateNodes(), _createIntermediateNodes);
221  UASSERT(_rate >= 0.0f);
222  _rtabmap->init(parameters, str);
223  break;
225  Parameters::parse(parameters, Parameters::kRtabmapImageBufferSize(), _dataBufferMaxSize);
226  Parameters::parse(parameters, Parameters::kRtabmapDetectionRate(), _rate);
227  Parameters::parse(parameters, Parameters::kRtabmapCreateIntermediateNodes(), _createIntermediateNodes);
229  UASSERT(_rate >= 0.0f);
230  _rtabmap->parseParameters(parameters);
231  break;
232  case kStateReseting:
234  this->clearBufferedData();
235  break;
236  case kStateClose:
237  if(_dataBuffer.size())
238  {
239  UWARN("Closing... %d data still buffered! They will be cleared.", (int)_dataBuffer.size());
240  this->clearBufferedData();
241  }
242  _rtabmap->close(uStr2Bool(parameters.at("saved")), parameters.at("outputPath"));
243  break;
244  case kStateDumpingMemory:
245  _rtabmap->dumpData();
246  break;
249  break;
252  parameters.at("path"),
253  atoi(parameters.at("id").c_str()),
254  atoi(parameters.at("margin").c_str()));
255  break;
258  parameters.at("path"),
259  uStr2Bool(parameters.at("optimized")),
260  uStr2Bool(parameters.at("global")),
261  atoi(parameters.at("type").c_str()));
262  break;
264  this->clearBufferedData();
265  break;
266  case kStatePublishingMap:
267  this->publishMap(
268  uStr2Bool(parameters.at("optimized")),
269  uStr2Bool(parameters.at("global")),
270  uStr2Bool(parameters.at("graph_only")));
271  break;
272  case kStateTriggeringMap:
274  break;
275  case kStateSettingGoal:
276  id = atoi(parameters.at("id").c_str());
277  if(id == 0 && !parameters.at("label").empty() && _rtabmap->getMemory())
278  {
279  id = _rtabmap->getMemory()->getSignatureIdByLabel(parameters.at("label"));
280  if(id <= 0)
281  {
282  UERROR("Failed to find a node with label \"%s\".", parameters.at("label").c_str());
283  }
284  }
285  else if(id < 0)
286  {
287  UERROR("Failed to set a goal. ID (%d) should be positive > 0", id);
288  }
289  timer.start();
290  if(id > 0 && !_rtabmap->computePath(id, true))
291  {
292  UERROR("Failed to compute a path to goal %d.", id);
293  }
294  this->post(new RtabmapGlobalPathEvent(
295  id,
296  parameters.at("label"),
297  _rtabmap->getPath(),
298  timer.elapsed()));
299  break;
301  _rtabmap->clearPath(0);
302  break;
303  case kStateLabelling:
304  if(!_rtabmap->labelLocation(atoi(parameters.at("id").c_str()), parameters.at("label").c_str()))
305  {
306  this->post(new RtabmapLabelErrorEvent(atoi(parameters.at("id").c_str()), parameters.at("label").c_str()));
307  }
308  break;
309  default:
310  UFATAL("Invalid state !?!?");
311  break;
312  }
313 }
314 
315 
317 {
318  if(this->isRunning())
319  {
320  if(event->getClassName().compare("CameraEvent") == 0)
321  {
322  UDEBUG("CameraEvent");
323  CameraEvent * e = (CameraEvent*)event;
324  if(e->getCode() == CameraEvent::kCodeData)
325  {
326  if (_rtabmap->isRGBDMode())
327  {
328  if (!e->info().odomPose.isNull() || (_rtabmap->getMemory() && !_rtabmap->getMemory()->isIncremental()))
329  {
330  OdometryInfo infoCov;
331  infoCov.reg.covariance = e->info().odomCovariance;
332  if(e->info().odomVelocity.size() == 6)
333  {
334  infoCov.transform = Transform(
335  e->info().odomVelocity[0],
336  e->info().odomVelocity[1],
337  e->info().odomVelocity[2],
338  e->info().odomVelocity[3],
339  e->info().odomVelocity[4],
340  e->info().odomVelocity[5]);
341  infoCov.interval = 1.0;
342  }
343  this->addData(OdometryEvent(e->data(), e->info().odomPose, infoCov));
344  }
345  else
346  {
347  lastPose_.setNull();
348  }
349  }
350  else
351  {
352  OdometryInfo infoCov;
353  infoCov.reg.covariance = e->info().odomCovariance;
354  this->addData(OdometryEvent(e->data(), e->info().odomPose, infoCov));
355  }
356 
357  }
358  }
359  else if(event->getClassName().compare("OdometryEvent") == 0)
360  {
361  UDEBUG("OdometryEvent");
362  OdometryEvent * e = (OdometryEvent*)event;
363  if(!e->pose().isNull() || (_rtabmap->getMemory() && !_rtabmap->getMemory()->isIncremental()))
364  {
365  this->addData(*e);
366  }
367  else
368  {
369  lastPose_.setNull();
370  }
371  }
372  else if(event->getClassName().compare("UserDataEvent") == 0)
373  {
374  if(!_paused)
375  {
376  UDEBUG("UserDataEvent");
377  bool updated = false;
378  UserDataEvent * e = (UserDataEvent*)event;
380  if(!e->data().empty())
381  {
382  updated = !_userData.empty();
383  _userData = e->data();
384  }
386  if(updated)
387  {
388  UWARN("New user data received before the last one was processed... replacing "
389  "user data with this new one. Note that UserDataEvent should be used only "
390  "if the rate of UserDataEvent is lower than RTAB-Map's detection rate (%f Hz).", _rate);
391  }
392  }
393  }
394  else if(event->getClassName().compare("RtabmapEventCmd") == 0)
395  {
396  RtabmapEventCmd * rtabmapEvent = (RtabmapEventCmd*)event;
397  RtabmapEventCmd::Cmd cmd = rtabmapEvent->getCmd();
398  if(cmd == RtabmapEventCmd::kCmdInit)
399  {
400  ULOGGER_DEBUG("CMD_INIT");
401  ParametersMap parameters = ((RtabmapEventCmd*)event)->getParameters();
402  UASSERT(rtabmapEvent->value1().isStr());
403  UASSERT(parameters.insert(ParametersPair("RtabmapThread/DatabasePath", rtabmapEvent->value1().toStr())).second);
404  pushNewState(kStateInit, parameters);
405  }
406  else if(cmd == RtabmapEventCmd::kCmdClose)
407  {
408  ULOGGER_DEBUG("CMD_CLOSE");
409  UASSERT(rtabmapEvent->value1().isUndef() || rtabmapEvent->value1().isBool());
410  ParametersMap param;
411  param.insert(ParametersPair("saved", uBool2Str(rtabmapEvent->value1().isUndef() || rtabmapEvent->value1().toBool())));
412  param.insert(ParametersPair("outputPath", rtabmapEvent->value2().toStr()));
413  pushNewState(kStateClose, param);
414  }
415  else if(cmd == RtabmapEventCmd::kCmdResetMemory)
416  {
417  ULOGGER_DEBUG("CMD_RESET_MEMORY");
419  }
420  else if(cmd == RtabmapEventCmd::kCmdDumpMemory)
421  {
422  ULOGGER_DEBUG("CMD_DUMP_MEMORY");
424  }
426  {
427  ULOGGER_DEBUG("CMD_DUMP_PREDICTION");
429  }
431  {
432  ULOGGER_DEBUG("CMD_GENERATE_DOT_GRAPH");
433  UASSERT(rtabmapEvent->value1().isBool());
434  UASSERT(rtabmapEvent->value2().isStr());
435  UASSERT(rtabmapEvent->value1().toBool() || rtabmapEvent->value3().isInt() || rtabmapEvent->value3().isUInt());
436  UASSERT(rtabmapEvent->value1().toBool() || rtabmapEvent->value4().isInt() || rtabmapEvent->value4().isUInt());
437  ParametersMap param;
438  param.insert(ParametersPair("path", rtabmapEvent->value2().toStr()));
439  param.insert(ParametersPair("id", !rtabmapEvent->value1().toBool()?rtabmapEvent->value3().toStr():"0"));
440  param.insert(ParametersPair("margin", !rtabmapEvent->value1().toBool()?rtabmapEvent->value4().toStr():"0"));
442  }
443  else if(cmd == RtabmapEventCmd::kCmdExportPoses)
444  {
445  ULOGGER_DEBUG("CMD_EXPORT_POSES");
446  UASSERT(rtabmapEvent->value1().isBool());
447  UASSERT(rtabmapEvent->value2().isBool());
448  UASSERT(rtabmapEvent->value3().isStr());
449  UASSERT(rtabmapEvent->value4().isUndef() || rtabmapEvent->value4().isInt() || rtabmapEvent->value4().isUInt());
450  ParametersMap param;
451  param.insert(ParametersPair("global", rtabmapEvent->value1().toStr()));
452  param.insert(ParametersPair("optimized", rtabmapEvent->value1().toStr()));
453  param.insert(ParametersPair("path", rtabmapEvent->value3().toStr()));
454  param.insert(ParametersPair("type", rtabmapEvent->value4().isInt()?rtabmapEvent->value4().toStr():"0"));
456 
457  }
459  {
460  ULOGGER_DEBUG("CMD_CLEAN_DATA_BUFFER");
462  }
463  else if(cmd == RtabmapEventCmd::kCmdPublish3DMap)
464  {
465  ULOGGER_DEBUG("CMD_PUBLISH_MAP");
466  UASSERT(rtabmapEvent->value1().isBool());
467  UASSERT(rtabmapEvent->value2().isBool());
468  UASSERT(rtabmapEvent->value3().isBool());
469  ParametersMap param;
470  param.insert(ParametersPair("global", rtabmapEvent->value1().toStr()));
471  param.insert(ParametersPair("optimized", rtabmapEvent->value2().toStr()));
472  param.insert(ParametersPair("graph_only", rtabmapEvent->value3().toStr()));
474  }
475  else if(cmd == RtabmapEventCmd::kCmdTriggerNewMap)
476  {
477  ULOGGER_DEBUG("CMD_TRIGGER_NEW_MAP");
479  }
480  else if(cmd == RtabmapEventCmd::kCmdPause)
481  {
482  ULOGGER_DEBUG("CMD_PAUSE");
483  _paused = !_paused;
484  }
485  else if(cmd == RtabmapEventCmd::kCmdGoal)
486  {
487  ULOGGER_DEBUG("CMD_GOAL");
488  UASSERT(rtabmapEvent->value1().isStr() || rtabmapEvent->value1().isInt() || rtabmapEvent->value1().isUInt());
489  ParametersMap param;
490  param.insert(ParametersPair("label", rtabmapEvent->value1().isStr()?rtabmapEvent->value1().toStr():""));
491  param.insert(ParametersPair("id", !rtabmapEvent->value1().isStr()?rtabmapEvent->value1().toStr():"0"));
493  }
494  else if(cmd == RtabmapEventCmd::kCmdCancelGoal)
495  {
496  ULOGGER_DEBUG("CMD_CANCEL_GOAL");
498  }
499  else if(cmd == RtabmapEventCmd::kCmdLabel)
500  {
501  ULOGGER_DEBUG("CMD_LABEL");
502  UASSERT(rtabmapEvent->value1().isStr());
503  UASSERT(rtabmapEvent->value2().isUndef() || rtabmapEvent->value2().isInt() || rtabmapEvent->value2().isUInt());
504  ParametersMap param;
505  param.insert(ParametersPair("label", rtabmapEvent->value1().toStr()));
506  param.insert(ParametersPair("id", rtabmapEvent->value2().isUndef()?"0":rtabmapEvent->value2().toStr()));
508  }
509  else
510  {
511  UWARN("Cmd %d unknown!", cmd);
512  }
513  }
514  else if(event->getClassName().compare("ParamEvent") == 0)
515  {
516  ULOGGER_DEBUG("changing parameters");
517  pushNewState(kStateChangingParameters, ((ParamEvent*)event)->getParameters());
518  }
519  }
520  return false;
521 }
522 
523 //============================================================
524 // MAIN LOOP
525 //============================================================
527 {
528  OdometryEvent data;
529  if(_state.empty() && getData(data))
530  {
531  if(_rtabmap->getMemory())
532  {
533  bool wasPlanning = _rtabmap->getPath().size()>0;
534  if(_rtabmap->process(data.data(), data.pose(), data.covariance(), data.velocity()))
535  {
536  Statistics stats = _rtabmap->getStatistics();
537  stats.addStatistic(Statistics::kMemoryImages_buffered(), (float)_dataBuffer.size());
538  ULOGGER_DEBUG("posting statistics_ event...");
539  this->post(new RtabmapEvent(stats));
540 
541  if(wasPlanning && _rtabmap->getPath().size() == 0)
542  {
543  // Goal reached or failed
545  }
546  }
547  }
548  else
549  {
550  UERROR("RTAB-Map is not initialized! Ignoring received data...");
551  }
552  }
553 }
554 
555 void RtabmapThread::addData(const OdometryEvent & odomEvent)
556 {
557  if(!_paused)
558  {
559  UScopeMutex scopeMutex(_dataMutex);
560 
561  bool ignoreFrame = false;
562  if(_rate>0.0f)
563  {
564  if((_previousStamp>=0.0 && odomEvent.data().stamp()>_previousStamp && odomEvent.data().stamp() - _previousStamp < 1.0f/_rate) ||
565  ((_previousStamp<=0.0 || odomEvent.data().stamp()<=_previousStamp) && _frameRateTimer->getElapsedTime() < 1.0f/_rate))
566  {
567  ignoreFrame = true;
568  }
569  }
570  if(!lastPose_.isIdentity() &&
571  (odomEvent.pose().isIdentity() ||
572  odomEvent.info().reg.covariance.at<double>(0,0)>=9999))
573  {
574  if(odomEvent.pose().isIdentity())
575  {
576  UWARN("Odometry is reset (identity pose detected). Increment map id! (stamp=%fs)", odomEvent.data().stamp());
577  }
578  else
579  {
580  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());
581  }
582  _newMapEvents.push_back(odomEvent.data().stamp());
583  covariance_ = cv::Mat();
584  }
585 
586  if(uIsFinite(odomEvent.info().reg.covariance.at<double>(0,0)) &&
587  odomEvent.info().reg.covariance.at<double>(0,0) != 1.0 &&
588  odomEvent.info().reg.covariance.at<double>(0,0)>0.0)
589  {
590  // Use largest covariance error (to be independent of the odometry frame rate)
591  if(covariance_.empty() || odomEvent.info().reg.covariance.at<double>(0,0) > covariance_.at<double>(0,0))
592  {
593  covariance_ = odomEvent.info().reg.covariance;
594  }
595  }
596 
597  if(ignoreFrame && !_createIntermediateNodes)
598  {
599  return;
600  }
601  else if(!ignoreFrame)
602  {
604  _previousStamp = odomEvent.data().stamp();
605  }
606 
607  lastPose_ = odomEvent.pose();
608 
609  bool notify = true;
610 
611  if(covariance_.empty())
612  {
613  covariance_ = cv::Mat::eye(6,6,CV_64FC1);
614  }
615  OdometryInfo odomInfo = odomEvent.info().copyWithoutData();
616  odomInfo.reg.covariance = covariance_;
617  if(ignoreFrame)
618  {
619  // set negative id so rtabmap will detect it as an intermediate node
620  SensorData tmp = odomEvent.data();
621  tmp.setId(-1);
622  tmp.setFeatures(std::vector<cv::KeyPoint>(), std::vector<cv::Point3f>(), cv::Mat());// remove features
623  _dataBuffer.push_back(OdometryEvent(tmp, odomEvent.pose(), odomInfo));
624  }
625  else
626  {
627  _dataBuffer.push_back(OdometryEvent(odomEvent.data(), odomEvent.pose(), odomInfo));
628  }
629  UINFO("Added data %d", odomEvent.data().id());
630 
631  covariance_ = cv::Mat();
632  while(_dataBufferMaxSize > 0 && _dataBuffer.size() > _dataBufferMaxSize)
633  {
634  if(_rate > 0.0f)
635  {
636  ULOGGER_WARN("Data buffer is full, the oldest data is removed to add the new one.");
637  }
638  _dataBuffer.pop_front();
639  notify = false;
640  }
641 
642  if(notify)
643  {
645  }
646  }
647 }
648 
650 {
651  ULOGGER_DEBUG("");
652 
653  ULOGGER_INFO("waiting for data");
655  ULOGGER_INFO("wake-up");
656 
657  bool dataFilled = false;
658  bool triggerNewMap = false;
659  _dataMutex.lock();
660  {
661  if(_state.empty() && !_dataBuffer.empty())
662  {
663  data = _dataBuffer.front();
664  _dataBuffer.pop_front();
665 
667  {
668  if(!_userData.empty())
669  {
670  data.data().setUserData(_userData);
671  _userData = cv::Mat();
672  }
673  }
675 
676  while(_newMapEvents.size() && _newMapEvents.front() <= data.data().stamp())
677  {
678  UWARN("Triggering new map %f<=%f...", _newMapEvents.front() , data.data().stamp());
679  triggerNewMap = true;
680  _newMapEvents.pop_front();
681  }
682 
683  dataFilled = true;
684  }
685  }
686  _dataMutex.unlock();
687 
688  if(triggerNewMap)
689  {
691  }
692 
693  return dataFilled;
694 }
695 
696 } /* namespace rtabmap */
int getCode() const
Definition: UEvent.h:74
const UVariant & value2() const
Definition: RtabmapEvent.h:114
SensorData & data()
Definition: OdometryEvent.h:69
static bool parse(const ParametersMap &parameters, const std::string &key, bool &value)
Definition: Parameters.cpp:446
void get3DMap(std::map< int, Signature > &signatures, std::map< int, Transform > &poses, std::multimap< int, Link > &constraints, bool optimized, bool global) const
Definition: Rtabmap.cpp:3670
void release(int n=1)
Definition: USemaphore.h:168
bool isRGBDMode() const
Definition: Rtabmap.h:102
void dumpData() const
Definition: Rtabmap.cpp:3181
cv::Mat odomCovariance
Definition: CameraInfo.h:69
Definition: UTimer.h:46
std::list< OdometryEvent > _dataBuffer
bool isBool() const
Definition: UVariant.h:63
Definition: UEvent.h:57
void clearPath(int status)
Definition: Rtabmap.cpp:4139
int lock() const
Definition: UMutex.h:87
void exportPoses(const std::string &path, bool optimized, bool global, int format)
Definition: Rtabmap.cpp:791
double elapsed()
Definition: UTimer.h:75
f
#define ULOGGER_INFO(...)
Definition: ULogger.h:54
Definition: lz4.c:365
bool computePath(int targetNode, bool global)
Definition: Rtabmap.cpp:4157
string cmd
const UVariant & value3() const
Definition: RtabmapEvent.h:115
std::pair< std::string, std::string > ParametersPair
Definition: Parameters.h:42
void generateDOTGraph(const std::string &path, int id=0, int margin=5)
Definition: Rtabmap.cpp:759
bool UTILITE_EXP uStr2Bool(const char *str)
bool labelLocation(int id, const std::string &label)
Definition: Rtabmap.cpp:719
OdometryInfo copyWithoutData() const
Definition: OdometryInfo.h:62
void kill()
Definition: UThread.cpp:48
unsigned int _dataBufferMaxSize
bool isRunning() const
Definition: UThread.cpp:245
GLM_FUNC_DECL genType e()
std::map< std::string, std::string > ParametersMap
Definition: Parameters.h:41
std::string UTILITE_EXP uBool2Str(bool boolean)
const UVariant & value1() const
Definition: RtabmapEvent.h:113
void setId(int id)
Definition: SensorData.h:153
std::vector< float > odomVelocity
Definition: CameraInfo.h:70
Some conversion functions.
bool acquire(int n=1, int ms=0)
Definition: USemaphore.h:101
void setUserData(const cv::Mat &userData)
Definition: SensorData.cpp:452
void getGraph(std::map< int, Transform > &poses, std::multimap< int, Link > &constraints, bool optimized, bool global, std::map< int, Signature > *signatures=0)
Definition: Rtabmap.cpp:3759
int triggerNewMap()
Definition: Rtabmap.cpp:685
#define UFATAL(...)
double getElapsedTime()
Definition: UTimer.cpp:90
void post(UEvent *event, bool async=true) const
bool isIdentity() const
Definition: Transform.cpp:136
virtual void mainLoopBegin()
bool uIsFinite(const T &value)
Definition: UMath.h:55
#define UASSERT(condition)
Wrappers of STL for convenient functions.
const cv::Mat & data() const
Definition: UserDataEvent.h:50
const Transform & pose() const
Definition: OdometryEvent.h:71
void close(bool databaseSaved=true, const std::string &ouputDatabasePath="")
Definition: Rtabmap.cpp:348
bool isNull() const
Definition: Transform.cpp:107
#define ULOGGER_DEBUG(...)
Definition: ULogger.h:53
virtual std::string getClassName() const =0
bool isInt() const
Definition: UVariant.h:68
void publishMap(bool optimized, bool full, bool graphOnly) const
bool isStr() const
Definition: UVariant.h:72
bool getData(OdometryEvent &data)
int getSignatureIdByLabel(const std::string &label, bool lookInDatabase=true) const
Definition: Memory.cpp:2171
const Statistics & getStatistics() const
Definition: Rtabmap.cpp:631
static void registerCurrentThread(const std::string &name)
Definition: ULogger.cpp:218
bool toBool() const
Definition: UVariant.cpp:97
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.
Definition: Rtabmap.cpp:897
virtual void mainLoopKill()
const UVariant & value4() const
Definition: RtabmapEvent.h:116
void start()
Definition: UTimer.cpp:80
int id() const
Definition: SensorData.h:152
const OdometryInfo & info() const
Definition: OdometryEvent.h:89
void init(const ParametersMap &parameters, const std::string &databasePath="")
Definition: Rtabmap.cpp:282
double stamp() const
Definition: SensorData.h:154
RecoveryProgressState state
void parseParameters(const ParametersMap &parameters)
Definition: Rtabmap.cpp:405
const cv::Mat & covariance() const
Definition: OdometryEvent.h:72
bool isUInt() const
Definition: UVariant.h:69
#define false
Definition: ConvertUTF.c:56
void setDetectorRate(float rate)
#define UDEBUG(...)
int getPathStatus() const
Definition: Rtabmap.h:172
const CameraInfo & info() const
Definition: CameraEvent.h:81
void resetMemory()
Definition: Rtabmap.cpp:829
const std::vector< std::pair< int, Transform > > & getPath() const
Definition: Rtabmap.h:176
int unlock() const
Definition: UMutex.h:113
#define UERROR(...)
void setDataBufferSize(unsigned int bufferSize)
#define ULOGGER_WARN(...)
Definition: ULogger.h:55
void dumpPrediction() const
Definition: Rtabmap.cpp:3612
ULogger class and convenient macros.
#define UWARN(...)
const Memory * getMemory() const
Definition: Rtabmap.h:124
void close(bool databaseSaved, const std::string &databasePath="")
std::string toStr(bool *ok=0) const
Definition: UVariant.cpp:586
void addData(const OdometryEvent &odomEvent)
void createIntermediateNodes(bool enabled)
virtual bool handleEvent(UEvent *anEvent)
RegistrationInfo reg
Definition: OdometryInfo.h:91
std::queue< ParametersMap > _stateParam
const SensorData & data() const
Definition: CameraEvent.h:79
std::vector< float > velocity() const
Definition: OdometryEvent.h:73
bool isIncremental() const
Definition: Memory.h:200
static void removeHandler(UEventsHandler *handler)
void join(bool killFirst=false)
Definition: UThread.cpp:85
std::list< double > _newMapEvents
bool isUndef() const
Definition: UVariant.h:62
void pushNewState(State newState, const ParametersMap &parameters=ParametersMap())
Transform odomPose
Definition: CameraInfo.h:68
RtabmapThread(Rtabmap *rtabmap)
void setFeatures(const std::vector< cv::KeyPoint > &keypoints, const std::vector< cv::Point3f > &keypoints3D, const cv::Mat &descriptors)
Definition: SensorData.cpp:828
void addStatistic(const std::string &name, float value)
Definition: Statistics.cpp:90
std::queue< State > _state
#define UINFO(...)


rtabmap
Author(s): Mathieu Labbe
autogenerated on Wed Jun 5 2019 22:41:32