Skip to content

Commit

Permalink
mavextra.py: return None if nan passed as new value to lowpass
Browse files Browse the repository at this point in the history
similar to what other function in here to, don't poison the lowpass result with nans - just ignore the bad value
  • Loading branch information
peterbarker committed Oct 7, 2024
1 parent b2a5d71 commit df16b4b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mavextra.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ def second_derivative_9(var, key):

def lowpass(var, key, factor):
'''a simple lowpass filter'''
if isnan(var):
return None
global lowpass_data
if not key in lowpass_data:
lowpass_data[key] = var
Expand Down

0 comments on commit df16b4b

Please sign in to comment.