mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-10 11:52:10 +08:00
timed: publish clocks periodically (#31434)
* timed: publish clocks periodically * simplify * Apply suggestions from code review old-commit-hash: c5739651a241788f9c84ebf705325de57aabfc39
This commit is contained in:
+1
-1
Submodule cereal updated: 9b573c2be3...e842020c1c
@@ -65,10 +65,15 @@ def main() -> NoReturn:
|
||||
cloudlog.debug("Restoring timezone from param")
|
||||
set_timezone(tz)
|
||||
|
||||
pm = messaging.PubMaster(['clocks'])
|
||||
sm = messaging.SubMaster(['liveLocationKalman'])
|
||||
while True:
|
||||
sm.update(1000)
|
||||
|
||||
msg = messaging.new_message('clocks', valid=True)
|
||||
msg.clocks.wallTimeNanos = time.time_ns()
|
||||
pm.send('clocks', msg)
|
||||
|
||||
llk = sm['liveLocationKalman']
|
||||
if not llk.gpsOK or (time.monotonic() - sm.logMonoTime['liveLocationKalman']/1e9) > 0.2:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user