@@ -323,6 +323,8 @@ def ishom(T, check=False, tol=100):
323
323
:type T: numpy(4,4)
324
324
:param check: check validity of rotation submatrix
325
325
:type check: bool
326
+ :param tol: Tolerance in units of eps for rotation submatrix check, defaults to 100
327
+ :type: float
326
328
:return: whether matrix is an SE(3) homogeneous transformation matrix
327
329
:rtype: bool
328
330
@@ -365,6 +367,8 @@ def isrot(R, check=False, tol=100):
365
367
:type R: numpy(3,3)
366
368
:param check: check validity of rotation submatrix
367
369
:type check: bool
370
+ :param tol: Tolerance in units of eps for rotation matrix test, defaults to 100
371
+ :type: float
368
372
:return: whether matrix is an SO(3) rotation matrix
369
373
:rtype: bool
370
374
@@ -1142,7 +1146,7 @@ def tr2rpy(T, unit="rad", order="zyx", check=False):
1142
1146
1143
1147
1144
1148
# ---------------------------------------------------------------------------------------#
1145
- def trlog (T , check = True , twist = False ):
1149
+ def trlog (T , check = True , twist = False , tol = 10 ):
1146
1150
"""
1147
1151
Logarithm of SO(3) or SE(3) matrix
1148
1152
@@ -1152,6 +1156,8 @@ def trlog(T, check=True, twist=False):
1152
1156
:type check: bool
1153
1157
:param twist: return a twist vector instead of matrix [default]
1154
1158
:type twist: bool
1159
+ :param tol: Tolerance in units of eps for zero-rotation case, defaults to 10
1160
+ :type: float
1155
1161
:return: logarithm
1156
1162
:rtype: ndarray(4,4) or ndarray(3,3)
1157
1163
:raises ValueError: bad argument
@@ -1179,10 +1185,10 @@ def trlog(T, check=True, twist=False):
1179
1185
:seealso: :func:`~trexp` :func:`~spatialmath.smb.transformsNd.vex` :func:`~spatialmath.smb.transformsNd.vexa`
1180
1186
"""
1181
1187
1182
- if ishom (T , check = check ):
1188
+ if ishom (T , check = check , tol = 10 ):
1183
1189
# SE(3) matrix
1184
1190
1185
- if smb .iseye (T ):
1191
+ if smb .iseye (T , tol = tol ):
1186
1192
# is identity matrix
1187
1193
if twist :
1188
1194
return np .zeros ((6 ,))
@@ -1221,7 +1227,7 @@ def trlog(T, check=True, twist=False):
1221
1227
return np .zeros ((3 ,))
1222
1228
else :
1223
1229
return np .zeros ((3 , 3 ))
1224
- elif abs (np .trace (R ) + 1 ) < 100 * _eps :
1230
+ elif abs (np .trace (R ) + 1 ) < tol * _eps :
1225
1231
# check for trace = -1
1226
1232
# rotation by +/- pi, +/- 3pi etc.
1227
1233
diagonal = R .diagonal ()
0 commit comments