studio
studio copied to clipboard
[3D] Don't preload future transforms
User-Facing Changes
- [3D] Transforms from the future are no longer used for TF interpolation
Description The goal of preloading TFs is to get the full back history of TF messages in case one or a few TF messages were published early on and not republished or republished infrequently (such as static TFs). Preloading TFs from past the current playback time produces unexpected interpolation that deviates from how a live robot would behave.
Resolves #4605
John and I had a brainstorm on this and we came up with an idea to try:
Preload only the first N transform messages and preload M transform messages before the current time. As more transforms arrive cycle out old ones but always keeping the first N transforms from start and M before current time active. The thinking was that this solves the common case of ensuring static transforms are present (but loading the first N transform messages) and being able to transform recent messages by having the M transforms before current time present.
If a message needs transforming that falls before the M oldest transform time show a topic error that transforms for that time are expired (or something like that). We can see how often this happens. If necessary we could load a small batch of transforms for this new transform time.
We would do the above iff the total amount of transforms exceeds some upper bound we determine. The idea is that past this upper bound - working with the entire array no longer becomes practical for every frame rendering.
@jhurliman can double check what I've written and correct me if I've stated something incorrect