30 : minSensorDistance(0),
34 sensorLocationOnRobot(),
36 validCovariances(false),
56 out << minSensorDistance << maxSensorDistance << fieldOfView_yaw
57 << fieldOfView_pitch << sensorLocationOnRobot << timestamp;
59 out << validCovariances;
60 if (!validCovariances)
61 out << sensor_std_range << sensor_std_yaw << sensor_std_pitch;
64 std::set<int32_t> lstIDs;
66 n = sensedData.size();
68 for (i = 0; i <
n; i++)
70 int32_t id = sensedData[i].landmarkID;
73 if (0 != lstIDs.count(
id))
75 "Duplicate landmark ID=%i found.", (
int)
id);
79 out << sensedData[i].range << sensedData[i].yaw
80 << sensedData[i].pitch <<
id;
82 if (validCovariances) out << sensedData[i].covariance;
105 in >> minSensorDistance >> maxSensorDistance;
109 in >> fieldOfView_yaw >> fieldOfView_pitch;
116 fieldOfView_yaw = fieldOfView_pitch = fieldOfView;
119 in >> sensorLocationOnRobot;
128 in >> validCovariances;
129 if (!validCovariances)
130 in >> sensor_std_range >> sensor_std_yaw >>
134 validCovariances =
false;
137 sensedData.resize(
n);
140 std::set<int32_t> lstIDs;
142 for (i = 0; i <
n; i++)
144 in >> sensedData[i].range >> sensedData[i].yaw >>
145 sensedData[i].pitch >> sensedData[i].landmarkID;
147 if (version >= 3 && validCovariances)
148 in >> sensedData[i].covariance;
150 int32_t id = sensedData[i].landmarkID;
153 if (0 != lstIDs.count(
id))
155 "Duplicate landmark ID=%i found.", (
int)
id);
176 printf(
"[CObservationBearingRange::debugPrintOut] Dumping:\n");
178 "[CObservationBearingRange::debugPrintOut] minSensorDistance:\t%f\n",
181 "[CObservationBearingRange::debugPrintOut] maxSensorDistance:\t%f:\n",
184 "[CObservationBearingRange::debugPrintOut] %u landmarks:\n",
185 static_cast<unsigned>(sensedData.size()));
187 size_t i,
n = sensedData.size();
188 for (i = 0; i <
n; i++)
190 "[CObservationBearingRange::debugPrintOut] \tID[%i]: y:%fdeg " 191 "p:%fdeg range: %f\n",
192 sensedData[i].landmarkID,
RAD2DEG(sensedData[i].yaw),
201 o <<
"Homogeneous matrix for the sensor's 3D pose, relative to robot " 203 o << sensorLocationOnRobot.getHomogeneousMatrixVal()
204 << sensorLocationOnRobot << endl
207 o <<
"Do observations have individual covariance matrices? " 208 << (validCovariances ?
"YES" :
"NO") << endl
211 o <<
"Default noise sigmas:" << endl;
212 o <<
"sensor_std_range (m) : " << sensor_std_range << endl;
213 o <<
"sensor_std_yaw (deg) : " <<
RAD2DEG(sensor_std_yaw) << endl;
214 o <<
"sensor_std_pitch (deg) : " <<
RAD2DEG(sensor_std_pitch) << endl;
219 o <<
" LANDMARK_ID RANGE (m) YAW (deg) PITCH (deg) COV. MATRIX " 222 o <<
"---------------------------------------------------------------------" 225 for (
size_t q = 0;
q < sensedData.size();
q++)
231 o <<
format(
"%7u", sensedData[
q].landmarkID);
234 " %10.03f %10.03f %10.03f ", sensedData[
q].
range,
238 if (validCovariances)
239 o << sensedData[
q].covariance.inMatlabFormat() << endl;
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
GLdouble GLdouble GLdouble GLdouble q
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This namespace contains representation of robot actions and observations.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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...
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
Declares a class that represents any robot's observation.
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...
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
#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...
unsigned __int32 uint32_t
virtual void getDescriptionAsText(std::ostream &o) const
Build a detailed, multi-line textual description of the observation contents and dump it to the outpu...