Skip to content

Commit

Permalink
ogma-cli: Update README to document cFS application template customiz…
Browse files Browse the repository at this point in the history
…ation. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

Prior commits have expanded the command to allow for customization of
the template using a user-provided directory and expanding variables
in the template using mustache.

This commit documents the new feature in the README.

[ci skip]
  • Loading branch information
ivanperez-keera committed Nov 12, 2024
1 parent 554d56f commit d3a950d
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion ogma-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ flags to customize the list of known variables, so that projects can maintain
their own variable databases beyond what Ogma includes by default.

cFS applications are generated using the Ogma command `cfs`, which receives
three main arguments:
four main arguments:
- `--app-target-dir DIR`: location where the cFS application files must be
stored.
- `--app-template-dir DIR`: location of the cFS application template to use.
- `--variable-file FILENAME`: a file containing a list of variables that must
be made available to the monitor.
- `--variable-db FILENAME`: a file containing a database of known variables,
Expand Down Expand Up @@ -187,6 +188,45 @@ void COPILOT_ProcessIcarousPosition(void)
}
```
### Template Customization
By default, Ogma uses a pre-defined template to generate the cFS monitoring
application. It's possible to customize the output by providing a directory
with a set of files with a cFS application template, which Ogma will use
instead.
To choose this feature, one must call Ogma's `cfs` command with the argument
`--app-template-dir DIR`, where `DIR` is the path to a directory containing a
cFS application template. For example, assuming that the directory
`my_template` contains a custom cFS application template, one can execute:
```
$ ogma cfs --app-template-dir my_template/ --variable-db examples/cfs-variable-db --variable-file examples/cfs-variables
```
Ogma will copy the files in that directory to the target path, filling in
several holes with specific information:
- `{{variablesS}}`: this will be replaced by a list of variable declarations,
one for each global variable that holds information read from the cFS
software bus that must be made accessible to the monitoring code.
- `{{msgSubscriptionsS}}`: this will be replaced by a list of calls to
`CFE_SB_Subscribe`, subscribing to the necessary information coming in the
software bus.
- `{{msgCasesS}}`: this will be replaced by a switch case statements that match
the ID of an incoming message, to handle information being received that must
be updated and would trigger a re-evaluation of the monitors.
- `{{msgHandlerS}}`: this will be replaced by function definitions of the
functions that will be called to actually update the variables with
information coming from the software bus, and re-evaluate the monitors.
We understand that this level of customization may be insufficient for your
application. If that is the case, feel free to reach out to our team to discuss
how we could make the template expansion system more versatile.
## ROS Application Generation
The Robot Operating System (ROS) is a framework to build robot applications.
Expand Down

0 comments on commit d3a950d

Please sign in to comment.