Skip to content

fix: replace incremental comet update with full reinit#391

Open
mrosseel wants to merge 1 commit intobrickbots:mainfrom
mrosseel:fix/comet-timed-task-reinit
Open

fix: replace incremental comet update with full reinit#391
mrosseel wants to merge 1 commit intobrickbots:mainfrom
mrosseel:fix/comet-timed-task-reinit

Conversation

@mrosseel
Copy link
Collaborator

@mrosseel mrosseel commented Mar 4, 2026

Summary

  • The incremental update path in do_timed_task() could never add new comets or remove stale ones once the catalog was initially populated
  • Combined with a boot-time race condition (wrong datetime before GPS lock), the initial catalog could contain wrong comets with no way to self-correct
  • Fix: always call init_comets() which is already idempotent and has identical computation cost (since calc_comets() was called on every update anyway)

Symptoms observed

  • 114P/Wiseman showing at mag ~14 when it should be mag 19.8
  • Missing bright comets like C/2024 E1 (Wierzchos) at mag 7.6
  • Only 4 comets shown instead of 11

Test plan

  • Verify comet catalog initializes correctly on boot
  • Verify comets update correctly after GPS lock
  • Verify new comets appear and stale ones are removed on periodic update

🤖 Generated with Claude Code

The incremental update path in do_timed_task() could never add new
comets or remove stale ones. Combined with a boot-time race condition
(wrong datetime before GPS lock), the initial catalog could contain
wrong comets with no way to self-correct.

init_comets() is already idempotent and the computation cost is
identical since calc_comets() was called on every update anyway.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mrosseel mrosseel force-pushed the fix/comet-timed-task-reinit branch from ebc8c06 to 729d09b Compare March 4, 2026 11:46
@jscheidtmann
Copy link
Collaborator

Does this in any way depend on OS clock being synchronized to GPS clock? AFAIK, we do not have the OS clock synchronized at all! On my PiFinders I usually install Chrony and enable synchronization, but I can‘t find an indication in brickbots/PiFinder that we are trying to (synchronize OS time).

@mrosseel
Copy link
Collaborator Author

mrosseel commented Mar 4, 2026

it depends on 'dt = self.shared_state.datetime()' which is set by the GPS (i think), os time is not used really. We could sync it but then we could have weird time jumps, not sure raspbian likes that. Any experiences there? Only upside is correct log file timestamps I guess.

@mrosseel mrosseel force-pushed the fix/comet-timed-task-reinit branch from 1756af0 to 729d09b Compare March 8, 2026 18:18
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