25 : sensedData(), auxEstimatePose()
35 out << minSensorDistance << maxSensorDistance << stdError;
36 n = sensedData.size();
38 for (i = 0; i <
n; i++)
39 out << sensedData[i].sensorLocationOnRobot
40 << sensedData[i].sensedDistance << sensedData[i].beaconID;
41 out << auxEstimatePose;
42 out << sensorLabel << timestamp;
58 in >> minSensorDistance >> maxSensorDistance >> stdError;
62 for (i = 0; i <
n; i++)
64 in >> sensedData[i].sensorLocationOnRobot >>
65 sensedData[i].sensedDistance;
67 sensedData[i].beaconID =
id;
70 if (version >= 1)
in >> auxEstimatePose;
90 printf(
"[CObservationBeaconRanges::debugPrintOut] Dumping:\n");
92 "[CObservationBeaconRanges::debugPrintOut] minSensorDistance:\t%f\n",
95 "[CObservationBeaconRanges::debugPrintOut] maxSensorDistance:\t%f:\n",
98 "[CObservationBeaconRanges::debugPrintOut] stdError:\t%f\n", stdError);
100 "[CObservationBeaconRanges::debugPrintOut] %u ranges:\n",
101 static_cast<unsigned>(sensedData.size()));
103 size_t i,
n = sensedData.size();
104 for (i = 0; i <
n; i++)
106 "[CObservationBeaconRanges::debugPrintOut] \tID[%u]: %f\n",
107 sensedData[i].beaconID, sensedData[i].sensedDistance);
115 if (!sensedData.empty())
116 out_sensorPose =
CPose3D(sensedData[0].sensorLocationOnRobot);
118 out_sensorPose =
CPose3D(0, 0, 0);
126 size_t i,
n = sensedData.size();
128 for (i = 0; i <
n; i++)
129 sensedData[i].sensorLocationOnRobot =
CPoint3D(newSensorPose);
137 for (
auto& i : sensedData)
138 if (i.beaconID == beaconID)
return i.sensedDistance;
147 o <<
"Auxiliary estimated pose (if available): " << auxEstimatePose << endl;
149 o <<
format(
"minSensorDistance=%f m\n", minSensorDistance);
150 o <<
format(
"maxSensorDistance=%f m\n", maxSensorDistance);
151 o <<
format(
"stdError=%f m\n\n", stdError);
154 "There are %u range measurements:\n\n", (
unsigned)sensedData.size());
156 o <<
" BEACON RANGE SENSOR POSITION ON ROBOT \n";
157 o <<
"------------------------------------------------\n";
158 for (
const auto& it : sensedData)
161 " %i %.04f (%.03f,%.03f,%.03f)\n", (
int)it.beaconID,
162 it.sensedDistance, it.sensorLocationOnRobot.x(),
163 it.sensorLocationOnRobot.y(), it.sensorLocationOnRobot.z());
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.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) override
A general method to change the sensor pose on the robot.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Declares a class derived from "CObservation" that represents one (or more) range measurements to labe...
float getSensedRangeByBeaconID(int32_t beaconID)
Easy look-up into the vector sensedData, returns the range for a given beacon, or 0 if the beacon is ...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This namespace contains representation of robot actions and observations.
A class used to store a 3D point.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
Virtual base class for "archives": classes abstracting I/O streams.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Declares a class that represents any robot's observation.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void debugPrintOut()
Prints out the contents of the object.
unsigned __int32 uint32_t
void getDescriptionAsText(std::ostream &o) const override
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...