TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Transform2D Class Reference

Represents a 2D rigid body transform (SE(2)): translation and rotation. More...

#include <FrameMgr2D.h>

Collaboration diagram for Transform2D:
Collaboration graph
[legend]

Public Member Functions

 Transform2D (float x, float y, float heading_deg)
 
 Transform2D (const Coordinate< DistanceM > &coord, float heading_deg)
 
float getHeading (AngleUnit unit) const
 Get heading in specified unit (degrees or radians)
 
Coordinate< DistanceM > apply (const Coordinate< DistanceM > &local) const
 Applies this transform to a local coordinate, returning the coordinate in the global frame. The local coordinate is first rotated by the heading, then translated by the position of this transform.
 
Transform2D operator* (const Transform2D &other) const
 Compose this transform with another (this * other). Applies this transform, then the other.
 
Transform2D inverse () const
 Invert this transform.
 

Public Attributes

Coordinate< DistanceM > pos
 Position (x, y) in meters.
 
float heading_deg
 Heading in degrees (0 = x axis)
 

Detailed Description

Represents a 2D rigid body transform (SE(2)): translation and rotation.

Transform2D models a pose in 2D space, consisting of a translation (x, y) in meters and a heading (rotation) in degrees. It supports:

The heading is in degrees, where 0 means facing along the positive x-axis, and positive values rotate counterclockwise (e.g., 90 degrees is along the positive y-axis).

Typical usage:

Example:

Transform2D base_to_world(1.0, 2.0, 45); // 1m x, 2m y, 45 deg rotation
Coordinate local_point(0.5, 0.0); // 0.5m ahead in base frame
Coordinate global_point = base_to_world.apply(local_point);
Transform2D world_to_base = base_to_world.inverse();
A generic 3D coordinate class for robotics, navigation, and spatial calculations.
Definition: Coordinate.h:57
Represents a 2D rigid body transform (SE(2)): translation and rotation.
Definition: FrameMgr2D.h:42
Transform2D inverse() const
Invert this transform.
Definition: FrameMgr2D.h:88

The documentation for this class was generated from the following file: