fix(ui): clamp deltaTime to 1ms in pose-renderer FPS calc (#519 Bug 2)#610
Merged
Conversation
…Bug 2) When two render frames land in the same performance.now() tick, `currentTime - lastFrameTime === 0`, so `fps = 1000 / 0 = Infinity`, and `averageFps = averageFps * 0.9 + Infinity * 0.1 = Infinity` poisons the EMA forever after a single zero-dt tick. The UI then displays "Infinity FPS" until reload. Floor deltaTime at 1 ms before the division. That caps displayed FPS at 1000 (far above any real render rate so the cap is never observed in practice) but keeps the EMA finite. Reported in #519 ("Bug 2 — FPS shows Infinity") by @kapilsoni2013 on a 3-node ESP32-S3-WROOM multi-node setup with edge-tier 1 + 2. Co-Authored-By: claude-flow <ruv@ruv.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #519 Bug 2 (FPS shows Infinity).
Root cause
ui/utils/pose-renderer.js:655didfps = 1000 / deltaTimewithout a floor. When two render frames land in the sameperformance.now()tick (common when an animation frame batches multiple renders),deltaTime === 0and the EMAaverageFps = averageFps * 0.9 + Infinity * 0.1poisons itself permanently. The HUD then readsInfinity FPSuntil page reload.Fix
The 1 ms floor caps displayed FPS at 1000 — far above any real render rate (a 240 Hz monitor renders every ~4 ms), so the cap is never observed in practice. Keeps the EMA finite.
Test plan
updatePerformanceMetricsunchangedInfinity FPSand the new build doesn'tRelated
Issue #519 has three other multi-node bugs documented separately:
This PR closes only Bug 2 cleanly. The other three are tracked in their own threads.
🤖 Generated with claude-flow