Skip to content

Commit bb08e9f

Browse files
committed
修正demo脚本的pymycobot使用
1 parent 5f941a9 commit bb08e9f

File tree

8 files changed

+28
-19
lines changed

8 files changed

+28
-19
lines changed

demo/Client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from pymycobot import MyCobotSocket
1+
from pymycobot import MyCobot280Socket
22

3-
m = MyCobotSocket("192.168.10.10", "9000")
3+
m = MyCobot280Socket("192.168.10.10", "9000")
44
# connect pi
55
# m.connect()
66
print(m.get_coords())

demo/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import time
22
import os
33
import sys
4-
from pymycobot.mycobot import MyCobot
4+
from pymycobot.mycobot280 import MyCobot280
55
from pymycobot.genre import Angle, Coord
66

77
sys.path.append(os.path.dirname(__file__))

demo/change_pid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# coding: utf-8
22
import time
33
from turtle import goto
4-
from pymycobot.mycobot import MyCobot
4+
from pymycobot.mycobot280 import MyCobot280
55
import serial.tools.list_ports
66

77
data_id = [21, 22, 23, 24, 26, 27]
@@ -44,7 +44,7 @@ def setup(): #机械臂检测
4444

4545
for port in ports:
4646
try:
47-
mycobot = MyCobot(port, baud)
47+
mycobot = MyCobot280(port, baud)
4848
except Exception as e:
4949
print(e)
5050
exit(1)

demo/gripper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import time
33
import sys
4-
from pymycobot.mycobot import MyCobot
4+
from pymycobot import MyCobot280
55

66
sys.path.append(os.path.dirname(__file__))
77
from port_setup import setup

demo/loop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import time
22
import os
33
import sys
4-
from pymycobot.mycobot import MyCobot
4+
from pymycobot import MyCobot280
55

66
sys.path.append(os.path.dirname(__file__))
77
from port_setup import setup

demo/pid_read_write.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
from pymycobot import MyCobot
1+
from pymycobot import MyCobot280, MyCobot320
22
# from pymycobot import PI_PORT
33
import time
44
import serial
55

66
# pi
77
# 280
8-
# mc = MyCobot(PI_PORT, 1000000)
9-
# mc = MyCobot('/dev/ttyAMA0', 1000000)
8+
# mc = MyCobot280(PI_PORT, 1000000)
9+
# mc = MyCobot280('/dev/ttyAMA0', 1000000)
1010
# 320
11-
# mc = MyCobot(PI_PORT, 115200)
12-
# mc = MyCobot('/dev/ttyAMA0', 115200)
11+
# mc = MyCobot320(PI_PORT, 115200)
12+
# mc = MyCobot320('/dev/ttyAMA0', 115200)
1313

1414
# M5
15-
# 280/320
16-
mc = MyCobot('COM66', 115200)
17-
# mc = MyCobot('/dev/ttyUSB0',115200)
15+
# 280
16+
mc = MyCobot280('COM66', 115200)
17+
# mc = MyCobot280('/dev/ttyUSB0',115200)
18+
19+
# 320
20+
# mc = MyCobot320('COM66', 115200)
21+
# mc = MyCobot320('/dev/ttyUSB0',115200)
1822

1923
# 参数对应地址
2024
data_id = [7, 21, 22, 23, 24, 26, 27]

demo/port_setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import serial
22
import serial.tools.list_ports
33

4-
from pymycobot.mycobot import MyCobot
4+
from pymycobot.mycobot280 import MyCobot280
55

66

77

@@ -33,6 +33,6 @@ def setup():
3333
if f in ["y", "Y", "yes", "Yes"]:
3434
DEBUG = True
3535
# mc = MyCobot(port, debug=True)
36-
mc = MyCobot(port, baud, debug=DEBUG)
36+
mc = MyCobot280(port, baud, debug=DEBUG)
3737
return mc
3838

demo/reader.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
from pymycobot.mycobot import MyCobot
1+
from pymycobot import MyCobot280, MyCobot320
22
from port_setup import setup
33

4-
mc: MyCobot
4+
# 280
5+
mc: MyCobot280
56
sp: int = 80
67

8+
# 320
9+
# mc: MyCobot320
10+
# sp: int = 80
11+
712

813
def setup():
914
print("")

0 commit comments

Comments
 (0)