-
Notifications
You must be signed in to change notification settings - Fork 2
/
ur_connector.py
38 lines (30 loc) · 1.09 KB
/
ur_connector.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
from urinterface.robot_connection import RobotConnection
import numpy as np
from pathlib import Path
import time
import msvcrt
v0 = 1.0
a0 = 5.0
vm_ip = "192.168.230.128"
ur5e = RobotConnection(vm_ip) # Establish dashboard connection (port 29999) and controller connection (port 30002)
f_name = "test_motion1.csv"
filename = Path("test_results") / Path(f_name)
config_file = Path("resources") / Path("record_configuration.xml")
ur5e.start_recording(filename=filename, overwrite=True, frequency=50, config_file=config_file, publish_topic=["actual_q"]) # start recording and place the recorded data in test_motion.csv
time.sleep(1)
while True:
try:
k = msvcrt.getwche()
if k == "c":
break
elif k in {"1","2"}:
if k == "1":
ur5e.movej(np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0]), v=1.0, a=0.5)
if k == "2":
ur5e.load_program("/program1.urp")
ur5e.play_program()
# reset k
k = "a"
except KeyboardInterrupt:
break
ur5e.stop_recording()