@@ -323,6 +323,8 @@ def ishom(T, check=False, tol=100):
323323 :type T: numpy(4,4)
324324 :param check: check validity of rotation submatrix
325325 :type check: bool
326+ :param tol: Tolerance in units of eps for rotation submatrix check, defaults to 100
327+ :type: float
326328 :return: whether matrix is an SE(3) homogeneous transformation matrix
327329 :rtype: bool
328330
@@ -365,6 +367,8 @@ def isrot(R, check=False, tol=100):
365367 :type R: numpy(3,3)
366368 :param check: check validity of rotation submatrix
367369 :type check: bool
370+ :param tol: Tolerance in units of eps for rotation matrix test, defaults to 100
371+ :type: float
368372 :return: whether matrix is an SO(3) rotation matrix
369373 :rtype: bool
370374
@@ -1142,7 +1146,7 @@ def tr2rpy(T, unit="rad", order="zyx", check=False):
11421146
11431147
11441148# ---------------------------------------------------------------------------------------#
1145- def trlog (T , check = True , twist = False ):
1149+ def trlog (T , check = True , twist = False , tol = 10 ):
11461150 """
11471151 Logarithm of SO(3) or SE(3) matrix
11481152
@@ -1152,6 +1156,8 @@ def trlog(T, check=True, twist=False):
11521156 :type check: bool
11531157 :param twist: return a twist vector instead of matrix [default]
11541158 :type twist: bool
1159+ :param tol: Tolerance in units of eps for zero-rotation case, defaults to 10
1160+ :type: float
11551161 :return: logarithm
11561162 :rtype: ndarray(4,4) or ndarray(3,3)
11571163 :raises ValueError: bad argument
@@ -1179,10 +1185,10 @@ def trlog(T, check=True, twist=False):
11791185 :seealso: :func:`~trexp` :func:`~spatialmath.smb.transformsNd.vex` :func:`~spatialmath.smb.transformsNd.vexa`
11801186 """
11811187
1182- if ishom (T , check = check ):
1188+ if ishom (T , check = check , tol = 10 ):
11831189 # SE(3) matrix
11841190
1185- if smb .iseye (T ):
1191+ if smb .iseye (T , tol = tol ):
11861192 # is identity matrix
11871193 if twist :
11881194 return np .zeros ((6 ,))
@@ -1221,7 +1227,7 @@ def trlog(T, check=True, twist=False):
12211227 return np .zeros ((3 ,))
12221228 else :
12231229 return np .zeros ((3 , 3 ))
1224- elif abs (np .trace (R ) + 1 ) < 100 * _eps :
1230+ elif abs (np .trace (R ) + 1 ) < tol * _eps :
12251231 # check for trace = -1
12261232 # rotation by +/- pi, +/- 3pi etc.
12271233 diagonal = R .diagonal ()
0 commit comments