Main MRPT website > C++ reference for MRPT 1.9.9
CObservationWindSensor.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 
13 #include <mrpt/utils/CStream.h>
14 
15 using namespace mrpt::obs;
16 using namespace mrpt::utils;
17 using namespace mrpt::poses;
18 
19 // This must be added to any CSerializable class implementation file.
21 
22 /** Constructor
23  */
24 CObservationWindSensor::CObservationWindSensor() : speed(0.0), direction(0.0) {}
25 /*---------------------------------------------------------------
26  Implements the writing to a CStream capability of CSerializable objects
27  ---------------------------------------------------------------*/
29  mrpt::utils::CStream& out, int* version) const
30 {
31  MRPT_UNUSED_PARAM(out);
32  if (version)
33  *version = 3;
34  else
35  {
36  // The data
37  out << speed << direction << sensorLabel << timestamp
38  << sensorPoseOnRobot;
39  }
40 }
41 
42 /*---------------------------------------------------------------
43  Implements the reading from a CStream capability of CSerializable objects
44  ---------------------------------------------------------------*/
46  mrpt::utils::CStream& in, int version)
47 {
48  // MRPT_UNUSED_PARAM(in);
49  switch (version)
50  {
51  case 0:
52  case 1:
53  case 2:
54  case 3:
55  {
56  in >> speed >> direction;
57  if (version >= 1)
58  in >> sensorLabel;
59  else
60  sensorLabel = "";
61 
62  if (version >= 2)
63  in >> timestamp;
64  else
65  timestamp = INVALID_TIMESTAMP;
66 
67  if (version >= 3)
68  in >> sensorPoseOnRobot;
69  else
70  sensorPoseOnRobot = CPose3D();
71  }
72  break;
73  default:
75  };
76 }
77 
79 {
80  out_sensorPose = sensorPoseOnRobot;
81 }
82 
84 {
85  sensorPoseOnRobot = newSensorPose;
86 }
87 
89 {
91 }
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const override
A general method to retrieve the sensor pose on the robot.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
#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.
This namespace contains representation of robot actions and observations.
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:16
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:41
GLuint in
Definition: glext.h:7274
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) override
A general method to change the sensor pose on the robot.
Declares a class derived from "CObservation" that represents the wind measurements taken on the robot...
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: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019