CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
geom
RightHandedRotation.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
namespace
carla
{
10
namespace
geom
{
11
12
/// Euler angles of a rotation expressed in a **right-handed** frame, in
13
/// degrees. This is the boundary type for ROS / REP-103 "FLU" consumers:
14
/// x forward, y **left**, z up, every axis turned by the right-hand rule.
15
///
16
/// The three angles compose as the usual intrinsic Z-Y-X (yaw, then pitch,
17
/// then roll) sequence, i.e. `R = Rz(yaw) * Ry(pitch) * Rx(roll)` with the
18
/// standard right-handed elementary matrices. That is exactly what
19
/// `scipy.spatial.transform.Rotation.from_euler("xyz", ...)`,
20
/// `tf2::Quaternion::setRPY` and NVIDIA's ClipGT `rig.json` all mean by
21
/// "roll pitch yaw".
22
///
23
/// This is **not** `carla::geom::Rotation`. CARLA's frame is left-handed
24
/// (x forward, y **right**, z up) and its rotator has mixed signs; the
25
/// exact mapping is
26
///
27
/// right_handed.roll = carla.roll
28
/// right_handed.pitch = -carla.pitch
29
/// right_handed.yaw = -carla.yaw
30
///
31
/// which is its own inverse. Use `Rotation::ToRightHanded()` /
32
/// `Rotation::FromRightHanded()` rather than flipping signs by hand, and
33
/// see `Docs/coordinate_conventions.md`.
34
struct
RightHandedRotation
{
35
36
/// Rotation about the forward (+X) axis, degrees, right-hand rule.
37
float
roll
= 0.0f;
38
39
/// Rotation about the left (+Y) axis, degrees, right-hand rule.
40
float
pitch
= 0.0f;
41
42
/// Rotation about the up (+Z) axis, degrees, right-hand rule.
43
float
yaw
= 0.0f;
44
45
RightHandedRotation
() =
default
;
46
47
constexpr
RightHandedRotation
(
float
in_roll,
float
in_pitch,
float
in_yaw)
48
:
roll
(in_roll),
49
pitch
(in_pitch),
50
yaw
(in_yaw) {
51
}
52
53
constexpr
bool
operator==
(
const
RightHandedRotation
&rhs)
const
{
54
return
(
roll
== rhs.
roll
) && (
pitch
== rhs.
pitch
) && (
yaw
== rhs.
yaw
);
55
}
56
57
constexpr
bool
operator!=
(
const
RightHandedRotation
&rhs)
const
{
58
return
!(*
this
== rhs);
59
}
60
};
61
62
}
// namespace geom
63
}
// namespace carla
carla::geom
Definition
Misc.h:24
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
carla::geom::RightHandedRotation::RightHandedRotation
RightHandedRotation()=default
carla::geom::RightHandedRotation::yaw
float yaw
Rotation about the up (+Z) axis, degrees, right-hand rule.
Definition
RightHandedRotation.h:43
carla::geom::RightHandedRotation::operator==
constexpr bool operator==(const RightHandedRotation &rhs) const
Definition
RightHandedRotation.h:53
carla::geom::RightHandedRotation::roll
float roll
Rotation about the forward (+X) axis, degrees, right-hand rule.
Definition
RightHandedRotation.h:37
carla::geom::RightHandedRotation::operator!=
constexpr bool operator!=(const RightHandedRotation &rhs) const
Definition
RightHandedRotation.h:57
carla::geom::RightHandedRotation::RightHandedRotation
constexpr RightHandedRotation(float in_roll, float in_pitch, float in_yaw)
Definition
RightHandedRotation.h:47
carla::geom::RightHandedRotation::pitch
float pitch
Rotation about the left (+Y) axis, degrees, right-hand rule.
Definition
RightHandedRotation.h:40
Generated by
1.18.0