Class Transform

Class Documentation

class Transform

A class representing a 2D frame transformation or 2D pose.

This class mimics the tf2::Transform class to the extent possible.

Public Functions

inline Transform()

No initialization constructor.

inline Transform(const Rotation &rotation, const Vector2 &translation)

Constructor from a rotation and translation.

Parameters:
  • rotationRotation

  • translation – Translation

inline Transform(const tf2Scalar x, const tf2Scalar y, const tf2Scalar yaw)

Constructor from individual x, y, yaw elements.

Parameters:
  • x – The X value

  • y – The Y value

  • yaw – The yaw value in radians

inline explicit Transform(const tf2::Transform &transform)

Constructor from a tf2 Transform object.

Parameters:

transform – - The tf2 Transform object from which we will initialize this object

inline Transform &operator*=(const Transform &rhs)

Compose this transform with another transform on the right.

inline bool operator==(const Transform &rhs)

Test if two transforms have all elements equal.

inline bool operator!=(const Transform &rhs)

Test if two transforms are not equal.

inline Transform lerp(const Transform &other, const tf2Scalar ratio) const

Return the linear interpolation between this and another transform.

Parameters:
  • other – The other transform

  • ratio – The ratio of this to other (ratio=0 => return this, ratio=1 => return other)

inline const Rotation &getRotation() const

Return the rotation for this transform.

inline const Rotation &rotation() const
inline const Vector2 &getTranslation() const

Return the translation for this transform.

inline const Vector2 &translation() const
inline void setRotation(const Rotation &other)

Set the rotation for this transform.

inline void setTranslation(const Vector2 &other)

Set the translation for this transform.

inline const tf2Scalar &getX() const

Return the X value.

inline const tf2Scalar &x() const
inline const tf2Scalar &getY() const

Return the Y value.

inline const tf2Scalar &y() const
inline const tf2Scalar &getYaw() const

Return the yaw value.

inline const tf2Scalar &yaw() const
inline const tf2Scalar &getAngle() const
inline const tf2Scalar &angle() const
inline const tf2Scalar &getHeading() const
inline const tf2Scalar &heading() const
inline const tf2Scalar &getTheta() const
inline const tf2Scalar &theta() const
inline void setX(const tf2Scalar x)

Set the X value.

inline void setY(const tf2Scalar y)

Set the Y value.

inline void setYaw(const tf2Scalar yaw)

Set the yaw value.

inline void setAngle(const tf2Scalar angle)
inline void setHeading(const tf2Scalar heading)
inline void setTheta(const tf2Scalar theta)
inline void setIdentity()

Set this transformation to the identity.

inline Transform inverse() const

Return the inverse of this transform.

inline Transform inverseTimes(const Transform &other) const

Return the inverse of this transform times the other transform.

returns this.inverse() * other

Parameters:

other – The other transform

inline Eigen::Matrix3d getHomogeneousMatrix() const

Get a 3x3 homogeneous transformation matrix.