Skip to content

Fix video synchronization for Autonomous periods other than 15 seconds.#489

Open
blaze-developer wants to merge 3 commits intoMechanical-Advantage:mainfrom
blaze-developer:videosync
Open

Fix video synchronization for Autonomous periods other than 15 seconds.#489
blaze-developer wants to merge 3 commits intoMechanical-Advantage:mainfrom
blaze-developer:videosync

Conversation

@blaze-developer
Copy link
Contributor

@blaze-developer blaze-developer commented Mar 17, 2026

This PR attempts to solve the problem with video synchronization caused by assuming that Autonomous periods will always be 15 seconds long (#487 ), finding the frame which is 3 seconds in to the auto, (when the countdown reaches 12,) and offsetting that to find the beginning of Autonomous.

The first obvious solution is probably just checking if the log is from 2026, and then changing the amount you offset by. However this will have to continue to be updated for every season that has a different length auto mode. Aiming for broad applicability from season to season, this changes the synchronization to add 12 seconds rather than subtracting 3, and to synchronize based on the end of auto rather than the beginning. This should work always because since we are finding frames from the match timer, the number of seconds displayed will always be the number of seconds left in Autonomous.

After testing, It gets mostly close, however it is ~600 milliseconds off with the log files I tried. This is either an error on my part, or inherent error with using FPS building up over a longer period of time, A potential fix being detecting a smaller number, and shifting by less frames, but I figured that someone else might have some insight.

@AvidCoder27
Copy link

Is there a reason why the system searches for specifically the 0:12 mark? If it instead searched for, say, 0:03 perhaps the 600 ms error could be mitigated.

@blaze-developer
Copy link
Contributor Author

Probably just because it was three seconds after auto began. I'll try to see if using a lower number could minimize it.

@blaze-developer
Copy link
Contributor Author

Probably just because it was three seconds after auto began. I'll try to see if using a lower number could minimize it

@blaze-developer
Copy link
Contributor Author

Changed the behavior to search for smaller numbers, and it seems to be synced up nicely! :)

@AvidCoder27
Copy link

Based on testing with a few of our team's logs, searching for smaller numbers saves about ~100 ms (before it was 200-300 ms error, after it's consistently under 200 ms).
There must be some variance among our logs and match videos, but an error of 100 ms looks pretty great to me!
Especially given that on the main branch, there is similar error on logs with 15 second autos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants