Ground Station Network Interface - FL-1 Controls & DAQ
The controls system needs the ability to be commanded by the ground software, in order to do this they need to agree on a protocol. The controls system is expected to communicate over a standard IPv4 network using the following protocol built on UDP. The device (or devices) sending commands to the controls system will be referred to as a collective "ground system."
UDP
Commands will be sent from the ground system encapsulated in UDP frames. The destination port must be agreed upon in advance and the source port is up to the ground system to decide and does not matter. The optional checksum does not need to be checked or calculated.
Header
Commands encapsulated in UDP packets will all share a common header:
Sequence Number:
Each command will have a unique sequence number sent with it. This is so the controls system can track if it received a duplicate command (in which case it should ignore it) and as a way for the controls system to acknowledge a command when it's been received. Sequence numbers are 4 bytes (32 bits) in little endian order.
Control:
This is a value that represents which control to command. "Controls" can be as simple as "0xa1 represents solenoid 1" to "0xa1 represents engine shutdown." The controls system and ground system must agree on which values represent which controls ahead of time. Control values are 2 bytes (16 bits) in little endian order.
State:
This is the state to command the control too. Similar to the Control field, these values must be agreed upon in advance by the ground and control systems. It can be as simple as "0x01 represents an igniter state of ON" to "0x01 means to safe the engine." State values are 2 bytes (16 bits) in little endian order.
A note about endianness: most protocols use big endian ordering for network order, the reason little endian is used here is because the ground system and controls system are both likely to be little endian systems. Both x86 and ARM are little endian platforms so sending data in little endian order removes the need to rearrange data on both sides.
Acknowledgement
The ground system needs a way to know whether the command it sent was received and executed, to accomplish this a "last command acknowledged" measurement should be added to the normal telemetry stream of the controller which contains the 4 byte sequence number of the last received command. All devices sending data to the ground system can specify a telemetry format, some measurements the controller may want to send are:
Last Command Acknowledged (4 bytes)
Solenoid X State (1 byte)
Linear Actuator X Position (1 byte)
Igniter State (1 byte)
These measurements can be sent in any combination as UDP payloads to the ground system as long as destination port numbers corresponding to each order are specified in advance.
As soon as the controller receives a command it should send out a telemetry packet with the "last command acknowledged" field updated with the sequence number it just received, the ground system will look for the command to be acknowledged and may resend the command if it sees no acknowledgement in a given amount of time.