MRPT  2.0.2
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
mrpt::math::TTwist2D Struct Reference

Detailed Description

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

See also
mrpt::math::TTwist3D, mrpt::math::TPose2D

Definition at line 19 of file TTwist2D.h.

#include <mrpt/math/TTwist2D.h>

Inheritance diagram for mrpt::math::TTwist2D:

Public Types

enum  { static_size = 3 }
 

Public Member Functions

constexpr TTwist2D (double vx_, double vy_, double omega_)
 Constructor from components. More...
 
 TTwist2D ()=default
 Default fast constructor. More...
 
double & operator[] (size_t i)
 Coordinate access using operator[]. More...
 
constexpr double operator[] (size_t i) const
 Coordinate access using operator[]. More...
 
void asVector (std::vector< double > &v) const
 Transformation into vector. More...
 
void rotate (const double ang)
 Transform the (vx,vy) components for a counterclockwise rotation of ang radians. More...
 
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. More...
 
void operator*= (const double k)
 Scale factor. More...
 
void asString (std::string &s) const
 Returns a human-readable textual representation of the object (eg: "[vx vy omega]", omega in deg/s) More...
 
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]" ) More...
 
constexpr std::size_t rows () const
 
constexpr std::size_t cols () const
 
constexpr std::size_t size () const
 
void resize (std::size_t n)
 throws if attempted to resize to incorrect length More...
 

Static Public Member Functions

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

Public Attributes

double vx {.0}
 Velocity components: X,Y (m/s) More...
 
double vy {.0}
 
double omega {.0}
 Angular velocity (rad/s) More...
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
static_size 

Definition at line 21 of file TTwist2D.h.

Constructor & Destructor Documentation

◆ TTwist2D() [1/2]

constexpr mrpt::math::TTwist2D::TTwist2D ( double  vx_,
double  vy_,
double  omega_ 
)
inline

Constructor from components.

Definition at line 31 of file TTwist2D.h.

◆ TTwist2D() [2/2]

mrpt::math::TTwist2D::TTwist2D ( )
default

Default fast constructor.

Initializes to zeros

Member Function Documentation

◆ asString() [1/2]

void TTwist2D::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

Definition at line 23 of file Twist2D.cpp.

References mrpt::format(), omega, mrpt::RAD2DEG(), vx, and vy.

Here is the call graph for this function:

◆ asString() [2/2]

std::string mrpt::math::TTwist2D::asString ( ) const
inline

Definition at line 97 of file TTwist2D.h.

◆ asVector()

void mrpt::math::TTwist2D::asVector ( std::vector< double > &  v) const
inline

Transformation into vector.

Definition at line 68 of file TTwist2D.h.

References omega, vx, and vy.

◆ cols()

constexpr std::size_t mrpt::math::internal::ProvideStaticResize< TTwist2D >::cols ( ) const
inlineinherited

Definition at line 66 of file TPoseOrPoint.h.

◆ fromString()

void TTwist2D::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
Exceptions
std::exceptionOn invalid format

Definition at line 27 of file Twist2D.cpp.

References ASSERTMSG_, mrpt::math::CMatrixDynamic< T >::cols(), mrpt::DEG2RAD(), mrpt::math::MatrixVectorBase< Scalar, Derived >::fromMatlabStringFormat(), omega, mrpt::math::CMatrixDynamic< T >::rows(), THROW_EXCEPTION, vx, and vy.

Referenced by FromString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FromString()

static TTwist2D mrpt::math::TTwist2D::FromString ( const std::string &  s)
inlinestatic

Definition at line 111 of file TTwist2D.h.

References fromString().

Here is the call graph for this function:

◆ operator!=()

bool TTwist2D::operator!= ( const TTwist2D o) const

Definition at line 51 of file Twist2D.cpp.

◆ operator*()

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

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

Definition at line 52 of file Twist2D.cpp.

References omega, vx, and vy.

◆ operator*=()

void mrpt::math::TTwist2D::operator*= ( const double  k)
inline

Scale factor.

Definition at line 85 of file TTwist2D.h.

References omega, vx, and vy.

◆ operator==()

bool TTwist2D::operator== ( const TTwist2D o) const

Definition at line 47 of file Twist2D.cpp.

References omega, vx, and vy.

◆ operator[]() [1/2]

double& mrpt::math::TTwist2D::operator[] ( size_t  i)
inline

Coordinate access using operator[].

Order: vx,vy,vphi

Definition at line 38 of file TTwist2D.h.

References omega, vx, and vy.

◆ operator[]() [2/2]

constexpr double mrpt::math::TTwist2D::operator[] ( size_t  i) const
inline

Coordinate access using operator[].

Order: vx,vy,vphi

Definition at line 53 of file TTwist2D.h.

References omega, vx, and vy.

◆ resize()

void mrpt::math::internal::ProvideStaticResize< TTwist2D >::resize ( std::size_t  n)
inlineinherited

throws if attempted to resize to incorrect length

Definition at line 70 of file TPoseOrPoint.h.

◆ rotate()

void TTwist2D::rotate ( const double  ang)

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

Definition at line 40 of file Twist2D.cpp.

References vx, and vy.

Referenced by mrpt::poses::CRobot2DPoseEstimator::getCurrentEstimate(), mrpt::kinematics::CVehicleSimulVirtualBase::getCurrentGTVelLocal(), mrpt::kinematics::CVehicleSimulVirtualBase::getCurrentOdometricVelLocal(), mrpt::kinematics::CVehicleSimulVirtualBase::simulateOneTimeStep(), and mrpt::nav::CAbstractNavigator::updateCurrentPoseAndSpeeds().

Here is the caller graph for this function:

◆ rows()

constexpr std::size_t mrpt::math::internal::ProvideStaticResize< TTwist2D >::rows ( ) const
inlineinherited

Definition at line 65 of file TPoseOrPoint.h.

◆ size()

constexpr std::size_t mrpt::math::internal::ProvideStaticResize< TTwist2D >::size ( ) const
inlineinherited

Definition at line 67 of file TPoseOrPoint.h.

Member Data Documentation

◆ omega

double mrpt::math::TTwist2D::omega {.0}

◆ vx

double mrpt::math::TTwist2D::vx {.0}

◆ vy

double mrpt::math::TTwist2D::vy {.0}



Page generated by Doxygen 1.8.14 for MRPT 2.0.2 Git: 9b4fd2465 Mon May 4 16:59:08 2020 +0200 at lun may 4 17:26:07 CEST 2020