Skip to content

Commit ab21f4d

Browse files
committed
update demo.
1 parent dbc61f0 commit ab21f4d

File tree

9 files changed

+37
-25
lines changed

9 files changed

+37
-25
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ test_test.py
1616
.vscode/.ropeproject/objectdb
1717

1818
__pycache__/port.cpython-39.pyc
19-
demo/__pycache__/port.cpython-39.pyc
19+
demo/__pycache__/port.cpython-39.pyc
20+
demo/__pycache__/port_setup.cpython-39.pyc

CHANGELOG.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# 2021
22

3+
## 5.24
4+
5+
- update demo.
6+
37
## 4.27
8+
49
- release v2.4.0
510
- set_free_mode -> release_all_servos
611
- Add new port:
7-
- is_controller_connected
8-
- set_servo_data
9-
- get_servo_data
10-
- set_servo_calibration
11-
- set_basic_output
12+
- is_controller_connected
13+
- set_servo_data
14+
- get_servo_data
15+
- set_servo_calibration
16+
- set_basic_output
1217
- Update API document.
1318

1419
## 4.25

demo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
There are some demo files of **pymycobot**.
22

3-
`get_port.py`: output all port, choice one then write to `port.txt`, other test `.py` will read port string from `port.txt`.
3+
<!--`get_port.py`: output all port, choice one then write to `port.txt`, other test `.py` will read port string from `port.txt`.-->

demo/basic.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import time
22
import os
3+
import sys
34
from pymycobot.mycobot import MyCobot
45
from pymycobot.genre import Angle, Coord
56

7+
sys.path.append(os.path.dirname(__file__))
8+
from port_setup import setup
9+
610
reset = [153.19, 137.81, -153.54, 156.79, 87.27, 13.62]
711

812

@@ -73,9 +77,8 @@ def test(mycobot):
7377
time.sleep(3)
7478
# port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
7579
# shell=True).decode()
76-
with open(os.path.dirname(__file__) + "/port.txt") as f:
77-
port = f.read().strip().replace("\n", "")
78-
print(port)
79-
# mycobot = MyCobot(port, debug=True)
80-
mycobot = MyCobot(port)
80+
# with open(os.path.dirname(__file__) + "/port.txt") as f:
81+
# port = f.read().strip().replace("\n", "")
82+
# print(port)
83+
mycobot = setup()
8184
test(mycobot)

demo/gripper.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import os
22
import time
3+
import sys
34
from pymycobot.mycobot import MyCobot
45

6+
sys.path.append(os.path.dirname(__file__))
7+
from port_setup import setup
8+
59

610
def gripper_test(mc):
711
print("Start check IO part of api\n")
@@ -38,8 +42,5 @@ def gripper_test(mc):
3842

3943

4044
if __name__ == "__main__":
41-
with open(os.path.dirname(__file__) + "/port.txt") as f:
42-
port = f.read().strip().replace("\n", "")
43-
print(port)
44-
mycobot = MyCobot(port)
45+
mycobot = setup()
4546
gripper_test(mycobot)

demo/loop.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import time
22
import os
3+
import sys
34
from pymycobot.mycobot import MyCobot
45

6+
sys.path.append(os.path.dirname(__file__))
7+
from port_setup import setup
8+
59

610
if __name__ == "__main__":
7-
with open(os.path.dirname(__file__) + "/port.txt") as f:
8-
port = f.read().strip().replace("\n", "")
9-
print(port)
10-
cobot = MyCobot(port)
11+
cobot = setup()
1112
cobot.send_angles([0, 0, 0, 0, 0, 0], 100)
1213
time.sleep(10)
1314
print("start")
File renamed without changes.

demo/send_angle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import os
33
sys.path.append(os.path.dirname(__file__))
4-
from port import setup
4+
from port_setup import setup
55

66
if __name__ == "__main__":
77
mc = setup()

demo/sync.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import time
22
import os
3+
import sys
34
from pymycobot.mycobot import MyCobot
45

6+
sys.path.append(os.path.dirname(__file__))
7+
from port_setup import setup
8+
59
reset = [153.19, 137.81, -153.54, 156.79, 87.27, 13.62]
610

711

@@ -32,9 +36,6 @@ def test(mycobot):
3236
"""
3337
)
3438
time.sleep(3)
35-
with open(os.path.dirname(__file__) + "/port.txt") as f:
36-
port = f.read().strip().replace("\n", "")
37-
print(port)
38-
mycobot = MyCobot(port)
39+
mycobot = setup()
3940
test(mycobot)
4041
# print(mycobot.get_angles())

0 commit comments

Comments
 (0)