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-2691: Add Create a Sensor Module how-to #3259

Merged
merged 20 commits into from
Aug 20, 2024

Conversation

JessamyT
Copy link
Collaborator

@JessamyT JessamyT commented Aug 16, 2024

@viambot viambot added the safe to build This pull request is marked safe to build from a trusted zone label Aug 16, 2024
@JessamyT JessamyT changed the title 2691sensormodule DOCS-2691: Add Create a Sensor Module how-to Aug 16, 2024

{{< /expand >}}

Run your test script from your command line and make sure you are able to get readings from the sensor before proceeding.
Copy link
Contributor

@sguequierre sguequierre Aug 16, 2024

Choose a reason for hiding this comment

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

Suggested change
Run your test script from your command line and make sure you are able to get readings from the sensor before proceeding.
Run your test script from your command line interface and make sure you are able to get readings from the sensor before proceeding.

I think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe a "CLI" is something you interface with from within the terminal, such as the Viam CLI. I will change this to "terminal window" or "terminal" because that seems to be more general, whereas "command prompt" is more Windows-based.


## Generate boilerplate module code

You need some boilerplate files to make your module.
Copy link
Contributor

Choose a reason for hiding this comment

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

this might be hard to understand without knowing what boilerplate means, maybe simple explanation of term?

1. When prompted for a model triplet, use `<your organization public namespace>:<repo name>:<what you want to call your sensor model>`.
For example, `jessamy:weather:meteo_PM`.

- You can find your organization namespace by going to your organization settings in the [Viam app](https://app.viam.com).
Copy link
Contributor

Choose a reason for hiding this comment

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

might need more explanation, idk what to do in organization settings. Or is that next bullet point?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought about this, but since nowadays we're erring on the side of less verbosity, if someone can figure out how to write a module I trust them to find this with a gesture in the right direction. I think clicking the name of their org, and then clicking "settings", is intuitive enough if they know they're looking for organization settings.

{{< expand "Example sensor module README" >}}

````md
# meteo_PM modular component
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# meteo_PM modular component
# `meteo_PM` modular component


To use this module, follow these instructions to [add a module from the Viam Registry](https://docs.viam.com/registry/configure/#add-a-modular-resource-from-the-viam-registry) and select the `rdk:sensor:jessamy:weather:meteo_PM` model from the [`jessamy:weather:meteo_PM` module](https://app.viam.com/module/rdk/jessamy:weather:_PM).

## Configure your meteo_PM sensor
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Configure your meteo_PM sensor
## Configure your `meteo_PM` sensor

@npentrel
Copy link
Collaborator

I don't have the time to go through this in detail today unfortunately.
From a brief review:

  • I love the test script start and the examples you have there.
  • do you think you could change the formatting to be similar to https://docs-test.viam.dev/3259/use-cases/collect-sensor-data/ ? I think this is now short enough that that could work, and I do think it's important we try to keep these consistent in styling...

For example, `jessamy:weather:meteo_PM`.

- You can find your organization namespace by going to your organization settings in the [Viam app](https://app.viam.com).
- The repo name (family name) is the name of the GitHub repo where you will put your module code.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- The repo name (family name) is the name of the GitHub repo where you will put your module code.
- The repo name (also used as family name) is generally the name of the GitHub repo where you will put your module code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We say repo name elsewhere in the docs, but the generator says family name. What exactly does "also used as" mean here?


It's a good idea to test your module locally before uploading it to the [Viam registry](https://app.viam.com/registry):

1. Follow [the local module testing instructions](/how-tos/create-module/#test-your-module-locally) to configure your local module and then the associated model on your machine.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think those steps are so small state you can include them directly, maybe in slightly shortened form

Copy link
Collaborator

@npentrel npentrel left a comment

Choose a reason for hiding this comment

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

The content is very good. I do think there is value in conforming to the how-to template for this. I don't want this to merge without conforming to the template. And I don't know that we'll be able to make a decision on a new formatting quickly. I think I'd like to see where the formatting fails before we make a decision on moving away from the format.

The create a module and the update and manage modules page don't conform to it but I think that's because we still have work to do on them. For this how-to I don't see why the format shouldn't work right now.

@JessamyT JessamyT requested a review from npentrel August 19, 2024 23:10
{{< /expand >}}
{{% /tablestep %}}
{{% tablestep %}}
**2. Run your test script**
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can if you want to skip having steps for this part. I agree that here it feels a bit unnecessary. In the rest it's more helpful. Up to you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry i'm not sure what this comment is in relation to

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm saying you don't need to put tablesteps here into the "Start with a test script" section if you don't want to

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oooh

{{% tablestep %}}
**1. Install and run the module generator**

Follow the steps in the [readme](https://github.com/viam-labs/generator-viam-module/tree/main) to install the generator and run it.
Copy link
Collaborator

@npentrel npentrel Aug 20, 2024

Choose a reason for hiding this comment

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

Given the instruction can be one command to run I don't see a reason to direct them to the readme. It's better if we keep them on one page

Suggested change
Follow the steps in the [readme](https://github.com/viam-labs/generator-viam-module/tree/main) to install the generator and run it.
The following commands will install a module generator [generator-viam-module](https://github.com/viam-labs/generator-viam-module/tree/main).
You must have node 16 or newer installed.
npm install -g yo generator-viam-module
Then run the generator with:
yo viam-module


{{< table >}}
{{% tablestep %}}
**1. Install and run the module generator**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
**1. Install and run the module generator**
**1. Install the module generator**

Copy link
Collaborator

@npentrel npentrel left a comment

Choose a reason for hiding this comment

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

A few minor things then I think this is ready for merge

@JessamyT JessamyT requested a review from npentrel August 20, 2024 21:14

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Co-authored-by: Naomi Pentrel <[email protected]>

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@viambot
Copy link
Member

viambot commented Aug 20, 2024

You can view a rendered version of the docs from this PR at https://docs-test.viam.dev/3259

@JessamyT JessamyT merged commit 93d00b0 into viamrobotics:main Aug 20, 2024
9 checks passed
@JessamyT JessamyT deleted the 2691sensormodule branch August 20, 2024 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to build This pull request is marked safe to build from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants