Skip to content

fix: compute quartile indices dynamically instead of hardcoding 25/75#96

Merged
iandareid merged 1 commit into
rosflight:mainfrom
shanboss:fix/baro-calibration-quartile-indices
Jul 2, 2026
Merged

fix: compute quartile indices dynamically instead of hardcoding 25/75#96
iandareid merged 1 commit into
rosflight:mainfrom
shanboss:fix/baro-calibration-quartile-indices

Conversation

@shanboss

Copy link
Copy Markdown
Contributor

Description

Fixes hardcoded Q1/Q3 indices (24/25, 74/75) in barometer calibration
outlier detection. These were hardcoded assuming a vector of exactly
100 elements, which breaks when baro_calibration_count is changed
from its default of 100.

Changes

  • Compute q1_index and q3_index dynamically based on the size of
    init_static_vector_, instead of hardcoded constants.

Testing

  • Verified the new formula produces identical results to the original
    hardcoded indices when n=100 (no behavior change at default config)
  • Verified no out-of-bounds access / correct scaling for n=50 and n=200
    via a standalone test of the quartile logic

Closes #95

@JMoore5353 JMoore5353 self-requested a review June 25, 2026 17:24
@JMoore5353 JMoore5353 requested a review from iandareid June 25, 2026 19:39
@JMoore5353

Copy link
Copy Markdown
Contributor

Thanks for the contribution @shanboss!

@iandareid I pinged you on this since you are probably code owner of ROSplane... If you think it looks good, go ahead and merge it.

@iandareid iandareid merged commit c792da8 into rosflight:main Jul 2, 2026
2 checks passed
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.

Baro calibration implicitly hardcodes 100 as the calib count

3 participants