# class mrpt::slam::CRejectionSamplingRangeOnlyLocalization¶

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).

bayes::CRejectionSamplingCapable

#include <mrpt/slam/CRejectionSamplingRangeOnlyLocalization.h>

class CRejectionSamplingRangeOnlyLocalization: public mrpt::bayes::CRejectionSamplingCapable
{
public:
// typedefs

typedef CProbabilityParticle<mrpt::poses::CPose2D, mrpt::bayes::particle_storage_mode::POINTER> TParticle;

// structs

struct TDataPerBeacon;

//
methods

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
);
};

## Inherited Members¶

public:
//
methods

void rejectionSampling(
size_t desiredSamples,
std::vector<TParticle>& outSamples,
size_t timeoutTrials = 1000
);

## Methods¶

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:

Parameters:

 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”.

Returns:

true if at least ONE beacon has been successfully loaded, false otherwise. In this case do not call “rejectionSampling” or an exception will be launch, since there is no information to generate samples.