.. _scenarioHelioTransSpice: scenarioHelioTransSpice ======================= Overview -------- The purpose of this simulation is to illustrate how to set a spacecraft's heliocentric translational motion using custom Spice files. This allows the user to easily visualize a mission trajectory using Vizard. The script is found in the folder ``xmera/examples`` and executed by using:: python3 scenarioHelioTransSpice.py Configuring Translational Motion Using Custom Spice Files --------------------------------------------------------- To set up the spacecraft's heliocentric translational motion via custom Spice files, the user should first create a string list containing the desired file names to upload. This script loads a single Spice file:: customSpiceFiles = ["spacecraft_21T01.bsp"] Next, the ``loadSpiceKernel()`` method of class SpiceInterface should be called to load the custom Spice files. This method accepts a file name and the path to the desired file to load:: spiceObject.loadSpiceKernel(file, os.path.join(path, "dataForExamples", "Spice/")) Note that setting up the orbital elements and initial conditions using the ``orbitalMotion`` module is no longer needed. After the Spice files are loaded, the final step is to connect the configured Spice translational output message to the spacecraft object's ``transRefInMsg`` input message:: scObject.transRefInMsg.subscribeTo(spiceObject.transRefStateOutMsgs[0]) Finally, add the Spice object to the simulation task list:: scSim.AddModelToTask(simTaskName, spiceObject) Ensure to unload the Spice kernels at the end of each simulation:: spiceObject.unloadSpiceKernel(file, os.path.join(path, "dataForExamples", "Spice/")) Simulation Visualization In Vizard ---------------------------------- The following image illustrates the expected visualization of this simulation script. .. image:: /_images/static/scenarioHelioTransSpice.jpg :align: center