Struct TTwist2D

Inheritance Relationships

Base Type

Struct Documentation

struct TTwist2D : public mrpt::math::internal::ProvideStaticResize<TTwist2D>

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

Public Functions

inline constexpr TTwist2D(double vx_, double vy_, double omega_)

Constructor from components

TTwist2D() = default

Default fast constructor. Initializes to zeros

inline double &operator[](size_t i)

Coordinate access using operator[]. Order: vx,vy,vphi

inline constexpr double operator[](size_t i) const

Coordinate access using operator[]. Order: vx,vy,vphi

template<typename Vector>
inline void asVector(Vector &v) const

Gets the twist as a vector of doubles.

Template Parameters:

Vector – It can be std::vector<double>, Eigen::VectorXd, etc.

template<typename Vector>
inline Vector asVector() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rotate(const double ang)

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

inline TTwist2D rotated(const double ang) const

Like rotate(), but returning a copy of the rotated twist.

Note

New in MRPT 2.3.2

bool operator==(const TTwist2D &o) const
bool operator!=(const TTwist2D &o) const
mrpt::math::TPose2D operator*(const double dt) const

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

inline 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

inline std::string asString() const
void fromString(const std::string &s)

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

See also

asString

Throws:

std::exception – On invalid format

Public Members

double vx = {.0}

Velocity components: X,Y (m/s)

double vy = {.0}
double omega = {.0}

Angular velocity (rad/s)

Public Static Functions

template<typename Vector>
static inline TTwist2D FromVector(const Vector &v)

Builds from the first 3 elements of a vector-like object: [vx vy w]

Template Parameters:

Vector – It can be std::vector<double>, Eigen::VectorXd, etc.

static inline TTwist2D FromString(const std::string &s)

Public Static Attributes

static constexpr std::size_t static_size = 3