# pypose.euler2SO3¶

pypose.euler2SO3(euler)[source]

Convert batched Euler angles (roll, pitch, and yaw) to SO3Type LieTensor.

Parameters

euler (Tensor) – the euler angles in radians to convert.

Returns

the converted SO3Type LieTensor.

Return type

LieTensor

Shape:

Input: (*, 3)

Output: (*, 4)

${\displaystyle \mathbf{y}_i={ \begin{bmatrix}\, \sin(\alpha_i)\cos(\beta_i)\cos(\gamma_i) - \cos(\alpha_i)\sin(\beta_i)\sin(\gamma_i)\\ \cos(\alpha_i)\sin(\beta_i)\cos(\gamma_i) + \sin(\alpha_i)\cos(\beta_i)\sin(\gamma_i)\\ \cos(\alpha_i)\cos(\beta_i)\sin(\gamma_i) - \sin(\alpha_i)\sin(\beta_i)\cos(\gamma_i)\\ \cos(\alpha_i)\cos(\beta_i)\cos(\gamma_i) + \sin(\alpha_i)\sin(\beta_i)\sin(\gamma_i) \end{bmatrix}}},$

where the $$i$$-th item of input $$\mathbf{x}_i = [\alpha_i, \beta_i, \gamma_i]$$ are roll, pitch, and yaw, respectively.

Note

The last dimension of the input tensor has to be 3. The Euler angle takes the rotation sequence of x (roll), y (pitch), then z (yaw) axis (counterclockwise).

Warning

Any given rotation has two possible quaternion representations. If one is known, the other is just the negative of all four terms. This function only returns one of them.

Examples

>>> input = torch.randn(2, 3, requires_grad=True, dtype=torch.float64)
>>> pp.euler2SO3(input)
SO3Type LieTensor:
tensor([[-0.4873,  0.1162,  0.4829,  0.7182],
[ 0.3813,  0.4059, -0.2966,  0.7758]], dtype=torch.float64, grad_fn=<AliasBackward0>)


See euler for more information.