struct mrpt::math::TPose2D
Lightweight 2D pose.
Allows coordinate access using [] operator.
See also:
#include <mrpt/math/TPose2D.h> struct TPose2D: public mrpt::math::TPoseOrPoint, public mrpt::math::internal::ProvideStaticResize { // enums enum { static_size = 3, }; // fields double x {.0}; double y {.0}; double phi {.0}; // construction TPose2D(const TPoint2D& p); TPose2D(const TPoint3D& p); TPose2D(const TPose3D& p); TPose2D(double xx, double yy, double Phi); TPose2D(); // methods static constexpr TPose2D Identity(); template <typename Vector> static TPose2D FromVector(const Vector& v); static TPose2D FromString(const std::string& s); double& operator [] (size_t i); constexpr double operator [] (size_t i) const; template <typename Vector> void asVector(Vector& v) const; template <typename Vector> Vector asVector() const; void asString(std::string& s) const; std::string asString() const; mrpt::math::TPose2D operator + (const mrpt::math::TPose2D& b) const; mrpt::math::TPose2D operator - (const mrpt::math::TPose2D& b) const; mrpt::math::TPoint2D composePoint(const TPoint2D l) const; mrpt::math::TPoint2D operator + (const mrpt::math::TPoint2D& b) const; mrpt::math::TPoint2D inverseComposePoint(const TPoint2D g) const; mrpt::math::TPoint2D translation() const; double norm() const; void normalizePhi(); void fromString(const std::string& s); };
Inherited Members
public: // methods void resize(std::size_t n);
Fields
double x {.0}
X,Y coordinates.
double phi {.0}
Orientation (rads)
Construction
TPose2D(const TPoint2D& p)
Implicit constructor from TPoint2D.
Zeroes the phi coordinate.
See also:
TPose2D(const TPoint3D& p)
Constructor from TPoint3D, losing information.
Zeroes the phi coordinate.
See also:
TPose2D(const TPose3D& p)
Constructor from TPose3D, losing information.
The phi corresponds to the original pose’s yaw.
See also:
TPose2D(double xx, double yy, double Phi)
Constructor from coordinates.
TPose2D()
Default fast constructor.
Initializes to zeros.
Methods
static constexpr TPose2D Identity()
Returns the identity transformation.
template <typename Vector> static TPose2D FromVector(const Vector& v)
Builds from the first 3 elements of a vector-like object: [x y phi].
Parameters:
Vector |
It can be std::vector<double>, Eigen::VectorXd, etc. |
double& operator [] (size_t i)
Coordinate access using operator[].
Order: x,y,phi
constexpr double operator [] (size_t i) const
Coordinate access using operator[].
Order: x,y,phi
template <typename Vector> void asVector(Vector& v) const
Gets the pose as a vector of doubles.
Parameters:
Vector |
It can be std::vector<double>, Eigen::VectorXd, etc. |
template <typename Vector> 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 asString(std::string& s) const
Returns a human-readable textual representation of the object (eg: “[x y yaw]”, yaw in degrees)
See also:
mrpt::math::TPose2D operator + (const mrpt::math::TPose2D& b) const
Operator “oplus” pose composition: “ret=this oplus b”.
See also:
CPose2D
mrpt::math::TPose2D operator - (const mrpt::math::TPose2D& b) const
Operator “ominus” pose composition: “ret=this ominus b”.
See also:
CPose2D
mrpt::math::TPoint2D translation() const
Returns the (x,y) translational part of the SE(2) transformation.
double norm() const
Returns the norm of the (x,y) vector (phi is not used)
void normalizePhi()
Forces “phi” to be in the range [-pi,pi].
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: