Example #1
0
def test_aileron_elevator2elevon():
    control_input = ControlInput()
    test_vec1 = np.zeros(2)
    test_vec2 = np.ones(2)
    val1 = control_input.aileron_elevator2elevon(test_vec1)
    val2 = control_input.aileron_elevator2elevon(test_vec2)
    expect1 = np.zeros(2)
    expect2 = np.array([0, 2])
    assert np.allclose(val1, expect1)
    assert np.allclose(val2, expect2)
Example #2
0
def test_flying_wing_get():
    control_input = ControlInput()
    throttle = 0.2
    aileron = 0.2
    elevator = 0.2
    control_input.throttle = throttle
    control_input.aileron = aileron
    control_input.elevator = elevator
    expect_elevon = control_input.aileron_elevator2elevon(
        control_input.control_input[:2])
    expect_flying_wing_input = np.array(
        [expect_elevon[0], expect_elevon[1], throttle])
    assert control_input.throttle == pytest.approx(throttle)
    assert np.allclose(
        np.array([
            control_input.elevon_right, control_input.elevon_left,
            control_input.throttle
        ]), expect_flying_wing_input)