In this section, users will create a deployment and perform the initial integration the LED component into that deployment. This deployment will automatically include the basic command and data handling setup needed to interact with the component. Wiring the Led
component to the GPIO driver component will be covered in a later section after the component implementation has finished.
Users must have created the initial Led component implementation in order to run through this section. Users may continue to define commands, events, telemetry, and ports after this initial integration.
In order to produce an executable to run the software, users need to create a deployment. A deployment is one software executable that contains the main entry point, and an F´ system topology.
Create a new deployment in the led-blinker
directory with:
#In led-blinker
fprime-util new --deployment
This will ask for some input, respond with the following answers:
[INFO] Cookiecutter: using builtin template for new deployment
Deployment name [MyDeployment]: LedBlinker
Select communication driver type:
1 - TcpClient
2 - TcpServer
3 - UART
Choose from 1, 2, 3 [1]: 2
[INFO] Found CMake file at 'led-blinker/project.cmake'
Add component LedBlinker to led-blinker/project.cmake at end of file? (yes/no) [yes]:
Use the default response for any other questions asked.
In order to check that the deployment was created successfully, the user can build the deployment. This will build the code for the current host system, not the remote embedded hardware allowing local testing during development.
This will reuse the build cache created during the project creation.
# In led-blinker
cd LedBlinker
fprime-util build
The component can now be added to the deployment's topology effectively adding this component to the running system. This is done by modifying instances.fpp
and topology.fpp
in the Top
directory.
Add the following to led-blinker/LedBlinker/Top/instances.fpp
. Typically, this is added to the "Active component instances" section of that document.
instance led: Components.Led base id 0x0E00 \
queue size Default.QUEUE_SIZE \
stack size Default.STACK_SIZE \
priority 95
This defines an instance of the Led
component called led
. Since the component is active it needs a queue size, stack size, and priority for the thread of the component and the queue that thread serves. We have chosen the topology specified defaults and a priority of 95.
Next, the topology needs to use the above definition. This is done by adding the following to the list of instances defined in led-blinker/LedBlinker/Top/topology.fpp
.
topology LedBlinker {
...
instance ...
instance led
No port connections need to be added because thus far the component only defines standard ports and those are connected automatically.
The topology may now be run. This can be done with the fprime-gds
command. Since we are currently building for the host platform, that command will run the ground data system (GDS) and the deployment executable automatically in-tandem.
Make sure to build the deployment first with
fprime-util build
fprime-gds --ip-client
This will likely open up your browser and show the running flight software. If it does not open a browser, navigate to http://localhost:5000
.
Test the component integration with the following steps:
- Verify connection: confirm that there is a green circle and not a red X in the upper right corner.
- Send a Command: select the 'Commanding' tab, search for
led.BLINKING_ON_OFF
and send it with the argument set toON
. - Verify Event: select the 'Events' tab and verify that the
SetBlinkingState
event reports the blinking state was set toON
.
CTRL-C
to stop the F´ GDS program.
Congratulations! You have now integrated your component and tested that integration.
Return to the led-blinker/LedBlinker
and run the following commands to test whenever you desire.
#In led-blinker/LedBlinker
fprime-util build
fprime-gds --ip-client
# CTRL-C to exit
This tutorial will return to the component implementation before finishing the integration of the component and testing on hardware.