Skip to content

Commit

Permalink
Added the tests for the geometric_model
Browse files Browse the repository at this point in the history
  • Loading branch information
Moanalengkeek committed Jan 22, 2024
1 parent c7a9030 commit 0259866
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions paseos/tests/actor_builder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,15 @@ def test_add_comm_device():
assert len(sat1.communication_devices) == 2
assert sat1.communication_devices["dev1"].bandwidth_in_kbps == 10
assert sat1.communication_devices["dev2"].bandwidth_in_kbps == 42


def test_set_geometric_model():
"""Check if we can set the geometry, and if the moments of inertia are calculated correctly"""
_, sat1, _ = get_default_instance()
ActorBuilder.set_geometric_model(sat1, mass=100)

assert sat1.mass == 100
assert all(sat1._mesh.center_mass == np.array([0,0,0])) # check the default mesh is centered
assert sat1._mesh.volume == 1 # check the default volume is correct
assert round(sat1._moment_of_inertia[0,0], 4) == 0.1667 # for the default mesh
assert sat1._moment_of_inertia[0,1] == 0.0 # Should be zero if the mass distribution is even

0 comments on commit 0259866

Please sign in to comment.