Flightkit to MCS How-To Guide
This guide will show you how to connect a Flightkit deployment to MCS. First, make sure you have the the correct versions of both Flightkit and MCS.
|
Connecting to MCS requires Flightkit version 2025.3.0 or newer. Flightkit compatibility was introduced in version 22.4.8 of MCS. |
Create a workspace in which to write your flight software.
hfk workspace create MyWorkspace
MCS uses PUS to connect to flight software, so your Flightkit deployment needs to be PUS compatible:
-
It must use a PUS-based comms stack, as described in the Communication Protocols Reference.
-
Instances of the
core.component.pas.PASTargetcomponent type used to receive requests from MCS must set.b_OmitTimeFields = truein their initialisation data.
Flightkit provides PUSCommsDemo deployment types out-of-the-box for you in the FlightkitFoundation bundle. These are instantiated in the LinuxDemo and KrytenDemo missions, and are configured as described above. For demonstration and testing, you can use whichever mission is appropriate to your development environment.
For information about bundles and how to include them within a workspace, refer to the Getting Started guide.
Connecting the PUSCommsDemo deployment to MCS follows a similar process to how you would normally connect to Helix Lab, with just a few differences.
1. Generating a Legacy Spacecraft Database
The MCS uses a legacy Spacecraft Database (SCDB) to interpret the flight software model. This database can be generated while building a mission by using the --legacy-scdbs argument.
Run the following command inside the workspace to build the mission and generate the legacy SCDB.
hfk mission build LinuxDemo --legacy-scdbs
Note that the --legacy-scdbs argument works for both build and generate when working with missions.
This will produce a legacy SCDB in the following directory in the workspace. Replace "X.Y.Z" with the version of FlightkitFoundation you are using.
output/bundles/FlightkitFoundation/X.Y.Z/missions/LinuxDemo/PUSCommsDemo/Default
2. Connecting to MCS
In separate terminals, open MCS Server and Display by running the following commands in the MCS_Server and MCS_Display directories respectively:
. runMCS_Server.sh
. runMCS_Display.sh
Open up the Mission Management window at File > Manage mission… and then add in a new asset and target. We recommend you give them the same names as in your Flightkit mission. If you are testing with PUSCommsDemo, the asset is called LinuxAsset and the target is called PUSCommsDemo.
Add a deployment to the target you just created, filling in the following fields:
-
Deployment id - Give this the same name as your deployment instance, e.g.
Default. -
Definition file - Select the legacy SCDB you created as the definition file.
The rest of the fields can be left blank. Then load and import the mission.
Each deployment has a unique deployment ID (different to the ID we were asked for just then) which the MCS uses when routing packets. We need to specify this in the protocol settings.
Run the following command in the mission’s workspace to return the deployment ID.
grep -rnI DEPLOY_DEPLOYMENT_ID generated
Note - this command will return the deployment ID for each deployment that has ever been generated in the workspace. We just need the relevant deployment ID, e.g. for LinuxDemo/PUSCommsDemo/Default or KrytenDemo/PUSCommsDemo/Default.
Go to File > Protocol properties… to open the Update protocol properties window and scroll down to Flightkit deployment ID in the General tab. Enter the deployment ID you just found in here.
A workaround for older versions of MCS can be achieved by disabling deployment ID checks, although this is not recommended as it can cause problems when working with multiple deployments. To do this, go to the Monitor tab in the tool bar and uncheck Enable deployment ID checks.
You’re now ready to run your flight software deployment as usual, by executing the binary file.
./output/bundles/FlightkitFoundation/4.0.0/missions/LinuxDemo/PUSCommsDemo/Default/Default
Add in a new TCP Client Connection in the Connections tab in the left-hand menu. Give it a name, then set it to the appropriate Address and Port number specified by the initialisation data of your deployment instance’s TCP server; for PUSCommsDemo these are 127.0.0.1 and 51423 respectively. Ensure that Framing is set to Packet stream.
You can now click Connect… to access the deployment.
A good check to make sure it has worked is to invoke the dumpVersion Action in the Version component instance – if you see an output in the terminal, it’s worked!