예제 #1
0
def test_rcs_switch_off_at_default_threshold():
    vertical_velocity = 4 / 3.6  # m / s
    rda_range = 2  # m
    pitch = 0.0

    expected_result = True

    result = rcs_switch_off(rda_range, pitch, vertical_velocity)
예제 #2
0
def test_inconsistent_sensor_never_switches_off_rcs():
    rda_range = 10_000
    pitch = np.radians(100)
    vertical_velocity = 0

    expected_result = False

    result = rcs_switch_off(rda_range, pitch, vertical_velocity)

    assert result == expected_result
예제 #3
0
def test_rcs_switch_off_happens_if_energy_below_threshold():
    rda_range = pitch = vertical_velocity = 0
    energy_threshold = 1

    expected_result = True

    result = rcs_switch_off(rda_range, pitch, vertical_velocity,
                            energy_threshold)

    assert result == expected_result
예제 #4
0
def test_rcs_switch_off_does_not_happen_if_energy_above_threshold():
    rda_range = 3.5e3
    pitch = vertical_velocity = 0
    energy_threshold = 0

    expected_result = False

    result = rcs_switch_off(rda_range, pitch, vertical_velocity,
                            energy_threshold)

    assert result == expected_result
예제 #5
0
def test_rcs_switch_off_just_above_default_threshold_is_false():
    vertical_velocity = 4 / 3.6  # m / s
    rda_range = 2 + 0.01  # m
    pitch = 0.0

    expected_result = False

    result = rcs_switch_off(rda_range, pitch, vertical_velocity)

    assert result == expected_result
    assert result == expected_result
예제 #6
0
def rcs_off():
    rda_range = float(request.args["rda_range"])
    pitch = float(request.args["pitch"])
    vertical_velocity = float(request.args["velocity"])

    try:
        is_rcs_off = rcs_switch_off(rda_range, pitch, vertical_velocity)
    except:
        return "Invalid altitude", 400
    altitude = edm_altitude(rda_range, pitch)
    consistent = is_consistent(rda_range, pitch)
    color = COLORS["GREEN"] if consistent else COLORS["RED"]

    return f"""<b>Altitude</b>: {altitude:.3f} m