Skip to content

Instantly share code, notes, and snippets.

@nro-bot
Last active July 10, 2020 20:00
Show Gist options
  • Save nro-bot/bac35bee6712855a4513eaaf53e5b923 to your computer and use it in GitHub Desktop.
Save nro-bot/bac35bee6712855a4513eaaf53e5b923 to your computer and use it in GitHub Desktop.
# will pop up on tablet, "hi"
# robot must be on and not e-stopped
# For more commands see https://s3-eu-west-1.amazonaws.com/ur-support-site/69271/scriptManual.pdf
def arbitraryname():
sleep(1.0)
popup("hi")
set_digital_out(8, False)
end
import socket
import time
HOST = "10.75.15.199" # The remote host
PORT = 30002 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
print("Starting Program")
f = open("example.UR.script", "rb")
l = f.read(1024)
while (l):
s.send(l)
l = f.read(1024)
s.close()
print ("Closed connection and received data")
# Other possibilities
# e.g. Used for RG2 gripper
def olmia():
#force0 = 5
#width0 = 0
#force1 = 5
#width1 = 1100
#force2 = 40
#width2 = 0
#force3 = 40
#width3 = 1100
## Turn off supply voltage
set_tool_voltage(0)
## Wait for discharge
sleep(1.0)
#popup("hi4")
# Turn on supply voltage
set_digital_out(8, False)
set_digital_out(9, False)
set_tool_voltage(24)
## Wait for RG2 ready
timeout = 0
while get_digital_in(9) == False:
timeout = timeout+1
# sleep(0.008)
sleep(0.005)
if timeout > 100:
# wait at most 5 secs
textmsg("breaking")
break
end
end
count = 0
textmsg("beginning loop")
#set_digital_out(8, True)
set_digital_out(9, False)
sleep(0.1)
while True:
textmsg("count")
textmsg(count)
#textmsg(count)
set_digital_out(8, True)
#set_digital_out(9, False)
sleep(0.5)
#set_digital_out(9, True)
set_digital_out(8, False)
sleep(0.5)
count = count + 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment