MRPT  2.0.1
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-2020, 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 
33  mrpt::serialization::CArchive& in, uint8_t version)
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  o << "Sample rate : " << sample_rate << " Hz"
57  << "\n";
58  o << "Analog IN Channel count : " << AIN_channel_count << "\n";
59  o << "Analog IN interleaved? : " << (AIN_interleaved ? "yes" : "no")
60  << "\n";
61 
62 #define RAWDAQ_SHOW_FIRSTS(_VEC) \
63  o << "Raw data in " #_VEC " (" << (_VEC).size() \
64  << " entries): First values ["; \
65  if (!(_VEC).empty()) \
66  { \
67  for (size_t i = 1; \
68  i <= std::min((_VEC).size(), static_cast<size_t>(10)); i++) \
69  o << (_VEC)[i - 1] << " "; \
70  o << " ... "; \
71  } \
72  o << "]\n";
73 
74  RAWDAQ_SHOW_FIRSTS(AIN_8bits)
75  RAWDAQ_SHOW_FIRSTS(AIN_16bits)
76  RAWDAQ_SHOW_FIRSTS(AIN_32bits)
77  RAWDAQ_SHOW_FIRSTS(AIN_float)
78  RAWDAQ_SHOW_FIRSTS(AIN_double)
79  RAWDAQ_SHOW_FIRSTS(AOUT_8bits)
80  RAWDAQ_SHOW_FIRSTS(AOUT_16bits)
81  RAWDAQ_SHOW_FIRSTS(AOUT_float)
82  RAWDAQ_SHOW_FIRSTS(AOUT_double)
84  RAWDAQ_SHOW_FIRSTS(DOUT)
85  RAWDAQ_SHOW_FIRSTS(CNTRIN_32bits)
86  RAWDAQ_SHOW_FIRSTS(CNTRIN_double)
87 
88  o << "\n";
89 }
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.
#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:54
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
mrpt::vision::TStereoCalibResults out
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:43
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 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020