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
Copy file name to clipboardExpand all lines: docs/operate/get-started/other-hardware/_index.md
+20-5
Original file line number
Diff line number
Diff line change
@@ -51,10 +51,25 @@ For C++ module examples, see the [C++ examples directory on GitHub](https://gith
51
51
{{% /alert %}}
52
52
53
53
{{< expand "How and where do modules run?" >}}
54
-
Modules run on your machine, alongside [`viam-server`](/operate/reference/viam-server/) as separate processes, communicating with `viam-server` over UNIX sockets.
55
-
56
-
When a module initializes, it registers its {{< glossary_tooltip term_id="model" text="model or models" >}} and associated [APIs](/dev/reference/apis/) with `viam-server`, making the new model available for use.
57
-
`viam-server` manages the [dependencies](/operate/reference/viam-server/#dependency-management), [start-up](/operate/reference/viam-server/#start-up), [reconfiguration](/operate/reference/viam-server/#reconfiguration), [data management](/data-ai/capture-data/capture-sync/), and [shutdown](/operate/reference/viam-server/#shutdown) behavior of your modular resource.
54
+
Modules run on your machine, alongside `viam-server` as separate processes, communicating with `viam-server` over UNIX sockets.
55
+
56
+
[`viam-server` manages](/operate/reference/viam-server/) the dependencies, start-up, reconfiguration, [data management](/data-ai/capture-data/capture-sync/), and shutdown behavior of your modular resource.
57
+
58
+
The lifecycle of a module and the resources it provides is as follows:
59
+
60
+
1.`viam-server` starts, and if it is connected to the internet, it checks for configuration updates.
61
+
1.`viam-server` starts any configured modules.
62
+
1. When a module initializes, it registers its model or models and associated [APIs](/dev/reference/apis/) with `viam-server`, making the models available for use.
63
+
1. For each modular resource configured on the machine, `viam-server` uses the resource's `validate` function and the `depends_on` field in the resource configuration to determine the dependencies of the resource.
64
+
1. If a dependency is not already running, `viam-server` starts it before starting the resource.
65
+
If a dependency is not found or fails to start, `viam-server` will not start the resource that depends on it.
66
+
1.`viam-server` builds the resource based on its resource configuration.
67
+
1. If configuration fails due to a validation failure or an exception thrown by the reconfigure function, `viam-server` attempts to reconfigure the resource.
68
+
1. The modular resource is ready to use.
69
+
1. If at any point the user changes the configuration of the machine, `viam-server` reconfigures the affected resources within 15 seconds.
70
+
1. If a resource crashes, `viam-server` attempts to rebuild it.
71
+
1. When `viam-server` shuts down, it attempts to stop all running modules.
72
+
If a module fails to shut down within 90 seconds, `viam-server` will forcefully kill it after 15 seconds.
58
73
59
74
For microcontrollers, you must flash a [firmware build that includes the Micro-RDK](/operate/get-started/other-hardware/micro-module/) and one or more modules onto your device.
60
75
{{< /expand >}}
@@ -134,7 +149,7 @@ Authenticate your CLI session with Viam using one of the following options:
134
149
| Language | The language for the module. |
135
150
| Visibility | Choose `Private` to share only with your organization, or `Public` to share publicly with all organizations. If you are testing, choose `Private`. |
136
151
| Namespace/Organization ID | In the [Viam app](https://app.viam.com), navigate to your organization settings through the menu in upper right corner of the page. Find the **Public namespace** (or create one if you haven't already) and copy that string. If you use the organization ID, you must still create a public namespace first. |
137
-
| Resource to add to the module (API) | The [component API](/dev/reference/apis/#component-apis) your module will implement. |
152
+
| Resource to add to the module (API) | The [component API](/dev/reference/apis/#component-apis) your module will implement. See [How to design your module](#how-to-design-your-module) for more information. |
138
153
| Model name | Name your component model based on what it supports, for example, if it supports a model of ultrasonic sensor called "XYZ Sensor 1234" you could call your model `xyz_1234` or similar. Must be all-lowercase and use only alphanumeric characters (`a-z` and `0-9`), hyphens (`-`), and underscores (`_`). |
139
154
| Enable cloud build | If you select `Yes` (recommended) and push the generated files (including the <file>.github</file> folder) and create a release of the format `vX.X.X`, the module will build and upload to the Viam registry and be available for all Viam-supported architectures without you needing to build for each architecture. `Yes` also makes it easier to [upload](#upload-your-module) using PyInstaller by creating a build entrypoint script. You can select `No` if you will always build the module yourself before uploading it. |
140
155
| Register module | Select `Yes` unless you are creating a local-only module for testing purposes and do not intend to upload it. Registering a module makes its name and metadata appear in the Viam app registry page; uploading the actual code that powers the module is a separate step. If you decline to register the module at this point, you can run [`viam module create`](/dev/tools/cli/#module) to register it later. |
Copy file name to clipboardExpand all lines: docs/operate/get-started/other-hardware/dependencies.md
+11-25
Original file line number
Diff line number
Diff line change
@@ -7,33 +7,12 @@ type: "docs"
7
7
description: "Handle dependencies in your custom modular resource."
8
8
---
9
9
10
-
If you are authoring a module, this page will help you understand how to handle dependencies in your modular resources.
11
-
12
-
## The lifecycle of a module
13
-
14
-
An instance of a module runs as a separate process from `viam-server`.
15
-
`viam-server` manages the lifecycle of the module, communicating with it over UNIX sockets.
16
-
The lifecycle of a module and the resources it provides is as follows:
17
-
18
-
1.`viam-server` starts, and if it is connected to the internet, it checks for configuration updates.
19
-
1.`viam-server` starts any configured modules.
20
-
1. For each modular resource configured on the machine, `viam-server` uses the resource's `validate` function and the `depends_on` field in the resource configuration to determine the dependencies of the resource.
21
-
1. If a dependency is not already running, `viam-server` starts it before starting the resource.
22
-
1.`viam-server` builds the resource based on its configuration.
23
-
1. If the configuration fails, `viam-server` attempts to reconfigure the resource.
24
-
1. The modular resource is ready to use.
25
-
1. If at any point the user changes the configuration of the machine, `viam-server` reconfigures the affected resources.
26
-
1. If a resource crashes, `viam-server` attempts to rebuild it.
27
-
1. When `viam-server` shuts down, it attempts to stop all running modules.
28
-
29
-
## What are dependencies?
30
-
31
10
Dependencies are other {{< glossary_tooltip term_id="resource" text="resources" >}} that your modular resource needs to access in order to function.
32
11
For example, a vision service might depend on a camera component, meaning that the camera is a dependency of that vision service.
33
12
34
-
When `viam-server` builds all the resources on a machine, it builds the dependencies first.
13
+
When [`viam-server` builds all the resources on a machine](/operate/get-started/other-hardware/#how-and-where-do-modules-run), it builds the dependencies first.
35
14
36
-
###Implicit versus explicit dependencies
15
+
## Implicit versus explicit dependencies
37
16
38
17
-**Implicit dependencies** require users to configure a named attribute (for example `"left-motor": "motor1"`).
39
18
@@ -68,7 +47,8 @@ For example, you cannot call `Camera.from_robot()` to get a camera resource.
68
47
69
48
Instead, you must access dependencies by writing your module code as follows:
70
49
71
-
### Use implicit dependencies
50
+
{{< tabs >}}
51
+
{{% tab name="Use implicit dependencies" %}}
72
52
73
53
{{< tabs >}}
74
54
{{% tab name="Python" %}}
@@ -205,7 +185,8 @@ If you need to maintain the state of your resource, see [(Optional) Create and e
There is not currently an SDK method to access configuration attributes of dependencies in Python or Go, but in Python it is possible to use `get_robot_part` to return information including the whole configuration of a machine part, and then access the configuration attributes of the dependency from there.
249
233
{{% /hiddencontent %}}
250
234
251
235
## Configure your module's dependencies more easily with a discovery service
236
+
237
+
If your module requires dependencies, you can make it easier for users to configure them by writing a [discovery service](/operate/reference/services/discovery/) as one model within your module.
Copy file name to clipboardExpand all lines: docs/operate/reference/viam-server/_index.md
+8-8
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Overall, `viam-server` manages:
37
37
38
38
## Dependency management
39
39
40
-
`viam-server` handles dependency management between resources.
40
+
`viam-server` handles [dependency](/operate/get-started/other-hardware/dependencies/) management between resources.
41
41
42
42
## Start-up
43
43
@@ -50,7 +50,7 @@ After start-up, `viam-server` manages:
50
50
- the running services, and
51
51
- the {{< glossary_tooltip term_id="module" text="modules" >}} that provide the {{< glossary_tooltip term_id="modular-resource" text="modular resources" >}}.
52
52
53
-
###Reconfiguration
53
+
## Reconfiguration
54
54
55
55
When you or your collaborators change the configuration of a machine in the Viam app, `viam-server` automatically synchronizes the configuration to your machine and updates the running resources within 15 seconds.
56
56
This means you can add, modify, and remove a modular resource instance from a running machine.
@@ -67,7 +67,7 @@ If you want to force a reconfiguration of a resource, you can click the **Disabl
67
67
Alternatively, if you are having issues with a module, try the **Restart module** button in the module menu.
68
68
{{% /hiddencontent %}}
69
69
70
-
###Maintenance window
70
+
## Maintenance window
71
71
72
72
There are a few updates that may make your machine temporarily unavailable:
73
73
@@ -108,7 +108,7 @@ maintenance : {
108
108
|`sensor_name`| string |**Required**| The full name of the sensor that provides the information if it is safe to update a machine's configuration. For example `rdk:component:sensor/sensor1`. |
109
109
|`maintenance_allowed_key`| string |**Required**| The key of the key value pair for the reading returned by the sensor. |
110
110
111
-
###Logging
111
+
## Logging
112
112
113
113
Log messages appear under the [**LOGS** tab](/manage/troubleshoot/troubleshoot/#check-logs) for a machine.
114
114
@@ -191,7 +191,7 @@ If log configurations are applied at a resource level using the `log_configurati
191
191
192
192
{{% /expand%}}
193
193
194
-
####Disable log deduplication
194
+
### Disable log deduplication
195
195
196
196
By default, `viam-server` deduplicates log messages that are deemed noisy.
197
197
A log is deemed noisy if it has been output 3 times in the past 10 seconds.
@@ -220,7 +220,7 @@ To disable log deduplication, set `disable_log_deduplication` in your machine's
220
220
221
221
{{% /expand%}}
222
222
223
-
####Delete machine logs
223
+
### Delete machine logs
224
224
225
225
You cannot delete machine logs.
226
226
If your machine has generated a large amount of logs and you are concerned about the cost, you can:
@@ -230,7 +230,7 @@ If your machine has generated a large amount of logs and you are concerned about
230
230
231
231
If you delete a machine you will not be charged for the remainder of the 30 days until logs from that machine are deleted.
232
232
233
-
####Debugging
233
+
### Debugging
234
234
235
235
You can enable debug level logs in two ways:
236
236
@@ -246,7 +246,7 @@ You can enable debug level logs in two ways:
246
246
247
247
Enabling debug level logs will take precedence over all logging configuration set using the `log` field on a machine or the `log_configuration` field on a resource.
248
248
249
-
###Shutdown
249
+
## Shutdown
250
250
251
251
During machine shutdown, `viam-server` handles modular resource instances similarly to built-in resource instances - it signals them for shutdown in topological (dependency) order.
0 commit comments