Skip to content

Commit

Permalink
Updated WindSensor to SimWindSensor
Browse files Browse the repository at this point in the history
  • Loading branch information
kristatraboulay committed Oct 19, 2024
1 parent 49d9b66 commit d6f594b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/boat_simulator/tests/unit/common/test_wind_sensor.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from boat_simulator.common.sensors import WindSensor
from boat_simulator.common.sensors import SimWindSensor
import numpy as np


class TestWindSensor:
class TestSimWindSensor:
def test_wind_sensor_init(self):
init_data = np.array([1, 0])
ws = WindSensor(
ws = SimWindSensor(
wind=init_data,
)

assert np.all(ws.wind == init_data)

def test_wind_sensor_read_no_noise(self):
init_data = np.array([1, 0])
ws = WindSensor(
ws = SimWindSensor(
wind=init_data,
)
read_data = ws.read("wind")
Expand All @@ -23,7 +23,7 @@ def test_wind_sensor_read_mv_gaussian_noise(self):
init_data = np.array([0, 0])
mean = np.array([0, 0])
cov = np.eye(2)
ws = WindSensor(wind=init_data, enable_noise=True)
ws = SimWindSensor(wind=init_data, enable_noise=True)

NUM_READINGS = 10000
reading = np.zeros(shape=(NUM_READINGS, mean.size))
Expand All @@ -38,7 +38,7 @@ def test_wind_sensor_read_mv_gaussian_noise(self):

def test_wind_sensor_update_no_delay(self):
init_data = np.array([0, 0])
ws = WindSensor(wind=init_data)
ws = SimWindSensor(wind=init_data)

NUM_READINGS = 100
for i in range(NUM_READINGS):
Expand All @@ -54,7 +54,7 @@ def test_wind_sensor_update_with_delay(self):

init_data = np.array([0, 0])

ws = WindSensor(wind=init_data, enable_delay=True)
ws = SimWindSensor(wind=init_data, enable_delay=True)

wind = ws.read("wind")
# Initialized data is read without delay
Expand Down

0 comments on commit d6f594b

Please sign in to comment.