diff --git a/main.py b/main.py index 54e4bb31165feeefec1ef2efc9e2ccd4f124534e..6da59271dfdf20b4e1ce387d32a5b8ac2168e1ab 100644 --- a/main.py +++ b/main.py @@ -40,7 +40,16 @@ message_queue = queue.Queue() expert_view_buttons = [ 'send-place-a-model-details', 'send-place-b-model-details', - 'send-place-b-demo-initial_scene' + 'send-place-b-demo-initial_scene', + 'send-coordinator-model-details', + 'send-place-a-robot-ctrl-up', + 'send-place-b-robot-ctrl-up', + 'send-place-a-rag-up', + 'send-place-b-rag-up', + 'send-place-a-robot-ctrl-ready', + 'send-place-b-robot-ctrl-ready', + 'send-place-a-rag-ready', + 'send-place-b-rag-ready', ] # button-id: (topic, payload) @@ -71,17 +80,15 @@ commands = { 'send-coordinator-model-details': ('coordinator/model', 'details'), 'send-coordinator-exit': ('coordinator/exit', '1'), - # 'send-place-a-robot-ctrl-up': ('ros-place-a/status', 'up'), - # 'send-place-b-robot-ctrl-up': ('ros-place-b/status', 'up'), + 'send-place-a-robot-ctrl-up': ('ros-place-a/status', 'up'), + 'send-place-b-robot-ctrl-up': ('ros-place-b/status', 'up'), 'send-place-a-rag-up': ('rag-a/status', 'up'), 'send-place-b-rag-up': ('rag-b/status', 'up'), - 'send-dummy-up': ('random/status', 'up'), - # 'send-place-a-robot-ctrl-ready': ('ros-place-a/status', 'ready'), - # 'send-place-b-robot-ctrl-ready': ('ros-place-b/status', 'ready'), + 'send-place-a-robot-ctrl-ready': ('ros-place-a/status', 'ready'), + 'send-place-b-robot-ctrl-ready': ('ros-place-b/status', 'ready'), 'send-place-a-rag-ready': ('rag-a/status', 'ready'), 'send-place-b-rag-ready': ('rag-b/status', 'ready'), - 'send-dummy-ready': ('random/status', 'ready'), } # button-id: (topic, textarea-content-id, protobuf-object) @@ -191,24 +198,22 @@ app.layout = html.Div([ html.H3("Coordinator"), # html.Div([ # Row for commands coordinator html.Button('Model', id='send-coordinator-model', style=button_style_normal), - html.Button('Model (Details)', id='send-coordinator-model-details', style=button_style_normal), + html.Button('Model (Details)', id='send-coordinator-model-details', style=button_style_normal_invisible), html.Button('Exit', id='send-coordinator-exit', style=button_style_exit), # ], className='row'), # html.Div([ # Row for commands up - # html.Button('Robot Control A Up', id='send-place-a-robot-ctrl-up', style=button_style_normal), - # html.Button('Robot Control B Up', id='send-place-b-robot-ctrl-up', style=button_style_normal), - html.Button('RAG A Up', id='send-place-a-rag-up', style=button_style_normal), - html.Button('RAG B Up', id='send-place-b-rag-up', style=button_style_normal), - html.Button('Dummy Up', id='send-dummy-up', style=button_style_normal), + html.Button('Robot A Up', id='send-place-a-robot-ctrl-up', style=button_style_normal_invisible), + html.Button('Robot B Up', id='send-place-b-robot-ctrl-up', style=button_style_normal_invisible), + html.Button('RAG A Up', id='send-place-a-rag-up', style=button_style_normal_invisible), + html.Button('RAG B Up', id='send-place-b-rag-up', style=button_style_normal_invisible), # ], className='row'), # html.Div([ # Row for commands ready - # html.Button('Robot Control A Ready', id='send-place-a-robot-ctrl-ready', style=button_style_normal), - # html.Button('Robot Control B Ready', id='send-place-b-robot-ctrl-ready', style=button_style_normal), - html.Button('RAG A Ready', id='send-place-a-rag-ready', style=button_style_normal), - html.Button('RAG B Ready', id='send-place-b-rag-ready', style=button_style_normal), - html.Button('Dummy Ready', id='send-dummy-ready', style=button_style_normal), + html.Button('Robot A Ready', id='send-place-a-robot-ctrl-ready', style=button_style_normal_invisible), + html.Button('Robot B Ready', id='send-place-b-robot-ctrl-ready', style=button_style_normal_invisible), + html.Button('RAG A Ready', id='send-place-a-rag-ready', style=button_style_normal_invisible), + html.Button('RAG B Ready', id='send-place-b-rag-ready', style=button_style_normal_invisible), # ], className='row'), - ], className="four columns", id='coordinator-div', style={'display': 'none'}), + ], className="four columns", id='coordinator-div'), html.Div([ # Column for commands of place a html.H3("Commands Place A"), html.Button('Model', id='send-place-a-model', style=button_style_normal), @@ -364,7 +369,6 @@ def send_json_for_object_to_topic(json_content: str, obj, topic: str): @app.callback( [Output(button_id, 'style') for button_id in expert_view_buttons], - Output('coordinator-div', 'style'), Output('arm-buttons', 'style'), Output('object-buttons', 'style'), Input('expert-view', 'value') @@ -373,7 +377,6 @@ def toggle_expert_view(visibility_state): local_buttons_style = dict(buttons_style) local_buttons_style['display'] = 'flex' if visibility_state else 'none' result = [button_style_normal if visibility_state else button_style_normal_invisible for _ in expert_view_buttons] - result.append({'display': 'block' if visibility_state else 'none'}) result.append(local_buttons_style) result.append(local_buttons_style) print(result)