Per discussion with @mposa, we should keep an eye on the issue of LcmDrivenLoop potentially getting old lcm messages.
Problem description:
After calling drake::lcm::Subscriber.clear() and LcmHandleSubscriptionsUntil() to wait for a new message, it's still possible that we read an old message when we call drake::lcm::Subscriber.message().
This problem is not critical unless the LcmDrivenLoop is intended to be run at a lower rate than the incoming message's rate.
Per discussion with @mposa, we should keep an eye on the issue of LcmDrivenLoop potentially getting old lcm messages.
Problem description: After calling
drake::lcm::Subscriber.clear()
andLcmHandleSubscriptionsUntil()
to wait for a new message, it's still possible that we read an old message when we calldrake::lcm::Subscriber.message()
.This problem is not critical unless the LcmDrivenLoop is intended to be run at a lower rate than the incoming message's rate.
Potentially the best solution: The problem is probably caused by us running
LcmHandleSubscriptionsUntil
in the main thread. A solution could be running the lcm subscriber on a different thread so that it's constantly updating the message buffer.https://github.com/RobotLocomotion/drake/blob/b09e40db4b1c01232b22f7705fb98aa99ef91f87/lcm/test/drake_lcm_thread_test.cc
Hacky solution: Call
clear()
andLcmHandleSubscriptionsUntil()
twice.