From 5024b7be04871205c9115187603f4edb23932b12 Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Mon, 16 Dec 2024 13:31:56 -0500 Subject: [PATCH 1/3] Add some logging around what I think is causing some can errors --- hardware/opentrons_hardware/drivers/can_bus/can_messenger.py | 2 ++ .../opentrons_hardware/hardware_control/move_group_runner.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py b/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py index c0b49e376bb..a4794a825e5 100644 --- a/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py +++ b/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py @@ -154,6 +154,7 @@ async def send_and_verify_recieved(self) -> ErrorCode: log.error( f"Message did not receive ack for message index {self._message.payload.message_index}" ) + log.error(f"Missing node {self._expected_nodes}") return ErrorCode.timeout finally: self._can_messenger.remove_listener(self) @@ -284,6 +285,7 @@ async def _ensure_send( expected_nodes = list(self._known_nodes) else: expected_nodes = [node_id] + log.warning(f"Setting expected nodes to {expected_nodes}") listener = AcknowledgeListener( can_messenger=self, diff --git a/hardware/opentrons_hardware/hardware_control/move_group_runner.py b/hardware/opentrons_hardware/hardware_control/move_group_runner.py index 1b7baf61d6d..228ff3a1c0c 100644 --- a/hardware/opentrons_hardware/hardware_control/move_group_runner.py +++ b/hardware/opentrons_hardware/hardware_control/move_group_runner.py @@ -469,6 +469,10 @@ def _remove_move_group( f"Received completion for {node_id} group {group_id} seq {seq_id}" f", which {'is' if in_group else 'isn''t'} in group" ) + if not self._moves[group_id] and len(self._moves[group_id]) == 0: + log.error( + f"Python bug proven if check {bool(not self._moves[group_id])} len check {len(self._moves[group_id]) == 0}" + ) if not self._moves[group_id]: log.debug(f"Move group {group_id+self._start_at_index} has completed.") self._event.set() From 57766cbfc5f49da9954f0aa2e6c42add64dfba53 Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Fri, 20 Dec 2024 10:16:08 -0500 Subject: [PATCH 2/3] logic flub --- .../opentrons_hardware/hardware_control/move_group_runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/opentrons_hardware/hardware_control/move_group_runner.py b/hardware/opentrons_hardware/hardware_control/move_group_runner.py index 228ff3a1c0c..9d9ff583ec7 100644 --- a/hardware/opentrons_hardware/hardware_control/move_group_runner.py +++ b/hardware/opentrons_hardware/hardware_control/move_group_runner.py @@ -469,7 +469,7 @@ def _remove_move_group( f"Received completion for {node_id} group {group_id} seq {seq_id}" f", which {'is' if in_group else 'isn''t'} in group" ) - if not self._moves[group_id] and len(self._moves[group_id]) == 0: + if self._moves[group_id] and len(self._moves[group_id]) == 0: log.error( f"Python bug proven if check {bool(not self._moves[group_id])} len check {len(self._moves[group_id]) == 0}" ) From bcd524d0a605bc547034d2919b071c446b042090 Mon Sep 17 00:00:00 2001 From: Ryan Howard Date: Fri, 10 Jan 2025 11:48:24 -0500 Subject: [PATCH 3/3] condense logging --- .../opentrons_hardware/drivers/can_bus/can_messenger.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py b/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py index a4794a825e5..0184c5e5c1f 100644 --- a/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py +++ b/hardware/opentrons_hardware/drivers/can_bus/can_messenger.py @@ -152,9 +152,8 @@ async def send_and_verify_recieved(self) -> ErrorCode: ) except asyncio.TimeoutError: log.error( - f"Message did not receive ack for message index {self._message.payload.message_index}" + f"Message did not receive ack for message index {self._message.payload.message_index} Missing node(s) {self._expected_nodes}" ) - log.error(f"Missing node {self._expected_nodes}") return ErrorCode.timeout finally: self._can_messenger.remove_listener(self) @@ -279,13 +278,14 @@ async def _ensure_send( exclusive: bool = False, ) -> ErrorCode: if len(expected_nodes) == 0: - log.warning("Expected Nodes should have been specified") if node_id == NodeId.broadcast: if not expected_nodes: expected_nodes = list(self._known_nodes) else: expected_nodes = [node_id] - log.warning(f"Setting expected nodes to {expected_nodes}") + log.warning( + f"Expected Nodes should have been specified, Setting expected nodes to {expected_nodes}" + ) listener = AcknowledgeListener( can_messenger=self,