|
| 1 | +# `refill-controller` module |
| 2 | + |
| 3 | +This [module](https://docs.viam.com/registry/modular-resources/) implements the [`rdk:service:generic` API](https://docs.viam.com/appendix/apis/services/generic/) for the Smart Snack Dispenser demo. |
| 4 | + |
| 5 | +With this model, you can set up automated refilling of a snack bowl from a motorized dispenser using computer vision. |
| 6 | + |
| 7 | +## Requirements |
| 8 | + |
| 9 | +This module assumes you have a Viam machine configured with a camera component, a motor component, and a vision service that can perform image classification. |
| 10 | + |
| 11 | +## Model: viam-demo:refill-controller:refiller |
| 12 | + |
| 13 | +With this model, you can set up automated refilling of a snack bowl from a motorized dispenser using computer vision. |
| 14 | + |
| 15 | +Navigate to the [**CONFIGURE** tab](https://docs.viam.com/configure/) of your [machine](https://docs.viam.com/fleet/machines/) in the [Viam app](https://app.viam.com/). |
| 16 | +[Add `viam-demo:refill-controller` to your machine](https://docs.viam.com/configure/#services). |
| 17 | + |
| 18 | +### Attributes |
| 19 | + |
| 20 | +The following attributes are available for `viam-demo:refill-controller:refiller` generic service: |
| 21 | + |
| 22 | +| Name | Type | Required? | Default | Description | |
| 23 | +| ------- | ------ | ------------ | ------- | ----------- | |
| 24 | +| `camera_name` | string | Required | N/A | The name of the camera component to use to get images. | |
| 25 | +| `motor_name` | string | Required | N/A | The name of the motor component to use to dispense snacks. | |
| 26 | +| `vision_name` | string | Required | N/A | The name of the vision service to use to get classifications using the image from the camera. | |
| 27 | +| `confidence_level` | number | Optional | 0.55 | Number between 0 and 1 as a minimum percentage of confidence for the returned classifications from the vision service | |
| 28 | + |
| 29 | +### Example configuration |
| 30 | + |
| 31 | +```json |
| 32 | +{ |
| 33 | + "camera_name": "camera-1", |
| 34 | + "motor_name": "motor-1", |
| 35 | + "vision_name": "vision-1" |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | +## Commands |
| 40 | + |
| 41 | +This module implements the following commands to be used by the `DoCommand` method in the Control tab of the Viam app or one of the language SDKs. |
| 42 | + |
| 43 | +**start** |
| 44 | + |
| 45 | +Start the control loop for detecting an empty bowl and triggering refills. |
| 46 | + |
| 47 | +```json |
| 48 | +{ |
| 49 | + "start": [] |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +**stop** |
| 54 | + |
| 55 | +Stop the control loop. |
| 56 | + |
| 57 | +```json |
| 58 | +{ |
| 59 | + "stop": [] |
| 60 | +} |
| 61 | +``` |
0 commit comments