Read data from ROS2 topic when I want to instead of callback
Hi,
Currently, if a topic is published, in order to listen to the message, I create a subscriber and a callback function which gets called whenever there is a new message on the topic. Instead of this approach, is it possible to read data from a topic only when I want to? Or to call a function which can read data from topic only when I want it?
Thanks, Dev