Skip to content

Commit 11f66ca

Browse files
committed
Filter abnormal timesync samples
1 parent ed9b76a commit 11f66ca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/MAVez/controller.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,8 @@ async def sync_clocks(self) -> int:
10621062
# rolling average for offset
10631063
if self.offset is None:
10641064
self.offset = offset
1065+
elif abs(self.offset - offset) > self.offset * 0.1: # if offset differs by more than 10%, ignore it
1066+
self.logger.debug("[Controller] Offset differs significantly, ignoring sample.")
10651067
else:
10661068
self.offset = (self.offset * len(self.local_samples) + offset) // (len(self.local_samples) + 1)
10671069

0 commit comments

Comments
 (0)