skrobot.coordinates.math.rpy2matrix
- skrobot.coordinates.math.rpy2matrix(roll, pitch, yaw)[source]
Create rotation matrix from roll, pitch, yaw angles.
This function takes parameters in roll-pitch-yaw order (X-Y-Z rotation order), which is more intuitive for many applications. The rotation is applied as: roll around X, then pitch around Y, then yaw around Z.
- Parameters:
- Returns:
matrix – 3x3 rotation matrix
- Return type:
Examples
>>> import numpy as np >>> from skrobot.coordinates.math import rpy2matrix, matrix2rpy >>> roll, pitch, yaw = np.pi/3, np.pi/4, np.pi/6 >>> rot = rpy2matrix(roll, pitch, yaw) >>> recovered = matrix2rpy(rot) >>> np.allclose(recovered, [roll, pitch, yaw]) True
# Verify rotation order: X then Y then Z >>> # Pure rotations should work correctly >>> rot_x = rpy2matrix(np.pi/2, 0, 0) >>> rot_y = rpy2matrix(0, np.pi/2, 0) >>> rot_z = rpy2matrix(0, 0, np.pi/2)