Main MRPT website > C++ reference for MRPT 1.9.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-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 <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  : minSensorDistance(0), maxSensorDistance(1e6f)
26 {
27 }
28 
30 {
31 }
32 
36 {
38 
39  const uint32_t n = sensedFeatures.size();
40  out << n;
41  for (uint32_t i = 0; i < n; i++)
42  {
43  const TMeasurement& m = sensedFeatures[i];
44  out << m.pose << m.id << m.inf_matrix;
45  }
46 
47  out << sensorLabel << timestamp;
48 }
49 
52 {
53  switch (version)
54  {
55  case 0:
56  {
58 
59  uint32_t n;
60  in >> n;
61  sensedFeatures.clear();
62  sensedFeatures.resize(n);
63  for (uint32_t i = 0; i < n; i++)
64  {
66  in >> m.pose >> m.id >> m.inf_matrix;
67  }
68 
69  in >> sensorLabel >> timestamp;
70  }
71  break;
72  default:
74  };
75 }
76 
78 {
79  out_sensorPose = sensorPose;
80 }
81 
83 {
84  sensorPose = newSensorPose;
85 }
86 
88 {
89  using namespace std;
91 
92  o << "Sensor pose: " << sensorPose << endl;
93  o << "Min range : " << minSensorDistance << endl;
94  o << "Max range : " << maxSensorDistance << endl << endl;
95 
96  o << "Observation count : " << sensedFeatures.size() << endl << endl;
97 
98  for (size_t k = 0; k < sensedFeatures.size(); k++)
99  {
101  o << "#" << k << ": ID=" << m.id << "; value=" << m.pose
102  << "; inf=" << m.inf_matrix.inMatlabFormat() << endl;
103  }
104 }
n
GLenum GLsizei n
Definition: glext.h:5074
os.h
mrpt::obs::CObservation::sensorLabel
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
Definition: CObservation.h:62
matrix_serialization.h
mrpt::obs::CObservation6DFeatures::sensorPose
mrpt::poses::CPose3D sensorPose
The pose of the sensor on the robot/vehicle.
Definition: CObservation6DFeatures.h:59
mrpt::obs::CObservation6DFeatures::sensedFeatures
mrpt::aligned_std_deque< TMeasurement > sensedFeatures
The list of observed features.
Definition: CObservation6DFeatures.h:56
INVALID_LANDMARK_ID
#define INVALID_LANDMARK_ID
Used for CObservationBearingRange::TMeasurement::beaconID and others.
Definition: CObservation.h:27
mrpt::obs::CObservation6DFeatures::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: CObservation6DFeatures.cpp:87
mrpt::obs::CObservation6DFeatures::TMeasurement::pose
mrpt::poses::CPose3D pose
The observed feature SE(3) pose with respect to the sensor.
Definition: CObservation6DFeatures.h:42
obs-precomp.h
mrpt::obs::CObservation6DFeatures::getSensorPose
void getSensorPose(mrpt::poses::CPose3D &out_sensorPose) const override
A general method to retrieve the sensor pose on the robot.
Definition: CObservation6DFeatures.cpp:77
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::CObservation6DFeatures::maxSensorDistance
float maxSensorDistance
Definition: CObservation6DFeatures.h:36
mrpt::obs
This namespace contains representation of robot actions and observations.
Definition: CParticleFilter.h:17
mrpt::obs::CObservation6DFeatures::serializeGetVersion
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
Definition: CObservation6DFeatures.cpp:33
mrpt::obs::CObservation::timestamp
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
Definition: CObservation.h:60
mrpt::serialization::CArchive
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:48
mrpt::obs::CObservation6DFeatures::serializeFrom
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
Definition: CObservation6DFeatures.cpp:50
mrpt::obs::CObservation6DFeatures::setSensorPose
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) override
A general method to change the sensor pose on the robot.
Definition: CObservation6DFeatures.cpp:82
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
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::obs::CObservation6DFeatures
An observation of one or more "features" or "objects", possibly identified with a unique ID,...
Definition: CObservation6DFeatures.h:28
id
GLuint id
Definition: glext.h:3909
mrpt::obs::CObservation6DFeatures::TMeasurement
Each one of the measurements.
Definition: CObservation6DFeatures.h:39
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::CObservation6DFeatures::minSensorDistance
float minSensorDistance
Information about the sensor.
Definition: CObservation6DFeatures.h:36
mrpt::obs::CObservation6DFeatures::TMeasurement::inf_matrix
mrpt::math::CMatrixDouble66 inf_matrix
The inverse of the observation covariance matrix (default:all zeros)
Definition: CObservation6DFeatures.h:47
mrpt::obs::CObservation6DFeatures::serializeTo
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Definition: CObservation6DFeatures.cpp:34
mrpt::obs::CObservation6DFeatures::TMeasurement::TMeasurement
TMeasurement()
Ctor with default values.
Definition: CObservation6DFeatures.cpp:29
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
CObservation6DFeatures.h
mrpt::obs::CObservation6DFeatures::TMeasurement::id
int32_t id
The feature ID, or INVALID_LANDMARK_ID if unidentified (default)
Definition: CObservation6DFeatures.h:44
uint32_t
unsigned __int32 uint32_t
Definition: rptypes.h:47



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