From ec0336b044ca04183e479a214d4878a5b112b0a8 Mon Sep 17 00:00:00 2001 From: Josh Hartung Date: Tue, 7 Apr 2026 11:40:01 -0700 Subject: [PATCH] Fix: store control_command subscription in on_activate The ~/control_command topic subscription created in on_activate() was not assigned to the control_command_sub_ member variable. The subscription was immediately destroyed when the temporary SharedPtr went out of scope, resulting in zero subscribers on the topic. Any node publishing to ~/control_command would see Subscription count: 0 and no CAN frames would be generated from the topic. The send_control_command service (separate code path) was unaffected, masking the bug in topic-based usage. --- .../sygnal_can_interface_ros2/src/sygnal_can_interface_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sygnal_can_interface/sygnal_can_interface_ros2/src/sygnal_can_interface_node.cpp b/sygnal_can_interface/sygnal_can_interface_ros2/src/sygnal_can_interface_node.cpp index 79f3cc8..e3d20e0 100644 --- a/sygnal_can_interface/sygnal_can_interface_ros2/src/sygnal_can_interface_node.cpp +++ b/sygnal_can_interface/sygnal_can_interface_ros2/src/sygnal_can_interface_node.cpp @@ -134,7 +134,7 @@ rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn Sygnal entry.publisher->on_activate(); } - create_subscription( + control_command_sub_ = create_subscription( "~/control_command", rclcpp::QoS(10), std::bind(&SygnalCanInterfaceNode::controlCommandCallback, this, std::placeholders::_1));