MRPT  1.9.9
CObservationRawDAQ.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://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)
To be added to all CSerializable-classes implementation files.
#define RAWDAQ_SHOW_FIRSTS(_VEC)
STL namespace.
unsigned char uint8_t
Definition: rptypes.h:44
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:97
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:53
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:7391
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: 8a2d96f36 Mon Jul 15 00:01:58 2019 +0200 at lun jul 15 00:10:13 CEST 2019