struct mrpt::math::TTwist2D

2D twist: 2D velocity vector (vx,vy) + planar angular velocity (omega)

See also:

mrpt::math::TTwist3D, mrpt::math::TPose2D

#include <mrpt/math/TTwist2D.h>

struct TTwist2D: public mrpt::math::internal::ProvideStaticResize
{
    // enums

    enum
    {
        static_size = 3,
    };

    //
fields

    double vx {.0};
    double vy {.0};
    double omega {.0};

    // construction

    TTwist2D(double vx_, double vy_, double omega_);
    TTwist2D();

    //
methods

    double& operator [] (size_t i);
    constexpr double operator [] (size_t i) const;
    void asVector(std::vector<double>& v) const;
    void rotate(const double ang);
    bool operator == (const TTwist2D& o) const;
    bool operator != (const TTwist2D& o) const;
    mrpt::math::TPose2D operator * (const double dt) const;
    void operator *= (const double k);
    void asString(std::string& s) const;
    std::string asString() const;
    void fromString(const std::string& s);
    static TTwist2D FromString(const std::string& s);
};

Inherited Members

public:
    //
methods

    void resize(std::size_t n);

Fields

double vx {.0}

Velocity components: X,Y (m/s)

double omega {.0}

Angular velocity (rad/s)

Construction

TTwist2D(double vx_, double vy_, double omega_)

Constructor from components.

TTwist2D()

Default fast constructor.

Initializes to zeros

Methods

double& operator [] (size_t i)

Coordinate access using operator[].

Order: vx,vy,vphi

constexpr double operator [] (size_t i) const

Coordinate access using operator[].

Order: vx,vy,vphi

void asVector(std::vector<double>& v) const

Transformation into vector.

void rotate(const double ang)

Transform the (vx,vy) components for a counterclockwise rotation of ang radians.

mrpt::math::TPose2D operator * (const double dt) const

Returns the pose increment of multiplying each twist component times “dt” seconds.

void operator *= (const double k)

Scale factor.

void asString(std::string& s) const

Returns a human-readable textual representation of the object (eg: “[vx vy omega]”, omega in deg/s)

See also:

fromString

void fromString(const std::string& s)

Set the current object value from a string generated by ‘asString’ (eg: “[0.02 1.04 -45.0]” )

Parameters:

std::exception

On invalid format

See also:

asString