ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

Update time for get_node_names

Hi,
I wondered how long the get_node_names method in the rclcpp graph interface takes until it notices that a node was shutdown or a new node was added assuming I used Fast-RTPS as middleware?

Another question: Are there any plans to implement some kind of callbacks/events that get called in case node was added / shutdown from the system?

Just to push this topic a bit.
I was asking this question because I did some tests with two nodes. I was very surprised when I found out that it takes just a few seconds until a newly started node is shown in the list of the previous started node.
But if I stop a node it takes about 5 minutes until the change is shown in the list of the node that is still running.

I just took a look at the implementation below but wasn’t able to find any information in the fast rtps code how long it should take until the shutdown of a node is known by the rest of the system.

The fact that it takes so long for a node to go away might be related to the Fast-RTPS settings or perhaps if the node is not terminated cleanly.

@karsten implemented this, so I’ll let him chime in, but we might need to change the implementation of this anyways to address node name uniqueness or the mapping of nodes to participants.

We have the graph API for changes to the graph, but I think it currently does not get notified when new nodes are added or when nodes are removed. I guess @karsten just didn’t implement that part when doing the initial implementation. Again the behavior (or underlying mechanism) may need to change in the future.

Sorry for coming back on this so late.

The getParticipantNames function has been added to FastRTPS to get going with exposing node names. It’s clearly a one-directional implementation, saying that every time you ask for available nodes, you basically ask FastRTPS for available participants. I am not really familiar about the underlying specifics within FastRTPS to give qualified feedback on why it takes that long. There is no API currently for the rosgraph, notifying about node changes, only about topics (AFAIK).

I believe that FastRTPS has support for callbacks on node changes, but I have to look into it. For the time being, I would invite you to open a github issue for that particular scenario of yours, maybe posting your code snippet and we can pick it up from there.