-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
48 lines (37 loc) · 1.13 KB
/
main.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
'''
Author: Elite_zhangjunjie
CreateDate:
LastEditors: Elite_zhangjunjie
LastEditTime: 2022-05-13 17:32:33
Description:
'''
import time
from elite import EC
from loguru import logger
import matplotlib.pyplot as plt
if __name__ == "__main__":
logger.add("log.log")
ec = EC(ip="172.16.11.251", auto_connect=True)
ec.monitor_thread_run()
ec.robot_servo_on()
j1 = [-166.00185643564356, -73.90748762376238, 89.49133663366337, -106.92824074074073, 89.73109567901234,
0.00038580246913580245]
ec.move_joint(j1, 30)
ec.wait_stop()
time.sleep(2)
ec.run_jbi("main")
all_torque = [[], [], [], [], [], [], [], []]
while 1:
time.sleep(0.1)
torque = [int(i) for i in ec.monitor_info.torque]
for k, v in enumerate(torque):
all_torque[k].append(v)
if ec.get_jbi_state("main").value == 0:
break
if torque[1] < -50:
ec.set_var("B", 0, 2)
# ec.
print(all_torque)
plt.plot([i for i in range(len(all_torque[0]))], all_torque[1])
plt.plot([i for i in range(len(all_torque[0]))], all_torque[2])
plt.show()