You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Viam sensor implementation that reads the system's wifi information. This is an example repo to show how to:
4
+
1. Make a Viam module with Go
5
+
1. Build it in CI and upload to the registry
4
6
5
-
## Usage
7
+
## Running this with local exec
6
8
7
-
### 1. Build binary
9
+
For iterative development, you can run a module locally (laptop or robot) and test it using a local instance of the RDK.
8
10
9
-
If you clone this repository to the target environment where you run your Viam robot, then you can build a binary named `wifi` with:
11
+
Create the binary with `make wifi`.
10
12
11
-
```
12
-
go build -o wifi
13
-
```
14
-
15
-
Alternatively, if you want to build a binary for a different target environment, please use the [viam canon tool](https://github.com/viamrobotics/canon).
16
-
17
-
### 2. Add to robot configuration
13
+
Your config will look something like this (replace /path/to/wifi-sensor with the actual path on your system):
18
14
19
-
Copy the binary to the robot (system where viam-server is running) and add the following to your configuration:
20
-
21
-
```
22
-
...
23
-
"modules": [
24
-
...,
15
+
```json
16
+
{
17
+
"components": [
25
18
{
26
-
"executable_path": "<path_to_binary>",
27
-
"name": "wifisensor"
28
-
},
29
-
...,
19
+
"name": "whatever",
20
+
"model": "viam:sensor:linux-wifi",
21
+
"type": "sensor"
22
+
}
30
23
],
31
-
"components": [
32
-
...,
24
+
"modules": [
33
25
{
34
26
"name": "wifi",
35
-
"type": "sensor",
36
-
"model": "viam-labs:sensor:linux-wifi"
37
-
},
38
-
...,
39
-
],
40
-
...
27
+
"executable_path": "/path/to/wifi-sensor/wifi",
28
+
"type": "local"
29
+
}
30
+
]
31
+
}
41
32
```
42
33
43
-
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).
34
+
Our docs for running local modules are [here](https://docs.viam.com/extend/modular-resources/configure/#local-modules).
35
+
36
+
## What's in this repo
37
+
38
+
- .github/workflows: CI and deploy logic
39
+
- Makefile: instructions for building the binary and bundling it into a tarball
40
+
-\*.go: the implementation
41
+
- meta.json: module configuration file
42
+
43
+
## Forking this repo
44
+
45
+
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 commit comments