fprime-python provides an autocoder for automatically binding F Prime C++ code to Python. It is designed to work within the Python interpreter allowing access to standard F Prime components and topologies.
fprime-python-reference (this repository) provides a reference project that builds on top of fprime-python.
The fprime-python-reference repository includes example components that demonstrate how to implement F Prime components in Python. These components are located in the FprimePythonReference/Components directory and include:
- ActiveImager: An
activecomponent that uses Python and OpenCV to capture/downlink camera images - PythonGc: A
queuedcomponent that demonstrates how to telemeter Garbage Collection information - PythonTcpCom: A
passivecomponent that implements a communication interface using TCP sockets
Caution
This reference will use your system's camera.
Note
The fprime-python rate group driver is also used in this reference.
First, clone the project using fprime-bootstrap, which will ensure that requirements.txt is properly installed:
pip install -U fprime-bootstrap
fprime-bootstrap clone https://github.com/fprime-community/fprime-python-reference.gitNext, source the environment created by fprime-bootstrap and build/run as usual:
. fprime-venv/bin/activate
fprime-util generate
fprime-util buildCaution
The build for fprime-python projects will be much slower as it is autocoding more items, as well as running complete model exporting with fpp-to-json.
To run the project, first run the GDS in the root of the project:
. fprime-venv/bin/activate
fprime-gdsNote
This automatically starts the GDS without running the executable.
Next, run Python with the bindings installed:
python3 build-artifacts/python/fsw_main.py