The mux node does not properly unsubscribe from its previous subscription when switching to the __none topic. This issue allows downstream subscriptions to continue receiving messages even though they shouldn't.
Expected Behavior
When selecting the __none topic through a service call, the mux node unsubscribes from its previous topic, meaning no messages get forwarded downstream.
Actual Behavior
When selecting the __none topic though a service call, the mux node maintains its previous subscription, forwarding incoming messages downstream.
To Reproduce
Open four terminals
In terminal 1, start the talker node from demo_nodes_cpp
ros2 run demo_nodes_cpp talker
In terminal 2, start the mux node
ros2 run topic_tools mux input_topics /chatter
In terminal 3, start the listener node from the demo_nodes_cpp package with a topic remapping
ros2 run demo_nodes_cpp listener --ros-args -r /chatter:=/input_topics
Observe that the listener node receives messages from the talker node.
In terminal 4, send a service call to select the __none topic
ros2 service call /mux/select topic_tools_interfaces/srv/MuxSelect "{topic: '__none'}"
Observe that the service call succeeded, the mux node acknowledged the selection change, but the listener node still receives messages from the talker node.
System (please complete the following information)
OS: Ubuntu 22.04 (Jammy)
ROS 2 Distro: Humble
Additional context
I want to use the mux node in a three-input configuration. Two inputs would subscribe to used topics, and the third "subscription" would be to the __none topic. From my understanding, the mux node was designed to support this.
I believe the issue stems from a missing ToolBaseNode::make_subscribe_unsubscribe_decisions() function call. It seems like the call should happen in on_mux_select() after updating input_topic_ = NONE_TOPIC.
Description
The
mux
node does not properly unsubscribe from its previous subscription when switching to the__none
topic. This issue allows downstream subscriptions to continue receiving messages even though they shouldn't.Expected Behavior
When selecting the
__none
topic through a service call, the mux node unsubscribes from its previous topic, meaning no messages get forwarded downstream.Actual Behavior
When selecting the
__none
topic though a service call, the mux node maintains its previous subscription, forwarding incoming messages downstream.To Reproduce
Open four terminals
In terminal 1, start the
talker
node fromdemo_nodes_cpp
In terminal 2, start the
mux
nodeIn terminal 3, start the
listener
node from thedemo_nodes_cpp
package with a topic remappingObserve that the
listener
node receives messages from thetalker
node.In terminal 4, send a service call to select the
__none
topicObserve that the service call succeeded, the
mux
node acknowledged the selection change, but thelistener
node still receives messages from thetalker
node.System (please complete the following information)
Additional context
I want to use the
mux
node in a three-input configuration. Two inputs would subscribe to used topics, and the third "subscription" would be to the__none
topic. From my understanding, themux
node was designed to support this.I believe the issue stems from a missing
ToolBaseNode::make_subscribe_unsubscribe_decisions()
function call. It seems like the call should happen inon_mux_select()
after updatinginput_topic_ = NONE_TOPIC
.I'm more than happy to apply the fix.