@@ -16,7 +16,7 @@ def test_DHRobot(self):
1616 l0 = rp .DHLink ()
1717 rp .DHRobot ([l0 ])
1818
19- def test_isprismatic (self ):
19+ def test_prismaticjoints (self ):
2020 l0 = rp .PrismaticDH ()
2121 l1 = rp .RevoluteDH ()
2222 l2 = rp .PrismaticDH ()
@@ -26,7 +26,33 @@ def test_isprismatic(self):
2626
2727 ans = [True , False , True , False ]
2828
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 )
3056
3157 def test_isrevolute (self ):
3258 l0 = rp .PrismaticDH ()
@@ -38,7 +64,10 @@ def test_isrevolute(self):
3864
3965 ans = [False , True , False , True ]
4066
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 )
4271
4372 def test_todegrees (self ):
4473 l0 = rp .PrismaticDH ()
@@ -596,52 +625,53 @@ def test_fkine_all(self):
596625 q = [1 , 2 , 3 , 4 , 5 , 6 , 7 ]
597626 panda .q = q
598627
599- t0 = np .array ([
628+
629+ t0 = np .eye (4 )
630+ t1 = np .array ([
600631 [0.5403 , - 0.8415 , 0 , 0 ],
601632 [0.8415 , 0.5403 , 0 , 0 ],
602633 [0 , 0 , 1 , 0.333 ],
603634 [0 , 0 , 0 , 1 ]
604635 ])
605- t1 = np .array ([
636+ t2 = np .array ([
606637 [- 0.2248 , - 0.4913 , - 0.8415 , 0 ],
607638 [- 0.3502 , - 0.7651 , 0.5403 , 0 ],
608639 [- 0.9093 , 0.4161 , 0 , 0.333 ],
609640 [0 , 0 , 0 , 1 ]
610641 ])
611- t2 = np .array ([
642+ t3 = np .array ([
612643 [0.1038 , 0.8648 , 0.4913 , 0.1552 ],
613644 [0.4229 , - 0.4855 , 0.7651 , 0.2418 ],
614645 [0.9002 , 0.1283 , - 0.4161 , 0.2015 ],
615646 [0 , 0 , 0 , 1 ]
616647 ])
617- t3 = np .array ([
648+ t4 = np .array ([
618649 [- 0.4397 , - 0.2425 , - 0.8648 , 0.1638 ],
619650 [- 0.8555 , - 0.1801 , 0.4855 , 0.2767 ],
620651 [- 0.2735 , 0.9533 , - 0.1283 , 0.2758 ],
621652 [0 , 0 , 0 , 1 ]
622653 ])
623- t4 = np .array ([
654+ t5 = np .array ([
624655 [- 0.9540 , - 0.1763 , - 0.2425 , 0.107 ],
625656 [0.2229 , - 0.9581 , - 0.1801 , 0.2781 ],
626657 [- 0.2006 , - 0.2258 , 0.9533 , 0.6644 ],
627658 [0 , 0 , 0 , 1 ]
628659 ])
629- t5 = np .array ([
660+ t6 = np .array ([
630661 [- 0.8482 , - 0.4994 , 0.1763 , 0.107 ],
631662 [0.2643 , - 0.1106 , 0.9581 , 0.2781 ],
632663 [- 0.4590 , 0.8593 , 0.2258 , 0.6644 ],
633664 [0 , 0 , 0 , 1 ]
634665 ])
635- t6 = np .array ([
666+ t7 = np .array ([
636667 [- 0.5236 , 0.6902 , 0.4994 , 0.08575 ],
637668 [0.8287 , 0.5487 , 0.1106 , 0.3132 ],
638669 [- 0.1977 , 0.4718 , - 0.8593 , 0.5321 ],
639670 [0 , 0 , 0 , 1 ]
640671 ])
641672
642673 Tall = panda .fkine_all (q )
643- Tall2 = panda .fkine_all ()
644- Tall3 = panda .fkine_all (old = False )
674+
645675
646676 nt .assert_array_almost_equal (Tall [0 ].A , t0 , decimal = 4 )
647677 nt .assert_array_almost_equal (Tall [1 ].A , t1 , decimal = 4 )
@@ -650,8 +680,8 @@ def test_fkine_all(self):
650680 nt .assert_array_almost_equal (Tall [4 ].A , t4 , decimal = 4 )
651681 nt .assert_array_almost_equal (Tall [5 ].A , t5 , decimal = 4 )
652682 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+
655685
656686 # def test_gravjac(self):
657687 # 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):
13451375
13461376 def test_teach (self ):
13471377 panda = rp .models .DH .Panda ()
1348- panda .q = panda .qr
13491378 e = panda .teach (block = False )
13501379 e .close ()
13511380
0 commit comments