Skip to content

Commit 6c7f714

Browse files
committed
update test file
1 parent e575d1e commit 6c7f714

File tree

4 files changed

+84
-2
lines changed

4 files changed

+84
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ pymycobot.egg-info/
55
log
66
.vscode/
77
pymycobot/__pycache__/
8+
9+
test.py

tests/get_port.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import serial
2+
import serial.tools.list_ports
3+
4+
if __name__ == "__main__":
5+
'''
6+
result:
7+
/dev/cu.wlan-debug - n/a
8+
/dev/cu.debug-console - n/a
9+
/dev/cu.Bluetooth-Incoming-Port - n/a
10+
/dev/cu.usbserial-0213245D - CP2104 USB to UART Bridge Controller
11+
12+
port='/dev/cu.usbserial-0213245D'
13+
'''
14+
plist = list(serial.tools.list_ports.comports())
15+
for port in plist:
16+
print(port)

tests/gripper_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import time, random, subprocess
1+
import time, subprocess
22
from pymycobot.mycobot import MyCobot
3-
from pymycobot.genre import Angle, Coord
43

54
def gripper_test(mc):
65
print('Start check IO part of api\n')

tests/loop_test.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import time, subprocess
2+
from pymycobot.mycobot import MyCobot
3+
4+
5+
if __name__ == '__main__':
6+
# port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
7+
# shell=True).decode()
8+
# port = "/dev/cu.usbserial-0203B030"
9+
port = "/dev/cu.usbserial-0213245D"
10+
cobot = MyCobot(port)
11+
# test(cobot)
12+
cobot.send_angles([0,0,0,0,0,0],100)
13+
time.sleep(10)
14+
print('over')
15+
for count in range(50):
16+
time.sleep(0.05)
17+
cobot.send_angle(1, (-30), 100)
18+
time.sleep(0.05)
19+
cobot.send_angle(2, 70, 100)
20+
time.sleep(0.05)
21+
cobot.send_angle(3, (-110), 100)
22+
time.sleep(0.05)
23+
cobot.send_angle(4, (-100), 100)
24+
time.sleep(0.05)
25+
cobot.send_angle(5, 0, 100)
26+
time.sleep(0.05)
27+
cobot.send_angle(6, 0, 100)
28+
time.sleep(1)
29+
cobot.send_angle(2, 0, 100)
30+
time.sleep(0.05)
31+
cobot.send_angle(6, 0, 100)
32+
time.sleep(0.05)
33+
cobot.send_angle(5, 0, 100)
34+
time.sleep(0.05)
35+
cobot.send_angle(4, 0, 100)
36+
time.sleep(0.05)
37+
cobot.send_angle(3, 0, 100)
38+
time.sleep(0.05)
39+
cobot.send_angle(1, 0, 100)
40+
time.sleep(1)
41+
cobot.send_angle(1, 60, 100)
42+
time.sleep(0.05)
43+
cobot.send_angle(2, 70, 100)
44+
time.sleep(0.05)
45+
cobot.send_angle(3, (-100), 100)
46+
time.sleep(0.05)
47+
cobot.send_angle(4, (-100), 100)
48+
time.sleep(0.05)
49+
cobot.send_angle(5, 0, 100)
50+
time.sleep(0.05)
51+
cobot.send_angle(6, 0, 100)
52+
time.sleep(1)
53+
cobot.send_angle(2, 0, 100)
54+
time.sleep(0.05)
55+
cobot.send_angle(6, 0, 100)
56+
time.sleep(0.05)
57+
cobot.send_angle(5, 0, 100)
58+
time.sleep(0.05)
59+
cobot.send_angle(4, 0, 100)
60+
time.sleep(0.05)
61+
cobot.send_angle(3, 0, 100)
62+
time.sleep(0.05)
63+
cobot.send_angle(1, 0, 100)
64+
time.sleep(1)
65+
print('time')

0 commit comments

Comments
 (0)