Skip to content

Commit

Permalink
autotest: check altitude in GPSWeightedBlending test
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Aug 20, 2024
1 parent ae5b606 commit 06ef30a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9140,15 +9140,16 @@ def GPSWeightedBlending(self):
if m.TimeUS != current_ts:
current_ts = None
continue
measurements[m.I] = (m.Lat, m.Lng)
measurements[m.I] = (m.Lat, m.Lng, m.Alt)
if len(measurements) == 3:
# check lat:
for n in 0, 1:
for n in 0, 1, 2:
expected_blended = 0.8*measurements[0][n] + 0.2*measurements[1][n]
epsilon = 0.0000002
axis_epsilons = [0.0000002, 0.0000002, 0.2]
epsilon = axis_epsilons[n]
error = abs(measurements[2][n] - expected_blended)
if error > epsilon:
raise NotAchievedException(f"Blended diverged {measurements[0][n]=} {measurements[1][n]=}")
raise NotAchievedException(f"Blended diverged {n=} {measurements[0][n]=} {measurements[1][n]=}")
current_ts = None

self.context_pop()
Expand Down

0 comments on commit 06ef30a

Please sign in to comment.