Skip to content

Commit

Permalink
Updates to gui (#294)
Browse files Browse the repository at this point in the history
* Fixes ariac_tutorials issue with loading trial configurations

* Fixed save order button showing wrong order type when editing

* Insert rotations fix

* Rotations can now be floats or strings

* Removed max size and min size

* AGVs in map are now in the correct order

* Fixed loading issues with rotation

* Fixed issue where priority would stop configuration from starting

* Fixed editing assembly orders that are loaded in

* Fix for combined order

* Fixed kitting tray issue

---------

Co-authored-by: Justin Albrecht <[email protected]>
  • Loading branch information
jfernandez37 and jaybrecht authored Jan 25, 2024
1 parent 845006e commit 1fe48f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions ariac_gui/ariac_gui/trial_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,19 +663,19 @@ def kitting_trays_to_dict(self):
self.kitting_trays_dict["kitting_trays"] = {"tray_ids":trays, "slots":slots}

def update_available_kitting_trays(self,_,__,___):
self.available_kitting_trays.clear()
for i in range(len(self.kitting_tray_selections)):
tray = self.kitting_tray_selections[i].get()
if tray != "":
self.available_kitting_trays.append(str(tray))
self.available_kitting_trays = sorted(self.available_kitting_trays)
try:
self.reset_order()
self.show_main_order_menu()
except:
pass

def show_kitting_trays(self,_,__,___):
self.available_kitting_trays = [tray.get() for tray in self.kitting_tray_selections if tray.get() != KITTING_TRAY_OPTIONS[0]]
try:
self.reset_order()
self.show_main_order_menu()
except:
pass
for widget in self.kitting_tray_canvas_widgets:
self.kitting_tray_canvas.delete(widget)
self.kitting_tray_canvas_widgets.clear()
Expand Down Expand Up @@ -1728,7 +1728,7 @@ def show_kitting_menu(self):
tray_id_label = ctk.CTkLabel(self.orders_frame,text="Select the tray for the kitting order")
self.grid_left_column(tray_id_label)
self.current_left_order_widgets.append(tray_id_label)

tray_id_menu = ctk.CTkOptionMenu(self.orders_frame,variable=self.order_info["kitting_task"]["tray_id"], values = self.available_kitting_trays)
self.grid_left_column(tray_id_menu)
self.current_left_order_widgets.append(tray_id_menu)
Expand Down Expand Up @@ -2154,7 +2154,7 @@ def orders_to_dict(self):
temp_order_dict["id"] = order.id
temp_order_dict["type"] = ORDER_TYPES[order.type]
temp_order_dict["announcement"] = self.announcement_to_dict(order.condition)
temp_order_dict["priority"] = order.priority
temp_order_dict["priority"] = order.priority == "1"
if order.type == 0:
temp_order_dict["kitting_task"] = {}
temp_order_dict["kitting_task"]["agv_number"] = order.kitting_task.agv_number
Expand Down
14 changes: 7 additions & 7 deletions ariac_gui/ariac_gui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,18 @@ def build_competition_from_file(yaml_dict : dict) -> CompetitionClass:

assembly_insert_rotations = [0.0 for _ in range(4)]
if "assembly_inserts" in yaml_dict.keys():
assembly_insert_rotations[0] = SLIDER_VALUES[SLIDER_STR.index(yaml_dict["assembly_inserts"]["as1"])]
assembly_insert_rotations[1] = SLIDER_VALUES[SLIDER_STR.index(yaml_dict["assembly_inserts"]["as2"])]
assembly_insert_rotations[2] = SLIDER_VALUES[SLIDER_STR.index(yaml_dict["assembly_inserts"]["as3"])]
assembly_insert_rotations[3] = SLIDER_VALUES[SLIDER_STR.index(yaml_dict["assembly_inserts"]["as4"])]
assembly_insert_rotations[0] = SLIDER_VALUES[SLIDER_STR.index(yaml_dict["assembly_inserts"]["as1"] if yaml_dict["assembly_inserts"]["as1"]!=0 else "0")]
assembly_insert_rotations[1] = SLIDER_VALUES[SLIDER_STR.index(yaml_dict["assembly_inserts"]["as2"] if yaml_dict["assembly_inserts"]["as2"]!=0 else "0")]
assembly_insert_rotations[2] = SLIDER_VALUES[SLIDER_STR.index(yaml_dict["assembly_inserts"]["as3"] if yaml_dict["assembly_inserts"]["as3"]!=0 else "0")]
assembly_insert_rotations[3] = SLIDER_VALUES[SLIDER_STR.index(yaml_dict["assembly_inserts"]["as4"] if yaml_dict["assembly_inserts"]["as4"]!=0 else "0")]

bin_parts = {f"bin{i}":[BinPart() for _ in range(9)] for i in range(1,9)}
current_bin_parts = {f"bin{i}":["" for _ in range(9)] for i in range(1,9)}
try:
for bin in yaml_dict["parts"]["bins"].keys():
for part in yaml_dict["parts"]["bins"][bin]:
try:
part_rotation = SLIDER_VALUES[SLIDER_STR.index(part["rotation"])]
part_rotation = SLIDER_VALUES[SLIDER_STR.index(part["rotation"] if part["rotation"]!=0 else "0")]
except:
part_rotation = 0.0
try:
Expand Down Expand Up @@ -244,7 +244,7 @@ def build_competition_from_file(yaml_dict : dict) -> CompetitionClass:

if order["type"]=="assembly":
new_order.assembly_task.agv_numbers = order["assembly_task"]["agv_number"]
new_order.assembly_task.station = ASSEMBLY_STATIONS.index(order["assembly_task"]["station"])
new_order.assembly_task.station = ASSEMBLY_STATIONS.index(order["assembly_task"]["station"])+1
assembly_parts = []
if order["assembly_task"]["station"] in ["as1","as2"]:
correct_agv = FIRST_STATIONS_AGVS[0]
Expand All @@ -258,7 +258,7 @@ def build_competition_from_file(yaml_dict : dict) -> CompetitionClass:
new_order.assembly_task.parts = assembly_parts

if order["type"] == "combined":
new_order.combined_task.station = ASSEMBLY_STATIONS.index(order["combined_task"]["station"])
new_order.combined_task.station = ASSEMBLY_STATIONS.index(order["combined_task"]["station"])+1
combined_parts = []
for part in order["combined_task"]["products"]:
combined_part = PartMsg()
Expand Down

0 comments on commit 1fe48f2

Please sign in to comment.