Accessing the last data in a buffer using SyncLogger class #730
Replies: 1 comment 1 reply
-
I think the best solution is to not use the SyncLogger at all. The SyncLogger was mainly intended to simplify scripts that sets up some log and perhaps print the values. Another way would be to use threads, but to me this feels convoluted. The purpose of the SyncLogger is to make an asynchronous process synchronous. By adding threads you would essentially make it asynchronous again, but then why not skip the SyncLogger all together? |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I'm currently working with the SyncLogger class and I'm trying to access the last available state of a drone. My goal is to get infos of the drone in real-time.
I've tried this solution (Python):
where state_loggers[uri] is a SyncLogger object, state_data_dict[uri] is where I want to save the last state, .next() allows to empty the queue ( using _queue.get() ) and _queue.empty() should return True if the queue is empty, False otherwise.
However:
So, I was wondering if a better solution should be used in this case.
Thank you in advance for your assistance!
Best regards,
Matteo
Beta Was this translation helpful? Give feedback.
All reactions