Open darksidelemm opened 1 year ago
This change will need to be made in updateVehicleInfo function, in sondehub.js
Something like this might work however since predictions come through websockets this won't work on refresh after predictions have stopped for a sonde
if (vehicle.prediction_target && vehicle.prediction_target.pdata && vehicle.prediction_target.alt){
var landing_check_alt_idle = vehicle.prediction_target.alt + 300
var landing_check_alt = vehicle.prediction_target.alt + 100
} else {
var landing_check_alt_idle = 600
var landing_check_alt = 350
}
var landed = (
vehicle.max_alt > 1500 && // if it has gone up
vehicle.ascent_rate < 1.0 && // and has negative ascent_rate, aka is descending
newPosition.gps_alt < landing_check_alt // and is under 350 meters altitude
) || ( // or
newPosition.gps_alt < landing_check_alt_idle && // under 600m and has no position update for more than 30 minutes
(new Date().getTime() - newPosition.gps_timestamp) > 1800000
);
Currently we have some code which decides if a payload has 'landed', and it makes some not brilliant assumptions about what ground level is (refer 'The Colorado Problem'). Ideally we'd be comparing against terrain information, but that would require a lot of Ruaumoko API polls.
However, whenever a prediction is run in Tawhiri (which has direct access to the ruaumoko terrain dataset), it terminates the prediction at ground level. Therefore, the last point in any prediction we get will be ground level in the landing area.
We could extract this ground level altitude and store it, and use that to decide if the payload has landed!