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



Page generated by Doxygen 1.8.11 for MRPT 1.5.7 Git: cdb1297 Tue Jun 12 13:44:11 2018 +0200 at mar jun 12 15:30:13 CEST 2018