Go to the documentation of this file.
30 void RS_drawFromProposal(
CPose2D& outSample)
override
34 outSample.
x(1.0f - cos(ang) *
R);
35 outSample.
y(sin(ang) *
R);
42 double RS_observationLikelihood(
const CPose2D& x)
override
55 std::vector<CMyRejectionSampling::TParticle> samples;
59 printf(
"Computing...");
63 printf(
"Ok! %fms\n", 1000 * tictac.
Tac());
65 FILE* f =
os::fopen(
"_out_samples.txt",
"wt");
66 std::vector<CMyRejectionSampling::TParticle>::iterator it;
67 for (it = samples.begin(); it != samples.end(); it++)
69 f,
"%f %f %f %e\n", it->d->x(), it->d->y(), it->d->phi(),
86 catch (
const std::exception& e)
93 printf(
"Untyped excepcion!!");
int void fclose(FILE *f)
An OS-independent version of fclose.
A high-performance stopwatch, with typical resolution of nanoseconds.
double phi() const
Get the phi angle of the 2D pose (in radians)
double x() const
Common members of all points & poses classes.
A base class for implementing rejection sampling in a generic state space.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
double distanceTo(const CPoseOrPoint< OTHERCLASS, DIM2 > &b) const
Returns the Euclidean distance to another pose/point:
double Tac() noexcept
Stops the stopwatch.
return_t drawUniform(const double Min, const double Max)
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm,...
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
void Tic() noexcept
Starts the stopwatch.
return_t square(const num_t x)
Inline function for the square of a number.
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
The namespace for Bayesian filtering algorithm: different particle filters and Kalman filter algorith...
return_t drawGaussian1D(const double mean, const double std)
Generate a normally distributed pseudo-random number.
void rejectionSampling(size_t desiredSamples, std::vector< TParticle > &outSamples, size_t timeoutTrials=1000)
Generates a set of N independent samples via rejection sampling.
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen.
A namespace of pseudo-random numbers generators of diferent distributions.
std::string exception_to_str(const std::exception &e)
Builds a nice textual representation of a nested exception, which if generated using MRPT macros (THR...
A class used to store a 2D point.
Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 23:51:15 UTC 2020 | |