forked from petercorke/robotics-toolbox-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_Gripper.py
More file actions
47 lines (37 loc) · 1.78 KB
/
test_Gripper.py
File metadata and controls
47 lines (37 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
@author: Jesse Haviland
"""
import roboticstoolbox as rtb
import unittest
class TestGripper(unittest.TestCase):
def test_jindex_1(self):
e1 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=0)
e2 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=1, parent=e1)
e3 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=2, parent=e2)
e5 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=0, parent=e3)
e7 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=1, parent=e5)
rtb.ERobot([e1, e2, e3, e5, e7], gripper_links=e5)
def test_jindex_2(self):
e1 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=0)
e2 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=1, parent=e1)
e3 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=2, parent=e2)
e4 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=1, parent=e3)
with self.assertRaises(ValueError):
rtb.ERobot([e1, e2, e3, e4], gripper_links=e4)
def test_jindex_3(self):
e1 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=0)
e2 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=1, parent=e1)
e3 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=2, parent=e2)
e4 = rtb.Link(rtb.ETS(rtb.ET.Rz()), jindex=0, parent=e3)
e5 = rtb.Link(rtb.ETS(rtb.ET.Rz()), parent=e4)
with self.assertRaises(ValueError):
rtb.ERobot([e1, e2, e3, e4, e5], gripper_links=e4)
def test_jindex_4(self):
e1 = rtb.Link(rtb.ETS(rtb.ET.Rz()))
e2 = rtb.Link(rtb.ETS(rtb.ET.Rz()), parent=e1)
e3 = rtb.Link(rtb.ETS(rtb.ET.Rz()), parent=e2)
e4 = rtb.Link(rtb.ETS(rtb.ET.Rz()), parent=e3)
e5 = rtb.Link(rtb.ETS(rtb.ET.Rz()), parent=e4)
e6 = rtb.Link(rtb.ETS(rtb.ET.Rz()), parent=e5)
e7 = rtb.Link(rtb.ETS(rtb.ET.Rz()), parent=e6)
rtb.ERobot([e1, e2, e3, e4, e5, e6, e7], gripper_links=e3)