pyRTX.classes.Spacecraft
Classes
|
Represents a spacecraft, including its geometry, materials, and orientation. |
- class pyRTX.classes.Spacecraft.Spacecraft(name=None, base_frame=None, spacecraft_model=None, units='m', mass=0.0)[source]
Represents a spacecraft, including its geometry, materials, and orientation.
This class manages the different components of a spacecraft, their transformations, and material properties. It can load geometry from OBJ files and uses SPICE kernels to determine the orientation of each component.
- __init__(name=None, base_frame=None, spacecraft_model=None, units='m', mass=0.0)[source]
Initializes the Spacecraft object.
- Parameters:
name (
str, optional) – The name of the spacecraft.base_frame (
str, optional) – The SPICE reference frame for the spacecraft’s body.spacecraft_model (
dict, optional) –A dictionary defining the spacecraft’s components. Each key is the component name, and the value is another dictionary with the following keys:
’file’ (str): Path to the OBJ file for the component.
’frame_type’ (str): ‘Spice’ or ‘UD’ (User Defined).
’frame_name’ (str): The name of the SPICE or UD frame.
’center’ (list): The position of the component’s origin in the base frame.
’specular’ (float): The specular reflection coefficient.
’diffuse’ (float): The diffuse reflection coefficient.
’UD_rotation’ (trimesh.transformations.Transform, optional): A user-defined rotation matrix.
units (
str, default'm') – The units for the spacecraft model’s dimensions (‘m’ for meters, ‘km’ for kilometers, etc.).mass (
floatorxarray.Dataset, default0.) – The spacecraft’s mass. Can be a constant float or an xarray Dataset with time-varying mass.
- subset(elem_names)[source]
Creates a new Spacecraft instance containing only a subset of the
components of the current instance.
- remove_part(name)[source]
Removes a part from the spacecraft model.
- Parameters:
name (
str) – The name of the part to remove.
- apply_transforms(epoch)[source]
Applies the rotations and translations to each component for a given
epoch.
- Parameters:
epoch (
float) – The epoch (in SPICE ephemeris time) at which to apply the transformations.
- materials()[source]
Returns the material properties dictionary for the spacecraft.
- Returns:
A dictionary containing the material properties of each component.
- Return type:
- dump(epoch=None, split=False)[source]
Returns the combined or individual meshes of the spacecraft’s components
at a specific epoch.
- Parameters:
- Returns:
The combined mesh or a list of individual component meshes.
- Return type:
trimesh.Trimeshorlistoftrimesh.Trimesh