-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.py
47 lines (35 loc) · 956 Bytes
/
example.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
import time
from pydxl import Mx28, SerialLink
link = SerialLink(
device="/dev/ttyUSB0", baudrate=1_000_000, protocol_version=1.0
)
shoulder1 = Mx28(identifier=1, serial_link=link)
shoulder2 = Mx28(identifier=2, serial_link=link)
elbow = Mx28(identifier=3, serial_link=link)
shoulder1.ping()
shoulder1.led = True
print(shoulder1.led)
shoulder2.ping()
shoulder2.led = True
elbow.ping()
elbow.led = True
shoulder1.torque_enable = True
shoulder2.torque_enable = True
elbow.torque_enable = True
shoulder1.goal_position = 2000
shoulder2.goal_position = 2500
elbow.goal_position = 3000
print(shoulder1.goal_position)
time.sleep(3)
shoulder1.goal_position = 1500
shoulder2.goal_position = 2000
for _ in range(5):
elbow.goal_position = 1500
time.sleep(0.5)
elbow.goal_position = 2500
time.sleep(0.5)
elbow.goal_position = 3000
shoulder1.torque_enable = False
shoulder2.torque_enable = False
elbow.torque_enable = False
link.close()