black fmt

This commit is contained in:
ryleu
2026-03-18 23:14:53 -05:00
parent c814f34ca6
commit 5e5a52438d
5 changed files with 50 additions and 10 deletions

View File

@@ -318,7 +318,9 @@ class CANConnector(Connector):
}
if mcu_name not in mcu_key_map:
self.logger.error(f"unknown VicCAN mcu_name '{msg.mcu_name}' for CAN frame; dropping message")
self.logger.error(
f"unknown VicCAN mcu_name '{msg.mcu_name}' for CAN frame; dropping message"
)
return
mcu_key = mcu_key_map[mcu_name] & 0b111
@@ -352,7 +354,9 @@ class CANConnector(Connector):
)
command &= 0x3F
arbitration_id = ((mcu_key & 0b111) << 8) | ((data_type_key & 0b11) << 6) | (command & 0x3F)
arbitration_id = (
((mcu_key & 0b111) << 8) | ((data_type_key & 0b11) << 6) | (command & 0x3F)
)
# Map VicCAN.data (floats) to up to 8 CAN data bytes.
raw_bytes: list[int] = []

View File

@@ -1,6 +1,7 @@
from astra_msgs.msg import VicCAN
from rclpy.impl.rcutils_logger import RcutilsLogger
def string_to_viccan(msg: str, mcu_name: str, logger: RcutilsLogger):
"""
Converts the serial string VicCAN format to a ROS2 VicCAN message.
@@ -27,9 +28,7 @@ def string_to_viccan(msg: str, mcu_name: str, logger: RcutilsLogger):
logger.debug(f"got non-CAN data from {mcu_name}: {msg}")
return None
elif len(parts) < 3:
logger.debug(
f"got garbage (not enough parts) CAN data from {mcu_name}: {msg}"
)
logger.debug(f"got garbage (not enough parts) CAN data from {mcu_name}: {msg}")
return None
elif len(parts) > 7:
logger.debug(f"got garbage (too many parts) CAN data from {mcu_name}: {msg}")