Skip to content

Commit

Permalink
TST: lower tolerances
Browse files Browse the repository at this point in the history
  • Loading branch information
MateusStano committed Apr 12, 2024
1 parent 4db26f0 commit 4356af7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
17 changes: 13 additions & 4 deletions tests/fixtures/rockets/rocket_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,14 @@ def calisto_air_brakes_clamp_off(calisto_robust, controller_function):


@pytest.fixture
def calisto_accel_gyro(calisto_robust, ideal_accelerometer, ideal_gyroscope):
def calisto_accel_gyro(
calisto,
calisto_nose_cone,
calisto_tail,
calisto_trapezoidal_fins,
ideal_accelerometer,
ideal_gyroscope,
):
"""Create an object class of the Rocket class to be used in the tests. This
is the same Calisto rocket that was defined in the calisto fixture, but with
an ideal accelerometer and a gyroscope added at the center of dry mass.
Expand All @@ -264,9 +271,11 @@ def calisto_accel_gyro(calisto_robust, ideal_accelerometer, ideal_gyroscope):
rocketpy.Rocket
An object of the Rocket class
"""
calisto = calisto_robust
calisto.add_sensor(ideal_accelerometer, -0.10482544178314143)
calisto.add_sensor(ideal_gyroscope, -0.10482544178314143)
calisto.add_surfaces(calisto_nose_cone, 1.160)
calisto.add_surfaces(calisto_tail, -1.313)
calisto.add_surfaces(calisto_trapezoidal_fins, -1.168)
calisto.add_sensor(ideal_accelerometer, -0.1180124376577797)
calisto.add_sensor(ideal_gyroscope, -0.1180124376577797)
return calisto


Expand Down
4 changes: 2 additions & 2 deletions tests/test_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_ideal_sensors(flight_calisto_accel_gyro):
sim_accel = flight_calisto_accel_gyro.acceleration(time)

# tolerance is bounded to numerical errors in the transformation matrixes
assert np.allclose(a, sim_accel, atol=1e-2)
assert np.allclose(a, sim_accel, atol=1e-12)

gyroscope = flight_calisto_accel_gyro.rocket.sensors[1].component
time, wx, wy, wz = zip(*gyroscope.measured_data)
Expand All @@ -52,4 +52,4 @@ def test_ideal_sensors(flight_calisto_accel_gyro):
flight_wy = np.array(flight_calisto_accel_gyro.w2(time))
flight_wz = np.array(flight_calisto_accel_gyro.w3(time))
sim_w = np.sqrt(flight_wx**2 + flight_wy**2 + flight_wz**2)
assert np.allclose(w, sim_w, atol=1e-8)
assert np.allclose(w, sim_w, atol=1e-12)

0 comments on commit 4356af7

Please sign in to comment.