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

Add sourcing the virtual environment to the right spot #1993

Merged
merged 6 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions docs/Tutorials/HelloWorld/Deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ ground control and data collection of the deployment.

To create a deployment, run the following commands:
```bash
cd MyProject
# In: MyProject
fprime-util new --deployment
```
This command will ask for some input. Respond with the following answers:

```
deployment_name [MyDeployment]: MyDeployment
path_to_fprime [./fprime]:
author_name []: LeStarch
```

> For any other questions, select the default response.
Expand All @@ -50,6 +49,13 @@ to `MyDeployment/CMakeLists.txt`.
include("${FPRIME_PROJECT_ROOT}/project.cmake")
...
```
> To build this new deployment generate a build cache and then build.
> ```bash
> # In: MyProject/MyDeployment
> fprime-util generate
> fprime-util build
> ```
> > Notice `fprime-util generate` was used again. This is because this new deployment builds in a separate environment.

In this section the `HelloWorld` component will be added to the `MyDeployment` deployment. This can be done by adding
the component to the topology defined in `MyDeployment/Top`.
Expand All @@ -62,12 +68,13 @@ specific configuration.
In order to add a component to the topology, it must be added to the topology model. An instance definition and an
instance initializer must both be added.

To add an instance definition, add `instance helloWorld` to the instance definition list in the `topology Ref` section
To add an instance definition, add `instance helloWorld` to the instance definition list in the `topology MyDeployment` section
of `MyDeployment/Top/topology.fpp`. This is shown below.

Edit `MyDeployment/Top/topology.fpp`:
```
...
topology Ref {
topology MyDeployment {
# ----------------------------------------------------------------------
# Instances used in the topology
# ----------------------------------------------------------------------
Expand All @@ -85,6 +92,7 @@ Next, an instance initializer must be added to topology instances defined in `My
Since the `HelloWorld` component is an `active` component it should be added to the active components section and should
define a priority and queue depth options. This is shown below.

Add to `MyDeploymment/Top/instances.fpp`:
```
...
# ----------------------------------------------------------------------
Expand Down Expand Up @@ -112,6 +120,7 @@ Finally, our new telemetry channel should be added to our telemetry packet speci
channel can be ignored as the deployment will not use the telemetry packetizer. Add the following to the `ignore`
section of `MyDeployment/Top/MyDeploymentPackets.xml`.

Update `MyDeployment/Top/MyDeploymentPackets.xml`:
```
<ignore>
...
Expand All @@ -123,15 +132,12 @@ Since this component has no custom ports nor does it require special configurati
completed. The deployment can now be set up and built using the following commands:

```
cd MyDeployment
fprime-util generate
# In: MyProject/MyDeployment
fprime-util build -j4
```
Resolve any errors that occur before continuing to the testing section.
> Resolve any errors that occur before continuing to the running section.

> Notice `fprime-util generate` was used again. This is because this new deployment builds in a separate environment.

## Testing With `fprime-gds`
## Running With `fprime-gds`

It is now time to test the `HelloWorld` component by running the deployment created in this section. This can be
accomplished by running the `fprime-gds` command in the deployment, verifying connection, sending the new SEND_HELLO
Expand Down
33 changes: 21 additions & 12 deletions docs/Tutorials/HelloWorld/HelloWorld.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,22 @@ The next step is to create the new component. First, create a directory called `
components and change into that directory.

```bash
mkdir MyComponents
# In: MyProject
mkdir -p MyComponents
cd MyComponents
```

Creating a new component is accomplished with the following command:

```bash
# In: MyProject/MyComponents
fprime-util new --component
```
This command will ask for some input. You should respond with the following answers:

```
[INFO] Cookiecutter source: using builtin
component_name [MyComponent]: HelloWorld
component_name [MyComponent]: HelloWorld
component_short_description [Example Component for F Prime FSW framework.]: Hello World Tutorial Component
component_namespace [HelloWorld]: MyComponents
Select component_kind:
Expand All @@ -72,20 +74,21 @@ Choose from 1, 2 [1]: 1
Select enable_parameters:
1 - yes
2 - no
Choose from 1, 2 [1]: 2
Choose from 1, 2 [1]: 1
[INFO] Found CMake file at 'MyProject/project.cmake'
Add component MyComponents/HelloWorld to MyProject/project.cmake at end of file (yes/no)? yes
Generate implementation files (yes/no)? no
Generate implementation files (yes/no)? yes
```

> For any other questions, select the default response.

This will create a new component called "HelloWorld" in the "MyProject" namespace. This new component will be able to
define commands, events, and telemetry channels.
define commands, events, telemetry channels, and parameters.

We should navigate to the component's directory and look around:

```bash
# In: MyProject/MyComponents
cd HelloWorld
ls
```
Expand All @@ -104,21 +107,23 @@ To build this component run `fprime-util build` in the current folder.
A component model defines the interface of the component with the rest of the F´ system and with the ground system F´
communicates with. In this case we intend to define a command, an event, and a telemetry channel as specified above.

Open the model file `HelloWorld.fpp` and add replace the line
Open the model file `HelloWorld.fpp` and add replace the line:

`async command TODO opcode 0`
```
async command TODO opcode 0
```

with the following:

```
@ Command to issue greeting with maximum length of 20 characters
async command SAY_HELLO(
greeting: string size 20 @ Greeting to repeat in the Hello event
greeting: string size 20 @< Greeting to repeat in the Hello event
LeStarch marked this conversation as resolved.
Show resolved Hide resolved
)

@ Greeting event with maximum greeting length of 20 characters
event Hello(
greeting: string size 20 @ Greeting supplied from the SAY_HELLO command
greeting: string size 20 @< Greeting supplied from the SAY_HELLO command
) severity activity high format "I say: {}"

@ A count of the number of greetings issued
Expand All @@ -130,6 +135,7 @@ telemetry GreetingCount: U32
With this step completed you can generate a basic implementation with the following command:

```bash
# In: MyProject/MyComponents/HelloWorld
fprime-util impl
```

Expand Down Expand Up @@ -171,12 +177,15 @@ void HelloWorld:: SAY_HELLO_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw
> private:
> U32 m_greetingCount;
> ```
> Should be added inside the `class` definition in `HelloWorld.hpp`.
>
> **HelloWorld.cpp: Updating Constructor**
> ```c++
> HelloWorld:: HelloWorld() :
> m_greetingCount(0),
> HelloWorldComponentBase(compName) {
> HelloWorld:: HelloWorld(const char *const compName) : HelloWorldComponentBase(compName),
> m_greetingCount(0)
> {
> ```
> Should be added to the `HelloWorld` constructor at the top of the file.

The component should build without errors by running `fprime-util build`. Resolve any errors that occur before
proceeding to the next section.
Expand Down
13 changes: 10 additions & 3 deletions docs/Tutorials/HelloWorld/NewProject.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,16 @@ Choose from 1, 2 [1]: 1
Use the default for anything not specified. This command will take a moment to run.

The above command creates a new F´ project structure in a folder called `MyProject`, use the `devel` branch of F´ as
the basis for the project, and set up the matching tools in a new Virtual Environment.

> Experienced F´ users may note that we have not yet created a deployment, but rather just the base project structure.
the basis for the project, and sets up the matching tools in a new Virtual Environment.

> Load the tools for this project via the virtual environment.
>
> ```bash
> cd MyProject
> . venv/bin/activate
>```
>
> Make sure to load these tools any time you are working with the this project.

## Building the New F´ Project

Expand Down