rt_tr2eul - homogeneous transform to Euler angles[view code]
Return a vector of Euler angles, in radians, corresponding to the rotational part of the homogeneous transform T.
// The following example shows how rt_tr2eul() can be used to get the
// orientation of a coordinate frame, described by a given homogeneous
// transform, expressed in terms of Euler angles.
// generate a homogeneous transform
e = [%pi/6, %pi/4, -2/5*%pi], // Euler angles set
T = rt_eul2tr(e);
// corresponding Euler angles set
e_comp = rt_tr2eul(T),
// Remember that the solution to the problem of computing a set of
// Euler angles corresponding to the rotational part of a homogeneous
// transform is not univoque.
// rt_tr2eul() computes the solution reducing the range to whom theta
// belongs to (0, %pi) radians.
// Therefore, if you generate a coordinate frame from a set of Euler
// angles with theta belonging to (-%pi, 0) and then you try to get
// its orientation by using rt_tr2eul() function, be aware that you
// won't obtain the starting set of angles.
e1 = [0.6, -1.2, -1.75], // Euler angles set
T = rt_eul2tr(e1);
e2 = rt_tr2eul(T), // e2 is different from e1, but they
// are equivalent in their effects
// Lastly, note that rt_tr2eul() provides a single solution when the
// computed set of Euler angles has theta = 0 or theta = %pi. But you
// should remember that in these cases infinitely many solutions are
// corresponding to the rotational part of the homogeneous transform.
e1 = [0.6, 0, -1.75]; // Euler angles set with theta = 0
T = rt_eul2tr(e1),
// all solutions for which phi + psi = 0.6 + (-1.75) are equivalent in
// their effects
e1_a = rt_tr2eul(T); Ta = rt_eul2tr(e1_a),
e1_b = [0.25, 0, -1.15-0.25]; Tb = rt_eul2tr(e1_b),
e1_c = [2.6, 0, -1.15-2.6]; Tc = rt_eul2tr(e1_c),
e1_d = [-1.35, 0, -1.15+1.35]; Td = rt_eul2tr(e1_d),
e1_e = [-0.9, 0, -1.15+0.9]; Te = rt_eul2tr(e1_e),
e2 = [-2.2, %pi, 0.95]; // Euler angles set with theta = %pi
T = rt_eul2tr(e2),
// all solutions for which psi - phi = 0.95 - (-2.2) are equivalent in
// their effects
e2_a = rt_tr2eul(T); Ta = rt_eul2tr(e2_a),
e2_b = [0, %pi, 3.15]; Tb = rt_eul2tr(e2_b),
e2_c = [-2.1, %pi, 3.15-2.1]; Tc = rt_eul2tr(e2_c),
e2_d = [1.25, %pi, 3.15+1.25]; Td = rt_eul2tr(e2_d),
e2_e = [0.5, %pi, 3.15+0.5]; Te = rt_eul2tr(e2_e),
Corke, P.I. "A Robotics Toolbox for MATLAB", IEEE Robotics and Automation Magazine, Volume 3(1), March 1996, pp. 24-32
R. P. Paul, Robot Manipulators: Mathematics, Programming and Control. Cambridge, Massachusetts: MIT Press, 1981.
L. Sciavicco, B. Siciliano, Modelling and Control of Robot Manipulators. 2nd Edition, Springer-Verlag Advanced Textbooks in Control and Signal Processing Series, London, UK, 2000.