An implementation of rejection sampling for generating 2D robot pose from range-only measurements within a landmarks (beacons) map.
Before calling the method "rejectionSampling" to generate the samples, you must call "setParams". It is assumed a planar scenario, where the robot is at a fixed height (default=0).
Definition at line 32 of file CRejectionSamplingRangeOnlyLocalization.h.
#include <mrpt/slam/CRejectionSamplingRangeOnlyLocalization.h>
Classes | |
struct | TDataPerBeacon |
Data for each beacon observation with a correspondence with the map. More... | |
Public Types | |
typedef CProbabilityParticle< mrpt::poses::CPose2D > | TParticle |
Public Member Functions | |
CRejectionSamplingRangeOnlyLocalization () | |
Constructor. More... | |
virtual | ~CRejectionSamplingRangeOnlyLocalization () |
Destructor. More... | |
bool | setParams (const mrpt::maps::CLandmarksMap &beaconsMap, const mrpt::obs::CObservationBeaconRanges &observation, float sigmaRanges, const mrpt::poses::CPose2D &oldPose, float robot_z=0, bool autoCheckAngleRanges=true) |
The parameters used in the generation of random samples: More... | |
void | rejectionSampling (size_t desiredSamples, std::vector< TParticle > &outSamples, size_t timeoutTrials=1000) |
Generates a set of N independent samples via rejection sampling. More... | |
Protected Member Functions | |
void | RS_drawFromProposal (mrpt::poses::CPose2D &outSample) |
Generates one sample, drawing from some proposal distribution. More... | |
double | RS_observationLikelihood (const mrpt::poses::CPose2D &x) |
Returns the NORMALIZED observation likelihood (linear, not exponential!!!) at a given point of the state space (values in the range [0,1]). More... | |
Protected Attributes | |
float | m_z_robot |
Z coordinate of the robot. More... | |
float | m_sigmaRanges |
mrpt::poses::CPose2D | m_oldPose |
size_t | m_drawIndex |
The index in "m_dataPerBeacon" used to draw samples (the rest will be used to evaluate the likelihood) More... | |
std::deque< TDataPerBeacon > | m_dataPerBeacon |
Data for each beacon observation with a correspondence with the map. More... | |
|
inherited |
Definition at line 31 of file CRejectionSamplingCapable.h.
CRejectionSamplingRangeOnlyLocalization::CRejectionSamplingRangeOnlyLocalization | ( | ) |
Constructor.
Definition at line 31 of file CRejectionSamplingRangeOnlyLocalization.cpp.
|
inlinevirtual |
Destructor.
Definition at line 42 of file CRejectionSamplingRangeOnlyLocalization.h.
|
inlineinherited |
Generates a set of N independent samples via rejection sampling.
desiredSamples | The number of desired samples to generate |
outSamples | The output samples. |
timeoutTrials | The maximum number of rejection trials for each generated sample (i.e. the maximum number of iterations). This can be used to set a limit to the time complexity of the algorithm for difficult probability densities. All will have equal importance weights (a property of rejection sampling), although those samples generated at timeout will have a different importance weights. |
Definition at line 46 of file CRejectionSamplingCapable.h.
References ASSERT_, MRPT_END, MRPT_START, mrpt::random::randomGenerator, mrpt::bayes::CRejectionSamplingCapable< TStateSpace >::RS_drawFromProposal(), and mrpt::bayes::CRejectionSamplingCapable< TStateSpace >::RS_observationLikelihood().
|
protectedvirtual |
Generates one sample, drawing from some proposal distribution.
Implements mrpt::bayes::CRejectionSamplingCapable< mrpt::poses::CPose2D >.
Definition at line 43 of file CRejectionSamplingRangeOnlyLocalization.cpp.
References ASSERT_, DEG2RAD, mrpt::random::CRandomGenerator::drawGaussian1D(), mrpt::random::CRandomGenerator::drawUniform(), m_dataPerBeacon, m_drawIndex, m_oldPose, m_sigmaRanges, MRPT_END, MRPT_START, mrpt::poses::CPose2D::phi(), R, mrpt::random::randomGenerator, THROW_EXCEPTION, mrpt::poses::CPoseOrPoint< DERIVEDCLASS >::x(), and mrpt::poses::CPoseOrPoint< DERIVEDCLASS >::y().
|
protectedvirtual |
Returns the NORMALIZED observation likelihood (linear, not exponential!!!) at a given point of the state space (values in the range [0,1]).
Implements mrpt::bayes::CRejectionSamplingCapable< mrpt::poses::CPose2D >.
Definition at line 78 of file CRejectionSamplingRangeOnlyLocalization.cpp.
References mrpt::poses::CPoseOrPoint< DERIVEDCLASS >::distanceTo(), m_dataPerBeacon, m_drawIndex, m_sigmaRanges, MRPT_END, MRPT_START, and mrpt::math::square().
bool CRejectionSamplingRangeOnlyLocalization::setParams | ( | const mrpt::maps::CLandmarksMap & | beaconsMap, |
const mrpt::obs::CObservationBeaconRanges & | observation, | ||
float | sigmaRanges, | ||
const mrpt::poses::CPose2D & | oldPose, | ||
float | robot_z = 0 , |
||
bool | autoCheckAngleRanges = true |
||
) |
The parameters used in the generation of random samples:
beaconsMap | The map containing the N beacons (indexed by their "beacon ID"s). Only the mean 3D position of the beacons is used, the covariance is ignored. |
observation | An observation with, at least ONE range measurement. |
sigmaRanges | The standard deviation of the "range measurement noise". |
robot_z | The height of the robot on the floor (default=0). Note that the beacon sensor on the robot may be at a different height, according to data within the observation object. |
autoCheckAngleRanges | Whether to make a simple check for potential good angles from the beacons to generate samples (disable to speed-up the preparation vs. making slower the drawn). This method fills out the member "m_dataPerBeacon". |
Definition at line 104 of file CRejectionSamplingRangeOnlyLocalization.cpp.
References ASSERT_, mrpt::utils::CDynamicGrid< T >::cellByPos(), DEG2RAD, mrpt::utils::CDynamicGrid< T >::fill(), mrpt::maps::CLandmarksMap::TCustomSequenceLandmarks::getByBeaconID(), mrpt::maps::CLandmarksMap::landmarks, m_dataPerBeacon, m_drawIndex, m_oldPose, M_PIf, m_sigmaRanges, m_z_robot, min, MRPT_END, MRPT_START, mrpt::maps::CLandmark::pose_mean, R, mrpt::obs::CObservationBeaconRanges::sensedData, mrpt::math::square(), mrpt::math::TPoint3D::x, mrpt::math::TPoint3D::y, and mrpt::math::TPoint3D::z.
|
protected |
Data for each beacon observation with a correspondence with the map.
Definition at line 96 of file CRejectionSamplingRangeOnlyLocalization.h.
Referenced by RS_drawFromProposal(), RS_observationLikelihood(), and setParams().
|
protected |
The index in "m_dataPerBeacon" used to draw samples (the rest will be used to evaluate the likelihood)
Definition at line 79 of file CRejectionSamplingRangeOnlyLocalization.h.
Referenced by RS_drawFromProposal(), RS_observationLikelihood(), and setParams().
|
protected |
Definition at line 75 of file CRejectionSamplingRangeOnlyLocalization.h.
Referenced by RS_drawFromProposal(), and setParams().
|
protected |
Definition at line 74 of file CRejectionSamplingRangeOnlyLocalization.h.
Referenced by RS_drawFromProposal(), RS_observationLikelihood(), and setParams().
|
protected |
Z coordinate of the robot.
Definition at line 72 of file CRejectionSamplingRangeOnlyLocalization.h.
Referenced by setParams().
Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019 |