From 85184d5439349c3a8f1a41241304b1187462a128 Mon Sep 17 00:00:00 2001 From: Abe Winter Date: Tue, 26 Sep 2023 11:33:37 -0400 Subject: [PATCH] update readme --- .gitignore | 2 +- README.md | 67 ++++++++++++++++++++++++++---------------------------- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/.gitignore b/.gitignore index c65c518..fe22bf8 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,4 @@ # vendor/ wifi -module.tar.gz +*.tar.gz diff --git a/README.md b/README.md index 594e0f7..1be3f0f 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,40 @@ # wifi-sensor -A sensor that detects wifi strength - -## Usage - -### 1. Build binary - -If you clone this repository to the target environment where you run your Viam robot, then you can build a binary named `wifi` with: - -``` -go build -o wifi +A Viam sensor implementation that reads the system's wifi information. This is an example repo to show how to: +1. Make a Viam module with Go +1. Build it in CI and upload to the registry + +## Running this with local exec + +For iterative development, you can run a module locally (laptop or robot) and test it using a local instance of the RDK. + +Create the binary with `make wifi`. + +Your config will look something like this: + +```json +{ + "modules": [{ + "executable_path": "/path/to/project/wifi", + "name": "wifisensor" + }], + "components": [{ + "name": "wifi", + "type": "sensor", + "model": "viam-labs:sensor:linux-wifi" + }] +} ``` -Alternatively, if you want to build a binary for a different target environment, please use the [viam canon tool](https://github.com/viamrobotics/canon). +Our docs for running local modules are [here](https://docs.viam.com/extend/modular-resources/configure/#local-modules). -### 2. Add to robot configuration +## What's in this repo -Copy the binary to the robot (system where viam-server is running) and add the following to your configuration: +- .github/workflows: CI and deploy logic +- Makefile: instructions for building the binary and bundling it into a tarball +- \*.go: the implementation +- meta.json: module configuration file -``` - ... - "modules": [ - ..., - { - "executable_path": "", - "name": "wifisensor" - }, - ..., - ], - "components": [ - ..., - { - "name": "wifi", - "type": "sensor", - "model": "viam-labs:sensor:linux-wifi" - }, - ..., - ], - ... -``` +## Forking this repo -For more information on how to configure modular components, [see this example](https://docs.viam.com/services/slam/run-slam-cartographer/#step-1-add-your-rdiplar-as-a-modular-component). +If you fork this and want to deploy to the registry, you'll need to update namespaces and CI secrets. Full fork instructions are in the [Python module example](https://github.com/viam-labs/python-example-module#forking-this-repo).