Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify(leader_election_converter): fix a mistake #1529

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions system/leader_election_converter/script/relay_to_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,23 @@ 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:
self.autonomous_mode = msg.autonomous
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:
Expand Down
Loading