Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can try using the option --spin-time, which will cause ros2 topic list to wait for the specified number of seconds before returning. Note, it will only wait if a daemon is not already running. E.g. when running ros2 topic list --spin-time 3 consecutively, only the first call will wait 3 seconds and the others will return immediately since the daemon was started by the first call.

You can force the discovery time by stopping the daemon first:

ros2 daemon stop
ros2 topic list --spin-time 3

I'm not sure this is quite the feature you are looking for though. ros2 topic list does not provide a way to periodically poll for topics.

You can try using the option --spin-time, which will cause ros2 topic list to wait for the specified number of seconds before returning. Note, it will only wait if a daemon is not already running. E.g. when running ros2 topic list --spin-time 3 consecutively, only the first call will wait 3 seconds and the others will return immediately since the daemon was started by the first call.

You can force the discovery time to happen by first stopping the daemon first:daemon:

ros2 daemon stop
ros2 topic list --spin-time 3

I'm not sure this is quite the feature you are looking for though. ros2 topic list does not provide a way to periodically poll for topics.