32 out << minSensorDistance << maxSensorDistance << fieldOfView_yaw
33 << fieldOfView_pitch << sensorLocationOnRobot << timestamp;
34 out << validCovariances;
35 if (!validCovariances)
36 out << sensor_std_range << sensor_std_yaw << sensor_std_pitch;
39 std::set<int32_t> lstIDs;
41 n = sensedData.size();
43 for (i = 0; i < n; i++)
45 int32_t
id = sensedData[i].landmarkID;
48 if (0 != lstIDs.count(
id))
53 out << sensedData[i].range << sensedData[i].yaw << sensedData[i].pitch
56 if (validCovariances)
out << sensedData[i].covariance;
75 in >> minSensorDistance >> maxSensorDistance;
79 in >> fieldOfView_yaw >> fieldOfView_pitch;
86 fieldOfView_yaw = fieldOfView_pitch = fieldOfView;
89 in >> sensorLocationOnRobot;
98 in >> validCovariances;
99 if (!validCovariances)
100 in >> sensor_std_range >> sensor_std_yaw >>
104 validCovariances =
false;
107 sensedData.resize(n);
110 std::set<int32_t> lstIDs;
112 for (i = 0; i < n; i++)
114 in >> sensedData[i].range >> sensedData[i].yaw >>
115 sensedData[i].pitch >> sensedData[i].landmarkID;
117 if (version >= 3 && validCovariances)
118 in >> sensedData[i].covariance;
120 int32_t
id = sensedData[i].landmarkID;
123 if (0 != lstIDs.count(
id))
125 "Duplicate landmark ID=%i found.", (
int)id);
143 printf(
"[CObservationBearingRange::debugPrintOut] Dumping:\n");
145 "[CObservationBearingRange::debugPrintOut] minSensorDistance:\t%f\n",
148 "[CObservationBearingRange::debugPrintOut] maxSensorDistance:\t%f:\n",
151 "[CObservationBearingRange::debugPrintOut] %u landmarks:\n",
152 static_cast<unsigned>(sensedData.size()));
154 size_t i, n = sensedData.size();
155 for (i = 0; i < n; i++)
157 "[CObservationBearingRange::debugPrintOut] \tID[%i]: y:%fdeg " 158 "p:%fdeg range: %f\n",
159 sensedData[i].landmarkID,
RAD2DEG(sensedData[i].yaw),
168 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot " 171 << sensorLocationOnRobot << endl
174 o <<
"Do observations have individual covariance matrices? " 175 << (validCovariances ?
"YES" :
"NO") << endl
178 o <<
"Default noise sigmas:" << endl;
179 o <<
"sensor_std_range (m) : " << sensor_std_range << endl;
180 o <<
"sensor_std_yaw (deg) : " <<
RAD2DEG(sensor_std_yaw) << endl;
181 o <<
"sensor_std_pitch (deg) : " <<
RAD2DEG(sensor_std_pitch) << endl;
186 o <<
" LANDMARK_ID RANGE (m) YAW (deg) PITCH (deg) COV. MATRIX " 189 o <<
"---------------------------------------------------------------------" 192 for (
const auto& q : sensedData)
198 o <<
format(
"%7u", q.landmarkID);
201 " %10.03f %10.03f %10.03f ", q.range,
205 if (validCovariances)
206 o << q.covariance.inMatlabFormat() << endl;
A compile-time fixed-size numeric matrix container.
std::string std::string format(std::string_view fmt, ARGS &&... args)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This base provides a set of functions for maths stuff.
This namespace contains representation of robot actions and observations.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
T wrapToPi(T a)
Modifies the given angle to translate it into the ]-pi,pi] range.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Virtual base class for "archives": classes abstracting I/O streams.
mrpt::vision::TStereoCalibResults out
Declares a class that represents any robot's observation.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
This file implements matrix/vector text and binary serialization.
constexpr double RAD2DEG(const double x)
Radians to degrees.
This observation represents a number of range-bearing value pairs, each one for a detected landmark...
#define INVALID_LANDMARK_ID
Used for CObservationBearingRange::TMeasurement::beaconID and others.
void debugPrintOut()
Prints out the contents of the object.
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 THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
#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...