Class CActionRobotMovement2D

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class CActionRobotMovement2D : public mrpt::obs::CAction

Represents a probabilistic 2D movement of the robot mobile base

See docs: https://docs.mrpt.org/reference/latest/tutorial-motion-models.html

Velocity is encoded as mrpt::math::TTwist2D in the optional field velocityLocal.

See also

CAction

Public Types

enum TEstimationMethod

A list of possible ways for estimating the content of a CActionRobotMovement2D object.

Values:

enumerator emOdometry
enumerator emScan2DMatching
enum TDrawSampleMotionModel

Values:

enumerator mmGaussian
enumerator mmThrun

Public Functions

CActionRobotMovement2D()
inline double velocityLin() const
inline double velocityAng() const
void computeFromOdometry(const mrpt::poses::CPose2D &odometryIncrement, const TMotionModelOptions &options)

Computes the PDF of the pose increment from an odometry reading and according to the given motion model (speed and encoder ticks information is not modified). According to the parameters in the passed struct, it will be called one the private sampling functions (see “see also” next).

void computeFromEncoders(double K_left, double K_right, double D)

If “hasEncodersInfo”=true, this method updates the pose estimation according to the ticks from both encoders and the passed parameters, which is passed internally to the method “computeFromOdometry” with the last used PDF options (or the defualt ones if not explicitly called by the user).

Parameters:
  • K_left – The meters / tick ratio for the left encoder.

  • K_right – The meters / tick ratio for the right encoder.

  • D – The distance between both wheels, in meters.

void drawSingleSample(mrpt::poses::CPose2D &outSample) const

Using this method instead of “poseChange->drawSingleSample()” may be more efficient in most situations.

See also

CPosePDF::drawSingleSample

void prepareFastDrawSingleSamples() const

Call this before calling a high number of times “fastDrawSingleSample”, which is much faster than “drawSingleSample”

void fastDrawSingleSample(mrpt::poses::CPose2D &outSample) const

Faster version than “drawSingleSample”, but requires a previous call to “prepareFastDrawSingleSamples”

virtual void getDescriptionAsText(std::ostream &o) const override

Build a detailed, multi-line textual description of the action contents and dump it to the output stream.

Note

If overried by derived classes, call base CAction::getDescriptionAsText() first to show common information.

Public Members

mrpt::containers::deepcopy_poly_ptr<mrpt::poses::CPosePDF::Ptr> poseChange

The 2D pose change probabilistic estimation.

mrpt::poses::CPose2D rawOdometryIncrementReading

This is the raw odometry reading, and only is used when “estimationMethod” is “TEstimationMethod::emOdometry”

TEstimationMethod estimationMethod = {emOdometry}

This fields indicates the way in which this estimation was obtained.

bool hasEncodersInfo = {false}

If “true” means that “encoderLeftTicks” and “encoderRightTicks” contain valid values.

int32_t encoderLeftTicks = {0}

For odometry only: the ticks count for each wheel FROM the last reading (positive means FORWARD, for both wheels);

See also

hasEncodersInfo

int32_t encoderRightTicks = {0}
bool hasVelocities = {false}

If “true” means that “velocityLin” and “velocityAng” contain valid values.

mrpt::math::TTwist2D velocityLocal = {.0, .0, .0}

If “hasVelocities”=true, the robot velocity in local (robot frame, +X forward) coordinates.

TMotionModelOptions motionModelConfiguration

Protected Functions

void computeFromOdometry_modelGaussian(const mrpt::poses::CPose2D &odometryIncrement, const TMotionModelOptions &o)

Computes the PDF of the pose increment from an odometry reading, using a Gaussian approximation as the motion model.

void computeFromOdometry_modelThrun(const mrpt::poses::CPose2D &odometryIncrement, const TMotionModelOptions &o)

Computes the PDF of the pose increment from an odometry reading, using the motion model from Thrun’s book. This model is discussed in “Probabilistic Robotics”, Thrun, Burgard, and Fox, 2006, pp.136.

void drawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const

The sample generator for the model “computeFromOdometry_modelGaussian”, internally called when the user invokes “drawSingleSample”.

void drawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const

The sample generator for the model “computeFromOdometry_modelThrun”, internally called when the user invokes “drawSingleSample”.

void prepareFastDrawSingleSample_modelGaussian() const

Internal use

void prepareFastDrawSingleSample_modelThrun() const

Internal use

void fastDrawSingleSample_modelGaussian(mrpt::poses::CPose2D &outSample) const

Internal use

void fastDrawSingleSample_modelThrun(mrpt::poses::CPose2D &outSample) const

Internal use

Protected Attributes

mutable mrpt::math::CMatrixDouble33 m_fastDrawGauss_Z

Auxiliary matrix

mutable mrpt::poses::CPose2D m_fastDrawGauss_M
struct TMotionModelOptions

The parameter to be passed to “computeFromOdometry”.

Public Functions

TMotionModelOptions() = default

Default values loader.

Public Members

TDrawSampleMotionModel modelSelection = {mmGaussian}

The model to be used.

TOptions_GaussianModel gaussianModel
TOptions_ThrunModel thrunModel
struct TOptions_GaussianModel

Options for the gaussian model, which generates a CPosePDFGaussian object in poseChange using a closed-form linear Gaussian model. See docs in: https://docs.mrpt.org/reference/latest/tutorial-motion-models.html

Public Functions

TOptions_GaussianModel() = default
inline TOptions_GaussianModel(double a1_, double a2_, double a3_, double a4_, double minStdXY_, double minStdPHI_)

Public Members

double a1 = {0.01}

Ratio of uncertainty: [meter/meter]

double a2 = {mrpt::RAD2DEG(0.001)}

Ratio of uncertainty: [meter/degree]

double a3 = {mrpt::DEG2RAD(1.0)}

Ratio of uncertainty: [degree/meter]

double a4 = {0.05}

Ratio of uncertainty: [degree/degree]

double minStdXY = {0.01}

Additional uncertainty: [meters]

double minStdPHI = {mrpt::DEG2RAD(0.2)}

Additional uncertainty: [degrees]

struct TOptions_ThrunModel

Options for the Thrun’s model, which generates a CPosePDFParticles object in poseChange using a MonteCarlo simulation. See docs in: https://docs.mrpt.org/reference/latest/tutorial-motion-models.html

Public Members

uint32_t nParticlesCount = {300}

The default number of particles to generate in a internal representation (anyway you can draw as many samples as you want through CActionRobotMovement2D::drawSingleSample)

float alfa1_rot_rot = {0.05f}
float alfa2_rot_trans = {mrpt::DEG2RAD(4.0f)}
float alfa3_trans_trans = {0.01f}
float alfa4_trans_rot = {mrpt::RAD2DEG(0.0001f)}
float additional_std_XY = {0.001f}

An additional noise added to the thrun model (std. dev. in meters and radians).

float additional_std_phi = {mrpt::DEG2RAD(0.05f)}