Creates a validated rotation, an element of SO(2) or SO(3). Exactly one representation must be supplied:
Usage
robot_rotation(
x = NULL,
axis = NULL,
angle = NULL,
euler = NULL,
sequence = "ZYX",
rotvec = NULL,
quaternion = NULL,
tol = 1e-06
)Arguments
- x
Optional matrix,
robot_rotation, orrobot_quaternion.- axis
Rotation axis (length 3).
- angle
Rotation angle in radians.
- euler
Three Euler angles in radians.
- sequence
Intrinsic axis sequence, one of the 12 valid sequences such as
"ZYX","XYZ"or"ZYZ".- rotvec
Rotation vector (length 3).
- quaternion
Scalar-first quaternion (length 4).
- tol
Tolerance for matrix validation.
Details
x: a rotation matrix,robot_rotation, orrobot_quaternion;axisandangle: active right-handed rotation byangleradians about the unit vectoraxis(any nonzero vector is normalized);anglealone: a planar rotation (SO(2));eulerwithsequence: intrinsic Euler angles, sosequence = "ZYX"andeuler = c(a, b, c)gives \(R_z(a) R_y(b) R_x(c)\) (yaw, pitch, roll). The URDFrpy = c(r, p, y)attribute corresponds tosequence = "ZYX"witheuler = c(y, p, r);rotvec: a rotation vector \(\theta u\);quaternion: scalar-firstc(w, x, y, z).
Matrices are checked for \(R^\top R = I\) and \(\det R = 1\) within
tol; use orthonormalize() first to repair accumulated drift.
Examples
R <- robot_rotation(axis = c(0, 0, 1), angle = pi / 2)
R
#> <robot_rotation> SO(3)
#> angle 1.5708 rad about axis (0, 0, 1)
#> [,1] [,2] [,3]
#> [1,] 0 -1 0
#> [2,] 1 0 0
#> [3,] 0 0 1
robot_rotation(euler = c(0.3, -0.2, 0.1), sequence = "ZYX")
#> <robot_rotation> SO(3)
#> angle 0.381565 rad about axis (0.3379, -0.4807, 0.8092)
#> [,1] [,2] [,3]
#> [1,] 0.9363 -0.3130 -0.1593
#> [2,] 0.2896 0.9447 -0.1538
#> [3,] 0.1987 0.0978 0.9752
robot_rotation(angle = pi / 6)
#> <robot_rotation> SO(2)
#> angle 0.523599 rad
#> [,1] [,2]
#> [1,] 0.866 -0.500
#> [2,] 0.500 0.866