@@ -16,7 +16,7 @@ def test_DHRobot(self):
16
16
l0 = rp .DHLink ()
17
17
rp .DHRobot ([l0 ])
18
18
19
- def test_isprismatic (self ):
19
+ def test_prismaticjoints (self ):
20
20
l0 = rp .PrismaticDH ()
21
21
l1 = rp .RevoluteDH ()
22
22
l2 = rp .PrismaticDH ()
@@ -26,7 +26,33 @@ def test_isprismatic(self):
26
26
27
27
ans = [True , False , True , False ]
28
28
29
- self .assertEqual (r0 .isprismatic (), ans )
29
+ self .assertEqual (r0 .prismaticjoints , ans )
30
+
31
+ def test_revolutejoints (self ):
32
+ l0 = rp .PrismaticDH ()
33
+ l1 = rp .RevoluteDH ()
34
+ l2 = rp .PrismaticDH ()
35
+ l3 = rp .RevoluteDH ()
36
+
37
+ r0 = rp .DHRobot ([l0 , l1 , l2 , l3 ])
38
+
39
+ ans = [False , True , False , True ]
40
+
41
+ self .assertEqual (r0 .revolutejoints , ans )
42
+
43
+
44
+ def test_isprismatic (self ):
45
+ l0 = rp .PrismaticDH ()
46
+ l1 = rp .RevoluteDH ()
47
+ l2 = rp .PrismaticDH ()
48
+ l3 = rp .RevoluteDH ()
49
+
50
+ r0 = rp .DHRobot ([l0 , l1 , l2 , l3 ])
51
+
52
+ self .assertEqual (r0 .isprismatic (0 ), True )
53
+ self .assertEqual (r0 .isprismatic (1 ), False )
54
+ self .assertEqual (r0 .isprismatic (2 ), True )
55
+ self .assertEqual (r0 .isprismatic (3 ), False )
30
56
31
57
def test_isrevolute (self ):
32
58
l0 = rp .PrismaticDH ()
@@ -38,7 +64,10 @@ def test_isrevolute(self):
38
64
39
65
ans = [False , True , False , True ]
40
66
41
- self .assertEqual (r0 .isrevolute (), ans )
67
+ self .assertEqual (r0 .isrevolute (0 ), False )
68
+ self .assertEqual (r0 .isrevolute (1 ), True )
69
+ self .assertEqual (r0 .isrevolute (2 ), False )
70
+ self .assertEqual (r0 .isrevolute (3 ), True )
42
71
43
72
def test_todegrees (self ):
44
73
l0 = rp .PrismaticDH ()
@@ -596,52 +625,53 @@ def test_fkine_all(self):
596
625
q = [1 , 2 , 3 , 4 , 5 , 6 , 7 ]
597
626
panda .q = q
598
627
599
- t0 = np .array ([
628
+
629
+ t0 = np .eye (4 )
630
+ t1 = np .array ([
600
631
[0.5403 , - 0.8415 , 0 , 0 ],
601
632
[0.8415 , 0.5403 , 0 , 0 ],
602
633
[0 , 0 , 1 , 0.333 ],
603
634
[0 , 0 , 0 , 1 ]
604
635
])
605
- t1 = np .array ([
636
+ t2 = np .array ([
606
637
[- 0.2248 , - 0.4913 , - 0.8415 , 0 ],
607
638
[- 0.3502 , - 0.7651 , 0.5403 , 0 ],
608
639
[- 0.9093 , 0.4161 , 0 , 0.333 ],
609
640
[0 , 0 , 0 , 1 ]
610
641
])
611
- t2 = np .array ([
642
+ t3 = np .array ([
612
643
[0.1038 , 0.8648 , 0.4913 , 0.1552 ],
613
644
[0.4229 , - 0.4855 , 0.7651 , 0.2418 ],
614
645
[0.9002 , 0.1283 , - 0.4161 , 0.2015 ],
615
646
[0 , 0 , 0 , 1 ]
616
647
])
617
- t3 = np .array ([
648
+ t4 = np .array ([
618
649
[- 0.4397 , - 0.2425 , - 0.8648 , 0.1638 ],
619
650
[- 0.8555 , - 0.1801 , 0.4855 , 0.2767 ],
620
651
[- 0.2735 , 0.9533 , - 0.1283 , 0.2758 ],
621
652
[0 , 0 , 0 , 1 ]
622
653
])
623
- t4 = np .array ([
654
+ t5 = np .array ([
624
655
[- 0.9540 , - 0.1763 , - 0.2425 , 0.107 ],
625
656
[0.2229 , - 0.9581 , - 0.1801 , 0.2781 ],
626
657
[- 0.2006 , - 0.2258 , 0.9533 , 0.6644 ],
627
658
[0 , 0 , 0 , 1 ]
628
659
])
629
- t5 = np .array ([
660
+ t6 = np .array ([
630
661
[- 0.8482 , - 0.4994 , 0.1763 , 0.107 ],
631
662
[0.2643 , - 0.1106 , 0.9581 , 0.2781 ],
632
663
[- 0.4590 , 0.8593 , 0.2258 , 0.6644 ],
633
664
[0 , 0 , 0 , 1 ]
634
665
])
635
- t6 = np .array ([
666
+ t7 = np .array ([
636
667
[- 0.5236 , 0.6902 , 0.4994 , 0.08575 ],
637
668
[0.8287 , 0.5487 , 0.1106 , 0.3132 ],
638
669
[- 0.1977 , 0.4718 , - 0.8593 , 0.5321 ],
639
670
[0 , 0 , 0 , 1 ]
640
671
])
641
672
642
673
Tall = panda .fkine_all (q )
643
- Tall2 = panda .fkine_all ()
644
- Tall3 = panda .fkine_all (old = False )
674
+
645
675
646
676
nt .assert_array_almost_equal (Tall [0 ].A , t0 , decimal = 4 )
647
677
nt .assert_array_almost_equal (Tall [1 ].A , t1 , decimal = 4 )
@@ -650,8 +680,8 @@ def test_fkine_all(self):
650
680
nt .assert_array_almost_equal (Tall [4 ].A , t4 , decimal = 4 )
651
681
nt .assert_array_almost_equal (Tall [5 ].A , t5 , decimal = 4 )
652
682
nt .assert_array_almost_equal (Tall [6 ].A , t6 , decimal = 4 )
653
- nt .assert_array_almost_equal (Tall2 [ 0 ].A , t0 , decimal = 4 )
654
- nt . assert_array_almost_equal ( Tall3 [ 0 ]. A , panda . base . A , decimal = 4 )
683
+ nt .assert_array_almost_equal (Tall [ 7 ].A , t7 , decimal = 4 )
684
+
655
685
656
686
# def test_gravjac(self):
657
687
# l0 = rp.RevoluteDH(d=2, B=3, G=2, Tc=[2, -1], alpha=0.4, a=0.2,
@@ -1345,7 +1375,6 @@ def test_perturb(self):
1345
1375
1346
1376
def test_teach (self ):
1347
1377
panda = rp .models .DH .Panda ()
1348
- panda .q = panda .qr
1349
1378
e = panda .teach (block = False )
1350
1379
e .close ()
1351
1380
0 commit comments