Center images

This commit is contained in:
2024-05-08 13:27:45 -05:00
parent ee78037f17
commit dc4cf5c222
5 changed files with 30 additions and 13 deletions

19
run.py
View File

@@ -67,6 +67,8 @@ ring_animation = None
led_set_mode = None
sensors = [0,0,0,0]
websocket_process = None
arm_updates = Queue()
animation_wait = False
def arm_start_callback(res):
fprint("Arm action complete.")
@@ -310,9 +312,10 @@ def setup_server(pool):
global to_server_queue
global from_server_queue
global websocket_process
global arm_updates
arm = Rob(config)
arm = Rob(config, arm_updates)
if real:
pool.apply_async(ur5_control.powerup_arm, (arm,), callback=arm_start_callback, error_callback=handle_error)
else:
@@ -443,6 +446,9 @@ def mainloop_server(pool):
global cable_list_state
global scan_value
global oldmode
global arm_updates
global animation_wait
if mode != oldmode:
print(" ***** Running mode:", mode, "***** ")
oldmode = mode
@@ -454,10 +460,16 @@ def mainloop_server(pool):
# do every loop!
if ring_animation is not None and ledsys.mode != "idle" and real:
if not animation_wait and not arm_updates.empty():
arm_updates.get()
ledsys.mainloop(None, ring_animation)
elif ring_animation is not None and real:
ledsys.mainloop(led_set_mode, ring_animation)
led_set_mode = None
if animation_wait:
if not arm_updates.empty():
animation_wait = False
val = arm_updates.get()
ledsys.mainloop(led_set_mode, ring_animation)
led_set_mode = None
else:
pass
#fprint("Not triggering LED loop: no ring animation")
@@ -475,6 +487,7 @@ def mainloop_server(pool):
fprint("Getting cable index " + str(counter) + " and scanning...")
arm_state = "GET"
ring_animation = counter
animation_wait=True
led_set_mode = "GrabA"
#ur5_control.to_camera(arm, counter)
#arm_ready = True