MRPT  1.9.9
CObservation6DFeatures.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-2019, 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 
15 #include <mrpt/system/os.h>
16 
17 using namespace mrpt::obs;
18 using namespace mrpt::poses;
19 
20 // This must be added to any CSerializable class implementation file.
22 
23 /** Default constructor */
25 
26  = default;
27 
29 {
30 }
31 
35 {
37 
38  const uint32_t n = sensedFeatures.size();
39  out << n;
40  for (uint32_t i = 0; i < n; i++)
41  {
42  const TMeasurement& m = sensedFeatures[i];
43  out << m.pose << m.id << m.inf_matrix;
44  }
45 
46  out << sensorLabel << timestamp;
47 }
48 
51 {
52  switch (version)
53  {
54  case 0:
55  {
57 
58  uint32_t n;
59  in >> n;
60  sensedFeatures.clear();
61  sensedFeatures.resize(n);
62  for (uint32_t i = 0; i < n; i++)
63  {
65  in >> m.pose >> m.id >> m.inf_matrix;
66  }
67 
68  in >> sensorLabel >> timestamp;
69  }
70  break;
71  default:
73  };
74 }
75 
77 {
78  out_sensorPose = sensorPose;
79 }
80 
82 {
83  sensorPose = newSensorPose;
84 }
85 
87 {
88  using namespace std;
90 
91  o << "Sensor pose: " << sensorPose << endl;
92  o << "Min range : " << minSensorDistance << endl;
93  o << "Max range : " << maxSensorDistance << endl << endl;
94 
95  o << "Observation count : " << sensedFeatures.size() << endl << endl;
96 
97  for (size_t k = 0; k < sensedFeatures.size(); k++)
98  {
100  o << "#" << k << ": ID=" << m.id << "; value=" << m.pose
101  << "; inf=" << m.inf_matrix.inMatlabFormat() << endl;
102  }
103 }
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) override
A general method to change the sensor pose on the robot.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
GLenum GLsizei n
Definition: glext.h:5136
mrpt::poses::CPose3D sensorPose
The pose of the sensor on the robot/vehicle.
float minSensorDistance
Information about the sensor.
STL namespace.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
unsigned char uint8_t
Definition: rptypes.h:44
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:97
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
mrpt::poses::CPose3D pose
The observed feature SE(3) pose with respect to the sensor.
This namespace contains representation of robot actions and observations.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
std::deque< TMeasurement > sensedFeatures
The list of observed features.
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
Definition: CObservation.h:62
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
Definition: CObservation.h:60
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:53
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:84
Declares a class that represents any robot&#39;s observation.
Definition: CObservation.h:43
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:3920
mrpt::math::CMatrixDouble66 inf_matrix
The inverse of the observation covariance matrix (default:all zeros)
GLuint in
Definition: glext.h:7391
std::string inMatlabFormat(const std::size_t decimal_digits=6) const
Exports the matrix as a string compatible with Matlab/Octave.
#define INVALID_LANDMARK_ID
Used for CObservationBearingRange::TMeasurement::beaconID and others.
Definition: CObservation.h:27
int32_t id
The feature ID, or INVALID_LANDMARK_ID if unidentified (default)
unsigned __int32 uint32_t
Definition: rptypes.h:50
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const override
A general method to retrieve the sensor pose on the robot.
CObservation6DFeatures()
Default ctor.
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: 3316834cb Wed Aug 21 11:42:56 2019 +0200 at miƩ ago 21 11:50:11 CEST 2019