From 4d8ed9ad57a214f4a8bab2725344a44bc44b7900 Mon Sep 17 00:00:00 2001
From: rschoene <rene.schoene@tu-dresden.de>
Date: Mon, 21 Jun 2021 13:05:40 +0200
Subject: [PATCH] coordinator fake controls

---
 main.py  | 35 +++++++++++++++++++++++++++++++++++
 utils.py |  2 +-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/main.py b/main.py
index 67414d6..0fbed9f 100644
--- a/main.py
+++ b/main.py
@@ -45,6 +45,22 @@ commands = {
     'send-place-a-demo-objRed-blue': ('place-a/demo/move/objectRed1/blue', '1'),
     'send-place-a-demo-objRed-red': ('place-a/demo/move/objectRed1/red', '1'),
     'send-place-b-demo-objRed-red': ('place-b/demo/move/objectRed1/red', '1'),
+
+    'send-coordinator-model': ('coordinator/model', '1'),
+    '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-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-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)
@@ -138,6 +154,25 @@ app.layout = html.Div([
             html.Button('obj-Red -> Red', id='send-place-b-demo-objRed-red', style=button_style_normal),
         ], className="six columns"),
     ], className='row'),
+    html.Div([  # Row for commands coordinator
+        html.Button('Coordinator Model', id='send-coordinator-model', style=button_style_normal),
+        html.Button('Coordinator Model (Details)', id='send-coordinator-model-details', style=button_style_normal),
+        html.Button('Coordinator 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),
+    ], 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),
+    ], className='row'),
     # dcc.Markdown("---"),
     html.H3("MQTT Log"),
     dcc.Textarea(
diff --git a/utils.py b/utils.py
index 49b4fe1..89fc487 100644
--- a/utils.py
+++ b/utils.py
@@ -46,7 +46,7 @@ def format_scene(scene: cgv_connector_pb2.Scene):
 
 
 def format_command(command: cgv_connector_pb2.MergedSelection):
-    return f"<cmd by {command.idRobot} of {command.idPick} to {command.idPlace}"
+    return f"<cmd by {command.idRobot} of {command.idPick} to {command.idPlace}>"
 
 
 def _get_reach_objects(r):
-- 
GitLab