Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter committed Sep 26, 2023
1 parent ed76a5e commit 85184d5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# vendor/

wifi
module.tar.gz
*.tar.gz
67 changes: 32 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -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": "<path_to_binary>",
"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).

0 comments on commit 85184d5

Please sign in to comment.