Skip to content

Commit 825fe48

Browse files
committed
power on, break release with waitings to be done
1 parent eee716e commit 825fe48

File tree

17 files changed

+185
-29
lines changed

17 files changed

+185
-29
lines changed

ToDo.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@
77
- ~~movej, movel~~
88
- ~~pose add, pose trans, pose inverse~~
99
- ~~set tcp, set payload~~
10-
- digital io control
10+
- ~~digital outputs~~
1111
- servoing movement
1212
- other?
1313
* [] RTDE?
14+
* [] Control
15+
- ~~joint move control~~
16+
- ~~pose move control~~
17+
- ~~set/get digital outputs~~
18+
- servo control
19+
- force control
20+
- other?
1421
* [] Examples
1522
- ~~pick and place~~
1623
- more examples?

build/lib/pyUR/dashboard/dashboard.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,30 @@ def is_connected() -> bool:
4141
def send_receive_socket(dashboard_command:str) -> str:
4242
global _dashboard_socket
4343
try:
44-
print(dashboard_command)
44+
send_socket(dashboard_command)
45+
return receive_socket()
46+
except:
47+
return None
48+
49+
'''
50+
function for send to socket
51+
:param dashboard_command: command to send to the robot
52+
'''
53+
def send_socket(dashboard_command:str) -> None:
54+
global _dashboard_socket
55+
try:
4556
_dashboard_socket.send(dashboard_command.encode('utf-8'))
57+
except:
58+
pass
59+
60+
'''
61+
function for receive from socket
62+
'''
63+
def receive_socket() -> str:
64+
global _dashboard_socket
65+
try:
4666
return str(_dashboard_socket.recv(1024).decode('utf-8'))
4767
except:
4868
return None
69+
4970

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
def get_powering_on():
2-
2+
pass

build/lib/pyURControl/ur_control.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,39 @@ def init(host_ip: str='127.0.0.1'):
3030
def power_on():
3131
responce = dashboard.send_receive_socket(dashboard_commands.power_on())
3232
print(responce)
33+
if 'Powering on' in responce:
34+
_wait_robot_powered_on()
35+
36+
37+
'''
38+
wait for robot to be powered on
39+
'''
40+
def _wait_robot_powered_on():
41+
while True:
42+
responce = dashboard.send_receive_socket(dashboard_commands.robotmode())
43+
if 'Robotmode: IDLE' in responce:
44+
break
45+
sleep(0.001)
3346

3447
'''
3548
send brake release command
3649
'''
3750
def break_release():
3851
responce = dashboard.send_receive_socket(dashboard_commands.brake_release())
3952
print(responce)
53+
if 'Brake releasing' in responce:
54+
_wait_robot_break_released()
4055

4156
'''
57+
wait for robot break realeased
58+
'''
59+
def _wait_robot_break_released():
60+
while True:
61+
responce = dashboard.send_receive_socket(dashboard_commands.robotmode())
62+
if 'Robotmode: RUNNING' in responce:
63+
break
64+
sleep(0.001)
65+
'''
4266
set tcp
4367
:param tcp_offset: tcp offset
4468
:param delay: delay for command to be executed 0.3s by default
153 Bytes
Binary file not shown.

dist/pyURControl-0.0.1.tar.gz

174 Bytes
Binary file not shown.

examples/pick_and_place/ReadMe.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Pick and place example

src/pyUR/dashboard/dashboard.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,30 @@ def is_connected() -> bool:
4141
def send_receive_socket(dashboard_command:str) -> str:
4242
global _dashboard_socket
4343
try:
44-
print(dashboard_command)
44+
send_socket(dashboard_command)
45+
return receive_socket()
46+
except:
47+
return None
48+
49+
'''
50+
function for send to socket
51+
:param dashboard_command: command to send to the robot
52+
'''
53+
def send_socket(dashboard_command:str) -> None:
54+
global _dashboard_socket
55+
try:
4556
_dashboard_socket.send(dashboard_command.encode('utf-8'))
57+
except:
58+
pass
59+
60+
'''
61+
function for receive from socket
62+
'''
63+
def receive_socket() -> str:
64+
global _dashboard_socket
65+
try:
4666
return str(_dashboard_socket.recv(1024).decode('utf-8'))
4767
except:
4868
return None
69+
4970

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
def get_powering_on():
2-
2+
pass

0 commit comments

Comments
 (0)