projecthorus / sondehub-infra

GNU General Public License v3.0
26 stars 4 forks source link

Flight document system for amateur balloons #63

Closed TheSkorm closed 2 years ago

TheSkorm commented 2 years ago

Need a way to having prediction parameters

TheSkorm commented 2 years ago

https://github.com/projecthorus/sondehub-infra/issues/64#issuecomment-1093701562

darksidelemm commented 2 years ago

Copying this in from the other issue:

For amateur flight predictions I would suggest using the following as the 'default' parameters:

... however, these will not always suffice. We need an API where a user can submit 'real' parameters for a particular callsign. I suggest this is tied to a callsign, not a 'flight' (which is something covered in another issue), so that the prediction system can work in a similar away to the current sondehub predictions.

The API should accept the following parameters:

We may also want to add as an optional field:

I would suggest that when a new submission is entered, it replaces any old parameters for the particular payload_callsign.

Further prediction behaviour (pseudocode):

if abs(current_altitude - ruaumoko(current_position)) < GROUND_LEVEL_THRESHOLD:
  continue # Don't run a prediction.

# Get parameters for particular payload_callsign
ascent_rate
descent_rate
peak_altitude
float_expected

# define the altitude used for burst / float
if (current_ascent_rate > 0):
    if (current_altitude > peak_altitude):
        predict_burst_altitude = current_altitude + 10
    else:
        predict_burst_altitude = peak_altitude
else:
    # Descending. Set burst alt just above current alt.
    predict_burst_altitude = current_altitude+0.05

if (current_ascent_rate < -1.0*ASCENT_RATE_THRESHOLD):
    # Balloon on descent. Use standard descent prediction.
    descent_rate = sea_level_descent_rate(current_ascent_rate)
    standard_prediction(launch_altitude=current_altitude, ascent_rate=5, burst_altitude=current_altitude+0.05, descent_rate=descent_rate)

if float_expected:
    if abs(current_ascent_rate) < ASCENT_RATE_THRESHOLD:
        # Balloon in float. Use float predictor with current altitude.
        float_prediction(launch_altitude=current_altitude, ascent_rate=1, float_altitude=current_altitude+0.05, stop_time=current_time+1day)
    else:
        # Expected float balloon still in ascent. Use float predictor.
        if current_ascent_rate > ASCENT_RATE_THRESHOLD:
            float_prediction(launch_altitude=current_altitude, ascent_rate=current_ascent_rate, float_altitude=predict_burst_altitude,, stop_time=current_time+1day)
else:
    # Standard balloon profile on ascent.
    standard_prediction(launch_altitude=current_altitude, ascent_rate=current_ascent_rate, burst_altitude=peak_altitude, descent_rate=descent_rate)

Suggest:

darksidelemm commented 2 years ago

I would also suggest that if custom (per-payload_callsign) prediction parameters have been used, then they should be included with the prediction data, so they can be displayed on the map.

TheSkorm commented 2 years ago
{
"datetime": ""
"payload_callsign": "",
"float_expected": true/false,
"peak_altitude": 28000,
"descent_rate": 2.8,
"ascent_rate": 2.8
}

Going to build an index in ES to store this for the time being. suggester_callsign left off for the time being since we'll manually poke things into ES

TheSkorm commented 2 years ago

![Uploading image.png…]() index made

TheSkorm commented 2 years ago

predictions using flight docs successfully.

I'm thinking for updating the fligthdocs of incorporating aws cognito into the frontend so we can have uses authenicate via that. Initially we wouldn't have authorization but it would allow us to add it in easily later. We also have cognito setup for ES should it shouldn't be too hard to incorporate, and AWS API gateway already supports. Probably the hardest part would be adding it into the frontend.