From 3de69e1fadf5bdf857d1ddbee4f8ae8968b1ff39 Mon Sep 17 00:00:00 2001 From: TetsuKawa Date: Tue, 10 Sep 2024 12:44:41 +0900 Subject: [PATCH] modify: fix a mistake Signed-off-by: TetsuKawa --- .../leader_election_converter/script/relay_to_sub.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/system/leader_election_converter/script/relay_to_sub.py b/system/leader_election_converter/script/relay_to_sub.py index 949c38eb7b049..fb07a2c852852 100644 --- a/system/leader_election_converter/script/relay_to_sub.py +++ b/system/leader_election_converter/script/relay_to_sub.py @@ -43,6 +43,7 @@ def __init__(self): self.autonomous_mode = False self.operation_mode_autonomous_state = False self.get_logger().info(f"Initial autonomous mode: {self.autonomous_mode}") + self.tmp_operation_mode_autonomous_state = False def operation_mode_callback(self, msg): if msg.autonomous != self.autonomous_mode: @@ -50,10 +51,15 @@ def operation_mode_callback(self, msg): self.get_logger().info(f"Autonomous mode changed: {self.autonomous_mode}") def operation_mode_state_callback(self, msg): + self.tmp_operation_mode_autonomous_state = self.operation_mode_autonomous_state if msg.mode == 2: - self.operation_mode_autonomous_state == True + self.operation_mode_autonomous_state = True + if self.tmp_operation_mode_autonomous_state != self.operation_mode_autonomous_state: + self.get_logger().info(f"Operation mode changed: {self.operation_mode_autonomous_state}") else: - self.operation_mode_autonomous_state == False + self.operation_mode_autonomous_state = False + if self.tmp_operation_mode_autonomous_state != self.operation_mode_autonomous_state: + self.get_logger().info(f"Operation mode changed: {self.operation_mode_autonomous_state}") def trajectory_callback(self, msg): if self.autonomous_mode or self.operation_mode_autonomous_state == False: