Advanced Sequencer Design Discussion #2848
Replies: 22 comments 58 replies
-
Notes from meeting:
Two types of cmds in a sequence
Other notes
Overall thoughts: |
Beta Was this translation helpful? Give feedback.
-
I am not quite sure how to engage with this, because it feels like there is a lot of contextual information that is missing from the discussion post. That is ok, as the option is here, I will list some comments and if they are already covered in a reformulation of some sort, great!
|
Beta Was this translation helpful? Give feedback.
-
@zimri-leisher @SterlingPeet I added context and basic tiers for this effort. |
Beta Was this translation helpful? Give feedback.
-
I think SVC-ADVSEQ-024 should say global index instead of local index |
Beta Was this translation helpful? Give feedback.
-
We have explicit support for a rudimentary form of arguments for sequences (parametrized sequences). I think we should also have explicit support for a rudimentary form of return values, so people can approximate function calling. Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
Another interesting reference:
The James Webb team uses an isolated and embedded javascript runtime to command the vehicle by building and sending CCSDS space packets to the flight software |
Beta Was this translation helpful? Give feedback.
-
Notes from meeting 9/17/24: Pre existing versus rolling our own:
Working groups
|
Beta Was this translation helpful? Give feedback.
-
Would this have any cross over with the mbse discussion from a while back ? This might be putting the cart before the horse but I'm curious if there's been cohesive thought behind how these two components might compliment each other and if there's any coordination between the two efforts. |
Beta Was this translation helpful? Give feedback.
-
I think it's interesting to look at this from the other direction: what are the constraints and limitations we want to impose? If sheer functionality is what you want consider this thought experiment. What is "sequences" were just compiled runtime loadable libraries that are built against flight software. You make things you want to access globally accessible so they're accessible by the "sequence library". You can do this by removing the anonymous namespace on the global component instances and make those symbols available via a header with To me this represents the unbounded solution: maximum functionality with high software fidelity and interop with FSW. If that doesn't sound right then there's some unspoken constraint or limitation we want to impose. Capturing those will help identify a solution. That said I think this kind of capability is great to have anyhow. Maybe you could do the same but use something like Cython to write it in a Python-like language (actually this is kind of non-starter because if you use Python objects you'll end up needing the Python C API). |
Beta Was this translation helpful? Give feedback.
-
If we don't want to use a real Python interpreter due to memory allocation concerns, what if instead we just used the abstract syntax tree of Python and compiled that into our own bytecode format? Python exposes the syntax tree quite nicely. This would give us the benefit of familiar and easy Python syntax, as well as avoiding having to write our own lexer and AST generator. |
Beta Was this translation helpful? Give feedback.
-
Meeting notes 9/23/24 On Micropython:
On using Python syntax:
Draft release plans:
Diving in deeper on callign cmds:
|
Beta Was this translation helpful? Give feedback.
-
Release plan table:
|
Beta Was this translation helpful? Give feedback.
-
Another possibility is to not introduce a first-class advanced sequencing language and instead introduce the abstractions that make integrating one very easy. By avoiding a new first-class sequencing language, we can reduce the complexity in F' and allow integrators to select the best-fit language, minimizing overhead for projects with specific needs. If there was some abstraction for a function/command map and state/variable map that gets us most of the way there. The function/command map would be a mapping from symbol, like component name and mnemonic, to function pointer (and maybe signature?). The state/variable map would be the variables the script can perform logic on. Other hooks like program-wide init and deinit, script loading, script run, script cleanup, etc. can be handled through a component written to integrate a scripting language. Ideally the abstractions would be concrete code objects that can be iterated, but some scripting engines might require integration that isn't easily done on a concrete code object. Instead you can provide an autocode step that makes these constructs (commands, function addresses, state/variable types and addresses, etc.) available to a template engine that the integrator could inject to provide the integration needed. A default template could be provided that produces concrete code objects so languages that can be integrated that way could just use that. Regarding the state/variable map, it seems the current concept is to use telemetry channels as the state/variables that the script/sequence can perform logic on. I think it's worth considering introducing a state/variables concept as a first-class concept in F Prime and using that concept as a building block for telemetry and parameters. Having this advanced sequencing capability (via custom design or third-party scripting engine) will require centralization of at least references to the states/variables anyhow. Making it a first-class concept creates a natural integration point and can streamline telemetry/parameters. You can also provide notification hooks for change detection. Such hooks could be used to implement a telemetry system on top of the state store. Similarly parameters could be reconceptualized as states that are populated on start up and loaded to components. Having this state centralized like this would also make integrating a scripting language or advanced sequencer easier. If you also introduce an abstraction for the state store you can add additional implementations beyond the "contiguous region of memory" one like one that stores it in three memory regions and does voting, one backed by external ECC memory, one enhanced with transaction history, etc. Ultimately, F' wouldn’t need to develop an advanced custom scripting language. Instead, it could offer a flexible integration layer, letting the integrator select the appropriate scripting language (custom or third-party) for their platform and deployment context. Regarding third-party options, an interesting one is using WASM. There are WASM run-times that target embedded applications (like wasm3). Sandboxing is also part of WASM's overall design allowing you to limit the memory and capabilities available to a WASM program. The WASM programs can be compiled from any toolchain that can compile to WASM (like C/C++ using Emscripten). |
Beta Was this translation helpful? Give feedback.
-
Meeting 9/30:
|
Beta Was this translation helpful? Give feedback.
-
Meeting notes 10/7:
On wasm:
|
Beta Was this translation helpful? Give feedback.
-
Notes 10/14:
|
Beta Was this translation helpful? Give feedback.
-
Extra meeting on bytecode format (draft):
Files look like:
Schema version 1 will not have time spec or value because delays will be separate commands. Other requirements:
|
Beta Was this translation helpful? Give feedback.
-
To help flight systems with constrained uplink rates, we should have the ability to compress the contents of the sequence. Not the header, which can contain "is compressed" bits, but the commands. |
Beta Was this translation helpful? Give feedback.
-
Hopefully this doesn't detract from the conversation here but I'm curious if anyone here as opinions about elua as an option for this kind of dsl? I've been working on a project of a similar nature to this, investigating different languages to specify operational behavior. After some evaluation I've found that lua appears to be the top contender for our purposes. It seems like the folks on this thread might have some valuable insight/opinions and also if it's not too far down the line it may be worth considering. |
Beta Was this translation helpful? Give feedback.
-
Hey, as part of the sequence compiler I would like access to the Python representation of the FPP model. What is the best entry point for getting, for instance, a list of the Or alternatively, do you think the advanced sequence compiler should only depend on the dictionary json? The problem is, the dictionary json doesn't include some key information that must exist in the Autocoder that I would have to manually reconstruct if I can't just use the Autocoder source itself. Maybe we could just include this info in future versions of the dictionary json ("module" declarations, some other small things but the list will grow). |
Beta Was this translation helpful? Give feedback.
-
For next meeting:
|
Beta Was this translation helpful? Give feedback.
-
Basic demo of the Python syntax is working in my branch, https://github.com/zimri-leisher/fprime-gds/tree/2919-adv-seq-compiler Example sequence file (using the Ref deployment):
Example of the new command to compile it:
Currently it doesn't actually produce the binary output. I estimate making the binary will take me another day or two of work. However, it includes
This is pretty exciting, we could easily start using this as a replacement for the .seq file format soon. |
Beta Was this translation helpful? Give feedback.
-
This call for comments discussed the implementation of a new "advanced" sequencer that would be another sequencing option alongside the simple legacy sequencer.
Description
The primary goal of an advanced sequencer is to supply new features to the sequencing set that fall outside of the legacy sequencer's capabilities. The sequencer is a component designed to execute a command Sequence.
Sequences are composed by a set of Statements where each statement is executed in order. Statements are either Commands used to dispatch a component command or Directives used to influence the sequencer itself.
The sequencer also has access to variables used to execute a sequence.
Variables
This advanced sequencer will have concept of three types of variable. These variables will be implemented as the type
Fw.PolyType
that stores both the type and value.Local Variables (
LVAR
s)There will be a fixed number of local variables. These variables are owned by a given command sequencer and may only be set by the owner. All operations (compare, arithmetic, etc) are performed on these local variables. Other variables must be pulled into a local variable before being operated on.
Local variables act like a register file.
The first N local variables are reserved for special value storage.
Success
,Failure
, orError
for the previously executed statementGlobal Variables (
GVAR
s)Global variables are stored in an external global variable store. These variables are designed for use between a set of command sequencers. Global variables must be loaded into a local variable before use.
System Variables (
SVAR
s)System variables are stored in an external variable store. These variables are designed to be set by a system's components. System variables use a designated project-configurable enumeration to represent them. System variables must be loaded into local variables before use.
Requirements
These requirements are broken into several sections:
WAIT
WAIT_UNTIL
ABORT_ON_FAILURE <true|false>
ABORT <status>
LABEL <label>
GOTO <label>
LVAR_SET_<I8,I16...,U8,U16...,F32,F64,BOOL>, <local index>, <literal value>
EQUAL, <local output index>, <local index>, <local index>
GREATER, <local output index>, <local index>, <local index>
LESS, <local output index>, <local index>, <local index>
CAST, <local output index>, <local index>, <new type>
ADD, <local output index>, <local index>, <local index>
MUL, <local output index>, <local index>, <local index>
AND, <local output index>, <local index>, <local index>
OR, <local output index>, <local index>, <local index>
IF <local index>
ELSE IF <local index>
ELSE
END_IF
SVAR_LOAD, <local index>, <svar enum>
GVAR_SET_<I8,I16...,U8,U16...,F32,F64,BOOL>, <local index>, <literal value>
GVAR_SAVE, <local index>, <global index>
GVAR_LOAD, <local index>, <global index>
SUB, <local output index>, <local index>, <local index>
GREATER_EQUAL, <local output index>, <local index>, <local index>
LESS_EQUAL, <local output index>, <local index>, <local index>
EQUAL_FP <local output index>, <local index>, <local index>, <epsilon>
DIV, <local output index>, <local index>, <local index>
NOR, <local output index>, <local index>, <local index>
XOR, <local output index>, <local index>, <local index>
Consider named arguments (alias) to local variable.
Beta Was this translation helpful? Give feedback.
All reactions