File tree Expand file tree Collapse file tree 1 file changed +35
-7
lines changed Expand file tree Collapse file tree 1 file changed +35
-7
lines changed Original file line number Diff line number Diff line change 14
14
from roboticstoolbox .robot .Link import Link
15
15
from functools import wraps
16
16
17
+ _eps = np .finfo (np .float64 ).eps
18
+
19
+ # ---------------------------------------------------------------------------------------#
20
+
21
+ try : # pragma: no cover
22
+ # print('Using SymPy')
23
+ import sympy as sym
24
+
25
+ def _issymbol (x ):
26
+ return isinstance (x , sym .Expr )
27
+ except ImportError :
28
+ def _issymbol (x ): # pylint: disable=unused-argument
29
+ return False
30
+
31
+ def _cos (theta ):
32
+ if _issymbol (theta ):
33
+ return sym .cos (theta )
34
+ else :
35
+ return np .cos (theta )
36
+
37
+ def _sin (theta ):
38
+ if _issymbol (theta ):
39
+ return sym .sin (theta )
40
+ else :
41
+ return np .sin (theta )
42
+
43
+ # ---------------------------------------------------------------------------------------#
44
+
17
45
class DHLink (Link ):
18
46
"""
19
47
A link superclass for all link types. A Link object holds all information
@@ -439,8 +467,8 @@ def A(self, q):
439
467
440
468
"""
441
469
442
- sa = np . sin (self .alpha )
443
- ca = np . cos (self .alpha )
470
+ sa = _sin (self .alpha )
471
+ ca = _cos (self .alpha )
444
472
445
473
if self .flip :
446
474
q = - q + self .offset
@@ -449,13 +477,13 @@ def A(self, q):
449
477
450
478
if self .sigma == 0 :
451
479
# revolute
452
- st = np . sin (q )
453
- ct = np . cos (q )
480
+ st = _sin (q )
481
+ ct = _cos (q )
454
482
d = self .d
455
483
else :
456
484
# prismatic
457
- st = np . sin (self .theta )
458
- ct = np . cos (self .theta )
485
+ st = _sin (self .theta )
486
+ ct = _cos (self .theta )
459
487
d = q
460
488
461
489
if self .mdh == 0 :
@@ -475,7 +503,7 @@ def A(self, q):
475
503
[0 , 0 , 0 , 1 ]
476
504
])
477
505
478
- return SE3 (T )
506
+ return SE3 (T , check = False )
479
507
480
508
def islimit (self , q ):
481
509
"""
You can’t perform that action at this time.
0 commit comments