42 ) :
CPose2DGridTemplate<
double>(xMin,xMax,yMin,yMax,resolutionXY,resolutionPhi,phiMin,phiMax)
44 uniformDistribution();
49 if (
this == &o)
return;
58 CPosePDFGrid::~CPosePDFGrid( )
72 for (
size_t phiInd = 0; phiInd < m_sizePhi; phiInd++)
73 for (
size_t y=0;
y<m_sizeY;
y++)
74 for (
size_t x=0;
x<m_sizeX;
x++)
76 const double w = *getByIndex(
x,
y,phiInd);
90 for (
size_t phiInd = 0; phiInd < m_sizePhi; phiInd++)
92 for (
size_t y=0;
y<m_sizeY;
y++)
93 for (
size_t x=0;
x<m_sizeX;
x++)
95 auxParts.
m_particles[idx].log_w = log( *getByIndex(
x,
y,phiInd) );
112 out << m_xMin << m_xMax
114 << m_phiMin << m_phiMax
115 << m_resolutionXY << m_resolutionPhi
116 <<
static_cast<int32_t>(m_sizeX) << static_cast<int32_t>(m_sizeY) <<
static_cast<int32_t>(m_sizePhi) << static_cast<int32_t>(m_sizeXY)
117 <<
static_cast<int32_t>(m_idxLeftX) << static_cast<int32_t>(m_idxLeftY) <<
static_cast<int32_t>(m_idxLeftPhi);
134 in >> m_xMin >> m_xMax
136 >> m_phiMin >> m_phiMax
137 >> m_resolutionXY >> m_resolutionPhi;
139 int32_t sizeX,sizeY,sizePhi,sizeXY,idxLeftX,idxLeftY,idxLeftPhi;
141 in >> sizeX >> sizeY >> sizePhi >> sizeXY >> idxLeftX >> idxLeftY >> idxLeftPhi;
147 m_idxLeftX= idxLeftX;
148 m_idxLeftY= idxLeftY;
149 m_idxLeftPhi=idxLeftPhi;
167 os::sprintf(dimsFile,1000,
"%s_dims.txt",dataFile.c_str());
169 FILE *f_d =
os::fopen(dataFile.c_str(),
"wt");
191 for (
unsigned int phiInd = 0; phiInd < m_sizePhi; phiInd++)
193 for (
unsigned int y=0;
y<m_sizeY;
y++)
195 for (
unsigned int x=0;
x<m_sizeX;
x++)
209 void CPosePDFGrid::changeCoordinatesReference(
const CPose3D &newReferenceBase )
218 void CPosePDFGrid::bayesianFusion(
const CPosePDF &p1,
const CPosePDF &p2,
const double &minMahalanobisDistToDrop )
236 void CPosePDFGrid::drawSingleSample(
CPose2D &outPart )
const 245 void CPosePDFGrid::drawManySamples(
247 std::vector<CVectorDouble> &outSamples )
const 274 void CPosePDFGrid::uniformDistribution()
276 double val = 1.0f / m_data.size();
Computes weighted and un-weighted averages of SE(2) poses.
FILE BASE_IMPEXP * fopen(const char *fileName, const char *mode) MRPT_NO_THROWS
An OS-independent version of fopen.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
void getCovarianceAndMean(mrpt::math::CMatrixDouble33 &cov, CPose2D &mean_point) const MRPT_OVERRIDE
Returns an estimate of the pose covariance matrix (3x3 cov matrix) and the mean, both at once...
int BASE_IMPEXP void BASE_IMPEXP fclose(FILE *f)
An OS-independent version of fclose.
#define THROW_EXCEPTION(msg)
int BASE_IMPEXP fprintf(FILE *fil, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(2
An OS-independent version of fprintf.
void saveToTextFile(const std::string &file, mrpt::math::TMatrixTextFileFormat fileFormat=mrpt::math::MATRIX_FORMAT_ENG, bool appendMRPTHeader=false, const std::string &userHeader=std::string()) const
Save matrix to a text file, compatible with MATLAB text format (see also the methods of matrix classe...
const Scalar * const_iterator
void append(const mrpt::poses::CPose2D &p)
Adds a new pose to the computation.
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
GLubyte GLubyte GLubyte GLubyte w
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
CParticleList m_particles
The array of particles.
This base provides a set of functions for maths stuff.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Eigen::Matrix< dataType, 4, 4 > inverse(Eigen::Matrix< dataType, 4, 4 > &pose)
Declares a class that represents a Probability Density Function (PDF) over a 2D pose (x...
GLsizei const GLchar ** string
Declares a class that represents a probability density function (pdf) of a 2D pose (x...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void normalize(Scalar valMin, Scalar valMax)
Scales all elements such as the minimum & maximum values are shifted to the given values...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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).
void resetDeterministic(const CPose2D &location, size_t particlesCount=0)
Reset the PDF to a single point: All m_particles will be set exactly to the supplied pose...
int BASE_IMPEXP sprintf(char *buf, size_t bufSize, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
Declares a class that represents a Probability Distribution function (PDF) of a 2D pose (x...
This is a template class for storing a 3D (2D+heading) grid containing any kind of data...
void get_average(mrpt::poses::CPose2D &out_mean) const
Returns the average pose.