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 [Message]
properties, where the messages are named either with an In
or an Out
prefix, depending if it owns or references the message object. Most components will have several messages available that can be referenced and used. For example, this 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_SpacecraftStateMsg
is an output message of the type SpacecraftStateMessage
, which includes information about the state of the spacecraft.
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. Create a function called Publish Message
and find the transmitter on the spacecraft.
The key option specifies a custom name of the key to be looked up with the receiver. By leaving the key as the default empty 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.
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 empty, 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.