30 : minSensorDistance(0),
34 sensorLocationOnRobot(),
36 validCovariances(false),
49 out << minSensorDistance << maxSensorDistance << fieldOfView_yaw
50 << fieldOfView_pitch << sensorLocationOnRobot << timestamp;
51 out << validCovariances;
52 if (!validCovariances)
53 out << sensor_std_range << sensor_std_yaw << sensor_std_pitch;
56 std::set<int32_t> lstIDs;
58 n = sensedData.size();
60 for (i = 0; i <
n; i++)
62 int32_t id = sensedData[i].landmarkID;
65 if (0 != lstIDs.count(
id))
70 out << sensedData[i].range << sensedData[i].yaw << sensedData[i].pitch
73 if (validCovariances) out << sensedData[i].covariance;
92 in >> minSensorDistance >> maxSensorDistance;
96 in >> fieldOfView_yaw >> fieldOfView_pitch;
103 fieldOfView_yaw = fieldOfView_pitch = fieldOfView;
106 in >> sensorLocationOnRobot;
115 in >> validCovariances;
116 if (!validCovariances)
117 in >> sensor_std_range >> sensor_std_yaw >>
121 validCovariances =
false;
124 sensedData.resize(
n);
127 std::set<int32_t> lstIDs;
129 for (i = 0; i <
n; i++)
131 in >> sensedData[i].range >> sensedData[i].yaw >>
132 sensedData[i].pitch >> sensedData[i].landmarkID;
134 if (version >= 3 && validCovariances)
135 in >> sensedData[i].covariance;
137 int32_t id = sensedData[i].landmarkID;
140 if (0 != lstIDs.count(
id))
142 "Duplicate landmark ID=%i found.", (
int)
id);
160 printf(
"[CObservationBearingRange::debugPrintOut] Dumping:\n");
162 "[CObservationBearingRange::debugPrintOut] minSensorDistance:\t%f\n",
165 "[CObservationBearingRange::debugPrintOut] maxSensorDistance:\t%f:\n",
168 "[CObservationBearingRange::debugPrintOut] %u landmarks:\n",
169 static_cast<unsigned>(sensedData.size()));
171 size_t i,
n = sensedData.size();
172 for (i = 0; i <
n; i++)
174 "[CObservationBearingRange::debugPrintOut] \tID[%i]: y:%fdeg " 175 "p:%fdeg range: %f\n",
176 sensedData[i].landmarkID,
RAD2DEG(sensedData[i].yaw),
185 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot " 188 << sensorLocationOnRobot << endl
191 o <<
"Do observations have individual covariance matrices? " 192 << (validCovariances ?
"YES" :
"NO") << endl
195 o <<
"Default noise sigmas:" << endl;
196 o <<
"sensor_std_range (m) : " << sensor_std_range << endl;
197 o <<
"sensor_std_yaw (deg) : " <<
RAD2DEG(sensor_std_yaw) << endl;
198 o <<
"sensor_std_pitch (deg) : " <<
RAD2DEG(sensor_std_pitch) << endl;
203 o <<
" LANDMARK_ID RANGE (m) YAW (deg) PITCH (deg) COV. MATRIX " 206 o <<
"---------------------------------------------------------------------" 209 for (
size_t q = 0;
q < sensedData.size();
q++)
215 o <<
format(
"%7u", sensedData[
q].landmarkID);
218 " %10.03f %10.03f %10.03f ", sensedData[
q].
range,
222 if (validCovariances)
223 o << sensedData[
q].covariance.inMatlabFormat() << endl;
double RAD2DEG(const double x)
Radians to degrees.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in 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.
A numeric matrix of compile-time fixed size.
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...