Main MRPT website > C++ reference
MRPT logo

mrpt::poses::CPose2D Class Reference

A class used to store a 2D pose. More...

#include <mrpt/poses/CPose2D.h>

Inheritance diagram for mrpt::poses::CPose2D:
Inheritance graph
[legend]
Collaboration diagram for mrpt::poses::CPose2D:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CPose2D (const double &x=0, const double &y=0, const double &phi=0)
 Constructor from an initial value of the pose.
 CPose2D (const CPoint2D &)
 Constructor from a CPoint2D object.
 CPose2D (const CPose3D &)
 Aproximation!! Avoid its use, since information is lost.
 CPose2D (const mrpt::math::TPose2D &)
 Constructor from lightweight object.
 CPose2D (const CPoint3D &)
 Constructor from CPoint3D with information loss.
double phi () const
 Get the phi angle of the 2D pose (in radians).
void phi (double angle)
 Set the phi angle of the 2D pose (in radians).
void phi_incr (const double Aphi)
 Increment the PHI angle (without checking the 2 PI range, call normalizePhi is needed).
void getAsVector (vector_double &v) const
 Returns a 1x3 vector with [x y phi].
void getHomogeneousMatrix (CMatrixDouble44 &out_HM) const
 Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (translation+orientation).
CPose2D operator+ (const CPose2D &D) const
 The operator $ a = this \oplus D $ is the pose compounding operator.
void composeFrom (const CPose2D &A, const CPose2D &B)
 Makes $ this = A \oplus B $.
CPose3D operator+ (const CPose3D &D) const
 The operator $ a = this \oplus D $ is the pose compounding operator.
CPoint2D operator+ (const CPoint2D &u) const
 The operator $ u' = this \oplus u $ is the pose/point compounding operator.
void composePoint (double lx, double ly, double &gx, double &gy) const
 An alternative, slightly more efficient way of doing $ G = P \oplus L $ with G and L being 2D points and P this 2D pose.
CPoint3D operator+ (const CPoint3D &u) const
 The operator $ u' = this \oplus u $ is the pose/point compounding operator.
CPose2D operator- (const CPose2D &b) const
 The operator $ D = this \ominus b $ is the pose inverse compounding operator, the resulting pose D fulfils: $ this = b \oplus D $, that is: $ b = a \oplus (b \ominus a) $.
void AddComponents (CPose2D &p)
 Scalar sum of components: This is diferent from poses composition, which is implemented as "+" operators in "CPose" derived classes.
void operator*= (const double s)
 Scalar multiplication.
CPose2Doperator+= (const CPose2D &b)
 Make $ this = this \oplus b $.
void normalizePhi ()
 Forces "phi" to be in the range [-pi,pi];.
void asString (std::string &s) const
 Returns a human-readable textual representation of the object (eg: "[x y yaw]", yaw in degrees).
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 -0.8]" ).
const double & operator[] (unsigned int i) const
double & operator[] (unsigned int i)

Protected Attributes

double m_phi
 The orientation of the pose, in radians.

STL-like methods and typedefs



enum  { static_size = 3 }
typedef double value_type
 The type of the elements.
typedef double & reference
typedef const double & const_reference
typedef std::size_t size_type
typedef std::ptrdiff_t difference_type
static size_type size ()
static bool empty ()
static size_type max_size ()
static void resize (const size_t n)

Detailed Description

A class used to store a 2D pose.

A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle. It is used in many situations, from defining a robot pose, maps relative poses, sensors,...

For a complete description of Points/Poses, see mrpt::poses::CPoseOrPoint, or refer to the 2D/3D Geometry tutorial in the wiki.

poses::CPose2D

Homogeneous transfomation matrix

Spatial representation

cosj

-sinj

0

x

sinj

cosj

0

y

0

0

1

0

0

0

0

1

CPose2D.gif
See also:
CPoseOrPoint,CPoint2D

Definition at line 154 of file CPose2D.h.


Member Typedef Documentation

Definition at line 294 of file CPose2D.h.

typedef std::ptrdiff_t mrpt::poses::CPose2D::difference_type

Definition at line 296 of file CPose2D.h.

Definition at line 293 of file CPose2D.h.

typedef std::size_t mrpt::poses::CPose2D::size_type

Definition at line 295 of file CPose2D.h.

The type of the elements.

Definition at line 292 of file CPose2D.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
static_size 

Definition at line 299 of file CPose2D.h.


Constructor & Destructor Documentation

mrpt::poses::CPose2D::CPose2D ( const double &  x = 0,
const double &  y = 0,
const double &  phi = 0 
)

Constructor from an initial value of the pose.

mrpt::poses::CPose2D::CPose2D ( const CPoint2D  ) 

Constructor from a CPoint2D object.

mrpt::poses::CPose2D::CPose2D ( const CPose3D  )  [explicit]

Aproximation!! Avoid its use, since information is lost.

mrpt::poses::CPose2D::CPose2D ( const mrpt::math::TPose2D  ) 

Constructor from lightweight object.

mrpt::poses::CPose2D::CPose2D ( const CPoint3D  )  [explicit]

Constructor from CPoint3D with information loss.


Member Function Documentation

void mrpt::poses::CPose2D::AddComponents ( CPose2D p  ) 

Scalar sum of components: This is diferent from poses composition, which is implemented as "+" operators in "CPose" derived classes.

std::string mrpt::poses::CPose2D::asString (  )  const [inline]

Definition at line 252 of file CPose2D.h.

References asString().

Referenced by asString().

void mrpt::poses::CPose2D::asString ( std::string &  s  )  const [inline, virtual]

Returns a human-readable textual representation of the object (eg: "[x y yaw]", yaw in degrees).

See also:
fromString

Implements mrpt::poses::CPoseOrPoint.

Definition at line 251 of file CPose2D.h.

References mrpt::format(), and mrpt::utils::RAD2DEG().

void mrpt::poses::CPose2D::composeFrom ( const CPose2D A,
const CPose2D B 
)

Makes $ this = A \oplus B $.

Note:
A or B can be "this" without problems.
void mrpt::poses::CPose2D::composePoint ( double  lx,
double  ly,
double &  gx,
double &  gy 
) const

An alternative, slightly more efficient way of doing $ G = P \oplus L $ with G and L being 2D points and P this 2D pose.

static bool mrpt::poses::CPose2D::empty (  )  [inline, static]

Definition at line 301 of file CPose2D.h.

void mrpt::poses::CPose2D::fromString ( const std::string &  s  )  [inline, virtual]

Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0.8]" ).

See also:
asString
Exceptions:
std::exception On invalid format

Implements mrpt::poses::CPoseOrPoint.

Definition at line 258 of file CPose2D.h.

References ASSERTMSG_, mrpt::utils::DEG2RAD(), mrpt::math::CMatrixTemplate< T >::fromMatlabStringFormat(), mrpt::math::CMatrixTemplate< T >::get_unsafe(), mrpt::math::size(), and THROW_EXCEPTION.

void mrpt::poses::CPose2D::getAsVector ( vector_double v  )  const [virtual]

Returns a 1x3 vector with [x y phi].

Implements mrpt::poses::CPoseOrPoint.

void mrpt::poses::CPose2D::getHomogeneousMatrix ( CMatrixDouble44 out_HM  )  const [virtual]

Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (translation+orientation).

See also:
getInverseHomogeneousMatrix

Implements mrpt::poses::CPoseOrPoint.

static size_type mrpt::poses::CPose2D::max_size (  )  [inline, static]

Definition at line 302 of file CPose2D.h.

void mrpt::poses::CPose2D::normalizePhi (  ) 

Forces "phi" to be in the range [-pi,pi];.

void mrpt::poses::CPose2D::operator*= ( const double  s  )  [virtual]

Scalar multiplication.

Implements mrpt::poses::CPoseOrPoint.

CPoint3D mrpt::poses::CPose2D::operator+ ( const CPoint3D u  )  const

The operator $ u' = this \oplus u $ is the pose/point compounding operator.

CPoint2D mrpt::poses::CPose2D::operator+ ( const CPoint2D u  )  const

The operator $ u' = this \oplus u $ is the pose/point compounding operator.

CPose3D mrpt::poses::CPose2D::operator+ ( const CPose3D D  )  const

The operator $ a = this \oplus D $ is the pose compounding operator.

CPose2D mrpt::poses::CPose2D::operator+ ( const CPose2D D  )  const

The operator $ a = this \oplus D $ is the pose compounding operator.

CPose2D& mrpt::poses::CPose2D::operator+= ( const CPose2D b  )  [inline]

Make $ this = this \oplus b $.

Definition at line 238 of file CPose2D.h.

CPose2D mrpt::poses::CPose2D::operator- ( const CPose2D b  )  const

The operator $ D = this \ominus b $ is the pose inverse compounding operator, the resulting pose D fulfils: $ this = b \oplus D $, that is: $ b = a \oplus (b \ominus a) $.

double& mrpt::poses::CPose2D::operator[] ( unsigned int  i  )  [inline]

Definition at line 278 of file CPose2D.h.

const double& mrpt::poses::CPose2D::operator[] ( unsigned int  i  )  const [inline]

Definition at line 267 of file CPose2D.h.

void mrpt::poses::CPose2D::phi ( double  angle  )  [inline]

Set the phi angle of the 2D pose (in radians).

Definition at line 187 of file CPose2D.h.

double mrpt::poses::CPose2D::phi (  )  const [inline]

Get the phi angle of the 2D pose (in radians).

Definition at line 184 of file CPose2D.h.

Referenced by mrpt::poses::CRobot2DPoseEstimator::getLatestRobotPose().

void mrpt::poses::CPose2D::phi_incr ( const double  Aphi  )  [inline]

Increment the PHI angle (without checking the 2 PI range, call normalizePhi is needed).

Definition at line 189 of file CPose2D.h.

static void mrpt::poses::CPose2D::resize ( const size_t  n  )  [inline, static]

Definition at line 303 of file CPose2D.h.

References mrpt::format().

static size_type mrpt::poses::CPose2D::size (  )  [inline, static]

Definition at line 300 of file CPose2D.h.


Member Data Documentation

double mrpt::poses::CPose2D::m_phi [protected]

The orientation of the pose, in radians.

Definition at line 160 of file CPose2D.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010