From c02cfecd0f54b8c33f9c8881c52d229b3833c379 Mon Sep 17 00:00:00 2001 From: Nathan Gill Date: Sat, 1 Nov 2025 14:27:34 +0000 Subject: [PATCH 1/2] use the new JSON reader class to read start info safely --- robot/wrapper.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/robot/wrapper.py b/robot/wrapper.py index 065709d..c51e3d6 100644 --- a/robot/wrapper.py +++ b/robot/wrapper.py @@ -83,6 +83,7 @@ def __init__(self, self._hopper_client.open_pipe(self._start_pipe, delete=True, create=True, blocking=True) # Make sure to use blocking mode, otherwise start button code fails self._log_pipe = PipeName((PipeType.INPUT, "log", "robot"), "/home/pi/pipes") + self._json_reader = JsonReader(self._hopper_client, self._start_pipe) # Close stdout and stderr os.close(1) @@ -283,9 +284,7 @@ def _get_start_info(self): """Get the start infomation from the named pipe""" # This call blocks until the start info is read - d = self._hopper_client.read(self._start_pipe).decode("utf-8") - - settings = json.loads(d) + settings = self._json_reader.read() assert "zone" in settings, "zone must be in startup info" if settings["zone"] not in range(4): From d71834b899716d74b0579c8c104c499f944c808b Mon Sep 17 00:00:00 2001 From: Nathan Gill Date: Sat, 1 Nov 2025 14:45:02 +0000 Subject: [PATCH 2/2] `MARKER_TYPE.ARENA_OBJECT` -> `MARKER_TYPE.TREE` --- robot/game_config/markers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/robot/game_config/markers.py b/robot/game_config/markers.py index 41c5884..0aa5655 100644 --- a/robot/game_config/markers.py +++ b/robot/game_config/markers.py @@ -55,7 +55,7 @@ def __repr__(self) -> str: def bounding_box_color(self) -> tuple: if self.type == MARKER_TYPE.ARENA: # If it is a wall return tuple(reversed((225, 249, 125))) # Turquoise - elif self.type == MARKER_TYPE.ARENA_OBJECT: # Other arena object (e.g. pillar) + elif self.type == MARKER_TYPE.TREE: # Other arena object (e.g. pillar) return tuple(reversed((255, 131, 125))) # Purple elif self.owning_team == TEAM.ARENA: # If it is a supply m = self if isinstance(self, TARGET_MARKER) else None