EulerAngle Class¶
The EulerAngle class represents attitude using Euler angle sequences for intuitive spacecraft orientation specification.
EulerAngle
¶
EulerAngle(order: str, phi: float, theta: float, psi: float, angle_format: AngleFormat)
Represents a rotation using Euler angles.
Euler angles describe rotations as a sequence of three rotations about specified axes. The rotation sequence is specified by the order parameter (e.g., "XYZ", "ZYX").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
str
|
Rotation sequence (e.g., "XYZ", "ZYX", "ZXZ") |
required |
phi
|
float
|
First rotation angle in radians or degrees |
required |
theta
|
float
|
Second rotation angle in radians or degrees |
required |
psi
|
float
|
Third rotation angle in radians or degrees |
required |
angle_format
|
AngleFormat
|
Units of input angles (RADIANS or DEGREES) |
required |
Example
import brahe as bh
# Create Euler angle rotation (roll, pitch, yaw in ZYX order)
e = bh.EulerAngle("ZYX", 0.1, 0.2, 0.3, bh.AngleFormat.RADIANS)
print(f"Roll={e.phi}, Pitch={e.theta}, Yaw={e.psi}")
# Convert to quaternion
q = e.to_quaternion()
# Convert to rotation matrix
dcm = e.to_rotation_matrix()
Initialize instance.
__doc__
class-attribute
¶
__doc__ = 'Represents a rotation using Euler angles.\n\nEuler angles describe rotations as a sequence of three rotations about\nspecified axes. The rotation sequence is specified by the order parameter\n(e.g., "XYZ", "ZYX").\n\nArgs:\n order (str): Rotation sequence (e.g., "XYZ", "ZYX", "ZXZ")\n phi (float): First rotation angle in radians or degrees\n theta (float): Second rotation angle in radians or degrees\n psi (float): Third rotation angle in radians or degrees\n angle_format (AngleFormat): Units of input angles (RADIANS or DEGREES)\n\nExample:\n ```python\n import brahe as bh\n\n # Create Euler angle rotation (roll, pitch, yaw in ZYX order)\n e = bh.EulerAngle("ZYX", 0.1, 0.2, 0.3, bh.AngleFormat.RADIANS)\n print(f"Roll={e.phi}, Pitch={e.theta}, Yaw={e.psi}")\n\n # Convert to quaternion\n q = e.to_quaternion()\n\n # Convert to rotation matrix\n dcm = e.to_rotation_matrix()\n ```'
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.
__module__
class-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.
order
property
¶
order: str
Get the rotation sequence order.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Rotation sequence (e.g., "XYZ", "ZYX") |
phi
property
¶
phi: float
Get the first rotation angle (phi) in radians.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
First rotation angle in radians |
psi
property
¶
psi: float
Get the third rotation angle (psi) in radians.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Third rotation angle in radians |
theta
property
¶
theta: float
Get the second rotation angle (theta) in radians.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Second rotation angle in radians |
__new__
builtin
¶
Create and return a new object. See help(type) for accurate signature.
from_euler_angle
builtin
¶
from_euler_angle(e: EulerAngle, order: str) -> EulerAngle
Create Euler angles from another Euler angle with different order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
e
|
EulerAngle
|
Source Euler angles |
required |
order
|
str
|
Desired rotation sequence (e.g., "XYZ", "ZYX") |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAngle |
EulerAngle
|
Equivalent Euler angles with new order |
from_euler_axis
builtin
¶
from_euler_axis(e: EulerAxis, order: str) -> EulerAngle
Create Euler angles from an Euler axis representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
e
|
EulerAxis
|
Euler axis representation |
required |
order
|
str
|
Desired rotation sequence (e.g., "XYZ", "ZYX") |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAngle |
EulerAngle
|
Equivalent Euler angles |
from_quaternion
builtin
¶
from_quaternion(q: Quaternion, order: str) -> EulerAngle
Create Euler angles from a quaternion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
Quaternion
|
Source quaternion |
required |
order
|
str
|
Desired rotation sequence (e.g., "XYZ", "ZYX") |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAngle |
EulerAngle
|
Equivalent Euler angles |
from_rotation_matrix
builtin
¶
from_rotation_matrix(r: RotationMatrix, order: str) -> EulerAngle
Create Euler angles from a rotation matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
RotationMatrix
|
Rotation matrix |
required |
order
|
str
|
Desired rotation sequence (e.g., "XYZ", "ZYX") |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAngle |
EulerAngle
|
Equivalent Euler angles |
from_vector
builtin
¶
from_vector(v: ndarray, order: str, angle_format: AngleFormat) -> EulerAngle
Create Euler angles from a numpy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
ndarray
|
3-element array [phi, theta, psi] |
required |
order
|
str
|
Rotation sequence (e.g., "XYZ", "ZYX") |
required |
angle_format
|
AngleFormat
|
Units of input angles (RADIANS or DEGREES) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAngle |
EulerAngle
|
New Euler angle instance |
to_euler_angle
method descriptor
¶
to_euler_angle(order: str) -> EulerAngle
Convert to Euler angles with different rotation sequence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
str
|
Desired rotation sequence (e.g., "XYZ", "ZYX") |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAngle |
EulerAngle
|
Equivalent Euler angles with new order |
to_euler_axis
method descriptor
¶
to_euler_axis() -> EulerAxis
Convert to Euler axis representation.
Returns:
| Name | Type | Description |
|---|---|---|
EulerAxis |
EulerAxis
|
Equivalent Euler axis |
to_quaternion
method descriptor
¶
to_quaternion() -> Quaternion
Convert to quaternion representation.
Returns:
| Name | Type | Description |
|---|---|---|
Quaternion |
Quaternion
|
Equivalent quaternion |
to_rotation_matrix
method descriptor
¶
to_rotation_matrix() -> RotationMatrix
Convert to rotation matrix representation.
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
Equivalent rotation matrix |