diff --git a/autonav_ws/src/autonav_display/src/display.py b/autonav_ws/src/autonav_display/src/display.py index e5e34f80..a1442bdd 100644 --- a/autonav_ws/src/autonav_display/src/display.py +++ b/autonav_ws/src/autonav_display/src/display.py @@ -155,9 +155,13 @@ async def consumer(self, websocket): nodes = self.get_node_names() for i in range(len(nodes)): nodes[i] = nodes[i].replace("/", "") + node_states = {} + for identifier in nodes: + node_states[identifier] = self.device_states[identifier] if identifier in self.device_states else 0 self.pushSendQueue(json.dumps({ "op": "get_nodes_callback", - "nodes": nodes + "nodes": nodes, + "states": node_states }), unique_id) if obj["op"] == "set_system_state": diff --git a/display/scripts/main.js b/display/scripts/main.js index 770486da..de962380 100644 --- a/display/scripts/main.js +++ b/display/scripts/main.js @@ -70,6 +70,17 @@ $(document).ready(function () { opcode: 4, iterator: iterate() }); + + const statemap = obj.states; + if (node in statemap) { + deviceStates[node] = statemap[node]; + unorderedListElement = $("#element_device_states"); + unorderedListElement.empty(); + for (const id in deviceStates) { + const state = deviceStates[id]; + unorderedListElement.append(`
${id}: ${deviceStateToName(state)}
`); + } + } } } }