MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / rotmat_to_ee

Function rotmat_to_ee

detrsmpl/utils/transforms.py:129–145  ·  view source on GitHub ↗

Convert rotation matrixs to euler angle. Args: matrix (Union[torch.Tensor, numpy.ndarray]): input shape should be (..., 3, 3). ndim of input is unlimited. convention (str, optional): Convention string of three letters from {“x”, “y”, and “z”}. Def

(
        matrix: Union[torch.Tensor, numpy.ndarray],
        convention: str = 'xyz')

Source from the content-addressed store, hash-verified

127
128
129def rotmat_to_ee(
130 matrix: Union[torch.Tensor, numpy.ndarray],
131 convention: str = 'xyz') -> Union[torch.Tensor, numpy.ndarray]:
132 """Convert rotation matrixs to euler angle.
133
134 Args:
135 matrix (Union[torch.Tensor, numpy.ndarray]): input shape
136 should be (..., 3, 3). ndim of input is unlimited.
137 convention (str, optional): Convention string of three letters
138 from {“x”, “y”, and “z”}. Defaults to 'xyz'.
139 Returns:
140 Union[torch.Tensor, numpy.ndarray]: shape would be (..., 3).
141 """
142 if matrix.shape[-1] != 3 or matrix.shape[-2] != 3:
143 raise ValueError(f'Invalid rotation matrix shape f{matrix.shape}.')
144 t = Compose([matrix_to_euler_angles])
145 return t(matrix, convention.upper())
146
147
148def rotmat_to_quat(

Callers 1

convert_camera_matrixFunction · 0.90

Calls 1

ComposeClass · 0.70

Tested by

no test coverage detected