Skip to content

Commit

Permalink
Fixing code to match CI/CD requirements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Meoni committed Jan 12, 2024
1 parent 74b3aa4 commit 785ef48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
15 changes: 2 additions & 13 deletions paseos/actors/actor_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,7 @@ def set_position(actor: BaseActor, position: list):

@staticmethod
def set_geometric_model(
actor: SpacecraftActor,
mass: float,
vertices=None,
faces=None,
scale: float = 1

actor: SpacecraftActor, mass: float, vertices=None, faces=None, scale: float = 1
):
"""Define geometry of the spacecraft actor. This is done in the spacecraft body reference frame, and can be
transformed to the inertial/PASEOS reference frame using the reference frane transformations in the attitude
Expand All @@ -334,17 +329,11 @@ def set_geometric_model(

actor._mass = mass
geometric_model = GeometricModel(
local_actor=actor,
actor_mass=mass,
vertices=vertices,
faces=faces,
scale=scale
local_actor=actor, actor_mass=mass, vertices=vertices, faces=faces, scale=scale
)
actor._mesh = geometric_model.set_mesh()
actor._moment_of_inertia = geometric_model.find_moment_of_inertia



@staticmethod
def set_power_devices(
actor: SpacecraftActor,
Expand Down
12 changes: 5 additions & 7 deletions paseos/geometric_model/geometric_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ class GeometricModel:
_actor_center_of_gravity = None
_actor_moment_of_inertia = None

def __init__(
self, local_actor, actor_mass, vertices=None, faces=None, scale=1
) -> None:
def __init__(self, local_actor, actor_mass, vertices=None, faces=None, scale=1) -> None:
"""Describes the geometry of the spacecraft, and outputs relevant parameters related to the spacecraft body.
If no vertices or faces are provided, defaults to a cube with unit length sides. This is in the spacecraft body
reference frame, and can be transformed to the inertial/PASEOS reference frame using the transformations in the
Expand Down Expand Up @@ -56,7 +54,7 @@ def set_mesh(self):
[0.5, -0.5, 0.5],
[0.5, 0.5, -0.5],
[0.5, 0.5, 0.5],
] # defines the corners of the mesh, values are in meters, from the origin of the body frame.
] # defines the corners of the mesh, values are in meters, from the origin of the body frame.
self.faces = [
[0, 1, 3],
[0, 3, 2],
Expand All @@ -70,10 +68,10 @@ def set_mesh(self):
[4, 7, 5],
[0, 4, 1],
[1, 4, 5],
] # List of three vertices to form a triangular face of the satellite. Two triangular faces are used
] # List of three vertices to form a triangular face of the satellite. Two triangular faces are used
# per side of the cuboid
mesh = trimesh.Trimesh(self.vertices, self.faces)
self._actor_mesh = mesh.apply_scale(self.scale) # Scales the mesh by the scale factor
self._actor_mesh = mesh.apply_scale(self.scale) # Scales the mesh by the scale factor
return self._actor_mesh

@property
Expand All @@ -97,4 +95,4 @@ def find_center_of_gravity(self):
np.array: Coordinates of the center of gravity of the mesh
"""
self._actor_center_of_gravity = self._actor_mesh.center_mass
return self._actor_center_of_gravity
return self._actor_center_of_gravity

0 comments on commit 785ef48

Please sign in to comment.