Main MRPT website > C++ reference for 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 }
mrpt::obs::CObservationRawDAQ
Store raw data from a Data Acquisition (DAQ) device, such that input or output analog and digital cha...
Definition: CObservationRawDAQ.h:32
mrpt::obs::CObservationRawDAQ::serializeTo
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Definition: CObservationRawDAQ.cpp:24
CObservationRawDAQ.h
obs-precomp.h
uint8_t
unsigned char uint8_t
Definition: rptypes.h:41
mrpt::poses
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CHierarchicalMapMHPartition.h:25
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
mrpt::serialization::CArchive
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:48
mrpt::obs::CObservation::getDescriptionAsText
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
Definition: CObservation.cpp:44
RAWDAQ_SHOW_FIRSTS
#define RAWDAQ_SHOW_FIRSTS(_VEC)
IMPLEMENTS_SERIALIZABLE
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
Definition: CSerializable.h:114
mrpt::obs::CObservationRawDAQ::getDescriptionAsText
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
Definition: CObservationRawDAQ.cpp:51
mrpt::obs::CObservation
Declares a class that represents any robot's observation.
Definition: CObservation.h:43
in
GLuint in
Definition: glext.h:7274
CArchive.h
MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:90
mrpt::obs::CObservationRawDAQ::serializeFrom
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
Definition: CObservationRawDAQ.cpp:32



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST