CARLA
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
carla::geom::Rotation Class Reference

Euler angles of a rotation in CARLA's / Unreal's left-handed frame: x forward, y right, z up, degrees. More...

#include <Rotation.h>

Public Member Functions

Vector3D GetForwardVector () const
 
Vector3D GetRightVector () const
 
Vector3D GetUpVector () const
 
void InverseRotateVector (Vector3D &in_point) const
 
 MSGPACK_DEFINE_ARRAY (pitch, yaw, roll)
 
Rotation Normalize () const
 
 operator FRotator () const
 
bool operator!= (const Rotation &rhs) const
 
Rotation operator+ (const Rotation &rhs) const
 
Rotation & operator+= (const Rotation &rhs)
 
Rotation operator- (const Rotation &rhs) const
 
Rotation & operator-= (const Rotation &rhs)
 
bool operator== (const Rotation &rhs) const
 
Vector3D RotateVector (const Vector3D &in_point) const
 
void RotateVector (Vector3D &in_point) const
 
 Rotation ()=default
 
 Rotation (const FRotator &rotator)
 
constexpr Rotation (float p, float y, float r)
 
constexpr RightHandedRotation ToRightHanded () const
 This rotation expressed in a right-handed, x-forward / y-**left** / z-up frame (ROS REP-103 "FLU"), as intrinsic Z-Y-X Euler angles under the right-hand rule.
 

Static Public Member Functions

static constexpr Rotation FromRightHanded (const RightHandedRotation &rhs)
 Inverse of ToRightHanded().
 

Public Attributes

float pitch = 0.0f
 
float roll = 0.0f
 
float yaw = 0.0f
 

Detailed Description

Euler angles of a rotation in CARLA's / Unreal's left-handed frame: x forward, y right, z up, degrees.

The three angles compose as R = Rz(+yaw) * Ry(-pitch) * Rx(-roll) with the standard (right-handed) elementary matrices, which is the same thing as saying:

This is CARLA 0.9.x's documented convention and it is what the engine builds from the same FRotator, verified against rendered camera frames on UE5.8. RotateVector, Transform::GetMatrix and Math::Get{Forward,Right,Up}Vector all live in this frame and must not be "corrected" towards a right-handed convention.

For ROS / REP-103 consumers convert explicitly at the boundary with ToRightHanded() / FromRightHanded(); see RightHandedRotation and Docs/coordinate_conventions.md.

Definition at line 45 of file Rotation.h.

Constructor & Destructor Documentation

◆ Rotation() [1/3]

carla::geom::Rotation::Rotation ( )
default

Referenced by FromRightHanded(), and Normalize().

◆ Rotation() [2/3]

constexpr carla::geom::Rotation::Rotation ( float  p,
float  y,
float  r 
)
inlineconstexpr

Definition at line 66 of file Rotation.h.

◆ Rotation() [3/3]

carla::geom::Rotation::Rotation ( const FRotator &  rotator)
inline

Definition at line 271 of file Rotation.h.

Member Function Documentation

◆ FromRightHanded()

static constexpr Rotation carla::geom::Rotation::FromRightHanded ( const RightHandedRotation &  rhs)
inlinestaticconstexpr

Inverse of ToRightHanded().

The mapping is an involution, so the same three sign flips apply in both directions.

Definition at line 212 of file Rotation.h.

References carla::geom::RightHandedRotation::pitch, carla::geom::RightHandedRotation::roll, Rotation(), and carla::geom::RightHandedRotation::yaw.

Referenced by carla::geom::Transform::FromRightHanded(), carla::geom::Quaternion::Rotator(), and TEST().

◆ GetForwardVector()

Vector3D carla::geom::Rotation::GetForwardVector ( ) const
inline

◆ GetRightVector()

Vector3D carla::geom::Rotation::GetRightVector ( ) const
inline

◆ GetUpVector()

Vector3D carla::geom::Rotation::GetUpVector ( ) const
inline

◆ InverseRotateVector()

void carla::geom::Rotation::InverseRotateVector ( Vector3D &  in_point) const
inline

◆ MSGPACK_DEFINE_ARRAY()

carla::geom::Rotation::MSGPACK_DEFINE_ARRAY ( pitch  ,
yaw  ,
roll   
)

◆ Normalize()

Rotation carla::geom::Rotation::Normalize ( ) const
inline

Definition at line 164 of file Rotation.h.

References pitch, roll, Rotation(), and yaw.

◆ operator FRotator()

carla::geom::Rotation::operator FRotator ( ) const
inline

Definition at line 274 of file Rotation.h.

References pitch, roll, and yaw.

◆ operator!=()

bool carla::geom::Rotation::operator!= ( const Rotation &  rhs) const
inline

Definition at line 226 of file Rotation.h.

◆ operator+()

Rotation carla::geom::Rotation::operator+ ( const Rotation &  rhs) const
inline

Definition at line 234 of file Rotation.h.

References pitch, roll, and yaw.

◆ operator+=()

Rotation & carla::geom::Rotation::operator+= ( const Rotation &  rhs)
inline

Definition at line 250 of file Rotation.h.

References pitch, roll, and yaw.

◆ operator-()

Rotation carla::geom::Rotation::operator- ( const Rotation &  rhs) const
inline

Definition at line 242 of file Rotation.h.

References pitch, roll, and yaw.

◆ operator-=()

Rotation & carla::geom::Rotation::operator-= ( const Rotation &  rhs)
inline

Definition at line 257 of file Rotation.h.

References pitch, roll, and yaw.

◆ operator==()

bool carla::geom::Rotation::operator== ( const Rotation &  rhs) const
inline

Definition at line 220 of file Rotation.h.

References pitch, roll, and yaw.

◆ RotateVector() [1/2]

Vector3D carla::geom::Rotation::RotateVector ( const Vector3D &  in_point) const
inline

Definition at line 125 of file Rotation.h.

References RotateVector().

◆ RotateVector() [2/2]

void carla::geom::Rotation::RotateVector ( Vector3D &  in_point) const
inline

◆ ToRightHanded()

constexpr RightHandedRotation carla::geom::Rotation::ToRightHanded ( ) const
inlineconstexpr

This rotation expressed in a right-handed, x-forward / y-**left** / z-up frame (ROS REP-103 "FLU"), as intrinsic Z-Y-X Euler angles under the right-hand rule.

Mirroring the Y axis maps Rz(+yaw) * Ry(-pitch) * Rx(-roll) onto Rz(-yaw) * Ry(+(-pitch)) * Rx(+roll), so pitch and yaw flip sign and roll does not. Example: Rotation(pitch=20, yaw=30, roll=10) becomes RightHandedRotation(roll=10, pitch=-20, yaw=-30).

Definition at line 206 of file Rotation.h.

References pitch, roll, and yaw.

Referenced by carla::geom::Transform::ToRightHanded().

Member Data Documentation

◆ pitch

float carla::geom::Rotation::pitch = 0.0f

◆ roll

float carla::geom::Rotation::roll = 0.0f

◆ yaw

float carla::geom::Rotation::yaw = 0.0f

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