From bff729f25a5cde22d837ab86797c0f50bd7dfca3 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 27 May 2025 19:59:13 +0000 Subject: [PATCH] style: add a few type annotations --- src/bio_pkg/bio_pkg/bio_node.py | 6 +++--- src/core_pkg/core_pkg/core_node.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bio_pkg/bio_pkg/bio_node.py b/src/bio_pkg/bio_pkg/bio_node.py index be0103d..e901e5b 100644 --- a/src/bio_pkg/bio_pkg/bio_node.py +++ b/src/bio_pkg/bio_pkg/bio_node.py @@ -170,7 +170,7 @@ class SerialRelay(Node): - def send_cmd(self, msg): + def send_cmd(self, msg: str): if self.launch_mode == 'anchor': #if in anchor mode, send to anchor node to relay output = String() output.data = msg @@ -179,7 +179,7 @@ class SerialRelay(Node): self.get_logger().info(f"[Bio to MCU] {msg}") self.ser.write(bytes(msg, "utf8")) - def anchor_feedback(self, msg): + def anchor_feedback(self, msg: String): output = msg.data parts = str(output.strip()).split(",") self.get_logger().info(f"[Bio Anchor] {msg.data}") @@ -188,7 +188,7 @@ class SerialRelay(Node): self.bio_feedback.bat_voltage = float(parts[3]) / 100.0 self.bio_feedback.voltage_12 = float(parts[4]) / 100.0 self.bio_feedback.voltage_5 = float(parts[5]) / 100.0 - if output.startswith("can_relay_fromvic,digit,57"): + elif output.startswith("can_relay_fromvic,digit,57"): self.bio_feedback.drill_temp = float(parts[3]) self.bio_feedback.drill_humidity = float(parts[4]) diff --git a/src/core_pkg/core_pkg/core_node.py b/src/core_pkg/core_pkg/core_node.py index 0f1052f..ca3555b 100644 --- a/src/core_pkg/core_pkg/core_node.py +++ b/src/core_pkg/core_pkg/core_node.py @@ -152,7 +152,7 @@ class SerialRelay(Node): self.ser.close() self.exit(1) - def scale_duty(self, value, max_speed): + def scale_duty(self, value: float, max_speed: float): leftMin = -1 leftMax = 1 rightMin = -max_speed/100.0