Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add documentation for F' subtopologies #2743

Open
wants to merge 10 commits into
base: devel
Choose a base branch
from

Conversation

mosa11aei
Copy link
Contributor

Related Issue(s) n/a
Has Unit Tests (y/n) n/a
Documentation Included (y/n) y

Change Description

F' subtopologies are a very powerful tool to allow for breaking out one large topology into smaller, more manageable and reusable ones. This PR provides documentation on this tool.

@mosa11aei mosa11aei marked this pull request as ready for review May 24, 2024 18:08
Copy link
Collaborator

@thomas-bc thomas-bc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This document should likely be linked in the documentation's navigation/indexes:

Also subtopology and subtopologies should be added to spellcheck: https://github.com/nasa/fprime/blob/devel/.github/actions/spelling/expect.txt

@mosa11aei mosa11aei requested a review from thomas-bc May 28, 2024 17:56
Copy link
Collaborator

@thomas-bc thomas-bc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the fprime-util new feature (nasa/fprime-tools#203) be documented in this guide?

docs/HowTo/develop-subtopologies.md Outdated Show resolved Hide resolved
@mosa11aei
Copy link
Contributor Author

Should the fprime-util new feature (nasa/fprime-tools#203) be documented in this guide?

Up to you. Will that be pushed before the docs?

@mosa11aei
Copy link
Contributor Author

Finally we pass spell check 😁

@mosa11aei mosa11aei requested a review from thomas-bc June 3, 2024 20:20
mosa11aei

This comment was marked as off-topic.

Copy link
Collaborator

@thomas-bc thomas-bc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mosa11aei this is awesome! I was very much of a noob when it comes to subtopology, and I now feel much more educated!

As a novice, I had a lot of comments/questions. Please just take them as suggestions, this is in no way critical. This is an amazing guide, very clear, the example is really descriptive of the kind of capability subtopologies offers.

Woohoo 🎉


## Subtopology Structure

A subtopology is a folder that contains a `topology.cpp` file, which includes the behavior for setting up your custom topology. It additionally contains a `topology.fpp` file, which is a *unified* topology file. As opposed to having separate files for component instances and the topology itself, the single file encapsulates both. A `topologydefs.hpp` defines a struct that is used when instantiating your subtopology. A `CMakeLists.txt` file links your `topology.cpp` file to the build for your project.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

topology.cpp etc. could be a little confusing to a new reader as it refers to something named differently. I usually interpret code blocks as literals, idk if that makes sense.

Could consider refactoring into italics: Topology C++, Topology FPP, Topology Defs HPP (or Header). I think this matches the style I've seen in the documentation we have for FPP

2. [Individual File Contents](#individual-file-contents) (this is a long section with multiple subsections!)
3. [Integration into a "Main" Deployment](#integration-into-a-main-deployment)
4. [Conclusion](#conclusion)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be good to add a small section about motivation/use case? It is addressed briefly above but I'm thinking a diagram if you have one, or just a few sentence, would clarify a lot.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming back to this, maybe pull up the

### Example Scenario

section up here? And include a quick diagram?

Just an idea, I'm not sure it's a good one. For consideration

All files will be discussed in more detail in later sections of this guide. Additionally, note that there are optional files that can be included in your subtopology to extend its capability.

- It is highly recommended to include a `docs` folder to document your subtopology. Simple markdown files work well in this case.
- `.fppi` files can be included as config files to your subtopology. They can include useful constants or structures that allow users to modify your subtopology.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we document what .fppi is or stands for in our docs. Could be good to clarify that i is just a naming convention for include, or simply say additional .fpp can be included or whatnot

stack size DEFAULTS.STACK_SIZE \
priority 150

instance rateGroupDriver: Svc.RateGroupDriver base id 0xFF8FF // to drive the 1Hz rate group
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since rateGroupDriver is not going to be in the subtopology but rather hooked from the Main topology, would it be good to remove it from the instance list here? And rather add a note right below to emphasize that this is a feature of subtopologies, leverage components from outside that the user will wire up to their subtopology.

} // end MySubtopology
```

## MySubtopologyTopology.cpp and MySubtopologyTopology.hpp (pt1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it read better to name the section

## Subtopology CPP and HPP

or something similar? Might be just a personal preference, let me know

...
```

Head over to `MainDeplomentTopologyDefs.hpp`. We want to not only include our subtopology's definitions header, but also modify `PingEntires` to use `GlobalDefs::PingEntires`. At the end of `namespace MainDeployment`, include:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in GlobalDefs::PingEntires Entries

namespace PingEntries = GlobalDefs::PingEntries;
```

Then modify the current `PingEntires` namespace call to be surrounded by GlobalDefs:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: PingEntires

...
```

Then, we want to tell our MainDeployment's topology to import and use our unified topology file from our subtopology. While we're here, we should also hook up the `CycleOut` port of our main deployment's rate group driver to the `CycleIn` port of our subtopology's rate group. Ensure that the rate group driver can have enough output wires going from the output port. We head over to the `topology.fpp` file, and include:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enough output wires going from the output port

size of the output port array ?


...
// MODIFY this line to include the 4th divider
// Svc::RateGroupDriver::DividerSet rateGroupDivisorsSet{{{1, 0}, {2, 0}, {4, 0}, {1, 0}}};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uncomment this line ?


This how-to guide has walked through the development of a subtopology. Deployments can include multiple different subtopologies, and thus this feature truly paves the way for making F Prime more accessible to quick prototyping.

If you'd like to see an example of how subtopologies are used within an actual project, please reference this repository: [RNG Library - An Example of Subtopologies within F'](https://github.com/mosa11aei/fprime-rngLibrary). This project uses the [example scenario](#example-scenario) from this guide.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would advertise this reference project at the very top of the guide so users can follow along with it? Seems very helpful
Also do we want to migrate this repo to e.g. fprime-community/fprime-subtopology-reference or something like this? This is awesome!

@thomas-bc thomas-bc linked an issue Jun 4, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation: Add Sub-Topology Guide
2 participants