Fix ground hit velocity calculation

The ground hit velocity is calculated by taking the last recorded
total velocity for the flight data and using that as the ground
hit velocity if the last altitude measurement is less than 10 m.

This method worked until commit f11a3e4 introduced the ability to
track and report all events that happened after a GROUND_HIT event.
That commit introduced a GroundStepper that will step between the
GROUND_HIT event and the SIMULATION_END event and will always
add a measurement to the flight data to record the rocket being on
the ground.

A better way of measuring the ground hit velocity is to interpolate
the velocity at the time the GROUND_HIT event, as that would actually
be the appropriate ground hit velocity.

Closes #576

Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
This commit is contained in:
Billy Olsen 2020-03-05 23:58:39 -07:00
parent 3aaf8c6802
commit 97c1112c56

View File

@ -195,12 +195,6 @@ public class FlightData {
maxMachNumber = branch.getMaximum(FlightDataType.TYPE_MACH_NUMBER);
flightTime = branch.getLast(FlightDataType.TYPE_TIME);
if (branch.getLast(FlightDataType.TYPE_ALTITUDE) < 10) {
groundHitVelocity = branch.getLast(FlightDataType.TYPE_VELOCITY_TOTAL);
} else {
groundHitVelocity = Double.NaN;
}
// Time to apogee
List<Double> time = branch.get(FlightDataType.TYPE_TIME);
@ -236,6 +230,10 @@ public class FlightData {
double t = event.getTime();
List<Double> velocity = branch.get(FlightDataType.TYPE_VELOCITY_TOTAL);
deploymentVelocity = MathUtil.interpolate( time, velocity, t);
} else if (event.getType() == FlightEvent.Type.GROUND_HIT) {
double t = event.getTime();
List<Double> velocity = branch.get(FlightDataType.TYPE_VELOCITY_TOTAL);
groundHitVelocity = MathUtil.interpolate( time, velocity, t);
}
}