Main MRPT website > C++ reference for MRPT 1.5.7
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 
20 // This must be added to any CSerializable class implementation file.
22 
23 /** Constructor
24  */
26  speed(0.0),
27  direction(0.0)
28 {
29 }
30 
31 /*---------------------------------------------------------------
32  Implements the writing to a CStream capability of CSerializable objects
33  ---------------------------------------------------------------*/
35 {
36  MRPT_UNUSED_PARAM(out);
37  if (version)
38  *version = 3;
39  else
40  {
41  // The data
42  out << speed
43  << direction
44  << sensorLabel
45  << timestamp
46  << sensorPoseOnRobot;
47  }
48 }
49 
50 /*---------------------------------------------------------------
51  Implements the reading from a CStream capability of CSerializable objects
52  ---------------------------------------------------------------*/
54 {
55  //MRPT_UNUSED_PARAM(in);
56  switch(version)
57  {
58  case 0:
59  case 1:
60  case 2:
61  case 3:
62  {
63  in >> speed
64  >> direction;
65  if (version>=1)
66  in >> sensorLabel;
67  else sensorLabel="";
68 
69  if (version>=2)
70  in >> timestamp;
71  else timestamp = INVALID_TIMESTAMP;
72 
73  if (version>=3)
74  in >> sensorPoseOnRobot;
75  else sensorPoseOnRobot = CPose3D();
76 
77  } break;
78  default:
80 
81  };
82 
83 }
84 
85 
86 
87 void CObservationWindSensor::getSensorPose( CPose3D &out_sensorPose ) const
88 {
89  out_sensorPose = sensorPoseOnRobot;
90 }
91 
92 void CObservationWindSensor::setSensorPose( const CPose3D &newSensorPose )
93 {
94  sensorPoseOnRobot = newSensorPose;
95 }
96 
97 
99 {
101 
102 }
103 
104 
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const MRPT_OVERRIDE
A general method to retrieve the sensor pose on the robot.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) MRPT_OVERRIDE
A general method to change the sensor pose on the robot.
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
void getDescriptionAsText(std::ostream &o) const MRPT_OVERRIDE
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
#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.
int version
Definition: mrpt_jpeglib.h:898
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:17
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
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:72
Declares a class that represents any robot&#39;s observation.
GLuint in
Definition: glext.h:6301
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.5.7 Git: 8277875f6 Mon Jun 11 02:47:32 2018 +0200 at lun oct 28 01:50:49 CET 2019