Skip to content

sat: use hubble_internal_time_drift_get() for drift compensation#197

Open
ceolin wants to merge 2 commits into
HubbleNetwork:mainfrom
ceolin:sat/pass
Open

sat: use hubble_internal_time_drift_get() for drift compensation#197
ceolin wants to merge 2 commits into
HubbleNetwork:mainfrom
ceolin:sat/pass

Conversation

@ceolin
Copy link
Copy Markdown
Collaborator

@ceolin ceolin commented May 8, 2026

Add an internal API to compute the device drift based on TDR to shift computed pass start back by half the drift window in hubble_next_pass_get().

Add an internal API to compute the device drift based on TDR to
shift computed pass start back by half the drift window in
hubble_next_pass_get().

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
HongNguyen635
HongNguyen635 previously approved these changes May 11, 2026
Copy link
Copy Markdown
Collaborator

@HongNguyen635 HongNguyen635 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 1 minor comment, otherwise this looks good to me.

Comment thread src/hubble_sat_ephemeris.c Outdated
Split the single pass timestamp into `start` and `culmination` so
callers know both when to begin transmitting and when the satellite
is overhead. The pass duration is now derived from the satellite
transmission period (base retries + drift-compensation retries
times the retransmission interval), exposed via the new
hubble_internal_sat_transmission_period_get() helper.

The drift compensation previously applied only in
hubble_next_pass_get() is now also applied in
hubble_next_pass_region_get() for consistency.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Comment on lines +814 to +817
transmission_period_s =
hubble_internal_sat_transmission_period_get() / 1000U;

pass->duration += transmission_period_s;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like I'm missing sometihng. This somehow doesn't feel right to me. For region, we already have the duration that sat passes over a region right? hubble_internal_sat_transmission_period_get will give you the number of retries. But this total retries is not right. Aren't we supposed to somehow do this:
total retries = duration / retries_period?

For single point prediction, it makes sense to call hubble_internal_sat_transmission_period_get, but for a region, we know that the retries period (even with no clock drift) is 160s, and the duration for a region could be longer than that.

Since we don't control the transmission period for region, I feel like the math for single point prediction doesn't apply here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't know the number of retries but we need to accommodate the situation were the device is located in the boundary of the region, if the device is in the boundary we can't simply wake up in the culmination time. This applies the same semantics, splitting the period of a single point transmission between the beginning and end the of the region. Remember that we calculate the duration based on the culmination time of when the sat enters and exits the region.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right you mentioned about the culmination time and I keep forgetting that the time sat enter/exit is at culmination. This makes sense then.

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