From bc9183d59acd88833f8cfdd49f2604f6536f8973 Mon Sep 17 00:00:00 2001 From: ryleu <69326171+ryleu@users.noreply.github.com> Date: Tue, 7 Apr 2026 21:52:52 -0500 Subject: [PATCH] make mock mcu use VicCAN messages --- README.md | 2 +- src/anchor_pkg/anchor_pkg/anchor_node.py | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index fe84505..b045857 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ $ ros2 topic pub /anchor/to_vic/relay astra_msgs/msg/VicCAN '{mcu_name: "core", To emulate receiving data from a microcontroller, publish to the dedicated topic: ```bash -$ ros2 topic pub /anchor/from_vic/mock_mcu std_msgs/msg/String '{data: "can_relay_fromvic,arm,55,0.0,450.0,900.0,0.0"}' +$ ros2 topic pub /anchor/from_vic/mock_mcu astra_msgs/msg/VicCAN '{mcu_name: "arm", command_id: 55, data: [0.0, 450.0, 900.0, 0.0]}' ``` ### Testing Serial diff --git a/src/anchor_pkg/anchor_pkg/anchor_node.py b/src/anchor_pkg/anchor_pkg/anchor_node.py index b9cf992..f831015 100644 --- a/src/anchor_pkg/anchor_pkg/anchor_node.py +++ b/src/anchor_pkg/anchor_pkg/anchor_node.py @@ -37,7 +37,7 @@ class Anchor(Node): Subscribers: * /anchor/from_vic/mock_mcu - - For testing without an actual MCU, publish strings here as if they came from an MCU + - For testing without an actual MCU, publish ViCAN messages here as if they came from an MCU * /anchor/to_vic/relay - Core, Arm, and Bio publish VicCAN messages to this topic to send to the MCU * /anchor/to_vic/relay_string @@ -229,16 +229,9 @@ class Anchor(Node): elif msg.mcu_name == "citadel" or msg.mcu_name == "digit": self.fromvic_bio_pub_.publish(msg) - def on_mock_fromvic(self, msg: String): + def on_mock_fromvic(self, msg: VicCAN): """Relay a message as if it came from the MCU""" - viccan = string_to_viccan( - msg.data, - "mock", - self.get_logger(), - self.get_clock().now().to_msg(), - ) - if viccan: - self.relay_fromvic(viccan) + self.relay_fromvic(msg) def main(args=None):