Exemplo n.º 1
0
def test_pitch_demand(start, target, expected):
    # (self,i, Swarm_Size, start_x, start_y, start_z, start_yaw)
    AUV = Vehicle(0, 1, start[0], start[1], start[2], 0)
    config = sim_config('config/sim_config.csv')
    AUV.waypoints = [target]
    AUV.move_to_waypoint()
    assert abs(AUV.pitch_demand - expected) < 0.0000001
Exemplo n.º 2
0
def test_yaw_demand(target, expected):
    # (self,i, Swarm_Size, start_x, start_y, start_z, start_yaw)
    AUV = Vehicle(0, 1, 0, 0, 0, 0)
    config = sim_config('config/sim_config.csv')
    AUV.waypoints = [target]
    AUV.move_to_waypoint()
    assert AUV.yaw_demand == expected
Exemplo n.º 3
0
def test_reached_waypoint():
    # (self,i, Swarm_Size, start_x, start_y, start_z, start_yaw)
    AUV = Vehicle(0, 1, 50, 50,-10 , 0)
    config = sim_config('config/sim_config.csv')
    AUV.state = 0

    # AUV at 1m depth and surfacing
    AUV.waypoints = [[50,50,-20]]
    AUV.move_to_waypoint()

    assert AUV.state == 0

    AUV.z = -19
    AUV.move_to_waypoint()

    assert AUV.state == 1
Exemplo n.º 4
0
def test_reached_waypoint():
    # (self,i, Swarm_Size, start_x, start_y, start_z, start_yaw)
    AUV = Vehicle(0, 1, 50, 50, -10, 0)
    config = sim_config('config/sim_config.csv')
    AUV.state = 0

    # AUV at 1m depth and surfacing
    AUV.waypoints = [[50, 50, -20]]
    AUV.move_to_waypoint()

    assert AUV.state == 0

    AUV.z = -19
    AUV.move_to_waypoint()

    assert AUV.state == 1
Exemplo n.º 5
0
def test_pitch(start_loc, wayp, expected):
    AUV = Vehicle(0, 1, start_loc[0], start_loc[1], start_loc[2], 0)
    config = sim_config('config/sim_config.csv')

    AUV.waypoints = [wayp]
    AUV.current_waypoint = 0

    AUV.move_to_waypoint()
    AUV.plant(config.time_step)

    if expected == 1:
        # assert AUV pitches nose down
        assert AUV.pitch > 0
    elif expected == 0:
        # assert AUV pitches nose up
        assert AUV.pitch < 0
    elif expected == 2:
        # assert AUV pitches nose up
        assert AUV.pitch == 0
Exemplo n.º 6
0
def test_pitch(start_loc, wayp, expected):
    AUV = Vehicle(0, 1, start_loc[0], start_loc[1], start_loc[2], 0)
    config = sim_config('config/sim_config.csv')

    AUV.waypoints = [wayp]
    AUV.current_waypoint = 0

    AUV.move_to_waypoint()
    AUV.plant(config.time_step)

    if expected == 1:
        # assert AUV pitches nose down
        assert AUV.pitch > 0
    elif expected == 0:
        # assert AUV pitches nose up
        assert AUV.pitch < 0
    elif expected == 2:
        # assert AUV pitches nose up
        assert AUV.pitch == 0
Exemplo n.º 7
0
def test_waypoint_sequence():
    AUV = Vehicle(0, 1, 50, 50, -49, 0)
    config = sim_config('config/sim_config.csv')
    AUV.waypoints = [[50,50,-50],[100,100,0]]
    AUV.move_to_waypoint()
    assert AUV.current_waypoint == 1