def test_surfacing(z, state, expected): # (self,i, Swarm_Size, start_x, start_y, start_z, start_yaw) AUV = Vehicle(0, 1, 0, 0, z, 0) config = sim_config('config/sim_config.csv') base = Base_Station(config.swarm_size) # AUV at 1m depth and surfacing AUV.state = state # Try to sat comm (this triggers state change to diving # should remain surfacing as deeper than conditional depth for sat (0.5m) AUV.sat_comms(base, config.swarm_size, 0) assert AUV.state == expected
def test_sat_commd(): AUV_A = Vehicle(0, 3, 10, 10, 0, 0) config = sim_config('tests/config/sim_config.csv') base = Base_Station(config.swarm_size) elps_time = 0 AUV_A.sat_comms(base, config, elps_time) assert AUV_A.state == 3 assert AUV_A.sat_commd == 0 AUV_A.pitch = AUV_A.config.max_pitch AUV_A.v = 0 AUV_A.sat_comms(base, config, elps_time) assert AUV_A.state == 3 assert AUV_A.sat_commd == 1 elps_time = 181 / config.time_step AUV_A.waypoints = [[2, 2, 2], [4, 4, 4], [5, 5, 5]] AUV_A.sat_comms(base, config, elps_time) assert AUV_A.state == 0 assert AUV_A.sat_commd == 1 AUV_A.z = -1 AUV_A.sat_comms(base, config, elps_time) assert AUV_A.sat_commd == 0
def test_sat_commd(): AUV_A = Vehicle(0, 3, 10, 10, 0, 0) config = sim_config('tests/config/sim_config.csv') base = Base_Station(config.swarm_size) elps_time = 0 AUV_A.sat_comms(base, config, elps_time) assert AUV_A.state == 3 assert AUV_A.sat_commd == 0 AUV_A.pitch = AUV_A.config.max_pitch AUV_A.v = 0 AUV_A.sat_comms(base, config, elps_time) assert AUV_A.state == 3 assert AUV_A.sat_commd == 1 elps_time = 181/config.time_step AUV_A.waypoints = [[2,2,2],[4,4,4],[5,5,5]] AUV_A.sat_comms(base, config, elps_time) assert AUV_A.state == 0 assert AUV_A.sat_commd == 1 AUV_A.z = -1 AUV_A.sat_comms(base, config, elps_time) assert AUV_A.sat_commd == 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()