MRPT  1.9.9
CObservationRawDAQ.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-2018, 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 
14 #include <iostream>
15 
16 using namespace mrpt::obs;
17 using namespace mrpt::poses;
18 using namespace std;
19 
20 // This must be added to any CSerializable class implementation file.
22 
23 uint8_t CObservationRawDAQ::serializeGetVersion() const { return 0; }
25 {
26  out << sensorLabel << timestamp << sample_rate << AIN_8bits << AIN_16bits
27  << AIN_32bits << AIN_float << AIN_double << AIN_channel_count
28  << AIN_interleaved << AOUT_8bits << AOUT_16bits << AOUT_float
29  << AOUT_double << DIN << DOUT << CNTRIN_32bits << CNTRIN_double;
30 }
31 
34 {
35  switch (version)
36  {
37  case 0:
38  {
39  in >> sensorLabel >> timestamp >> sample_rate >> AIN_8bits >>
40  AIN_16bits >> AIN_32bits >> AIN_float >> AIN_double >>
41  AIN_channel_count >> AIN_interleaved >> AOUT_8bits >>
42  AOUT_16bits >> AOUT_float >> AOUT_double >> DIN >> DOUT >>
43  CNTRIN_32bits >> CNTRIN_double;
44  }
45  break;
46  default:
48  };
49 }
50 
51 void CObservationRawDAQ::getDescriptionAsText(std::ostream& o) const
52 {
53  using namespace std;
55 
56  cout << "Sample rate : " << sample_rate << " Hz" << endl;
57  cout << "Analog IN Channel count : " << AIN_channel_count << endl;
58  cout << "Analog IN interleaved? : " << (AIN_interleaved ? "yes" : "no")
59  << endl;
60 
61 #define RAWDAQ_SHOW_FIRSTS(_VEC) \
62  cout << "Raw data in " #_VEC " (" << _VEC.size() \
63  << " entries): First values ["; \
64  if (!_VEC.empty()) \
65  { \
66  for (size_t i = 1; \
67  i <= std::min(_VEC.size(), static_cast<size_t>(10)); i++) \
68  cout << _VEC[i - 1] << " "; \
69  cout << " ... "; \
70  } \
71  cout << "]\n";
72 
73  RAWDAQ_SHOW_FIRSTS(AIN_8bits)
74  RAWDAQ_SHOW_FIRSTS(AIN_16bits)
75  RAWDAQ_SHOW_FIRSTS(AIN_32bits)
76  RAWDAQ_SHOW_FIRSTS(AIN_float)
77  RAWDAQ_SHOW_FIRSTS(AIN_double)
78  RAWDAQ_SHOW_FIRSTS(AOUT_8bits)
79  RAWDAQ_SHOW_FIRSTS(AOUT_16bits)
80  RAWDAQ_SHOW_FIRSTS(AOUT_float)
81  RAWDAQ_SHOW_FIRSTS(AOUT_double)
83  RAWDAQ_SHOW_FIRSTS(DOUT)
84  RAWDAQ_SHOW_FIRSTS(CNTRIN_32bits)
85  RAWDAQ_SHOW_FIRSTS(CNTRIN_double)
86 
87  cout << endl;
88 }
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
#define RAWDAQ_SHOW_FIRSTS(_VEC)
STL namespace.
unsigned char uint8_t
Definition: rptypes.h:41
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:90
This namespace contains representation of robot actions and observations.
Store raw data from a Data Acquisition (DAQ) device, such that input or output analog and digital cha...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:52
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:43
GLuint in
Definition: glext.h:7274
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020