Skip to content

Commit ef38d40

Browse files
author
MateusStano
committed
TST: fix tests values
1 parent d985eab commit ef38d40

2 files changed

Lines changed: 27 additions & 19 deletions

File tree

tests/integration/test_flight.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,9 @@ def test_empty_motor_flight(mock_show, example_plain_env, calisto_motorless): #
491491

492492
def test_freestream_speed_at_apogee(example_plain_env, calisto):
493493
"""
494-
Asserts that a rocket at apogee has a free stream speed of 0.0 m/s in all
495-
directions given that the environment doesn't have any wind.
494+
Asserts that a rocket at apogee has a free stream speed of near 0.0 m/s
495+
in all directions given that the environment doesn't have any wind. Any
496+
speed values comes from coriolis effect.
496497
"""
497498
# NOTE: this rocket doesn't move in x or z direction. There's no wind.
498499
hard_atol = 1e-12
@@ -508,7 +509,9 @@ def test_freestream_speed_at_apogee(example_plain_env, calisto):
508509
)
509510

510511
assert np.isclose(
511-
test_flight.stream_velocity_x(test_flight.apogee_time), 0.0, atol=hard_atol
512+
test_flight.stream_velocity_x(test_flight.apogee_time),
513+
0.4641492104717301,
514+
atol=hard_atol,
512515
)
513516
assert np.isclose(
514517
test_flight.stream_velocity_y(test_flight.apogee_time), 0.0, atol=hard_atol
@@ -518,9 +521,13 @@ def test_freestream_speed_at_apogee(example_plain_env, calisto):
518521
test_flight.stream_velocity_z(test_flight.apogee_time), 0.0, atol=soft_atol
519522
)
520523
assert np.isclose(
521-
test_flight.free_stream_speed(test_flight.apogee_time), 0.0, atol=soft_atol
524+
test_flight.free_stream_speed(test_flight.apogee_time),
525+
0.4641492104717798,
526+
atol=hard_atol,
527+
)
528+
assert np.isclose(
529+
test_flight.apogee_freestream_speed, 0.4641492104717798, atol=hard_atol
522530
)
523-
assert np.isclose(test_flight.apogee_freestream_speed, 0.0, atol=soft_atol)
524531

525532

526533
def test_rocket_csys_equivalence(
@@ -546,6 +553,7 @@ def test_rocket_csys_equivalence(
546553
assert np.isclose(
547554
flight_calisto_robust.x_impact,
548555
flight_calisto_nose_to_tail_robust.x_impact,
556+
atol=1e-3,
549557
)
550558
assert np.isclose(
551559
flight_calisto_robust.y_impact,

tests/unit/test_flight.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ def test_get_solution_at_time(flight_calisto):
109109
flight_calisto.get_solution_at_time(flight_calisto.t_final),
110110
np.array(
111111
[
112-
48.4313533,
113-
0.0,
114-
985.7665845,
115-
-0.00000229951048,
116-
0.0,
117-
11.2223284,
118-
-341.028803,
119-
0.999048222,
120-
-0.0436193874,
112+
48.43719482805657,
113+
-14.836008075478597,
114+
985.9858934483618,
115+
-3.4415459237894554e-05,
116+
0.0007572309307800201,
117+
11.21695000766671,
118+
-341.1460775169661,
119+
0.9990482215818578,
120+
-0.043619387365336,
121121
0.0,
122122
0.0,
123123
0.0,
@@ -212,7 +212,7 @@ def test_export_sensor_data(flight_calisto_with_sensors):
212212
[
213213
("t_initial", (0.25886, -0.649623, 0)),
214214
("out_of_rail_time", (0.792028, -1.987634, 0)),
215-
("apogee_time", (-0.522875, -0.741825, 0)),
215+
("apogee_time", (-0.509420, -0.732933, -2.089120e-14)),
216216
("t_final", (0, 0, 0)),
217217
],
218218
)
@@ -251,8 +251,8 @@ def test_aerodynamic_moments(flight_calisto_custom_wind, flight_time, expected_v
251251
[
252252
("t_initial", (1.654150, 0.659142, -0.067103)),
253253
("out_of_rail_time", (5.052628, 2.013361, -1.75370)),
254-
("apogee_time", (2.339424, -1.648934, -0.938867)),
255-
("t_final", (0, 0, 159.2210)),
254+
("apogee_time", (2.321838, -1.613641, -0.962108)),
255+
("t_final", (-0.025792, 0.012030, 159.202481)),
256256
],
257257
)
258258
def test_aerodynamic_forces(flight_calisto_custom_wind, flight_time, expected_values):
@@ -292,7 +292,7 @@ def test_aerodynamic_forces(flight_calisto_custom_wind, flight_time, expected_va
292292
("out_of_rail_time", (0, 2.248540, 25.700928)),
293293
(
294294
"apogee_time",
295-
(-14.488364, 15.638049, -0.000191),
295+
(-14.826350, 15.670022, -0.000264),
296296
),
297297
("t_final", (5, 2, -5.660155)),
298298
],
@@ -540,7 +540,7 @@ def test_lat_lon_conversion_from_origin(mock_show, example_plain_env, calisto_ro
540540
heading=0,
541541
)
542542

543-
assert abs(test_flight.longitude(test_flight.t_final) - 0) < 1e-12
543+
assert abs(test_flight.longitude(test_flight.t_final)) < 1e-4
544544
assert test_flight.latitude(test_flight.t_final) > 0
545545

546546

0 commit comments

Comments
 (0)