Data Downlink: Transmitting Messages
Getting Messages
Most components in Nominal’s simulation system contain output messages. For components that have output messages, these messages can be accessed using the Get Out Messages
function. Most components will have some form of function under this name and it will show a list of messages that may exist on the component or spacecraft. For example, this function on the spacecraft contains several exposed output messages that can be read from the simulation.
Each message will be a different type and the name of the message is often indicative of what the type of message is. For example, Out_BodyStatesMsg
is an output message of the type BodyStatesMessage, which includes information about the state of the spacecraft. Most components have an out message function and may contain one to many different messages.
Since these functions are blueprint pure, they will only be executed when one of the output pins is used by an execution node or function.
Transmitting a Message
The transmitter has a Transmit Message
function. This function adds a particular message to the outbound queue. When there is a valid connection to a receiver (which in this case will be on the ground station), a copy of the message data at the simulation time it was added to the queue will be transmitted over the network. The time it takes for the message to be transmitted is dependent on the distance between the antennae and the baud rate of the transmitter. A slower baud rate will lead to a longer time to process the message before it is sent.
The key option specifies a custom name of the key to be looked up with the receiver. By leaving the key as the default ‘None’ option, the key will be overridden using the name of the message type that is defined in the simulation. For this tutorial, leaving the key as the default will be sufficient. The seconds’ parameter is useful for tracking data as an output file by providing a timestamp at which the data was recorded. This can be left blank for now as well.
Note
The key parameter of the transmit message function must match the same parameter in the receive message function on the receiver. If both are marked as ‘None’, then the type of message inputted will be the type that is looked up from the queue.
For this simulation, the coarse sun sensor and the gyroscope messages will be transmitted from the spacecraft. This can be done by fetching the sensors from the spacecraft and getting the output message from the components. Multiple messages can be transmitted to each frame and this will add them to the transmitting queue, ready to be sent to the receiver when in access.
This function should be executed every frame and should be called after the Tick Simulation
function on the Tick event on the event graph. In each Unreal frame, the transmitter will attempt to publish information about the sun sensor and the gyroscope.