forked from cybergalactic/PythonVehicleSimulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_simulate.py
82 lines (64 loc) · 2.11 KB
/
test_simulate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The pytest for 'test_simulate.py' can be run in the termonal using:
1) cd <path of the Python Vehicle Simulator installation>
2) pytest -k simulate -v
"""
import matplotlib.pyplot as plt
from python_vehicle_simulator.lib import *
import python_vehicle_simulator.vehicles as vehicles
import pytest
sampleTime = 0.02 # sample time
N = 10000 # number of samples
numDataPoints = 50 # number of 3D data points
FPS = 10 # frames per second (animated GIF)
filename = '3D_animation.gif' # data file for animated GIF
browser = 'safari'
@pytest.fixture
def vehicle():
yield vehicles.tanker('headingAutopilot',-20,0.5,150,20,80)
@pytest.fixture
def simulation(vehicle):
yield simulate(N, sampleTime, vehicle)
def test_simulate(simulation):
pass
def test_plot_vehicle_states(simulation):
simTime, simData = simulation
plotVehicleStates(simTime, simData, 1)
#plt.show()
def test_plot_controls(simulation, vehicle):
simTime, simData = simulation
plotControls(simTime, simData, vehicle, 2)
#plt.show()
def test_3D_plot(simulation, vehicle):
simTime, simData = simulation
plot3D(simData,numDataPoints,FPS,filename,3)
#plt.show()
def test_DSRV():
vehicle = vehicles.DSRV()
simulate(N, sampleTime, vehicle)
def test_otter():
vehicle = vehicles.otter()
simulate(N, sampleTime, vehicle)
def test_ROVzefakkel():
vehicle = vehicles.ROVzefakkel()
simulate(N, sampleTime, vehicle)
def test_semisub():
vehicle = vehicles.semisub()
simulate(N, sampleTime, vehicle)
def test_shipClarke83():
vehicle = vehicles.shipClarke83()
simulate(N, sampleTime, vehicle)
def test_supply():
vehicle = vehicles.supply()
simulate(N, sampleTime, vehicle)
def test_frigate():
vehicle = vehicles.frigate()
simulate(N, sampleTime, vehicle)
def test_tanker():
vehicle = vehicles.tanker()
simulate(N, sampleTime, vehicle)
def test_remus100():
vehicle = vehicles.remus100()
simulate(N, sampleTime, vehicle)