ADCS.helpers.animations.godot.mesh_import.importer module

Import a team’s spacecraft model (glTF preferred, STL accepted) for the viewer.

The model is converted to the spacecraft BODY frame in metres, checked against the simulation’s satellite (mass properties, wheel axes, sensor boresights, drag/SRP panels), reduced to levels of detail, and written as normalised .glb files plus a .viz.json sidecar that the vizlog scene points to.

Problems that make the model unusable are errors; disagreements with the simulation model are warnings, because CAD usually omits internal mass and small parts.

class ADCS.helpers.animations.godot.mesh_import.importer.ImportResult(sidecar: Optional[pathlib.Path], lods: List[pathlib.Path], errors: List[str] = <factory>, warnings: List[str] = <factory>, info: List[str] = <factory>)[source]

Bases: object

Parameters:
  • sidecar (Path | None)

  • lods (List[Path])

  • errors (List[str])

  • warnings (List[str])

  • info (List[str])

exit_code(strict=False)[source]
Parameters:

strict (bool)

Return type:

int

errors: List[str]
info: List[str]
lods: List[Path]
property ok: bool
sidecar: Path | None
warnings: List[str]
ADCS.helpers.animations.godot.mesh_import.importer.import_spacecraft(config, out_dir, satellite=None, base_dir=None)[source]

Import, check and normalise a spacecraft model.

Parameters:
  • config (Dict[str, Any] | str | Path) – spacecraft_viz.json path or its content. Keys: name, mesh (path relative to the config), units (required for STL), cad_to_body (4x4 matrix or {rotation: preset|3x3, translation_m}), mass_kg / density_kg_m3 (default: the satellite’s mass), nodes ({node: {role, actuator, sensor, articulation, axis_body, boresight_local}}), lods, max_triangles.

  • out_dir (str | Path) – Output directory for <name>_lod<i>.glb and <name>.viz.json.

  • satellite (Any) – The simulation’s Satellite to check against (optional but recommended).

  • base_dir (Path | None) – Directory relative mesh paths resolve against (default: the config file’s directory).

Returns:

ImportResult with errors, warnings and output paths.

Return type:

ImportResult

ADCS.helpers.animations.godot.mesh_import.importer.PRESET_ROTATIONS = {'gltf_y_up': array([[ 1.,  0.,  0.],        [ 0.,  0., -1.],        [ 0.,  1.,  0.]]), 'identity': array([[1., 0., 0.],        [0., 1., 0.],        [0., 0., 1.]])}

undo the Z-up -> Y-up conversion Blender and most CAD exporters apply when writing glTF.

Type:

Named CAD -> BODY rotations. “gltf_y_up”

ADCS.helpers.animations.godot.mesh_import.importer.UNIT_SCALE = {'cm': 0.01, 'ft': 0.3048, 'in': 0.0254, 'm': 1.0, 'mm': 0.001}

Model units -> metres.