class mrpt::obs::CActionRobotMovement2D
Overview
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:
#include <mrpt/obs/CActionRobotMovement2D.h> class CActionRobotMovement2D: public mrpt::obs::CAction { public: // typedefs typedef std::shared_ptr<mrpt::obs ::CActionRobotMovement2D> Ptr; typedef std::shared_ptr<const mrpt::obs ::CActionRobotMovement2D> ConstPtr; typedef std::unique_ptr<mrpt::obs ::CActionRobotMovement2D> UniquePtr; typedef std::unique_ptr<const mrpt::obs ::CActionRobotMovement2D> ConstUniquePtr; // enums enum TDrawSampleMotionModel; enum TEstimationMethod; // structs struct TMotionModelOptions; // fields static constexpr const char* className = "mrpt::obs" "::" "CActionRobotMovement2D"; 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; // construction CActionRobotMovement2D(); // methods static constexpr auto getClassName(); static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); static std::shared_ptr<CObject> CreateObject(); template <typename... Args> static Ptr Create(Args&&... args); template <typename Alloc, typename... Args> static Ptr CreateAlloc( const Alloc& alloc, Args&&... args ); template <typename... Args> static UniquePtr CreateUnique(Args&&... args); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual mrpt::rtti::CObject* clone() const; 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: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; typedef std::shared_ptr<CAction> Ptr; typedef std::shared_ptr<const CAction> ConstPtr; // fields mrpt::system::TTimeStamp timestamp {INVALID_TIMESTAMP}; // methods static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const; static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); virtual void getDescriptionAsText(std::ostream& o) const; std::string getDescriptionAsTextValue() const;
Typedefs
typedef std::shared_ptr<mrpt::obs ::CActionRobotMovement2D> Ptr
A type for the associated smart pointer.
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:
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
virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const
Returns information about the class of an object in runtime.
virtual mrpt::rtti::CObject* clone() const
Returns a deep copy (clone) of the object, indepently of its class.
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.