Example #1
0
def prove_yaw_behaviour(config):
    print_time(0)
    start_loc = [0,0]
    start_yaw = 0
    AUV = Vehicle(config, 0, config.swarm_size, start_loc[0], start_loc[1], 0, start_yaw)
    AUV.waypoints = [[50,0,0],[50,50,0],[0,50,0],[0,0,0]]
    for elps_time in range(config.run_time):
        AUV.go(config, elps_time)
        update_progress(elps_time, config.run_time)
    # Outputs results
    print('\nWriting Results')
    write_proof(AUV, config)
    print_time(1)
Example #2
0
def prove_yaw_behaviour(config):
    print_time(0)
    start_loc = [0, 0]
    start_yaw = 0
    AUV = Vehicle(config, 0, config.swarm_size, start_loc[0], start_loc[1], 0,
                  start_yaw)
    AUV.waypoints = [[50, 0, 0], [50, 50, 0], [0, 50, 0], [0, 0, 0]]
    for elps_time in range(config.run_time):
        AUV.go(config, elps_time)
        update_progress(elps_time, config.run_time)
    # Outputs results
    print('\nWriting Results')
    write_proof(AUV, config)
    print_time(1)
Example #3
0
def prove_vel_behaviour(config):
    print_time(0)
    start_loc = [0, 0]
    start_yaw = 0
    AUV = Vehicle(config, 0, config.swarm_size, start_loc[0], start_loc[1], 0, start_yaw)
    AUV.waypoints = [[50000, 0, 0]]
    v_demands = [1.0,1.5,0.75,0.25,0.0]

    for v in v_demands:
        AUV.v_demand = v
        for elps_time in range(100):
            AUV.go(config, elps_time)

    write_proof(AUV, config)
    print_time(1)
Example #4
0
def prove_vel_behaviour(config):
    print_time(0)
    start_loc = [0, 0]
    start_yaw = 0
    AUV = Vehicle(config, 0, config.swarm_size, start_loc[0], start_loc[1], 0,
                  start_yaw)
    AUV.waypoints = [[50000, 0, 0]]
    v_demands = [1.0, 1.5, 0.75, 0.25, 0.0]

    for v in v_demands:
        AUV.v_demand = v
        for elps_time in range(100):
            AUV.go(config, elps_time)

    write_proof(AUV, config)
    print_time(1)
Example #5
0
def main():
    Base = Base_Station(1)
    config = sim_config('config/sim_config.csv')
    AUV = Vehicle(0, 1, 0, 0, 0, 0)

    AUV.waypoints = [[50,0,-50], [100, 0, -50], [100, 0, 0], [150, 0, -50], [200, 0, 0]]

    for elps_time in range(5000):
        AUV.sat_comms(Base, config, elps_time)
        AUV.go(config, elps_time)

    write_proof(AUV, config, fn = 'results/sat_delay_test.csv')

    df = pd.read_csv('results/sat_delay_test.csv')
    plt.plot(df.index, df.z)
    plt.show()
Example #6
0
def test_time_stamps():
    AUV_A = Vehicle(0, 3, 10, 10, 0, 0)
    AUV_B = Vehicle(1, 3, 50, 50, 0, 0)
    AUV_C = Vehicle(2, 3, 501, 501, 0, 0)

    config = sim_config('tests/config/sim_config.csv')
    base = Base_Station(config.swarm_size)
    achannel = V2V_comms(config)
    elps_time = 0
    # Information exchanged via satellite
    AUV_A.sat_up(base, elps_time)
    AUV_B.sat_up(base, elps_time)
    AUV_C.sat_up(base, elps_time)
    AUV_A.sat_down(base, config.swarm_size, elps_time)
    AUV_B.sat_down(base, config.swarm_size, elps_time)
    AUV_C.sat_down(base, config.swarm_size, elps_time)

    for i in range(100):
        AUV_A.go(config, 0)
        AUV_B.go(config, 0)
        AUV_C.go(config, 0)
        elps_time += 1

    # Information exchanged via satellite
    AUV_A.sat_up(base, elps_time)
    AUV_B.sat_up(base, elps_time)
    AUV_C.sat_up(base, elps_time)
    AUV_A.sat_down(base, config.swarm_size, elps_time)
    AUV_B.sat_down(base, config.swarm_size, elps_time)
    AUV_C.sat_down(base, config.swarm_size, elps_time)

    for i in range(100):
        AUV_A.go(config, 0)
        AUV_B.go(config, 0)
        AUV_C.go(config, 0)
        elps_time += 1
    # Condition AUVs must be more than 0.5m deep to transmit & receive acc
    AUV_A.z, AUV_B.z, AUV_C.z = -1, -1, -1
    AUV_B.send_acc_msg(achannel, elps_time, config, [AUV_A, AUV_B, AUV_C])
    # A should receive the acc data and update the timestamp
    AUV_A.receive_acc_msg(achannel)
    # C will not receieve the data as it is out of acc range
    AUV_C.receive_acc_msg(achannel)

    # A received the acoustic message therefore has a newer timestamp
    assert AUV_A.time_stamps[1] == 200
    # C was out of range hence has the timestamp from sat comms
    assert AUV_C.time_stamps[1] == 100

    # B has not moved since acc comms hence...
    assert (AUV_A.loc_pos[1][0] == AUV_B.x and AUV_A.loc_pos[1][1] == AUV_B.y
            and AUV_A.loc_pos[1][2] == AUV_B.z)

    # Cs knowledge of B should be the same as that on the server
    assert (AUV_C.loc_pos[1][0] == base.log[1].x[-1]
            and AUV_C.loc_pos[1][1] == base.log[1].y[-1]
            and AUV_C.loc_pos[1][2] == base.log[1].z[-1])

    # C should not know where B is currently
    assert (AUV_C.loc_pos[1][0] != AUV_B.x and AUV_C.loc_pos[1][1] != AUV_B.y
            and AUV_C.loc_pos[1][2] != AUV_B.z)
Example #7
0
def test_time_stamps():
    AUV_A = Vehicle(0, 3, 10, 10, 0, 0)
    AUV_B = Vehicle(1, 3, 50, 50, 0, 0)
    AUV_C = Vehicle(2, 3, 501, 501, 0, 0)

    config = sim_config('tests/config/sim_config.csv')
    base = Base_Station(config.swarm_size)
    achannel = V2V_comms(config)
    elps_time = 0
    # Information exchanged via satellite
    AUV_A.sat_up(base, elps_time)
    AUV_B.sat_up(base, elps_time)
    AUV_C.sat_up(base, elps_time)
    AUV_A.sat_down(base, config.swarm_size, elps_time)
    AUV_B.sat_down(base, config.swarm_size, elps_time)
    AUV_C.sat_down(base, config.swarm_size, elps_time)

    for i in range(100):
        AUV_A.go(config, 0)
        AUV_B.go(config, 0)
        AUV_C.go(config, 0)
        elps_time += 1

    # Information exchanged via satellite
    AUV_A.sat_up(base, elps_time)
    AUV_B.sat_up(base, elps_time)
    AUV_C.sat_up(base, elps_time)
    AUV_A.sat_down(base, config.swarm_size, elps_time)
    AUV_B.sat_down(base, config.swarm_size, elps_time)
    AUV_C.sat_down(base, config.swarm_size, elps_time)

    for i in range(100):
        AUV_A.go(config, 0)
        AUV_B.go(config, 0)
        AUV_C.go(config, 0)
        elps_time += 1
    # Condition AUVs must be more than 0.5m deep to transmit & receive acc
    AUV_A.z, AUV_B.z, AUV_C.z = -1,-1,-1
    AUV_B.send_acc_msg(achannel, elps_time, config, [AUV_A, AUV_B, AUV_C])
    # A should receive the acc data and update the timestamp
    AUV_A.receive_acc_msg(achannel)
    # C will not receieve the data as it is out of acc range
    AUV_C.receive_acc_msg(achannel)

    # A received the acoustic message therefore has a newer timestamp
    assert AUV_A.time_stamps[1] == 200
    # C was out of range hence has the timestamp from sat comms
    assert AUV_C.time_stamps[1] == 100

    # B has not moved since acc comms hence...
    assert (AUV_A.loc_pos[1][0] == AUV_B.x and
            AUV_A.loc_pos[1][1] == AUV_B.y and
            AUV_A.loc_pos[1][2] == AUV_B.z)

    # Cs knowledge of B should be the same as that on the server
    assert (AUV_C.loc_pos[1][0] == base.log[1].x[-1] and
            AUV_C.loc_pos[1][1] == base.log[1].y[-1] and
            AUV_C.loc_pos[1][2] == base.log[1].z[-1])

    # C should not know where B is currently
    assert (AUV_C.loc_pos[1][0] != AUV_B.x and
            AUV_C.loc_pos[1][1] != AUV_B.y and
            AUV_C.loc_pos[1][2] != AUV_B.z)