-
Notifications
You must be signed in to change notification settings - Fork 8
/
ezgripperGUI.py
executable file
·191 lines (129 loc) · 5.02 KB
/
ezgripperGUI.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from libezgripper import create_connection, Gripper
from PyQt4 import QtGui, QtCore
connection = create_connection(dev_name='/dev/ttyUSB0', baudrate= 57600)
gripper = Gripper(connection, 'gripper1', [1])
#gripper = Gripper(connection, 'gripper1', [1,2,3])
#gripper = Gripper(connection, 'gripper1', [2,3])
class GripperGUI(QtGui.QMainWindow):
def __init__(self):
super(GripperGUI, self).__init__()
self.initUI()
def initUI(self):
calibrateButton=QtGui.QPushButton("Calibrate",self)
calibrateButton.resize(100,30)
# calibrateButton.setStyleSheet("background-color:rgb(153, 153, 153)")
calibrateButton.clicked.connect(gripper.calibrate)
calibrateButton.move(50,10)
calibrateButton.show()
releaseButton=QtGui.QPushButton("Release",self)
releaseButton.resize(600,40)
releaseButton.clicked.connect(gripper.release)
releaseButton.move(50,50)
hard_closeButton=QtGui.QPushButton("Hard Close 100%",self)
hard_closeButton.resize(200,100)
hard_closeButton.clicked.connect(self.submit_goto_hard_close)
hard_closeButton.move(50,100)
gotoButton=QtGui.QPushButton("Medium Close 50%", self)
gotoButton.resize(200,100)
gotoButton.clicked.connect(self.submit_goto_medium_close)
gotoButton.move(250,100)
openButton=QtGui.QPushButton("Soft Close 10%", self)
openButton.clicked.connect(self.submit_goto_soft_close)
openButton.resize(200,100)
openButton.move(450,100)
gotoButton=QtGui.QPushButton("0% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto1)
gotoButton.move(50,210)
gotoButton=QtGui.QPushButton("10% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto2)
gotoButton.move(150,210)
gotoButton=QtGui.QPushButton("20% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto3)
gotoButton.move(250,210)
gotoButton=QtGui.QPushButton("30% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto4)
gotoButton.move(350,210)
gotoButton=QtGui.QPushButton("40% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto5)
gotoButton.move(450,210)
gotoButton=QtGui.QPushButton("50% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto6)
gotoButton.move(550,210)
gotoButton=QtGui.QPushButton("60% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto7)
gotoButton.move(150,260)
gotoButton=QtGui.QPushButton("70% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto8)
gotoButton.move(250,260)
gotoButton=QtGui.QPushButton("80% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto9)
gotoButton.move(350,260)
gotoButton=QtGui.QPushButton("90% Open", self)
gotoButton.resize(100,50)
gotoButton.clicked.connect(self.submit_goto10)
gotoButton.move(450,260)
gotoButton=QtGui.QPushButton("100% Open", self)
gotoButton.resize(100,50)
# gotoButton.setStyleSheet("background-color:yellow")
# gotoButton.setStyleSheet("background-color: rgb(51, 102, 153)")
# gotoButton.setStyleSheet("border: 1px solid rgb(255, 255, 255)")
gotoButton.clicked.connect(self.submit_goto11)
gotoButton.move(550,260)
self.statusBar()
self.setGeometry(300, 200, 700, 350)
self.setWindowTitle("EZGripper GUI")
self.show()
def submit_goto_hard_close(self):
gripper.goto_position(0, 100)
def submit_goto_medium_close(self):
gripper.goto_position(0, 50)
def submit_goto_soft_close(self):
gripper.goto_position(0, 10)
def submit_goto_open(self):
gripper.goto_position(100, 100)
def submit_goto1(self):
gripper.goto_position(1, 100)
def submit_goto2(self):
gripper.goto_position(10, 100)
def submit_goto3(self):
gripper.goto_position(20, 100)
def submit_goto4(self):
gripper.goto_position(30, 100)
def submit_goto5(self):
gripper.goto_position(40, 100)
def submit_goto6(self):
gripper.goto_position(50, 100)
def submit_goto7(self):
gripper.goto_position(60, 100)
def submit_goto8(self):
gripper.goto_position(70, 100)
def submit_goto9(self):
gripper.goto_position(80, 100)
def submit_goto10(self):
gripper.goto_position(90, 100)
def submit_goto11(self):
gripper.goto_position(100, 100)
def submit_goto12(self):
gripper.goto_position(.20, 100)
def submit_goto13(self):
gripper.goto_position(.20, 100)
def submit_goto14(self):
gripper.goto_position(.20, 100)
def main():
ezgripper_app=QtGui.QApplication(sys.argv)
ex=GripperGUI()
sys.exit(ezgripper_app.exec_())
if __name__== '__main__':
main()