53 insertionOpts.loadFromConfigFile(
source, sectionNamePrefix+
string(
"_insertOpts") );
65 this->insertionOpts.dumpToTextStream(out);
129 robotPose2D =
CPose2D(*robotPose);
130 robotPose3D = (*robotPose);
149 sensorReading = o->
power;
152 sensorReading = (sensorReading - insertionOptions.R_min) /( insertionOptions.R_max - insertionOptions.R_min );
155 m_average_normreadings_mean = (sensorReading + m_average_normreadings_count*m_average_normreadings_mean)/(1+m_average_normreadings_count);
156 m_average_normreadings_var = (
square(sensorReading - m_average_normreadings_mean) + m_average_normreadings_count*m_average_normreadings_var) /(1+m_average_normreadings_count);
157 m_average_normreadings_count++;
193 dyngridcommon_writeToStream(out);
204 #if MRPT_IS_BIG_ENDIAN 207 out << m_map[i].kf_mean << m_map[i].dm_mean << m_map[i].dmv_var_mean;
211 out.
WriteBuffer( &m_map[0],
sizeof(m_map[0])*m_map.size() );
220 out << insertionOptions.sigma
221 << insertionOptions.cutoffRadius
222 << insertionOptions.R_min
223 << insertionOptions.R_max
224 << insertionOptions.KF_covSigma
225 << insertionOptions.KF_initialCellStd
226 << insertionOptions.KF_observationModelNoise
227 << insertionOptions.KF_defaultCellMeanValue
228 << insertionOptions.KF_W_size;
231 out << m_average_normreadings_mean << m_average_normreadings_var <<
uint64_t(m_average_normreadings_count);
233 out << genericMapParams;
259 dyngridcommon_readFromStream(
in,
version<5);
270 vector<TOldCellTypeInVersion1> old_map(
n);
271 in.ReadBuffer( &old_map[0],
sizeof(old_map[0])*old_map.size() );
275 for (
size_t k=0;k<
n;k++)
277 m_map[k].kf_mean = (old_map[k].w!=0) ? old_map[k].wr : old_map[k].
mean;
278 m_map[k].kf_std = (old_map[k].w!=0) ? old_map[k].
w : old_map[k].
std;
289 #if MRPT_IS_BIG_ENDIAN 291 in >> m_map[i].kf_mean >> m_map[i].dm_mean >> m_map[i].dmv_var_mean;
294 in.ReadBuffer( &m_map[0],
sizeof(m_map[0])*m_map.size() );
308 in >> insertionOptions.sigma
309 >> insertionOptions.cutoffRadius
310 >> insertionOptions.R_min
311 >> insertionOptions.R_max
312 >> insertionOptions.KF_covSigma
313 >> insertionOptions.KF_initialCellStd
314 >> insertionOptions.KF_observationModelNoise
315 >> insertionOptions.KF_defaultCellMeanValue
316 >> insertionOptions.KF_W_size;
322 in >> m_average_normreadings_mean >> m_average_normreadings_var >> N;
323 m_average_normreadings_count = N;
327 in >> genericMapParams;
329 m_hasToRecoverMeanAndCov =
true;
350 out.
printf(
"\n----------- [CWirelessPowerGridMap2D::TInsertionOptions] ------------ \n\n");
351 internal_dumpToTextStream_common(out);
364 internal_loadFromConfigFile_common(iniFile,section);
373 if (!genericMapParams.enableSaveAs3DObject)
return;
#define ASSERT_EQUAL_(__A, __B)
void clear()
Erase all the contents of the map.
double x() const
Common members of all points & poses classes.
Virtual base for specifying the kind and parameters of one map (normally, to be inserted into mrpt::m...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) MRPT_OVERRIDE
Internal method called by computeObservationLikelihood()
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const MRPT_OVERRIDE
Returns a 3D object representing the map.
#define THROW_EXCEPTION(msg)
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
void WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
TMapRepresentation
The type of map representation to be used, see CRandomFieldGridMap2D for a discussion.
GLsizei GLsizei GLuint * obj
GLubyte GLubyte GLubyte GLubyte w
This class allows loading and storing values and vectors of different types from a configuration text...
T square(const T x)
Inline function for the square of a number.
static mrpt::maps::CMetricMap * internal_CreateFromMapDefinition(const mrpt::maps::TMetricMapInitializer &def)
CWirelessPowerGridMap2D represents a PDF of wifi concentrations over a 2D area.
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
The contents of each cell in a CRandomFieldGridMap2D map.
A helper class that can convert an enum value into its textual representation, and viceversa...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
double power
The power or signal strength as sensed by the Wifi receiver (In percentage: [0-100]) ...
This namespace contains representation of robot actions and observations.
virtual void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const MRPT_OVERRIDE
Returns a 3D object representing the map (mean)
TInsertionOptions()
Default values loader.
GLsizei const GLchar ** string
double resolution
See CWirelessPowerGridMap2D::CWirelessPowerGridMap2D.
This represents a measurement of the wireless strength perceived by the robot.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini"-like file or memory-stored string list.
mrpt::maps::CWirelessPowerGridMap2D::TInsertionOptions insertionOpts
unsigned __int64 uint64_t
#define MRPT_LOAD_CONFIG_VAR(variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define MAP_DEFINITION_REGISTER(_CLASSNAME_STRINGS, _CLASSNAME_WITH_NS)
Registers one map class into TMetricMapInitializer factory.
CRandomFieldGridMap2D represents a 2D grid map where each cell is associated one real-valued property...
Declares a virtual base class for all metric maps storage classes.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Declares a class that represents any robot's observation.
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
mrpt::maps::CWirelessPowerGridMap2D::TMapRepresentation mapType
The kind of map representation (see CWirelessPowerGridMap2D::CWirelessPowerGridMap2D) ...
virtual ~CWirelessPowerGridMap2D()
Destructor.
GLsizei GLsizei GLchar * source
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
mrpt::poses::CPose3D sensorPoseOnRobot
The location of the sensing antenna on the robot coordinate framework.
void loadFromConfigFile_map_specific(const mrpt::utils::CConfigFileBase &source, const std::string §ionNamePrefix)
Load all map-specific params.
void dumpToTextStream_map_specific(mrpt::utils::CStream &out) const
unsigned __int32 uint32_t
bool internal_insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=NULL) MRPT_OVERRIDE
Internal method called by insertObservation()
void internal_clear() MRPT_OVERRIDE
Erase all the contents of the map.
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
virtual void internal_clear() MRPT_OVERRIDE
Erase all the contents of the map.