Simulation mode

This commit is contained in:
2024-04-29 13:30:04 -05:00
parent d92ceafa57
commit d0083ed33f
4 changed files with 72 additions and 41 deletions

View File

@@ -59,9 +59,11 @@ def powerup_arm(robot):
#
# wait for power up (this function runs async)
while not ping(robot.ip):
count = 0
while not ping(robot.ip) and count == 10:
time.sleep(0.5)
count += 1
# trigger auto-initialize
fprint("Arm online. Waiting for calibration.")
# wait for auto-initialize
@@ -72,16 +74,19 @@ def connect(robot):
ip = robot.ip
fprint("Connecting to arm at " + ip)
trying = True
while trying:
count = 0
while trying and count < 10:
count += 1
try:
robot.robot = urx.Robot(ip)
robot.robot.set_tcp((robot.offset_x, robot.offset_y, robot.offset_z, 0, 0, 0))
# Set weight
robot.robot.set_payload(2, (0, 0, 0.1))
trying = False
except:
time.sleep(1)
time.sleep(0.5)
# Sets robot arm endpoint offset (x,y,z,rx,ry,rz)
robot.robot.set_tcp((robot.offset_x, robot.offset_y, robot.offset_z, 0, 0, 0))
# Set weight
robot.robot.set_payload(2, (0, 0, 0.1))
return robot
def init_arm(robot):