simIncludeGravBody
- class simIncludeGravBody.BodyData(identifier: str, planetName: str, displayName: str, modelDictionaryKey: str, mu: float, radEquator: float, spicePlanetFrame: str, radiusRatio: float = 1)[source]
Bases:
objectA class that contains information about a body in the simulation.
- Parameters:
identifier (str) – The SPICE identifier of the body.
planetName (str) – The name that identifies the body within the simulation.
displayName (str) – The name for the body in the Vizard display.
modelDictionaryKey (str) – Vizard model key name.
mu (float) – Gravitational parameter in m^3/s^2.
radEquator (float) – Equatorial radius of the body in meters.
spicePlanetFrame (str) – The name of the SPICE frame (attitude provider).
radiusRatio (float, optional) – Used to compute ellipticity. It is provided for bodies in the basic Vizard body dictionary. Defaults to 1.
- class simIncludeGravBody.gravBodyFactory(bodyNames: Iterable[str] = [])[source]
Bases:
objectClass to create gravitational bodies.
- addBodiesTo(objectToAddTheBodies: GravityEffector | WithGravField)[source]
Can be called with a GravityEffector or an object that has a gravField variable to set the gravity bodies used in the object.
- createBodies(*bodyNames: str | Iterable[str]) Dict[str, GravBodyData][source]
A convenience function to create multiple typical solar system bodies.
- Parameters:
bodyNames (Union[str, Iterable[str]]) – Planet name strings. Each planet name must be a valid SPICE celestial body string.
- Returns:
A dictionary of gravity body objects held by the gravity factory.
- Return type:
Dict[str, gravityEffector.GravBodyData]
- createBody(bodyData: str | BodyData) GravBodyData[source]
Convenience function to create a body given its name.
- Parameters:
bodyData (Union[str, BodyData]) – A valid SPICE celestial body string or a BodyData class with the relevant data.
- Returns:
The body object with corresponding data.
- Return type:
gravityEffector.GravBodyData
- createCustomGravObject(label: str, mu: float, displayName: str | None = None, modelDictionaryKey: str | None = None, radEquator: float | None = None, radiusRatio: float | None = None, planetFrame: str | None = None) GravBodyData[source]
Create a custom gravity body object.
- Parameters:
label (str) – Gravity body name
mu (float) – Gravity constant in m^3/s^2
displayName (Optional[str], optional) – Vizard celestial body name, if not provided then planetFrame becomes the Vizard name. Defaults to None.
modelDictionaryKey (Optional[str], optional) – Vizard model key name. If not set, then either the displayName or planetName is used to set the model. Defaults to None.
radEquator (Optional[float], optional) – Equatorial radius in meters. Defaults to None.
radiusRatio (Optional[float], optional) – Ratio of the polar radius to the equatorial radius. Defaults to None.
planetFrame (Optional[str], optional) – Name of the spice planet frame. Defaults to None.
- Returns:
The body object with the given data.
- Return type:
gravityEffector.GravBodyData
- createSpiceInterface(path: str, time: str, spiceKernelFileNames: Iterable[EphemerisData] = (DataFile.EphemerisData.de430, DataFile.EphemerisData.naif0012, DataFile.EphemerisData.de_403_masses, DataFile.EphemerisData.pck00010), spicePlanetNames: Sequence[str] | None = None, spicePlanetFrames: Sequence[str] | None = None, epochInMsg: bool = False) SpiceInterface[source]
- createSpiceInterface(*, path: str = '%BSK_PATH%/supportData/EphemerisData/', time: str, spiceKernelFileNames: Iterable[EphemerisData] = (DataFile.EphemerisData.de430, DataFile.EphemerisData.naif0012, DataFile.EphemerisData.de_403_masses, DataFile.EphemerisData.pck00010), spicePlanetNames: Sequence[str] | None = None, spicePlanetFrames: Sequence[str] | None = None, epochInMsg: bool = False) SpiceInterface
A convenience function to configure a NAIF Spice module for the simulation. It connects the
gravBodyDataobjects to the spice planet state messages. Thus, it must be run after thegravBodyDataobjects are created.Unless the
pathinput is provided, the kernels are loaded from the folder: %BSK_PATH%/supportData/EphemerisData/, where %BSK_PATH% is replaced by the Basilisk directory.Note
spicePlanetFramesspecifies the output frames used to computeJ20002Pfixfor each planet state output message. If this argument is not set, the method uses the frames gathered when bodies were created (typicallyIAU_*frame names).Alternatives to
IAU_*can be provided as long as SPICE can resolve the frame IDs from loaded kernels. For example,"ITRF93"can be used for Earth-fixed outputs when Earth high precision kernels are available, and"J2000"can be used to request an inertial-aligned output frame.Earth frame-association FK kernels (for example
earth_assoc_itrf93.tf) do not overridespicePlanetFrames.- Parameters:
path (str) – The absolute path to the folder that contains the kernels to be loaded.
time (str) – The time string in a format that SPICE recognizes.
spiceKernelFileNames (Iterable[str], optional) – A list of spice kernel file names including file extension. Defaults to [‘de430.bsp’, ‘naif0012.tls’, ‘de-403-masses.tpc’, ‘pck00010.tpc’].
spicePlanetNames (Optional[Sequence[str]], optional) – A list of planet names whose Spice data is loaded. If this is not provided, Spice data is loaded for the bodies created with this factory object. Defaults to None.
spicePlanetFrames (Optional[Sequence[str]], optional) – A list of planet frame names to load in Spice. If this is not provided, frames are loaded for the bodies created with this factory function. Defaults to None.
epochInMsg (bool, optional) – Flag to set an epoch input message for the spice interface. Defaults to False.
- Returns:
The generated SpiceInterface, which is the same as the stored self.spiceObject
- Return type:
spiceInterface.SpiceInterface
- simIncludeGravBody.loadGravFromFile(fileName: str, spherHarm: SphericalHarmonicsGravityModel, maxDeg: int = 2)[source]
Load the gravitational body spherical harmonics coefficients from a file.
Note that this function calls the gravityEffector function loadGravFromFile().
- Parameters:
fileName (str) – The full path to the specified data file.
spherHarm (gravityEffector.SphericalHarmonicsGravityModel) – The spherical harmonics container of the gravity body.
maxDeg (int, optional) – Maximum degree of spherical harmonics to load. Defaults to 2.
- simIncludeGravBody.loadPolyFromFile(fileName: str, poly: PolyhedralGravityModel)[source]
Load the gravitational body polyhedral coefficients from a file.
- Parameters:
fileName (str) – The full path to the specified data file.
poly (gravityEffector.PolyhedralGravityModel) – The polyhedarl gravity model container of the body.