30 : fieldOfView_yaw(
DEG2RAD(180)),
32 sensorLocationOnRobot(),
44 out << minSensorDistance << maxSensorDistance << fieldOfView_yaw
45 << fieldOfView_pitch << sensorLocationOnRobot << timestamp;
46 out << validCovariances;
47 if (!validCovariances)
48 out << sensor_std_range << sensor_std_yaw << sensor_std_pitch;
51 std::set<int32_t> lstIDs;
53 n = sensedData.size();
55 for (i = 0; i <
n; i++)
57 int32_t id = sensedData[i].landmarkID;
60 if (0 != lstIDs.count(
id))
65 out << sensedData[i].range << sensedData[i].yaw << sensedData[i].pitch
68 if (validCovariances) out << sensedData[i].covariance;
87 in >> minSensorDistance >> maxSensorDistance;
91 in >> fieldOfView_yaw >> fieldOfView_pitch;
98 fieldOfView_yaw = fieldOfView_pitch = fieldOfView;
101 in >> sensorLocationOnRobot;
110 in >> validCovariances;
111 if (!validCovariances)
112 in >> sensor_std_range >> sensor_std_yaw >>
116 validCovariances =
false;
119 sensedData.resize(
n);
122 std::set<int32_t> lstIDs;
124 for (i = 0; i <
n; i++)
126 in >> sensedData[i].range >> sensedData[i].yaw >>
127 sensedData[i].pitch >> sensedData[i].landmarkID;
129 if (version >= 3 && validCovariances)
130 in >> sensedData[i].covariance;
132 int32_t id = sensedData[i].landmarkID;
135 if (0 != lstIDs.count(
id))
137 "Duplicate landmark ID=%i found.", (
int)
id);
155 printf(
"[CObservationBearingRange::debugPrintOut] Dumping:\n");
157 "[CObservationBearingRange::debugPrintOut] minSensorDistance:\t%f\n",
160 "[CObservationBearingRange::debugPrintOut] maxSensorDistance:\t%f:\n",
163 "[CObservationBearingRange::debugPrintOut] %u landmarks:\n",
164 static_cast<unsigned>(sensedData.size()));
166 size_t i,
n = sensedData.size();
167 for (i = 0; i <
n; i++)
169 "[CObservationBearingRange::debugPrintOut] \tID[%i]: y:%fdeg " 170 "p:%fdeg range: %f\n",
171 sensedData[i].landmarkID,
RAD2DEG(sensedData[i].yaw),
180 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot " 183 << sensorLocationOnRobot << endl
186 o <<
"Do observations have individual covariance matrices? " 187 << (validCovariances ?
"YES" :
"NO") << endl
190 o <<
"Default noise sigmas:" << endl;
191 o <<
"sensor_std_range (m) : " << sensor_std_range << endl;
192 o <<
"sensor_std_yaw (deg) : " <<
RAD2DEG(sensor_std_yaw) << endl;
193 o <<
"sensor_std_pitch (deg) : " <<
RAD2DEG(sensor_std_pitch) << endl;
198 o <<
" LANDMARK_ID RANGE (m) YAW (deg) PITCH (deg) COV. MATRIX " 201 o <<
"---------------------------------------------------------------------" 204 for (
const auto&
q : sensedData)
210 o <<
format(
"%7u",
q.landmarkID);
213 " %10.03f %10.03f %10.03f ",
q.range,
217 if (validCovariances)
218 o <<
q.covariance.inMatlabFormat() << endl;
A compile-time fixed-size numeric matrix container.
double RAD2DEG(const double x)
Radians to degrees.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
double DEG2RAD(const double x)
Degrees to radians.
GLdouble GLdouble GLdouble GLdouble q
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
#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.
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.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
This file implements matrix/vector text and binary serialization.
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,...)
unsigned __int32 uint32_t
#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...