Table of Contents

Spacecraft: Configuring a Spacecraft

Spawning a Spacecraft

Similar to the Universe, a new function should be created here that will spawn the spacecraft into the level. Once created, spawn the spacecraft actor into the level.

Note

Spawning’ is the process of adding an Unreal ‘actor’ into the level and executing it. This applies to all physical objects, including components and spacecraft. This is an Unreal standard and the actual object that is being spawned can be changed on the blueprint node.

To spawn a new actor, find the Spawn Actor from Class generic node.

Untitled

By default, the spawn actor node will have an empty class. Instead, we will find the spacecraft class to spawn. An empty spacecraft is the Spacecraft class which includes no objects and is the base class for all spacecraft that exist within the simulation. As shown in a previous tutorial, there are several spacecraft that exist in Nominal Editor that have preconfigured components. These spacecraft can be found in the Content/Nominal/Blueprints/Spacecraft directory.

Untitled

To view what the spacecraft class contains, double-click on the asset and open up the viewport. In the components panel, the list of added components is shown. In this tutorial, the BP_Spacecraft_Empty_3U craft will be used. This craft contains a 3U cube-sat chassis and no other components. It is a simple basis for adding more complex components to it and does not contain any base functionality. Back in the level blueprint, find this class in the spawn actor node and select it.

Untitled

Any default variables that are marked as Expose On Spawn will appear here. In this spacecraft’s case, the following variables are exposed:

  • Attitude: This is the default orientation in Modified Rodriguez Parameters (MRPs) of the spacecraft at the start of the simulation. These values should be between -1 and 1 in each of the three axes.
  • Attitude Rate: This is the starting orientation rate per second of the spacecraft. This is measured in radians per second and leaving a value of 0 will result in a spacecraft being stationary in orientation.
  • Show Coordinate Axis: This toggle will display or hide the coordinate axis showing which local direction of the axis is located. This feature is useful for positioning components to the level.

The other parameters (collision, preview and instigator) are default Unreal parameters. These can be left blank and have no affiliation with the spacecraft spawning process. The Spawn Transform is required for components and will be needed in the next tutorial when adding components to the spacecraft. Unreal requires it to be created, so drag out the node and create a transform.

Note

When constructing structs in blueprints, a handy way to expand all of the parameters within the struct is to right-click on the structure pin and hit Split Struct Pin. This is easier and sometimes cleaner than creating a new node for the structure.

Since the spacecraft needs to be referenced multiple times in the level blueprint, it is good practice to store the object as a variable. Custom variables can be created using the outliner, but an easy way to do this is to right-click on the return value and select Promote to Variable. This will create a level-wide global variable that can be accessed throughout the level blueprint. Local variables are only accessible within the function call. Once created, the variable can be named Spacecraft.

Untitled


Setting the Mass

By default, a spacecraft will calculate the mass properties (mass, centre of mass and moment of inertia) based on the sums of the components and transforms attached to the spacecraft. This is useful for large simulations. For smaller simple simulations, often the user would prefer to override the mass properties. By calling the Set Override Properties function, the mass values will override the calculated ones and the totals will not be determined by the components added. An appropriate mass (in kilograms), centre of mass (in meters) and moment of inertia (in \(\mathrm{kg/m^2}\)) can be defined. Use the Make Double3x3 [IDENTITY] to create a diagonal 3x3 matrix for the moment of inertia.

Untitled

Warning

Although setting the override mass can be useful for creating a configuration without adding all required components, for certain components (such as fuel nodes), using the override mass should be avoided. Fuel mass will not be calculated correctly if the override flag is on. In these cases, the remainder mass should be added to the chassis to reach the required amount.


Setting an Orbit

There are several ways to initialize the position and velocity of a spacecraft in orbit. This tutorial will use the classical elements as the orbit. Without initializing, a spacecraft will be located in the centre of the Earth and will not run as expected. Use the Set Classic Elements to configure an orbit with the standard six Keplerian elements. Due to Unreal’s floating point precision, these values are expressed as doubles. To break a double into a float for entry, right-click and select Split Struct Pin. A default orbit can include a semi-major axis (SMA) of at least 6371000 meters (the Earth’s surface radius).

Untitled


Visualizing the Spacecraft

Once the spacecraft spawn function has been called in the Event Graph after the universe is configured, the level can be played. Because the simulation has not been executed or run, the visualization will show the spacecraft but it will not appear to be moving. This is perfectly normal and the simulation running will be shown in a later step of this tutorial.

Untitled