ui: synchronize model frame with camera frame to ensure consistent display #33461
+36
−13
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.
This PR synchronizes the camera frame displayed in the UI with the model's output, ensuring visual consistency between the model and camera frames.
Previously, the UI was repainted upon receiving a camera frame, while the model data (modelV2) was updated separately using a timer. This often led to a mismatch.
To address this issue, the timer-based update mechanism has been replaced with a background thread that manages updates. The UI now repaints only upon receiving a modelV2 frame rather than a camera frame.
When offroad (without modelV2 data), the update frequency is set to 10Hz. Once onroad, the update frequency aligns with the modelV2 update rate(20 hz). This ensures that the UI is only updated when modelV2 data is received, allowing the camera view to be accurately rendered based on the synchronized model frame ID.