class mrpt::obs::CActionRobotMovement2D

Represents a probabilistic 2D movement of the robot mobile base.

See docs: https://www.mrpt.org/tutorials/programming/odometry-and-motion-models/probabilistic_motion_models/

[New in MRPT 1.5.0] Velocity is now encoded as mrpt::math::TTwist2D as a more general version of the old (linVel, angVel).

See also:

CAction

#include <mrpt/obs/CActionRobotMovement2D.h>

class CActionRobotMovement2D: public mrpt::obs::CAction
{
public:
    // enums

    enum TDrawSampleMotionModel;
    enum TEstimationMethod;

    // structs

    struct TMotionModelOptions;

    //
fields

    mrpt::containers::deepcopy_poly_ptr<mrpt::poses::CPosePDF::Ptr> poseChange;
    mrpt::poses::CPose2D rawOdometryIncrementReading;
    TEstimationMethod estimationMethod {emOdometry};
    bool hasEncodersInfo {false};
    int32_t encoderLeftTicks {0};
    int32_t encoderRightTicks {0};
    bool hasVelocities {false};
    mrpt::math::TTwist2D velocityLocal {.0, .0, .0};
    TMotionModelOptions motionModelConfiguration;

    //
methods

    double velocityLin() const;
    double velocityAng() const;
    void computeFromOdometry(const mrpt::poses::CPose2D& odometryIncrement, const TMotionModelOptions& options);
    void computeFromEncoders(double K_left, double K_right, double D);
    void drawSingleSample(mrpt::poses::CPose2D& outSample) const;
    void prepareFastDrawSingleSamples() const;
    void fastDrawSingleSample(mrpt::poses::CPose2D& outSample) const;
    virtual void getDescriptionAsText(std::ostream& o) const;
};

Inherited Members

public:
    //
fields

    mrpt::system::TTimeStamp timestamp {INVALID_TIMESTAMP};

    //
methods

    virtual void getDescriptionAsText(std::ostream& o) const;
    std::string getDescriptionAsTextValue() const;

Fields

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

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.

Methods

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

See also:

computeFromOdometry_modelGaussian, computeFromOdometry_modelThrun

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

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

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