TechnoTitans / TitanWare2024

Crescendo 2024
Other
3 stars 1 forks source link

Use size-bounded DoubleCircularBuffer instead of unbounded Queue #31

Closed HarryXChen3 closed 8 months ago

HarryXChen3 commented 8 months ago

WPILib's DoubleCircularBuffer has an upper bound on the maximum size (amount of elements) that can be in the buffer - this is desirable so that the size of the queue/buffer does not continuously grow unbounded during a particularly long loop cycle or IO read.

This replaces the old implementation that used Queue, and is better than using ArrayBlockingQueue because the oldest data is discarded when the size grows to its maximum instead of discarding the latest (newest) data.

Resolves #30.