@@ -1693,37 +1693,22 @@ def __init__(
16931693 rot = joint .rpy
16941694
16951695 # Check if axis of rotation/tanslation is not 1
1696- # if np.sum(np.abs(np.array(joint.axis))) == 1 and 1 in np.abs(
1697- # np.array(joint.axis)
1698- # ):
1699- # print("not")
1700- childlink ._ets = rtb .ETS .SE3 (trans , rot )
1701- # else:
1702-
1703- # phi = np.arctan2(
1704- # np.sqrt(joint.axis[0] * joint.axis[0] + joint.axis[1] * joint.axis[1]),
1705- # joint.axis[2],
1706- # )
1707- # print(phi)
1708- # theta = np.arctan2(joint.axis[1], -joint.axis[0])
1709- # print(theta)
1710-
1711- # joint.axis = [1, 0, 0]
1712-
1713- # new_axis = [0, 0, 1]
1714-
1715- # v = np.cross(joint.axis, new_axis)
1716- # theta = np.arccos(np.dot(joint.axis, new_axis))
1717- # new_rot = sm.SO3.AngVec(theta, v)
1718-
1719- # print(joint.axis)
1720- # print(new_rot.rpy())
1696+ if np .sum (np .abs (np .array (joint .axis ))) == 1 and 1 in np .abs (
1697+ np .array (joint .axis )
1698+ ):
1699+ childlink ._ets = rtb .ETS .SE3 (trans , rot )
1700+ else :
1701+ # Normalise the joint axis to be along or about z axis
1702+ # Convert rest to static ETS
1703+ v = joint .axis
1704+ u , n = sm .base .unitvec_norm (v )
1705+ R = sm .base .angvec2r (n , u )
17211706
1722- # childlink._ets = rtb.ETS.SE3(trans, rot) * rtb.ETS.SE3(
1723- # [0, 0, 0], new_rot.rpy()
1724- # )
1707+ R_total = sm .SE3 .RPY (joint .rpy ) * R
1708+ rpy = sm .base .tr2rpy (R_total )
17251709
1726- # joint.axis = [0, 0, 1]
1710+ childlink ._ets = rtb .ETS .SE3 (trans , rpy )
1711+ joint .axis = [0 , 0 , 1 ]
17271712
17281713 childlink ._init_Ts ()
17291714
0 commit comments