Skip to content

Commit

Permalink
DOCS-1243: Make ultrasonic components consistent with others (#1990)
Browse files Browse the repository at this point in the history
  • Loading branch information
JessamyT authored Oct 9, 2023
1 parent 98b9e0d commit dfad994
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 13 deletions.
Binary file modified assets/components/camera/configure-ultrasonic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/components/sensor/ultrasonic-sensor-ui-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 36 additions & 6 deletions docs/components/camera/ultrasonic.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,35 @@ Enter a name for your camera and click **Create**.

![Creation of a ultrasonic camera in the Viam app config builder.](/components/camera/configure-ultrasonic.png)

Edit and fill in the attributes as applicable.
Copy and paste the following attribute template into your camera's **Attributes** box.
Then remove and fill in the attributes as applicable to your camera, according to the table below.

{{< tabs >}}
{{% tab name="Attributes template" %}}

```json {class="line-numbers linkable-line-numbers"}
{
"trigger_pin": "<pin-number>",
"echo_interrupt_pin": "<pin-number>",
"board": "<your-board-name>",
"timeout_ms": <int>
}
```

{{% /tab %}}
{{% tab name="Attributes example" %}}

```json {class="line-numbers linkable-line-numbers"}
{
"trigger_pin": "5",
"echo_interrupt_pin": "15",
"board": "local",
"timeout_ms": "1200"
}
```

{{% /tab %}}
{{< /tabs >}}

{{% /tab %}}
{{% tab name="JSON Template" %}}
Expand All @@ -37,8 +65,9 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "<your-ultrasonic-sensor-name>",
"type": "camera",
"model": "ultrasonic",
"type": "camera",
"namespace": "rdk",
"attributes": {
"trigger_pin": "<pin-number>",
"echo_interrupt_pin": "<pin-number>",
Expand All @@ -58,14 +87,15 @@ Edit and fill in the attributes as applicable.
{
"components": [
{
"name": "your-ultrasonic-sensor",
"type": "camera",
"name": "my-ultrasonic-sensor",
"model": "ultrasonic",
"type": "camera",
"namespace": "rdk",
"attributes": {
"trigger_pin": "5",
"echo_interrupt_pin": "15",
"board": "your-board-name",
"timeout_ms": "1000"
"board": "local",
"timeout_ms": "1200"
},
"depends_on": []
}
Expand Down
45 changes: 45 additions & 0 deletions docs/components/component/model1.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,51 @@ Enter a name for your arm and click **Create**.

Edit and fill in the attributes as applicable.

<!-- If the model does not have a fancy config UI available, such that the user needs to write JSON attributes, refer to one of the other component models as an example. You should include easily copy-pastable attribute templates on the config tab. For example, replace "Edit and fill in the attributes as applicable." with the following:
Copy and paste the following attribute template into your COMPONENT's **Attributes** box.
Then remove and fill in the attributes as applicable to your COMPONENT, according to the table below.
{{< tabs >}}
{{% tab name="Attributes template" %}}
```json {class="line-numbers linkable-line-numbers"}
{
"stream": "<color|depth>",
"url": "<URL>",
"intrinsic_parameters": {
"width_px": <int>,
"height_px": <int>,
"fx": <float>,
"fy": <float>,
"ppx": <float>,
"ppy": <float>
},
"distortion_parameters": {
"rk1": <float>,
"rk2": <float>,
"rk3": <float>,
"tp1": <float>,
"tp2": <float>
},
"debug": <boolean>
}
```
{{% /tab %}}
{{% tab name="Attributes example" %}}
```json {class="line-numbers linkable-line-numbers"}
{
"stream": "color",
"url": "http://urltogetstreamingimagedatafrom"
}
```
{{% /tab %}}
{{< /tabs >}}
-->

{{% /tab %}}
{{% tab name="JSON Template" %}}

Expand Down
42 changes: 36 additions & 6 deletions docs/components/sensor/ultrasonic.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,35 @@ Enter a name for your sensor and click **Create**.

![Creation of a ultrasonic sensor in the Viam app config builder.](/components/sensor/ultrasonic-sensor-ui-config.png)

Edit and fill in the attributes as applicable.
Copy and paste the following attribute template into your sensor's **Attributes** box.
Then remove and fill in the attributes as applicable to your sensor, according to the table below.

{{< tabs >}}
{{% tab name="Attributes template" %}}

```json {class="line-numbers linkable-line-numbers"}
{
"trigger_pin": "<pin-number>",
"echo_interrupt_pin": "<pin-number>",
"board": "<your-board-name>",
"timeout_ms": <int>
}
```

{{% /tab %}}
{{% tab name="Attributes example" %}}

```json {class="line-numbers linkable-line-numbers"}
{
"trigger_pin": "5",
"echo_interrupt_pin": "15",
"board": "local",
"timeout_ms": "1200"
}
```

{{% /tab %}}
{{< /tabs >}}

{{% /tab %}}
{{% tab name="JSON Template" %}}
Expand All @@ -39,8 +67,9 @@ Edit and fill in the attributes as applicable.
"components": [
{
"name": "<your-ultrasonic-sensor-name>",
"type": "sensor",
"model": "ultrasonic",
"type": "sensor",
"namespace": "rdk",
"attributes": {
"trigger_pin": "<pin-number>",
"echo_interrupt_pin": "<pin-number>",
Expand All @@ -60,14 +89,15 @@ Edit and fill in the attributes as applicable.
{
"components": [
{
"name": "your-ultrasonic-sensor",
"type": "sensor",
"name": "my-ultrasonic-sensor",
"model": "ultrasonic",
"type": "sensor",
"namespace": "rdk",
"attributes": {
"trigger_pin": "5",
"echo_interrupt_pin": "15",
"board": "your-board-name",
"timeout_ms": "1000"
"board": "local",
"timeout_ms": "1200"
},
"depends_on": []
}
Expand Down
2 changes: 1 addition & 1 deletion static/include/components/ultrasonic-attributes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- prettier-ignore -->
| Attribute | Type | Inclusion | Description |
| --------- | ---- | --------- | ----------- |
| `board` | string | **Required** | The `name` of the [board](/components/board/) the ultrasonic is wired to. |
| `trigger_pin` | string | **Required** | The {{< glossary_tooltip term_id="pin-number" text="pin number" >}} of the [board's](/components/board/) GPIO pin that you have wired [the ultrasonic's trigger pin](https://www.sparkfun.com/products/15569) to. |
| `echo_interrupt_pin` | string | **Required** | The {{< glossary_tooltip term_id="pin-number" text="pin number" >}} of the pin [the ultrasonic's echo pin](https://www.sparkfun.com/products/15569) is wired to on the board. If you have already created a [digital interrupt](/components/board/#digital_interrupts) for this pin in the [board's configuration](/components/board/), use that digital interrupt's `name` instead. |
| `board` | string | **Required** | The `name` of the [board](/components/board/) the ultrasonic is wired to. |
| `timeout_ms` | int | Optional | Time to wait in milliseconds before timing out of requesting to get ultrasonic distance readings. <br> Default: `1000`. |

0 comments on commit dfad994

Please sign in to comment.