11import math
2+
23import pytest
4+
35import local_pathfinding .wind_coord_systems as wcs
46
57
2022 ],
2123)
2224def test_boat_to_global_coordinate (boat_heading : float , wind_direction : float , expected : float ):
23- assert (
24- wcs . boat_to_global_coordinate ( boat_heading , wind_direction ) == pytest . approx ( expected )
25+ assert wcs . boat_to_global_coordinate ( boat_heading , wind_direction ) == pytest . approx (
26+ expected
2527 ), "incorrect angle conversion"
2628
2729
@@ -56,6 +58,16 @@ def test_global_to_boat_coordinate(
5658 (180 , 17 , 179 , 9 , 179.65 , 26 ),
5759 (140 , 17 , 45 , 9 , 111.06 , 18.52 ),
5860 (80 , 5 , - 70 , 8 , - 35.74 , 4.44 ),
61+ (70 , 10.579 , 180.0 , 3.452 , 89.04 , 9.94 ),
62+ (70 , 10.600 , 180.0 , 3.518 , 89.38 , 9.96 ),
63+ (70 , 10.601 , - 79.198 , 3.518 , 56.64 , 7.79 ),
64+ (- 8 , 13.044 , - 79.198 , 3.085 , - 19.75 , 14.34 ),
65+ (- 8 , 13.451 , - 52.021 , 3.497 , - 16.65 , 16.15 ),
66+ (- 31 , 11.693 , - 52.021 , 2.060 , - 34.10 , 13.64 ),
67+ (- 37 , 10.100 , - 71.758 , 0.127 , - 37.40 , 10.20 ),
68+ (- 16 , 10.745 , - 71.758 , 0.782 , - 19.31 , 11.20 ),
69+ (- 15 , 11.958 , - 71.765 , 2.044 , - 22.45 , 13.19 ),
70+ (- 14 , 12.370 , - 71.765 , 2.470 , - 22.67 , 13.85 ),
5971 ],
6072)
6173def test_get_true_wind_direction (
@@ -74,8 +86,8 @@ def test_get_true_wind_direction(
7486 tw_dir_deg = math .degrees (tw_dir_rad )
7587
7688 assert tw_dir_deg == pytest .approx (
77- expected = expected_direction , abs = 1e-2
78- ) and tw_speed_kmph == pytest .approx (expected = expected_speed , abs = 1e-2 )
89+ expected = expected_direction , abs = 1e-1
90+ ) and tw_speed_kmph == pytest .approx (expected = expected_speed , abs = 1e-1 )
7991
8092
8193@pytest .mark .parametrize (
@@ -137,7 +149,7 @@ def test_mock_wind_sensor_pipeline(
137149
138150 assert aw_dir_boat_coord_deg == pytest .approx (
139151 expected = expected_aw_boat_dir_deg , abs = 1
140- ), f"Apparent wind direction in boat frame mismatch: { aw_dir_boat_coord_deg } != { expected_aw_boat_dir_deg } " # noqa
152+ ), f"Apparent wind direction in boat frame mismatch: { aw_dir_boat_coord_deg } != { expected_aw_boat_dir_deg } " # noqa
141153 assert aw_speed_kmph == pytest .approx (
142154 expected = expected_aw_speed , abs = 1
143155 ), f"Apparent wind speed mismatch: { aw_speed_kmph } != { expected_aw_speed } "
0 commit comments