Main MRPT website > C++ reference for MRPT 1.9.9
CRawlog.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "obs-precomp.h" // Precompiled headers
11 
12 #include <mrpt/system/filesystem.h>
13 #include <mrpt/obs/CRawlog.h>
17 #include <mrpt/utils/CStream.h>
18 
19 using namespace mrpt;
20 using namespace mrpt::obs;
21 using namespace mrpt::utils;
22 using namespace mrpt::poses;
23 using namespace mrpt::utils;
24 using namespace mrpt::system;
25 
27 
28 // ctor
29 CRawlog::CRawlog() : m_seqOfActObs(), m_commentTexts() {}
30 // dtor
33 {
34  m_seqOfActObs.clear();
35  m_commentTexts.text.clear();
36 }
37 
39 {
40  m_seqOfActObs.push_back(
41  std::dynamic_pointer_cast<CSerializable>(
42  observations.duplicateGetSmartPtr()));
43 }
44 
46 {
47  m_seqOfActObs.push_back(
48  std::dynamic_pointer_cast<CSerializable>(
49  actions.duplicateGetSmartPtr()));
50 }
51 
53 {
54  m_seqOfActObs.push_back(action);
55 }
56 
58  const CSensoryFrame::Ptr& observations)
59 {
60  m_seqOfActObs.push_back(observations);
61 }
63 {
64  m_seqOfActObs.push_back(obj);
65 }
66 
68  const CObservation::Ptr& observation)
69 {
70  if (IS_CLASS(observation, CObservationComment))
71  {
73  std::dynamic_pointer_cast<CObservationComment>(observation);
74  m_commentTexts = *o;
75  }
76  else
77  m_seqOfActObs.push_back(observation);
78 }
79 
81 {
83  mrpt::make_aligned_shared<CActionCollection>();
84  temp->insert(action);
85  m_seqOfActObs.push_back(temp);
86 }
87 
88 size_t CRawlog::size() const { return m_seqOfActObs.size(); }
90 {
92 
93  if (index >= m_seqOfActObs.size()) THROW_EXCEPTION("Index out of bounds")
94 
95  CSerializable::Ptr obj = m_seqOfActObs[index];
96 
97  if (obj->GetRuntimeClass() == CLASS_ID(CActionCollection))
98  return std::dynamic_pointer_cast<CActionCollection>(obj);
99  else
101  "Element at index %i is not a CActionCollection", (int)index);
102  MRPT_END
103 }
104 
106 {
107  MRPT_START
108 
109  if (index >= m_seqOfActObs.size()) THROW_EXCEPTION("Index out of bounds")
110 
111  CSerializable::Ptr obj = m_seqOfActObs[index];
112 
113  if (obj->GetRuntimeClass()->derivedFrom(CLASS_ID(CObservation)))
114  return std::dynamic_pointer_cast<CObservation>(obj);
115  else
117  "Element at index %i is not a CObservation", (int)index);
118  MRPT_END
119 }
120 
122 {
123  MRPT_START
124  if (index >= m_seqOfActObs.size()) THROW_EXCEPTION("Index out of bounds")
125 
126  return m_seqOfActObs[index];
127  MRPT_END
128 }
129 
131 {
132  MRPT_START
133  if (index >= m_seqOfActObs.size()) THROW_EXCEPTION("Index out of bounds")
134 
135  const CSerializable::Ptr& obj = m_seqOfActObs[index];
136 
137  if (obj->GetRuntimeClass()->derivedFrom(CLASS_ID(CObservation)))
138  return etObservation;
139  else if (obj->GetRuntimeClass() == CLASS_ID(CActionCollection))
140  return etActionCollection;
141  else if (obj->GetRuntimeClass() == CLASS_ID(CSensoryFrame))
142  return etSensoryFrame;
143  else
144  return etOther;
145 
146  MRPT_END
147 }
148 
150 {
151  MRPT_START
152  if (index >= m_seqOfActObs.size()) THROW_EXCEPTION("Index out of bounds")
153 
154  CSerializable::Ptr obj = m_seqOfActObs[index];
155 
156  if (obj->GetRuntimeClass()->derivedFrom(CLASS_ID(CSensoryFrame)))
157  return std::dynamic_pointer_cast<CSensoryFrame>(obj);
158  else
160  "Element at index %i is not a CSensoryFrame", (int)index);
161  MRPT_END
162 }
163 
164 void CRawlog::writeToStream(mrpt::utils::CStream& out, int* version) const
165 {
166  if (version)
167  *version = 1;
168  else
169  {
170  uint32_t i, n;
171  n = static_cast<uint32_t>(m_seqOfActObs.size());
172  out << n;
173  for (i = 0; i < n; i++) out << m_seqOfActObs[i];
174 
175  out << m_commentTexts;
176  }
177 }
178 
179 /*---------------------------------------------------------------
180  readFromStream
181  ---------------------------------------------------------------*/
183 {
184  switch (version)
185  {
186  case 0:
187  case 1:
188  {
189  uint32_t i, n;
190 
191  clear();
192 
193  in >> n;
194  m_seqOfActObs.resize(n);
195  for (i = 0; i < n; i++)
196  m_seqOfActObs[i] = CSerializable::Ptr(in.ReadObject());
197 
198  in >> m_commentTexts;
199  }
200  break;
201  default:
203  };
204 }
205 
207  const std::string& fileName, bool non_obs_objects_are_legal)
208 {
209  // Open for read.
210  CFileGZInputStream fs(fileName);
211  if (!fs.fileOpenCorrectly()) return false;
212 
213  clear(); // Clear first
214 
215  // OK: read objects:
216  bool keepReading = true;
217  while (keepReading)
218  {
219  CSerializable::Ptr newObj;
220  try
221  {
222  fs >> newObj;
223  bool add_obj = false;
224  // Check type:
225  if (newObj->GetRuntimeClass() == CLASS_ID(CRawlog))
226  {
227  // It is an entire object: Copy and finish:
228  CRawlog::Ptr ao = std::dynamic_pointer_cast<CRawlog>(newObj);
229  this->swap(*ao);
230  return true;
231  }
232  else if (
233  newObj->GetRuntimeClass()->derivedFrom(CLASS_ID(CObservation)))
234  {
235  if (IS_CLASS(newObj, CObservationComment))
236  {
238  std::dynamic_pointer_cast<CObservationComment>(newObj);
239  m_commentTexts = *o;
240  }
241  else
242  {
243  add_obj = true;
244  }
245  }
246  else if (newObj->GetRuntimeClass() == CLASS_ID(CSensoryFrame))
247  {
248  add_obj = true;
249  }
250  else if (newObj->GetRuntimeClass() == CLASS_ID(CActionCollection))
251  {
252  add_obj = true;
253  }
254  else
255  {
256  // Other classes:
257  if (non_obs_objects_are_legal)
258  {
259  add_obj = true;
260  }
261  else
262  {
263  keepReading = false;
264  }
265  }
266  if (add_obj) m_seqOfActObs.push_back(newObj);
267  }
269  { // EOF, just finish the loop
270  keepReading = false;
271  }
272  catch (std::exception& e)
273  {
274  std::cerr << e.what() << std::endl;
275  keepReading = false;
276  }
277  catch (...)
278  {
279  keepReading = false;
280  }
281  }
282  return true;
283 }
284 
285 void CRawlog::remove(size_t index)
286 {
287  MRPT_START
288  if (index >= m_seqOfActObs.size()) THROW_EXCEPTION("Index out of bounds")
289  m_seqOfActObs.erase(m_seqOfActObs.begin() + index);
290  MRPT_END
291 }
292 
293 void CRawlog::remove(size_t first_index, size_t last_index)
294 {
295  MRPT_START
296  if (first_index >= m_seqOfActObs.size() ||
297  last_index >= m_seqOfActObs.size())
298  THROW_EXCEPTION("Index out of bounds")
299  m_seqOfActObs.erase(
300  m_seqOfActObs.begin() + first_index,
301  m_seqOfActObs.begin() + last_index + 1);
302  MRPT_END
303 }
304 
305 bool CRawlog::saveToRawLogFile(const std::string& fileName) const
306 {
307  try
308  {
309  CFileGZOutputStream f(fileName);
310  if (!m_commentTexts.text.empty()) f << m_commentTexts;
311  for (size_t i = 0; i < m_seqOfActObs.size(); i++)
312  f << *m_seqOfActObs[i];
313  return true;
314  }
315  catch (...)
316  {
317  return false;
318  }
319 }
320 
322 {
323  MRPT_START
324  if (this == &obj) return;
325  clear();
326  m_commentTexts = obj.m_commentTexts;
327  m_seqOfActObs = obj.m_seqOfActObs;
328  obj.m_seqOfActObs.clear();
329  obj.m_commentTexts.text.clear();
330  MRPT_END
331 }
332 
334 {
335  if (this == &obj) return;
336  m_seqOfActObs.swap(obj.m_seqOfActObs);
337  std::swap(m_commentTexts, obj.m_commentTexts);
338 }
339 
341  CStream& inStream, CActionCollection::Ptr& action,
342  CSensoryFrame::Ptr& observations, size_t& rawlogEntry)
343 {
344  try
345  {
346  // Load pose change from the rawlog:
347  action.reset();
348  while (!action)
349  {
351  inStream >> obj;
352  if (obj->GetRuntimeClass() == CLASS_ID(CActionCollection))
353  {
354  action = std::dynamic_pointer_cast<CActionCollection>(obj);
355  }
356  else
357  {
358  obj.reset();
359  }
360  rawlogEntry++;
361  };
362 
363  // Load sensory frame from the rawlog:
364  observations.reset();
365  while (!observations)
366  {
368  inStream >> obj;
369  if (obj->GetRuntimeClass() == CLASS_ID(CSensoryFrame))
370  {
371  observations = std::dynamic_pointer_cast<CSensoryFrame>(obj);
372  }
373  else
374  {
375  obj.reset();
376  }
377  rawlogEntry++;
378  }
379  return true;
380  }
381  catch (CExceptionEOF&)
382  {
383  return false;
384  }
385  catch (std::exception& e)
386  {
387  std::cerr << "[CRawlog::readActionObservationPair] Found exception:"
388  << std::endl
389  << e.what() << std::endl;
390  return false;
391  }
392  catch (...)
393  {
394  std::cerr << "Untyped exception reading rawlog file!!" << std::endl;
395  return false;
396  }
397 }
398 
399 /*---------------------------------------------------------------
400  getActionObservationPairOrObservation
401  ---------------------------------------------------------------*/
403  CStream& inStream, CActionCollection::Ptr& action,
404  CSensoryFrame::Ptr& observations, CObservation::Ptr& observation,
405  size_t& rawlogEntry)
406 {
407  try
408  {
409  // Load pose change from the rawlog:
410  observations.reset();
411  observation.reset();
412  action.reset();
413  while (!action)
414  {
416  inStream >> obj;
418  {
419  action = std::dynamic_pointer_cast<CActionCollection>(obj);
420  }
421  else if (IS_DERIVED(obj, CObservation))
422  {
423  observation = std::dynamic_pointer_cast<CObservation>(obj);
424  rawlogEntry++;
425  return true;
426  }
427  else
428  obj.reset();
429  rawlogEntry++;
430  };
431 
432  // Load sensory frame from the rawlog:
433  observations.reset();
434  while (!observations)
435  {
437  inStream >> obj;
438  if (obj->GetRuntimeClass() == CLASS_ID(CSensoryFrame))
439  {
440  observations = std::dynamic_pointer_cast<CSensoryFrame>(obj);
441  }
442  rawlogEntry++;
443  }
444  return true;
445  }
446  catch (CExceptionEOF&)
447  {
448  return false;
449  }
450  catch (std::exception& e)
451  {
452  std::cerr << "[CRawlog::readActionObservationPair] Found exception:"
453  << std::endl
454  << e.what() << std::endl;
455  return false;
456  }
457  catch (...)
458  {
459  std::cerr << "Untyped exception reading rawlog file!!" << std::endl;
460  return false;
461  }
462 }
463 
466  const mrpt::utils::TRuntimeClassId* class_type,
467  TListTimeAndObservations& out_found, size_t guess_start_position) const
468 {
469  MRPT_UNUSED_PARAM(guess_start_position);
470  MRPT_START
471 
472  out_found.clear();
473 
474  if (m_seqOfActObs.empty()) return;
475 
476  // Find the first appearance of time_start:
477  // ---------------------------------------------------
478  TListObjects::const_iterator first = m_seqOfActObs.begin();
479  const TListObjects::const_iterator last = m_seqOfActObs.end();
480  {
481  // The following is based on lower_bound:
482  size_t count, step;
483  count = std::distance(first, last);
484  while (count > 0)
485  {
487  step = count / 2;
488  std::advance(it, step);
489 
490  // The comparison function:
491  TTimeStamp this_timestamp;
492  if ((*it)->GetRuntimeClass()->derivedFrom(CLASS_ID(CObservation)))
493  {
495  std::dynamic_pointer_cast<CObservation>(*it);
496  this_timestamp = o->timestamp;
497  ASSERT_(this_timestamp != INVALID_TIMESTAMP);
498  }
499  else
501  "Element found which is not derived from CObservation");
502 
503  if (this_timestamp < time_start) // *it < time_start
504  {
505  first = ++it;
506  count -= step + 1;
507  }
508  else
509  count = step;
510  }
511  // "first" is our guy
512  }
513 
514  // Iterate until we get out of the time window:
515  while (first != last)
516  {
517  TTimeStamp this_timestamp;
518  if ((*first)->GetRuntimeClass()->derivedFrom(CLASS_ID(CObservation)))
519  {
521  std::dynamic_pointer_cast<CObservation>(*first);
522  this_timestamp = o->timestamp;
523  ASSERT_(this_timestamp != INVALID_TIMESTAMP);
524 
525  if (this_timestamp < time_end)
526  {
527  if (o->GetRuntimeClass()->derivedFrom(class_type))
528  out_found.insert(TTimeObservationPair(this_timestamp, o));
529  }
530  else
531  {
532  break; // end of time window!
533  }
534  }
535  else
537  "Element found which is not derived from CObservation");
538 
539  first++;
540  }
541 
542  MRPT_END
543 }
544 
546  CActionCollection::Ptr& action, CSensoryFrame::Ptr& observations,
547  size_t& rawlogEntry) const
548 {
549  try
550  {
551  while (getType(rawlogEntry) != CRawlog::etActionCollection)
552  {
553  rawlogEntry++;
554  }
555  action = getAsAction(rawlogEntry++);
556 
557  while (getType(rawlogEntry) != CRawlog::etSensoryFrame)
558  {
559  rawlogEntry++;
560  }
561  observations = getAsObservations(rawlogEntry++);
562 
563  return true;
564  }
565  catch (std::exception&)
566  {
567  return false;
568  }
569  catch (...)
570  {
571  std::cerr << "Untyped exception getting act-obs pair from rawlog!!"
572  << std::endl;
573  return false;
574  }
575 }
576 
577 void CRawlog::getCommentText(std::string& t) const { t = m_commentTexts.text; }
578 std::string CRawlog::getCommentText() const { return m_commentTexts.text; }
580  mrpt::utils::CConfigFileMemory& memCfg) const
581 {
582  memCfg.setContent(m_commentTexts.text);
583 }
584 
585 void CRawlog::setCommentText(const std::string& t) { m_commentTexts.text = t; }
587 {
588  const std::string rawlog_path = extractFileDirectory(str);
589  std::string temptative_img_path =
590  rawlog_path + extractFileName(str) + std::string("_Images");
591  if (mrpt::system::fileExists(temptative_img_path))
592  return temptative_img_path;
593  else if (
595  temptative_img_path =
596  (rawlog_path + extractFileName(str) + std::string("_images"))))
597  return temptative_img_path;
598  else if (
600  temptative_img_path =
601  (rawlog_path + extractFileName(str) + std::string("_IMAGES"))))
602  return temptative_img_path;
603  else
604  return rawlog_path + "Images";
605 }
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:32
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
Definition: CRawlog.cpp:182
GLuint GLuint GLsizei count
Definition: glext.h:3528
This "observation" is actually a placeholder for a text block with comments or additional parameters ...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
GLdouble GLdouble t
Definition: glext.h:3689
std::shared_ptr< CRawlog > Ptr
Definition: CRawlog.h:70
bool getActionObservationPair(CActionCollection::Ptr &action, CSensoryFrame::Ptr &observations, size_t &rawlogEntry) const
Gets the next consecutive pair action / observation from the rawlog loaded into this object...
Definition: CRawlog.cpp:545
static std::string detectImagesDirectory(const std::string &rawlogFilename)
Tries to auto-detect the external-images directory of the given rawlog file.
Definition: CRawlog.cpp:586
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
Definition: math_frwds.h:30
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:44
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
GLint * first
Definition: glext.h:3827
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
GLenum GLsizei n
Definition: glext.h:5074
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
Definition: filesystem.cpp:127
void addObservationsMemoryReference(const CSensoryFrame::Ptr &observations)
Add a set of observations to the sequence, using a smart pointer to the object to add...
Definition: CRawlog.cpp:57
void addActions(CActionCollection &action)
Add a set of actions to the sequence; the object is duplicated, so the original one can be freed if d...
Definition: CRawlog.cpp:45
const Scalar * const_iterator
Definition: eigen_plugins.h:27
void addObservations(CSensoryFrame &observations)
Add a set of observations to the sequence; the object is duplicated, so the original one can be free ...
Definition: CRawlog.cpp:38
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
void clear()
Clear the contents of this container.
Definition: ts_hash_map.h:189
Declares a class for storing a collection of robot actions.
void addGenericObject(const mrpt::utils::CSerializable::Ptr &obj)
Generic add for a smart pointer to a CSerializable object:
Definition: CRawlog.cpp:62
bool saveToRawLogFile(const std::string &fileName) const
Saves the contents to a rawlog-file, compatible with RawlogViewer (As the sequence of internal object...
Definition: CRawlog.cpp:305
CActionCollection::Ptr getAsAction(size_t index) const
Returns the i&#39;th element in the sequence, as being actions, where index=0 is the first object...
Definition: CRawlog.cpp:89
This class implements a config file-like interface over a memory-stored string list.
std::string getCommentText() const
Returns the block of comment text for the rawlog.
Definition: CRawlog.cpp:578
#define IS_DERIVED(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is an i...
Definition: CObject.h:109
bool loadFromRawLogFile(const std::string &fileName, bool non_obs_objects_are_legal=false)
Load the contents from a file containing one of these possibilities:
Definition: CRawlog.cpp:206
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
mrpt::utils::CSerializable::Ptr getAsGeneric(size_t index) const
Returns the i&#39;th element in the sequence, being its class whatever.
Definition: CRawlog.cpp:121
#define CLASS_ID(T)
Access to runtime class ID for a defined class name.
Definition: CObject.h:85
#define MRPT_END
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
CObservation::Ptr getAsObservation(size_t index) const
Returns the i&#39;th element in the sequence, as being an observation, where index=0 is the first object...
Definition: CRawlog.cpp:105
GLuint index
Definition: glext.h:4054
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void findObservationsByClassInRange(mrpt::system::TTimeStamp time_start, mrpt::system::TTimeStamp time_end, const mrpt::utils::TRuntimeClassId *class_type, TListTimeAndObservations &out_found, size_t guess_start_position=0) const
Returns the sub-set of observations of a given class whose time-stamp t fulfills time_start <= t < ti...
Definition: CRawlog.cpp:464
Transparently opens a compressed "gz" file and reads uncompressed data from it.
static bool getActionObservationPairOrObservation(mrpt::utils::CStream &inStream, CActionCollection::Ptr &action, CSensoryFrame::Ptr &observations, CObservation::Ptr &observation, size_t &rawlogEntry)
Reads a consecutive pair action/sensory_frame OR an observation, depending of the rawlog format...
Definition: CRawlog.cpp:402
This class stores a rawlog (robotic datasets) in one of two possible formats:
Definition: CRawlog.h:68
This namespace contains representation of robot actions and observations.
std::multimap< mrpt::system::TTimeStamp, CObservation::Ptr > TListTimeAndObservations
For usage with CRawlog classes.
Definition: CRawlog.h:27
Declares a class for storing a "sensory frame", a set of "observations" taken by the robot approximat...
Definition: CSensoryFrame.h:54
std::shared_ptr< CSensoryFrame > Ptr
Definition: CSensoryFrame.h:56
void moveFrom(CRawlog &obj)
Efficiently copy the contents from other existing object, and remove the data from the origin (after ...
Definition: CRawlog.cpp:321
mrpt::utils::CObject::Ptr duplicateGetSmartPtr() const
Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object w...
Definition: CObject.h:179
void setCommentText(const std::string &t)
Changes the block of comment text for the rawlog.
Definition: CRawlog.cpp:585
std::shared_ptr< CObservation > Ptr
Definition: CObservation.h:43
GLsizei const GLchar ** string
Definition: glext.h:4101
Used in mrpt::utils::CStream.
Definition: exceptions.h:39
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
CSensoryFrame::Ptr getAsObservations(size_t index) const
Returns the i&#39;th element in the sequence, as being an action, where index=0 is the first object...
Definition: CRawlog.cpp:149
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
Definition: datetime.h:16
std::shared_ptr< CSerializable > Ptr
Definition: CSerializable.h:47
void remove(size_t index)
Delete the action or observation stored in the given index.
Definition: CRawlog.cpp:285
Declares a class for storing a robot action.
Definition: CAction.h:28
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
Definition: CRawlog.cpp:164
#define MRPT_START
void addActionsMemoryReference(const CActionCollection::Ptr &action)
Add a set of actions to the sequence, using a smart pointer to the object to add. ...
Definition: CRawlog.cpp:52
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
Definition: CObservation.h:58
std::shared_ptr< CActionCollection > Ptr
#define CFileGZOutputStream
Saves data to a file and transparently compress the data using the given compression level...
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:41
bool fileOpenCorrectly()
Returns true if the file was open without errors.
TEntryType
The type of each entry in a rawlog.
Definition: CRawlog.h:95
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
Definition: CObject.h:103
GLuint in
Definition: glext.h:7274
#define ASSERT_(f)
void swap(CRawlog &obj)
Efficiently swap the contents of two existing objects.
Definition: CRawlog.cpp:333
void clear()
Clear the sequence of actions/observations.
Definition: CRawlog.cpp:32
TEntryType getType(size_t index) const
Returns the type of a given element.
Definition: CRawlog.cpp:130
std::shared_ptr< CObservationComment > Ptr
void addAction(CAction &action)
Add an action to the sequence: a collection of just one element is created.
Definition: CRawlog.cpp:80
A structure that holds runtime class type information.
Definition: CObject.h:31
std::string extractFileName(const std::string &filePath)
Extract just the name (without extension) of a filename from a complete path plus name plus extension...
Definition: filesystem.cpp:61
unsigned __int32 uint32_t
Definition: rptypes.h:47
size_t size() const
Returns the number of actions / observations object in the sequence.
Definition: CRawlog.cpp:88
virtual ~CRawlog()
Destructor:
Definition: CRawlog.cpp:31
std::string extractFileDirectory(const std::string &filePath)
Extract the whole path (the directory) of a filename from a complete path plus name plus extension...
Definition: filesystem.cpp:77
void setContent(const utils::CStringList &stringList)
Changes the contents of the virtual "config file".
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
Definition: geometry.cpp:1885
static bool readActionObservationPair(mrpt::utils::CStream &inStream, CActionCollection::Ptr &action, CSensoryFrame::Ptr &observations, size_t &rawlogEntry)
Reads a consecutive pair action / observation from the rawlog opened at some input stream...
Definition: CRawlog.cpp:340
std::pair< mrpt::system::TTimeStamp, CObservation::Ptr > TTimeObservationPair
For usage with CRawlog classes.
Definition: CRawlog.h:24
void getCommentTextAsConfigFile(mrpt::utils::CConfigFileMemory &memCfg) const
Saves the block of comment text for the rawlog into the passed config file object.
Definition: CRawlog.cpp:579
void addObservationMemoryReference(const CObservation::Ptr &observation)
Add a single observation to the sequence, using a smart pointer to the object to add.
Definition: CRawlog.cpp:67



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019