Fix issues with flight doc + floats (#84)

Co-authored-by: Mark Jessop <darkside@Marks-MacBook-Pro.local>
This commit is contained in:
Mark Jessop 2022-09-11 09:39:12 +09:30 committed by GitHub
parent 4e12def90f
commit fa651b2f2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -294,12 +294,12 @@ def get_standard_prediction(timestamp, latitude, longitude, altitude, current_ra
- All ascent/descent rates must be positive. - All ascent/descent rates must be positive.
""" """
# Bomb out if the rates are too low. # # Bomb out if the rates are too low.
if ascent_rate < ASCENT_RATE_THRESHOLD: # if ascent_rate < ASCENT_RATE_THRESHOLD:
return None # return None
if descent_rate < ASCENT_RATE_THRESHOLD: # if descent_rate < ASCENT_RATE_THRESHOLD:
return None # return None
# Shift longitude into the appropriate range for Tawhiri # Shift longitude into the appropriate range for Tawhiri
@ -777,7 +777,7 @@ async def run_predictions_for_serial(sem, flight_docs, serial, value):
# The flight document has not specified that a float is expected. # The flight document has not specified that a float is expected.
if abs(value['rate']) <= ASCENT_RATE_THRESHOLD: if abs(value['rate']) <= ASCENT_RATE_THRESHOLD:
# We didn't expect a float, but we are in one anyway. # We didn't expect a float, but we are in one anyway.
# Run a normal ascent prediction, but with with an imminent burst. # Run an ascent prediction, but with with an imminent burst.
logging.debug(f"{serial} - flight doc available but in float, near-burst ascent prediction") logging.debug(f"{serial} - flight doc available but in float, near-burst ascent prediction")
return [ return [
serial, serial,
@ -790,8 +790,8 @@ async def run_predictions_for_serial(sem, flight_docs, serial, value):
longitude, longitude,
value['alt'], value['alt'],
current_rate=value['rate'], current_rate=value['rate'],
ascent_rate=value['rate'], ascent_rate=1,
burst_altitude=value['alt']+100, burst_altitude=value['alt']+1,
descent_rate=_flight_doc['descent_rate'] descent_rate=_flight_doc['descent_rate']
) )
) )