25 : minSensorDistance(0),
26 maxSensorDistance(1e2f),
39 out << minSensorDistance << maxSensorDistance << stdError;
40 n = sensedData.size();
42 for (i = 0; i <
n; i++)
43 out << sensedData[i].sensorLocationOnRobot
44 << sensedData[i].sensedDistance << sensedData[i].beaconID;
45 out << auxEstimatePose;
46 out << sensorLabel << timestamp;
62 in >> minSensorDistance >> maxSensorDistance >> stdError;
66 for (i = 0; i <
n; i++)
68 in >> sensedData[i].sensorLocationOnRobot >>
69 sensedData[i].sensedDistance;
71 sensedData[i].beaconID =
id;
74 if (version >= 1)
in >> auxEstimatePose;
94 printf(
"[CObservationBeaconRanges::debugPrintOut] Dumping:\n");
96 "[CObservationBeaconRanges::debugPrintOut] minSensorDistance:\t%f\n",
99 "[CObservationBeaconRanges::debugPrintOut] maxSensorDistance:\t%f:\n",
102 "[CObservationBeaconRanges::debugPrintOut] stdError:\t%f\n", stdError);
104 "[CObservationBeaconRanges::debugPrintOut] %u ranges:\n",
105 static_cast<unsigned>(sensedData.size()));
107 size_t i,
n = sensedData.size();
108 for (i = 0; i <
n; i++)
110 "[CObservationBeaconRanges::debugPrintOut] \tID[%u]: %f\n",
111 sensedData[i].beaconID, sensedData[i].sensedDistance);
119 if (!sensedData.empty())
120 out_sensorPose =
CPose3D(sensedData[0].sensorLocationOnRobot);
122 out_sensorPose =
CPose3D(0, 0, 0);
130 size_t i,
n = sensedData.size();
132 for (i = 0; i <
n; i++)
133 sensedData[i].sensorLocationOnRobot =
CPoint3D(newSensorPose);
141 for (
size_t i = 0; i < sensedData.size(); i++)
142 if (sensedData[i].beaconID == beaconID)
143 return sensedData[i].sensedDistance;
152 o <<
"Auxiliary estimated pose (if available): " << auxEstimatePose << endl;
154 o <<
format(
"minSensorDistance=%f m\n", minSensorDistance);
155 o <<
format(
"maxSensorDistance=%f m\n", maxSensorDistance);
156 o <<
format(
"stdError=%f m\n\n", stdError);
159 "There are %u range measurements:\n\n", (
unsigned)sensedData.size());
161 o <<
" BEACON RANGE SENSOR POSITION ON ROBOT \n";
162 o <<
"------------------------------------------------\n";
165 it != sensedData.end(); it++)
168 " %i %.04f (%.03f,%.03f,%.03f)\n", (
int)it->beaconID,
169 it->sensedDistance, it->sensorLocationOnRobot.x(),
170 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)
This must be inserted in 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...
const Scalar * const_iterator
#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...