Main MRPT website > C++ reference for MRPT 1.5.9
CObservation6DFeatures.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 
12 
13 #include <mrpt/utils/CStream.h>
15 #include <mrpt/system/os.h>
17 
18 using namespace mrpt::obs;
19 using namespace mrpt::utils;
20 using namespace mrpt::poses;
21 
22 
23 // This must be added to any CSerializable class implementation file.
25 
26 /** Default constructor */
28  minSensorDistance ( 0 ),
29  maxSensorDistance ( 1e6f )
30 {
31 }
32 
35 {
36 }
37 
38 
39 /*---------------------------------------------------------------
40  Implements the writing to a CStream capability of CSerializable objects
41  ---------------------------------------------------------------*/
43 {
44  if (version)
45  *version = 0;
46  else
47  {
49 
50  const uint32_t n = sensedFeatures.size();
51  out << n;
52  for (uint32_t i=0;i<n;i++)
53  {
54  const TMeasurement & m = sensedFeatures[i];
55  out << m.pose << m.id << m.inf_matrix;
56  }
57 
58  out << sensorLabel
59  << timestamp;
60  }
61 }
62 
63 /*---------------------------------------------------------------
64  Implements the reading from a CStream capability of CSerializable objects
65  ---------------------------------------------------------------*/
67 {
68  switch(version)
69  {
70  case 0:
71  {
73 
74  uint32_t n;
75  in >> n;
76  sensedFeatures.clear();
77  sensedFeatures.resize(n);
78  for (uint32_t i=0;i<n;i++)
79  {
81  in >> m.pose >> m.id >> m.inf_matrix;
82  }
83 
84  in >> sensorLabel
85  >> timestamp;
86  } break;
87  default:
89  };
90 
91 }
92 
93 void CObservation6DFeatures::getSensorPose( CPose3D &out_sensorPose ) const
94 {
95  out_sensorPose = sensorPose;
96 }
97 
98 void CObservation6DFeatures::setSensorPose( const CPose3D &newSensorPose )
99 {
100  sensorPose = newSensorPose;
101 }
102 
104 {
105  using namespace std;
107 
108  o << "Sensor pose: " << sensorPose << endl;
109  o << "Min range : " << minSensorDistance << endl;
110  o << "Max range : " << maxSensorDistance << endl << endl;
111 
112  o << "Observation count : " << sensedFeatures.size() << endl << endl;
113 
114  for (size_t k=0;k<sensedFeatures.size();k++)
115  {
117  o << "#" << k << ": ID=" << m.id << "; value=" << m.pose << "; inf=" <<m.inf_matrix.inMatlabFormat() << endl;
118  }
119 }
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
GLenum GLsizei n
Definition: glext.h:4618
mrpt::poses::CPose3D sensorPose
The pose of the sensor on the robot/vehicle.
STL namespace.
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
float maxSensorDistance
Information about the sensor.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
mrpt::poses::CPose3D pose
The observed feature SE(3) pose with respect to the sensor.
This namespace contains representation of robot actions and observations.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
int version
Definition: mrpt_jpeglib.h:898
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const MRPT_OVERRIDE
A general method to retrieve the sensor pose on the robot.
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...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) MRPT_OVERRIDE
A general method to change the sensor pose on the robot.
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp. Where available, this should contain the accurate satellite-based time...
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.
An observation of one or more "features" or "objects", possibly identified with a unique ID...
This file implements matrix/vector text and binary serialization.
GLuint id
Definition: glext.h:3770
mrpt::math::CMatrixDouble66 inf_matrix
The inverse of the observation covariance matrix (default:all zeros)
GLuint in
Definition: glext.h:6301
#define INVALID_LANDMARK_ID
Used for CObservationBearingRange::TMeasurement::beaconID and others.
int32_t id
The feature ID, or INVALID_LANDMARK_ID if unidentified (default)
mrpt::aligned_containers< TMeasurement >::deque_t sensedFeatures
The list of observed features.
unsigned __int32 uint32_t
Definition: rptypes.h:49
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...
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.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020