ethz-asl / ethzasl_msf

MSF - Modular framework for multi sensor fusion based on an Extended Kalman Filter (EKF)
Other
989 stars 436 forks source link

Fix increasing buffer issue #187

Closed patripfr closed 1 year ago

patripfr commented 3 years ago

I experienced RAM filling up since the removal of old buffer values was never triggered, since the condition if (newest - it->second->time < age) was never true. After investigation I found the following: The tested sensor publishes data such that there is always a newer measurement (e.g 59.97 seconds in the past) closer to 60 seconds than the previous one (e.g 60.07 seconds in the past). Thus, GetIteratorClosest(newest - age) always returns the iterator to the object that is younger than 60 seconds, which leads to the condition newest - it->second->time < age being false and eventually no elements are ever removed from the container. The fix in this PR solves that issue by not comparing the time between the newest and the closest value to 60 seconds but by comparing the the time between the newest and the oldest measurement in the buffer.

ethzasl-jenkins commented 3 years ago

Can one of the admins verify this patch?

LBern commented 3 years ago

fyi @marco-tranzatto

michaelpantic commented 3 years ago

ok to test

patripfr commented 1 year ago

ok to test