|
| 1 | +""" |
| 2 | +@author: Jesse Haviland |
| 3 | +""" |
| 4 | + |
| 5 | +import roboticstoolbox as rtb |
| 6 | +import unittest |
| 7 | + |
| 8 | + |
| 9 | +class TestGripper(unittest.TestCase): |
| 10 | + |
| 11 | + def test_jindex_1(self): |
| 12 | + e1 = rtb.ELink(rtb.ETS.rz(), jindex=0) |
| 13 | + e2 = rtb.ELink(rtb.ETS.rz(), jindex=1, parent=e1) |
| 14 | + e3 = rtb.ELink(rtb.ETS.rz(), jindex=2, parent=e2) |
| 15 | + e5 = rtb.ELink(rtb.ETS.rz(), jindex=0, parent=e3) |
| 16 | + e7 = rtb.ELink(rtb.ETS.rz(), jindex=1, parent=e5) |
| 17 | + |
| 18 | + rtb.ERobot([e1, e2, e3, e5, e7], gripper_links=e5) |
| 19 | + |
| 20 | + def test_jindex_2(self): |
| 21 | + e1 = rtb.ELink(rtb.ETS.rz(), jindex=0) |
| 22 | + e2 = rtb.ELink(rtb.ETS.rz(), jindex=1, parent=e1) |
| 23 | + e3 = rtb.ELink(rtb.ETS.rz(), jindex=2, parent=e2) |
| 24 | + e4 = rtb.ELink(rtb.ETS.rz(), jindex=1, parent=e3) |
| 25 | + |
| 26 | + with self.assertRaises(ValueError): |
| 27 | + rtb.ERobot([e1, e2, e3, e4], gripper_links=e4) |
| 28 | + |
| 29 | + def test_jindex_3(self): |
| 30 | + e1 = rtb.ELink(rtb.ETS.rz(), jindex=0) |
| 31 | + e2 = rtb.ELink(rtb.ETS.rz(), jindex=1, parent=e1) |
| 32 | + e3 = rtb.ELink(rtb.ETS.rz(), jindex=2, parent=e2) |
| 33 | + e4 = rtb.ELink(rtb.ETS.rz(), jindex=0, parent=e3) |
| 34 | + e5 = rtb.ELink(rtb.ETS.rz(), parent=e4) |
| 35 | + |
| 36 | + with self.assertRaises(ValueError): |
| 37 | + rtb.ERobot([e1, e2, e3, e4, e5], gripper_links=e4) |
| 38 | + |
| 39 | + def test_jindex_4(self): |
| 40 | + e1 = rtb.ELink(rtb.ETS.rz()) |
| 41 | + e2 = rtb.ELink(rtb.ETS.rz(), parent=e1) |
| 42 | + e3 = rtb.ELink(rtb.ETS.rz(), parent=e2) |
| 43 | + e4 = rtb.ELink(rtb.ETS.rz(), parent=e3) |
| 44 | + e5 = rtb.ELink(rtb.ETS.rz(), parent=e4) |
| 45 | + e6 = rtb.ELink(rtb.ETS.rz(), parent=e5) |
| 46 | + e7 = rtb.ELink(rtb.ETS.rz(), parent=e6) |
| 47 | + |
| 48 | + rtb.ERobot([e1, e2, e3, e4, e5, e6, e7], gripper_links=e3) |
0 commit comments