diff --git a/docs/data-ai/capture-data/advanced/advanced-data-capture-sync.md b/docs/data-ai/capture-data/advanced/advanced-data-capture-sync.md index 6c044c73da..3a2d937384 100644 --- a/docs/data-ai/capture-data/advanced/advanced-data-capture-sync.md +++ b/docs/data-ai/capture-data/advanced/advanced-data-capture-sync.md @@ -8,6 +8,7 @@ type: "docs" platformarea: ["data"] description: "Advanced data capture and data sync configurations." date: "2025-02-10" +updated: "2025-12-04" --- Some data use cases require advanced configuration beyond the attributes accessible in the UI. @@ -18,7 +19,7 @@ You can also configure data capture for remote parts. Configure how long your synced data remains stored in the cloud: -- **Retain data up to a certain size (for example, 100GB) or for a specific length of time (for example, 14 days):** Set `retention_policies` at the resource level. +- **Retain data up to a certain size (for example, 100GB) or for a specific length of time (for example, 14 days):** Set `retention_policy` at the resource level. See the `retention_policy` field in [data capture configuration attributes](/data-ai/capture-data/advanced/advanced-data-capture-sync/#click-to-view-data-capture-attributes). - **Delete data captured by a machine when you delete the machine:** Control whether your cloud data is deleted when a machine or machine part is removed. See the `delete_data_on_part_deletion` field in the [data management service configuration attributes](/data-ai/capture-data/advanced/advanced-data-capture-sync/#click-to-view-data-management-attributes). @@ -93,7 +94,7 @@ The following attributes are available for the data management service: | Name | Type | Required? | Description | `viam-micro-server` Support | | ------------------ | ------ | --------- | ----------- | ------------------- | -| `capture_disabled` | bool | Optional | Toggle data capture on or off for the entire machine {{< glossary_tooltip term_id="part" text="part" >}}. Note that even if capture is on for the whole part, but is not on for any individual {{< glossary_tooltip term_id="component" text="components" >}} (see Step 2), data is not being captured.
Default: `false` |

| +| `capture_disabled` | bool | Optional | Toggle data capture on or off for the entire machine {{< glossary_tooltip term_id="part" text="part" >}}. Note that even if capture is on for the whole part, if it is not on for any individual {{< glossary_tooltip term_id="component" text="components" >}}, data is not being captured.
Default: `false` |

| | `capture_dir` | string | Optional | Path to the directory on your machine where you want to store captured data. If you change the directory for data capture, only new data is stored in the new directory. Existing data remains in the directory where it was stored.
Default: `~/.viam/capture` |

| | `tags` | array of strings | Optional | Tags to apply to all images or tabular data captured by this machine part. May include alphanumeric characters, underscores, and dashes. | | | `sync_disabled` | bool | Optional | Toggle cloud sync on or off for the entire machine {{< glossary_tooltip term_id="part" text="part" >}}.
Default: `false` | | @@ -103,12 +104,12 @@ The following attributes are available for the data management service: | `delete_data_on_part_deletion` | bool | Optional | Whether deleting this {{< glossary_tooltip term_id="machine" text="machine" >}} or {{< glossary_tooltip term_id="part" text="machine part" >}} should result in deleting all the data captured by that machine part.
Default: `false` |

| | `delete_every_nth_when_disk_full` | int | Optional | How many files to delete when local storage meets the [fullness criteria](/data-ai/capture-data/advanced/how-sync-works/#storage). The data management service will delete every Nth file that has been captured upon reaching this threshold. Use JSON mode to configure this attribute.
Default: `5`, meaning that every fifth captured file will be deleted. | | | `maximum_num_sync_threads` | int | Optional | Max number of CPU threads to use for syncing data to the Viam Cloud.
Default: [runtime.NumCPU](https://pkg.go.dev/runtime#NumCPU)/2 so half the number of logical CPUs available to viam-server | | -| `mongo_capture_config.uri` | string | Optional | The [MongoDB URI](https://www.mongodb.com/docs/v6.2/reference/connection-string/) data capture will attempt to write tabular data to after it is enqueued to be written to disk. When non-empty, data capture will capture tabular data to the configured MongoDB database and collection at that URI.
See `mongo_capture_config.database` and `mongo_capture_config.collection` below for database and collection defaults.
See [Data capture directly to MongoDB](/data-ai/capture-data/advanced/how-sync-works/#storage) for an example config.| | -| `mongo_capture_config.database` | string | Optional | When `mongo_capture_config.uri` is non empty, changes the database data capture will write tabular data to.
Default: `"sensorData"` | | -| `mongo_capture_config.collection` | string | Optional | When `mongo_capture_config.uri` is non empty, changes the collection data capture will write tabular data to.
Default: `"readings"` | | -| `cache_size_kb` | float | Optional | `viam-micro-server` only. The maximum amount of storage bytes (in kilobytes) allocated to a data collector.
Default: `1` KB. |

| +| `mongo_capture_config.uri` | string | Optional | The [MongoDB URI](https://www.mongodb.com/docs/v6.2/reference/connection-string/) to which data capture will attempt to write tabular data after it is enqueued to be written to disk. When non-empty, data capture will write tabular data to the configured MongoDB database and collection at that URI.
See `mongo_capture_config.database` and `mongo_capture_config.collection` below for database and collection defaults.
See [Capture directly to your own MongoDB cluster](/data-ai/capture-data/advanced/advanced-data-capture-sync/#capture-directly-to-your-own-mongodb-cluster) for example configurations.| | +| `mongo_capture_config.database` | string | Optional | When `mongo_capture_config.uri` is non-empty, changes the database data capture will write tabular data to.
Default: `"sensorData"` | | +| `mongo_capture_config.collection` | string | Optional | When `mongo_capture_config.uri` is non-empty, changes the collection data capture will write tabular data to.
Default: `"readings"` | | +| `cache_size_kb` | float | Optional | `viam-micro-server` only. The maximum amount of storage (in kilobytes) allocated to a data collector.
Default: `1` KB. |

| | `file_last_modified_millis` | float | Optional | The amount of time to pass since arbitrary files were last modified until they are synced. Normal .capture files are synced as soon as they are able to be synced.
Default: `10000` milliseconds. | | -| `disk_usage_deletion_threshold` | float | Optional | The disk usage ratio at or above which, files will be deleted if the capture directory makes up at least the specified `capture_dir_deletion_threshold` of the disk usage. If disk usage is at or above the disk usage threshold, but the capture directory is below the capture directory threshold, then file deletion will not occur but a warning will be logged periodically. Default: `0.9`. | | +| `disk_usage_deletion_threshold` | float | Optional | The disk usage ratio at or above which files will be deleted if the capture directory makes up at least the specified `capture_dir_deletion_threshold` of the disk usage. If disk usage is at or above the disk usage threshold, but the capture directory is below the capture directory threshold, then file deletion will not occur but a warning will be logged periodically. Default: `0.9`. | | | `capture_dir_deletion_threshold` | float | Optional | The ratio of disk usage made up by the capture directory at or above which files will be deleted if the disk usage ratio is also above the `disk_usage_deletion_threshold`. If the ratio of disk usage of the capture directory is at or above the threshold but the disk usage is below the disk usage threshold, then file deletion will not occur but a warning will be logged periodically. Default: `0.5`. | | {{< /expand >}} @@ -196,7 +197,7 @@ This example configuration captures data from the `ReadImage` method of a camera {{% /tab %}} {{% tab name="viam-micro-server" %}} -This example configuration captures data from the `GetReadings` method of a temperature sensor and wifi signal sensor: +This example configuration captures data from the `Readings` method of a temperature sensor and wifi signal sensor: ```json {class="line-numbers linkable-line-numbers"} { @@ -267,7 +268,7 @@ This example configuration captures data from the `GetReadings` method of a temp {{% /tab %}} {{< /tabs >}} -Example for a vision service: +Example configuration for a vision service: This example configuration captures data from the `CaptureAllFromCamera` method of the vision service: @@ -345,7 +346,9 @@ Viam supports data capture from {{< glossary_tooltip term_id="resource" text="re For example, if you use a {{< glossary_tooltip term_id="part" text="part" >}} that does not have a Linux operating system or does not have enough storage or processing power to run `viam-server`, you can still process and capture the data from that part's resources by adding it as a remote part. Currently, you can only configure data capture from remote resources in your JSON configuration. -To add them to your JSON configuration you must explicitly add the remote resource's `type`, `model`, `name`, and `additional_params` to the `data_manager` service configuration in the `remotes` configuration: +To add them to your JSON configuration, you must explicitly add the remote resource's `type`, `model`, `name`, and `additional_params` to the data_manager service configuration in the remotes configuration: + +`name` and `additional_params` to the `data_manager` service configuration in the `remotes` configuration: | Key | Description | @@ -428,9 +431,7 @@ The following example of a configuration with a remote part captures data from t "sync_disabled": true, "sync_interval_mins": 5, "tags": ["tag1", "tag2"] - }, - "name": "data_manager", - "type": "data_manager" + } } ], "components": [], @@ -443,16 +444,16 @@ The following example of a configuration with a remote part captures data from t "type": "data_manager", "attributes": { "capture_methods": [ - // Captures data from two analog readers (A1 and A2) - { + // Captures data from two analog readers (A1 and A2) + { "method": "Analogs", "capture_frequency_hz": 1, "cache_size_kb": 10, "name": "rdk:component:board/my-esp32", "additional_params": { "reader_name": "A1" }, "disabled": false - }, - { + }, + { "method": "Analogs", "capture_frequency_hz": 1, "cache_size_kb": 10, @@ -467,7 +468,7 @@ The following example of a configuration with a remote part captures data from t "cache_size_kb": 10, "name": "rdk:component:board/my-esp32", "additional_params": { - "pin_name": “27” + "pin_name": "27" }, "disabled": false } @@ -491,14 +492,15 @@ The following example of a configuration with a remote part captures data from t { "services": [ { + "name": "data_manager", + "api": "rdk:service:data_manager", + "model": "rdk:builtin:builtin", "attributes": { "capture_dir": "", "sync_disabled": true, "sync_interval_mins": 5, "tags": [] - }, - "name": "data_manager", - "type": "data_manager" + } } ], "components": [], diff --git a/docs/data-ai/capture-data/advanced/how-sync-works.md b/docs/data-ai/capture-data/advanced/how-sync-works.md index a7af41794a..e93845fbe3 100644 --- a/docs/data-ai/capture-data/advanced/how-sync-works.md +++ b/docs/data-ai/capture-data/advanced/how-sync-works.md @@ -6,11 +6,12 @@ weight: 12 layout: "docs" type: "docs" platformarea: ["data"] -description: "Data capture and sync works differently for viam-server and viam-micro-server." +description: "Data capture and sync work differently for viam-server and viam-micro-server." date: "2024-12-18" +updated: "2025-12-04" --- -Data capture and cloud sync works differently for `viam-server` and `viam-micro-server`. +Data capture and cloud sync work differently for `viam-server` and `viam-micro-server`. {{< tabs >}} {{% tab name="viam-server" %}} @@ -28,7 +29,7 @@ The data is captured locally on the machine's storage and, by default, stored in The relative path for the data capture directory depends on where `viam-server` is run from, as well as the operating system of the machine. -To find the `$HOME` value, check your machine's logs on startup which will log it in the environment variables: +To find the `$HOME` value, check your machine's logs on startup, which will log it in the environment variables: ```sh 2025-01-15T14:27:26.073Z INFO rdk server/entrypoint.go:77 Starting viam-server with following environment variables {"HOME":"/home/johnsmith"} @@ -69,15 +70,15 @@ When data is stored in the cloud, it is encrypted at rest by the cloud storage p ## Data integrity -Viam's data management service is designed to safeguard against data loss, data duplication and otherwise compromised data. +Viam's data management service is designed to safeguard against data loss, data duplication, and otherwise compromised data. If the internet becomes unavailable or the machine needs to restart during the sync process, the sync is interrupted. -If the sync process is interrupted, the service will retry uploading the data at exponentially increasing intervals until the interval in between tries is at one hour, at which point the service retries the sync every hour. +If the sync process is interrupted, the service will retry uploading the data at exponentially increasing intervals until the interval between retries reaches one hour, at which point the service retries the sync every hour. When the connection is restored and sync resumes, the service continues sync where it left off without duplicating data. If the interruption happens mid-file, sync resumes from the beginning of that file. To avoid syncing files that are still being written to, the data management service only syncs arbitrary files that haven't been modified in the previous 10 seconds. -This default can be changed with the [`file_last_modified_millis` config attribute](/data-ai/capture-data/capture-sync/). +This default can be changed with the [`file_last_modified_millis` config attribute](/data-ai/capture-data/advanced/advanced-data-capture-sync/#click-to-view-data-management-attributes). ## Automatic data deletion @@ -116,8 +117,7 @@ When a machine loses its internet connection, it cannot resume cloud sync until To ensure that the machine can store all data captured while it has no connection, you need to provide enough local data storage. -If your robot is offline and can't sync and your machine's disk fills up beyond a certain threshold, the data management service will delete captured data to free up additional space and maintain a working machine. -For more information, see [Automatic data deletion details](/data-ai/capture-data/advanced/how-sync-works/) +For information about automatic data deletion when storage fills up, see [Automatic data deletion](#automatic-data-deletion) above. Data capture supports capturing tabular data directly to MongoDB in addition to capturing to disk. For more information, see [Capture directly to MongoDB](/data-ai/capture-data/advanced/advanced-data-capture-sync/#capture-directly-to-your-own-mongodb-cluster). diff --git a/docs/data-ai/capture-data/capture-sync.md b/docs/data-ai/capture-data/capture-sync.md index 06c2ae39cc..946dd264ca 100644 --- a/docs/data-ai/capture-data/capture-sync.md +++ b/docs/data-ai/capture-data/capture-sync.md @@ -8,6 +8,7 @@ type: "docs" platformarea: ["data"] description: "Capture data from a resource on your machine and sync the data to the cloud." date: "2024-12-03" +updated: "2025-12-04" aliases: - /services/data/capture/ - /data/capture/ @@ -41,9 +42,9 @@ aliases: --- You can use the data management service to capture data from [supported components and services](/data-ai/capture-data/capture-sync/#click-to-see-resources-that-support-data-capture-and-cloud-sync), then sync it to the cloud. -You can also sync data from arbitrary folders on your machine. +You can also [sync data from arbitrary folders on your machine](/data-ai/capture-data/upload-other-data/#sync-data-from-another-directory). -## How data capture and data sync works +## How data capture and data sync work The data management service writes data from your configured Viam resources to local storage on your edge device and syncs data from the edge device to the cloud: @@ -92,13 +93,13 @@ Some models do not support all options, for example webcams do not capture point {{< /expand >}} -For instructions on configuring data capture and sync with JSON, go to [Advanced data capture and sync configurations](/data-ai/capture-data/advanced/advanced-data-capture-sync/) and follow the instructions for JSON examples. +For instructions on configuring data capture and sync with JSON, see [Advanced data capture and sync configurations](/data-ai/capture-data/advanced/advanced-data-capture-sync/). ## View captured data 1. Navigate to the [**DATA** tab](https://app.viam.com/data/view). 1. Select the [**Images**](https://app.viam.com/data/view?view=images), [**Files**](https://app.viam.com/data/view?view=files), [**Point clouds**](https://app.viam.com/data/view?view=point+clouds), or [**Sensors**](https://app.viam.com/data/view?view=sensors) subtab. -1. Filter data by location, type of data, and more. +1. Filter data by location, type, and more. ## Stop data capture or data sync @@ -142,4 +143,4 @@ For other ways to control data synchronization, see: ## Next steps For more information on available configuration attributes and options like capturing directly to MongoDB or conditional sync, see [Advanced data capture and sync configurations](/data-ai/capture-data/advanced/advanced-data-capture-sync/). -To leverage AI, you can now [create a dataset](/data-ai/train/create-dataset/) with the data you've captured. +To leverage AI, you can [create a dataset](/data-ai/train/create-dataset/) with the data you've captured. diff --git a/docs/data-ai/capture-data/conditional-sync.md b/docs/data-ai/capture-data/conditional-sync.md index 74d58f0df0..94cd36ba39 100644 --- a/docs/data-ai/capture-data/conditional-sync.md +++ b/docs/data-ai/capture-data/conditional-sync.md @@ -16,7 +16,7 @@ languages: [] viamresources: ["sensor", "data_manager"] platformarea: ["data", "registry"] date: "2024-12-04" -updated: "2025-09-05" +updated: "2025-12-04" --- By default, `viam-server` checks for new data to sync at the configured interval (`sync_interval_mins`). @@ -27,12 +27,12 @@ For example: - Sync when conditions are met or events are detected - Sync during certain time windows -To sync only when certain conditions are met you must provide the data manager a sensor that returns `"should_sync": true` when sync should happen and `"should_sync": false` otherwise. +To sync only when certain conditions are met, you must provide the data manager a sensor that returns `"should_sync": true` when sync should happen and `"should_sync": false` otherwise. -This page will show you the implementation of a sensor which only allows sync during a defined time interval. +This page shows you the implementation of a sensor which only allows sync during a defined time interval. You can use it as the basis of your own custom logic. -You can also view [trigger-sync-examples module](https://github.com/viam-labs/trigger-sync-examples-v2) for more examples. +You can also view the [trigger-sync-examples module](https://github.com/viam-labs/trigger-sync-examples-v2) for more examples. ## Prerequisites @@ -61,16 +61,21 @@ Start by [creating a sensor module](/operate/modules/support-hardware/). Your sensor should have access to the information you need to determine if your machine should sync or not. Based on that data, make the sensor return true when the machine should sync and false when it should not. -For example, if your want your machine to return data only during a specific time interval, your sensor needs to be able to access the time as well as be configured with the time interval during which you would like to sync data. +For example, if you want your machine to sync data only during a specific time interval, your sensor needs to be able to access the time as well as be configured with the time interval during which you would like to sync data. It can then return true during the specified sync time interval and false otherwise. {{% /expand%}} ## Return `should_sync` as a reading from a sensor +{{< alert title="Note" color="note" >}} +If you are using a pre-built module like `sync-at-time:timesyncsensor`, you can skip this section and go directly to [Add your sensor to determine when to sync](#add-your-sensor-to-determine-when-to-sync). +This section is for users who want to create their own custom sensor module. +{{< /alert >}} + The following example implementation of the `Readings()` method returns `"should_sync": true` if the current time is in a specified time window, and `"should_sync": false` otherwise. -```go {class="line-numbers linkable-line-numbers" data-line="26,31,32,37"} +```go {class="line-numbers linkable-line-numbers" data-line="34,40,41,46"} func (s *timeSyncer) Readings(context.Context, map[string]interface{}) (map[string]interface{}, error) { currentTime := time.Now() var hStart, mStart, sStart, hEnd, mEnd, sEnd int @@ -89,6 +94,7 @@ func (s *timeSyncer) Readings(context.Context, map[string]interface{}) (map[stri zone, err := time.LoadLocation(s.zone) if err != nil { s.logger.Error("Time zone cannot be loaded: ", s.zone) + return nil, err } startTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), @@ -96,9 +102,17 @@ func (s *timeSyncer) Readings(context.Context, map[string]interface{}) (map[stri endTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), hEnd, mEnd, sEnd, 0, zone) + // Handle time windows that span midnight (e.g., 23:00 to 01:00) + // If end time is earlier than or equal to start time, the window spans midnight + if endTime.Before(startTime) || endTime.Equal(startTime) { + // Add 24 hours to endTime to account for midnight crossover + endTime = endTime.Add(24 * time.Hour) + } + readings := map[string]interface{}{"should_sync": false} readings["time"] = currentTime.String() - // If it is between the start and end time, sync. + + // Check if current time is within the sync window if currentTime.After(startTime) && currentTime.Before(endTime) { s.logger.Debug("Syncing") readings["should_sync"] = true @@ -122,15 +136,14 @@ For additional examples, see the `Readings` function of the [time-interval-trigg ## Add your sensor to determine when to sync -Add your module to your machine and configure it. -In this example we will continue to use [`sync-at-time:timesyncsensor`](https://app.viam.com/module/naomi/sync-at-time). -You will need to follow the same steps with your module: +This section shows how to add and configure [`sync-at-time:timesyncsensor`](https://app.viam.com/module/naomi/sync-at-time). +If you created your own sensor module following the previous section, you will need to follow similar steps with your module: {{< table >}} {{% tablestep start=1 %}} **Add the sensor to your machine** -On your machine's **CONFIGURE** page, click the **+** button next to your machine part in the left menu. +On your machine's **CONFIGURE** tab, click the **+** button next to your machine part in the left menu. Select **Component or service**, then search for and select the `sync-at-time:timesyncsensor` model provided by the [`sync-at-time` module](https://app.viam.com/module/naomi/sync-at-time). Click **Add module**, then enter a name or use the suggested name for your sensor and click **Create**. @@ -186,11 +199,11 @@ The following attributes are available for the `naomi:sync-at-time:timesyncsenso
-In the next step you will configure the data manager to take the sensor into account when syncing. +In the next step, you will configure the data manager to take the sensor into account when syncing. ## Configure the data manager to sync based on sensor -On your machine's **CONFIGURE** tab, switch to **JSON** mode and add a `selective_syncer_name` with the name for the sensor you configured and add the sensor to the `depends_on` field: +On your machine's **CONFIGURE** tab, switch to **JSON** mode and add a `selective_syncer_name` field with the name of the sensor you configured, and add the sensor to the `depends_on` field: {{< tabs >}} {{% tab name="JSON Template" %}} @@ -301,8 +314,11 @@ Click on `GetReadings`. {{}} -If you are in the time frame for sync, the time sync sensor will return true. +If you are in the time frame for sync, the time sync sensor will return `true`. +If you are not in the time frame, it will return `false`. + +To verify that sync is working: -If data is currently syncing, go to the [**Data** tab](https://app.viam.com/data/view) to see your data. -If you are not in the time frame for sync, adjust the configuration of your time sync sensor. -Then check again on the **CONTROL** and **Data** tab to confirm data is syncing. +1. If the sensor returns `true` and data has been captured, go to the [**Data** tab](https://app.viam.com/data/view) to see your synced data. +2. If the sensor returns `false` but you want to test sync, adjust the configuration of your time sync sensor to include the current time. +3. Check again on the **CONTROL** tab to verify the sensor reading, and on the **Data** tab to confirm data is syncing. diff --git a/docs/data-ai/capture-data/filter-before-sync.md b/docs/data-ai/capture-data/filter-before-sync.md index 458fc9eb89..5c23c16603 100644 --- a/docs/data-ai/capture-data/filter-before-sync.md +++ b/docs/data-ai/capture-data/filter-before-sync.md @@ -8,14 +8,21 @@ description: "Use filtering to collect and sync only certain images." aliases: - /how-tos/image-data/ - /tutorials/projects/filtered-camera/ -updated: "2025-09-04" +updated: "2025-12-04" --- You can use filtering to selectively capture only images that contain certain objects or people, using a machine learning (ML) model. +You can also [create data filtering modules](/tutorials/configure/pet-photographer/) to filter other data or use registry modules other contributors have created. -Contributors have written several filtering {{< glossary_tooltip term_id="module" text="modules" >}} that you can use to filter image capture. The following steps use the [`filtered_camera`](https://app.viam.com/module/viam/filtered-camera) module. +{{% alert title="Prerequisites" color="note" %}} +Before starting, make sure you have: + +- A configured camera component on your machine. See [Configure a camera](/operate/reference/components/camera/) if you need to set one up. +- The data management service configured. See [Capture and sync edge data](/data-ai/capture-data/capture-sync/) for instructions. + {{% /alert %}} + If you want to create your own filtering module, see [Create a Data Filtering Module](/tutorials/configure/pet-photographer/). {{< table >}} @@ -44,13 +51,13 @@ From the **Select model** dropdown, select the name of your ML model service (fo {{% tablestep %}} **Configure the filtered camera** -The `filtered-camera` {{< glossary_tooltip term_id="modular-resource" text="modular component" >}} pulls the stream of images from the camera you configured earlier, and applies the vision service to it. +The `filtered-camera` {{< glossary_tooltip term_id="modular-resource" text="modular component" >}} pulls the stream of images from your camera component and applies the vision service to it. Configure a `filtered-camera` component on your machine, following the [attribute guide in the README](https://github.com/erh/filtered_camera?tab=readme-ov-file#configure-your-filtered-camera). -Use the name of the camera you configured in the first part of this guide as the `"camera"` to pull images from, and select the name of the vision service you just configured as your `"vision"` service. +Use the name of your camera component as the `"camera"` to pull images from, and select the name of the vision service you just configured as your `"vision"` service. Then add all or some of the labels your ML model uses as classifications or detections in `"classifications"` or `"objects"`. -For example, if you are using the `EfficientDet-COCO` model, you could use a configuration like the following to only capture images when a person is detected with more than 60% confidence in your camera stream. +For example, if you are using the `EfficientDet-COCO` model, you could use a configuration like the following to only capture images when a person is detected with more than 80% confidence in your camera stream. ```json {class="line-numbers linkable-line-numbers"} { @@ -67,17 +74,17 @@ For example, if you are using the `EfficientDet-COCO` model, you could use a con } ``` -Additionally, you can also add a buffer window with `window_seconds` which controls the duration of a buffer of images captured prior to a successful match. +You can also add a buffer window with `window_seconds`, which controls the duration of a buffer of images captured before a successful match. If you were to set `window_seconds` to `3`, the camera would also capture and sync images from the 3 seconds before a person appeared in the camera stream. {{% /tablestep %}} {{% tablestep %}} **Configure data capture and sync on the filtered camera** -Configure data capture and sync on the filtered camera just as you did before for the physical camera. +Configure data capture and sync on the filtered camera following the same process as described in [Capture and sync edge data](/data-ai/capture-data/capture-sync/#configure-data-capture-and-sync-for-individual-resources). The filtered camera will only capture image data that passes the filters you configured in the previous step. -Turn off data capture on your original camera if you haven't already, so that you don't capture duplicate or unfiltered images. +Turn off data capture on your original camera component if you haven't already, so that you don't capture duplicate or unfiltered images. {{% /tablestep %}} {{% tablestep %}} @@ -90,7 +97,7 @@ With cloud sync enabled, captured data is automatically uploaded to Viam after a {{% tablestep %}} **View filtered data on Viam** -Once you save your configuration, place something that is part of your trained ML model within view of your camera. +Once you save your configuration, place an object that your ML model can detect within view of your camera. Images that pass your filter will be captured and will sync at the specified sync interval, which may mean you have to wait and then refresh the page for data to appear. Your images will begin to appear under the **DATA** tab. diff --git a/docs/data-ai/capture-data/lorawan.md b/docs/data-ai/capture-data/lorawan.md index bd9fdf93dc..3271ba98bc 100644 --- a/docs/data-ai/capture-data/lorawan.md +++ b/docs/data-ai/capture-data/lorawan.md @@ -33,7 +33,7 @@ In a LoRaWAN network, information flows in two directions: Nodes pair LoRaWAN transmitters and receivers with a sensor. Instead of physically connecting to a machine over GPIO pins or USB, nodes communicate with your machine using the wireless LoRaWAN protocol. LoRaWAN supports communication over distances of up to 10 kilometers. -Nodes typically run off of battery power; a single coin cell battery can power a node for weeks or months. +Nodes typically run on battery power; a single coin cell battery can power a node for weeks or months. ### Gateway @@ -123,7 +123,7 @@ Choose an appropriate gateway model from the following options: - `viam:lorawan:sx1302-hat-generic`: generic model for all other peripherals built using the SX1302 or SX1303 chips - `viam:lorawan:rak7391`: RAK7391 WisGate Connect -Configure attributes based on the tables below: +Configure attributes based on the descriptions below: {{% /tab %}} {{< /tabs >}} @@ -148,7 +148,7 @@ Complete the following steps to configure your node: 1. Navigate to the **CONFIGURE** tab of your machine's page in the [Viam app](https://app.viam.com). 1. Click the **+** icon next to your machine part in the left-hand menu and select **Component or service**. -1. Select the `sensor` type, type `lorawan`, then select the `lorawan` model that matches the name of your node. +1. Select the `sensor` type, then type `lorawan` and select the `lorawan` model that matches the name of your node. If the name of your node does not appear in the list, choose the generic `lorawan:node` option. 1. Click **Add module**, and enter a name for your node. 1. Click **Create** to add the model and module to your machine. @@ -205,7 +205,7 @@ Choose an appropriate node model from the following options: - `viam:lorawan:milesight-em310-tilt`: Milesight EM310-TILT sensor - `viam:lorawan:node`: Any LoRaWAN sensor that is: - Class A - - supports either the `US915` or `EU868` frequency band + - supports either the `US915` or `EU868` frequency bands - uses LoRaWAN MAC specification version 1.0.3 Configure attributes based on the descriptions below: @@ -213,25 +213,25 @@ Configure attributes based on the descriptions below: {{% /tab %}} {{< /tabs >}} -You must configure the following attributes for OTAA nodes: +Configure the following attributes for OTAA nodes: -- `join_type`: The [activation protocol](#activation-protocols) used to secure this network. Default: "OTAA". Options: "OTAA", "ABP". +- `join_type`: (Optional) The [activation protocol](#activation-protocols) used to secure this network. Default: "OTAA". Options: "OTAA", "ABP". - `dev_eui`: The **device EUI (Extended Unique Identifier)**, a unique 64-bit identifier for the LoRaWAN device in hexadecimal format (16 characters). Found on your device or in device packaging. - `app_key`: The 128-bit hexadecimal AES **application key** used for device authentication and session key derivation. Found in the device datasheet. -- `gateways`: Name of the [gateway component](#add-a-gateway) in your Viam configuration. +- `gateways`: An array containing the names of the [gateway component](#add-a-gateway) in your Viam configuration. You must configure the following attributes for ABP nodes: - `dev_addr`: The 32-bit hexadecimal **device address** used to identify this device in uplink messages. Found in the device datasheet or in device packaging. - `app_s_key`: The 128-bit hexadecimal **application session key** used to decrypt uplink messages. Found in the device datasheet or in device packaging. - `network_s_key`: The 128-bit hexadecimal **network session key** used to decrypt uplink messages. Found in the device datasheet or in device packaging. -- `gateways`: The name of the [gateway component](#add-a-gateway) in your Viam configuration. +- `gateways`: An array containing the names of the [gateway component](#add-a-gateway) in your Viam configuration. For the generic `viam:lorawan:node` model, you must also configure `decoder_path` for the [decoder script](#decoder-script). {{% alert title="Tip" color="tip" %}} -Device-specific models for Milesight nodes provide default values for `app_key`, `network_s_key`, `app_s_key`, `fport`, `decoder_path`, and `uplink_interval_mins`. +Device-specific models for Milesight nodes provide default values for `app_key` (for OTAA), `network_s_key` and `app_s_key` (for ABP), `fport`, `decoder_path`, and `uplink_interval_mins`. If you use a Milesight node, omit these fields from your configuration. {{% /alert %}} @@ -321,7 +321,7 @@ await node.do_command({"restart_sensor": {}}) ```dart final node = Sensor.fromRobot(robot, ''); -# restart node +// restart node await node.doCommand({ 'restart_sensor': {} }); ``` @@ -332,7 +332,7 @@ await node.doCommand({ 'restart_sensor': {} }); ```typescript const node = new SensorClient(client, ""); -# restart node +// restart node await node.doCommand({ restart_sensor: {} }); ``` @@ -347,7 +347,7 @@ await node.doCommand({ restart_sensor: {} }); {{< tabs >}} {{% tab name="Viam web app" %}} -To restart a node from the Viam web UI, specify a hexadecimal string in the following DoCommand input in the **CONTROL** tab of your machine page: +To send a downlink message to a node from the Viam web UI, specify a hexadecimal string in the following DoCommand input in the **CONTROL** tab of your machine page: ```json { @@ -367,7 +367,7 @@ The following example shows how to send downlink messages to a node from an SDK: node = await robot.get_component(Sensor.get_resource_name("")) # send downlink message in hexadecimal -await node.do_command({"downlink": "48656C6C6F"}) +await node.do_command({"send_downlink": "48656C6C6F"}) ``` {{% /tab %}} @@ -678,7 +678,7 @@ For more information, see [Visualize data](/data-ai/data/visualize/). - **Check network configuration**: - Ensure gateway is running with no error logs. - - Verify that the `gateway` field of the node contains an array that contains only a string that exactly matches the name of your gateway in your machine configuration (for example, `"gateway": [ "example-gateway" ]`). + - Verify that the `gateways` field of the node contains an array that contains only a string that exactly matches the name of your gateway in your machine configuration (for example, `"gateways": [ "example-gateway" ]`). - Verify that your gateway and node frequency regions match. - **Adjust positioning**: