Skip to content

🐛 [BUG] - TopicMemorySubscriber enters RUNNING state when inappropriate #196

@chriseichmann

Description

@chriseichmann

Description

According to the code documentation, the TopicMemorySubscriber should never return RUNNING:

This node never returns RUNNING.

But the Node returns RUNNING (at least) for the first tick after _do_reset() was called, because _do_reset() deletes the Memory of the last received message and no new message is received in the minuscule time until _do_tick() is called again.
In my case, the Node is part of a Sequence and gets reset every time a subsequent Node fails, leading to the node returning RUNNING on half the ticks it receives.

From this, some points of discussion arise:

  1. The documentation is incorrect.
  2. I (and probably many others) would assume a TopicMemorySubscriber would store received messages more persistently.
  3. Deleting the memory on _do_reset() defeats the purpose of latching messages on the publisher side. The latched message is lost and the tick will not succeed until a new message is published.

I didn't come up with a clean way to solve the issues.
One solution would be to no longer clear out the memory on _do_reset(), solving 2. and 3. but might introduce new problems.
Point 3. might also be fixed by adding logic to handle latched and non-latched messages differently on _do_reset().
I'm interested in hearing your thoughts on theses or other possible solutions. I will probably write a custom Node now, which does not delete messages on reset.

Reproduction steps

topic_memory_subscriber_debugging_yaml.zip

1. Load the bt from topic_memory_subscriber_debugging_yaml.zip
2. Run `ros2 topic pub -r 10 --qos-depth 1 --qos-durability transient_local --qos-reliability reliable /bt_testing_bool std_msgs/msg/Bool "{data: false}"` to publish messages in rapid succession
3. Press "Tick Once" a couple of times and observe the trees behavior
4. Replace the command with `ros2 topic pub -r 0.1 --qos-depth 1 --qos-durability transient_local --qos-reliability reliable /bt_testing_bool std_msgs/msg/Bool "{data: false}"` to simulate a publisher with lower publication rate
5. Press "Tick Once" a couple of times and observe the trees behavior

Screenshots

Image Image

ROS 2 Version

Humble

OS

Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions