Esempio n. 1
0
def get_gs_fits_corrected() -> typing.List[typing.List[float]]:
    # Apply an offset of +5 knots and a tolerance of ±5knots
    gs_fits = [
        video_analysis.ground_speed_curve_fit_with_offset(
            video_utils.knots_to_m_p_s(5.0 + -5.0)),
        video_analysis.ground_speed_curve_fit_with_offset(
            video_utils.knots_to_m_p_s(5.0 + 0.0)),
        video_analysis.ground_speed_curve_fit_with_offset(
            video_utils.knots_to_m_p_s(5.0 + 5.0)),
    ]
    return gs_fits
Esempio n. 2
0
def gen_event_data() -> ComputedEventData:
    # gs_fits = [plot_common.get_gs_fit(err) for err in video_data.ErrorDirection]
    gs_fits = get_gs_fits_corrected()
    # Find initial start and distance
    start_times = [np.roots(list(reversed(v)))[-1] for v in gs_fits]
    # These are the location of the aircraft from the beginning of the runway at t=0
    offsets = [
        video_data.RUNWAY_LEN_M - video_analysis.ground_speed_integral(
            0, video_data.TIME_VIDEO_END_ASPHALT.time, gs_fit)
        for gs_fit in gs_fits
    ]
    gs_fit_mid = gs_fits[1]
    for event in EVENTS_TIMED:
        t_video = event.t
        if t_video is None:
            # Compute t_video from estimated start
            t_video = start_times[1]
            t_start = 0.0
            t_err = max([
                abs(start_times[1] - start_times[0]),
                abs(start_times[1] - start_times[2])
            ])
            gs_err = None
        else:
            t_start = t_video - start_times[1]
            t_err = None
            gs_err = video_utils.knots_to_m_p_s(
                5.0)  #max([abs(v) for v in GROUND_SPEED_OFFSETS])
        gs = video_analysis.ground_speed_from_fit(t_video, gs_fit_mid)
        accl = video_analysis.ground_speed_differential(t_video, gs_fit_mid)
        d_from_start = offsets[1] + video_analysis.ground_speed_integral(
            0.0, t_video, gs_fits[1])
        d_from_start_min = offsets[0] + video_analysis.ground_speed_integral(
            0.0, t_video, gs_fits[0])
        d_from_start_max = offsets[2] + video_analysis.ground_speed_integral(
            0.0, t_video, gs_fits[2])
        d_from_start_error = max([
            abs(d_from_start - d_from_start_min),
            abs(d_from_start - d_from_start_max),
        ])
        # Transit calculations improve integrated distance
        if t_video >= 0.0:
            d_from_start_error = 25.0
        d_from_start_error = max([d_from_start_error, 25.0])
        yield ComputedEventData(
            event.label,
            ValueAndError(t_video, t_err),
            ValueAndError(t_start, t_err),
            ValueAndError(gs, gs_err),
            ValueAndError(accl, 0.17 / 2),  # Hard coded
            ValueAndError(d_from_start, d_from_start_error),
            ValueAndError(video_data.RUNWAY_LEN_M - d_from_start,
                          d_from_start_error),
            event.notes,
        )
Esempio n. 3
0
def test_m_p_s_to_knots_and_back(m):
    assert math.isclose(m, video_utils.knots_to_m_p_s(video_utils.m_p_s_to_knots(m)))
Esempio n. 4
0
def test_knots_to_m_p_s_and_back(k):
    assert math.isclose(k, video_utils.m_p_s_to_knots(video_utils.knots_to_m_p_s(k)))
Esempio n. 5
0
def test_knots_to_m_p_s(m, k):
    assert m == video_utils.knots_to_m_p_s(k)
Esempio n. 6
0
# Open Street Map file that we have created, and the runway positions in pixels.
OSM_SVG_FILENAME = '../plots/OpenStreetmap_SBKP_01.svg'
RUNWAY_START = PosXY(342, 150)
RUNWAY_END = PosXY(839.75, 537.25)
X_DATUM_T0_TO_RUNWAY_END = 2058.4

# Derived constants
X_DATUM_T0_TO_RUNWAY_START = X_DATUM_T0_TO_RUNWAY_END - video_data.RUNWAY_LEN_M
RUNWAY_LEN_PX = math.sqrt((RUNWAY_END.x - RUNWAY_START.x) ** 2 + (RUNWAY_END.y - RUNWAY_START.y) ** 2)
METRE_PER_PIXEL = video_data.RUNWAY_LEN_M / RUNWAY_LEN_PX  # m / pixel
RUNWAY_DIRECTION = math.atan2(RUNWAY_END.y - RUNWAY_START.y, RUNWAY_END.x - RUNWAY_START.x)

EXTRAPOLATED_RANGE = range(-40, 40)
#: +/- 10 knots
GROUND_SPEED_OFFSETS = (
    video_utils.knots_to_m_p_s(-10.0),
    0.0,
    video_utils.knots_to_m_p_s(10.0),
)
# Bearing constants
OBSERVER_XY_IGNORE_N_FIRST_BEARINGS = 5
OBSERVER_XY_MINIMUM_BASELINE = 1250.0 # 250.0
OBSERVER_XY_TIME_RANGE = (0.0, 0.0)
# OBSERVER_XY_TIME_RANGE = (0.0, video_data.TIME_VIDEO_NOSEWHEEL_OFF.time)
# OBSERVER_XY_TIME_RANGE = (video_data.TIME_VIDEO_NOSEWHEEL_OFF.time, video_data.TIME_VIDEO_END.time + 1)




# X_AT_VIDEO_START = video_data.RUNWAY_LEN_M - X_DATUM_T0_TO_RUNWAY_END
def distance_m_to_pixels(d: float) -> float: