Skip to content

Commit

Permalink
Add a basic readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Zimri Leisher committed Nov 7, 2024
1 parent 49c7d05 commit 43db402
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions src/fprime_gds/common/sequence/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# FPy Advanced Sequencing Language Version 0.1

Check failure on line 1 in src/fprime_gds/common/sequence/README.md

View workflow job for this annotation

GitHub Actions / Spell checking

`FPy` is not a recognized word. (unrecognized-spelling)
The FPy advanced sequencing language is a combination of a high-level scripting language and a low-level bytecode language for running complex command sequences on spacecraft flight software.

Check failure on line 2 in src/fprime_gds/common/sequence/README.md

View workflow job for this annotation

GitHub Actions / Spell checking

`bytecode` is not a recognized word. (unrecognized-spelling)
## FPy Syntax
### Modules, components, channels, commands and types
You can imagine the FPy syntax as Python with the following mappings:
1. FPrime modules become Python namespaces
2. FPrime components become Python classes
3. FPrime types (structs, arrays and enums) become Python classes
4. FPrime component instances become Python object instances
5. FPrime commands become member functions of Python object instances
6. FPrime telemetry channels become member properties of Python object instances

FPrime declaration:
```
module Ref {
passive component ExampleComponent {
telemetry testChannel: U8
sync command TEST_COMMAND(arg: string size 40)
}
instance exampleInstance: ExampleComponent base id 0x01
}
```
FPy usage:
```py
# reference a telemetry channel
Ref.exampleInstance.testChannel
# call a command
Ref.exampleInstance.TEST_COMMAND("arg value")
```


FPrime declaration:
```
struct ExampleStruct {
member: F32
}
enum TestEnum {
ONE
TWO
THREE
}
array TestArray = [3] U8
```

FPy usage:
```py
# construct a struct
ExampleStruct(0.0)
# reference an enum const
TestEnum.THREE
# construct an array
TestArray(1, 2, 3)
```

### Sequence directives
FPy also has sequence directives, which are like commands that control the running sequence itself.

The most common sequence directives are absolute and relative sleep:
```py
sleep_abs(Time(time_base, time_context, seconds, useconds))
sleep_rel(Time(time_base, time_context, seconds, useconds))
```

Due to the nature of the FPrime `CmdSequencer`, you can only have zero or one `sleep` directives before each command.

## FPy Usage

Check warning on line 69 in src/fprime_gds/common/sequence/README.md

View workflow job for this annotation

GitHub Actions / Spell checking

`FPy` is not a recognized word -- found 8 times. (limited-references)
```
fprime-seq <sequence.fpy> -d <TopologyDictionary.json> [-o <output.bin>]

Check failure on line 71 in src/fprime_gds/common/sequence/README.md

View workflow job for this annotation

GitHub Actions / Spell checking

`fpy` is not a recognized word. (unrecognized-spelling)
A compiler for the FPrime advanced sequencing language
positional arguments:
input The path of the input sequence to compile
options:
-h, --help show this help message and exit
-d DICTIONARY, --dictionary DICTIONARY
The JSON topology dictionary to compile against
-o OUTPUT, --output OUTPUT
The output .bin file path. Defaults to the input file path
```

The result is a sequence binary file that works with the FPrime `CmdSequencer`.

0 comments on commit 43db402

Please sign in to comment.