-
Notifications
You must be signed in to change notification settings - Fork 48
DOCS-1637: Make ultrasonic
sensor page in micro-RDK
#2614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sguequierre
merged 7 commits into
viamrobotics:main
from
sguequierre:DOCS-1637/esp32-ultrasonic
Mar 7, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f3a5d01
Make ultrasonic sensor page
sguequierre d981e20
Update static/include/micro-rdk.md
sguequierre 6e14c29
Apply suggestions from code review
sguequierre caf63a6
Apply suggestions from code review
sguequierre 5754ba3
Update ultrasonic.md
sguequierre d68112d
Apply suggestions from code review
sguequierre fa52873
Update docs/build/micro-rdk/sensor/ultrasonic.md
sguequierre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: "Micro-RDK Sensor Models" | ||
linkTitle: "Sensor" | ||
weight: 30 | ||
type: "docs" | ||
description: "Support in the micro-RDK for sensors, devices that measure information about the outside world." | ||
images: ["/icons/components/sensor.svg"] | ||
tags: ["sensor", "components", "micro-rdk"] | ||
no_list: true | ||
# SMEs: Andrew Morrow | ||
--- | ||
|
||
A sensor is a device that can measure information about the outside world. | ||
For more information and models supported by the {{< glossary_tooltip term_id="rdk" text="RDK" >}}, see [Sensor Component](/components/sensor/). | ||
|
||
## Supported models | ||
|
||
For configuration information, click a supported sensor model name: | ||
|
||
<!-- prettier-ignore --> | ||
| Model |Description | | ||
| ----- | ---------- | | ||
| [`ultrasonic`](ultrasonic/) | [HC-SR04](https://www.sparkfun.com/products/15569) ultrasonic sensors | | ||
|
||
{{% readfile "/static/include/micro-create-your-own.md" %}} | ||
|
||
## API | ||
|
||
The micro-RDK [sensor API](/components/sensor/#api) supports only the following client SDK API methods, which operate the same as in the full-featured RDK: | ||
|
||
- [`GetReadings()`](/components/sensor/#getreadings) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
--- | ||
title: "Configure an Ultrasonic Sensor (Micro-RDK)" | ||
linkTitle: "ultrasonic" | ||
weight: 60 | ||
type: "docs" | ||
description: "Configure an ultrasonic sensor." | ||
tags: ["sensor", "components", "ultrasonic"] | ||
icon: true | ||
images: ["/icons/components/sensor.svg"] | ||
# SME: Andrew Morrow | ||
--- | ||
|
||
Configure an `ultrasonic` sensor to integrate the [HC-S204](https://www.sparkfun.com/products/15569) ultrasonic distance sensor into your machine: | ||
|
||
{{< tabs >}} | ||
{{% tab name="Config Builder" %}} | ||
|
||
Navigate to the **Config** tab of your machine's page in [the Viam app](https://app.viam.com). | ||
Click on the **Components** subtab and click **Create component**. | ||
Select the `sensor` type, then select the `ultrasonic` model. | ||
Enter a name for your sensor and click **Create**. | ||
|
||
 | ||
|
||
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>" | ||
} | ||
``` | ||
|
||
{{% /tab %}} | ||
{{% tab name="Attributes example" %}} | ||
|
||
```json {class="line-numbers linkable-line-numbers"} | ||
{ | ||
"trigger_pin": "15", | ||
"echo_interrupt_pin": "18" | ||
} | ||
``` | ||
|
||
{{% /tab %}} | ||
{{< /tabs >}} | ||
|
||
{{% /tab %}} | ||
{{% tab name="JSON Template" %}} | ||
|
||
```json {class="line-numbers linkable-line-numbers"} | ||
{ | ||
"components": [ | ||
{ | ||
"name": "<your-ultrasonic-sensor-name>", | ||
"model": "ultrasonic", | ||
"type": "sensor", | ||
"namespace": "rdk", | ||
"attributes": { | ||
"trigger_pin": "<pin-number>", | ||
"echo_interrupt_pin": "<pin-number>" | ||
}, | ||
"depends_on": [] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
{{% /tab %}} | ||
{{% tab name="JSON Example" %}} | ||
|
||
```json {class="line-numbers linkable-line-numbers"} | ||
{ | ||
"components": [ | ||
{ | ||
"name": "my-ultrasonic-sensor", | ||
"model": "ultrasonic", | ||
"type": "sensor", | ||
"namespace": "rdk", | ||
"attributes": { | ||
"trigger_pin": "15", | ||
"echo_interrupt_pin": "18" | ||
}, | ||
"depends_on": [] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
{{% /tab %}} | ||
{{% /tabs %}} | ||
|
||
The following attributes are available for `ultrasonic` sensors: | ||
|
||
<!-- prettier-ignore --> | ||
| Attribute | Type | Inclusion | Description | | ||
| --------- | ---- | --------- | ----------- | | ||
| `trigger_pin` | string | **Required** | The GPIO number of the [board's](/build/micro-rdk/board/) GPIO pin that you have wired to the trigger pin of your ultrasonic sensor. | | ||
| `echo_interrupt_pin` | string | **Required** | The GPIO number of the board's GPIO pin that you have wired to the echo pin of your ultrasonic sensor. Please note that unlike the RDK ultrasonic sensor, you must not use a named pin associated with a digital interrupt configured on your board: it will not (currently) work. | | ||
| `timeout_ms` | int | Optional | Time to wait in milliseconds before initiating a timeout when requesting readings from your ultrasonic sensor. <br> Default: `50` <br> Max: `100` | | ||
|
||
{{< readfile "/static/include/components/test-control/sensor-control.md" >}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,14 @@ The micro-RDK is a lightweight version of the {{% glossary_tooltip term_id="rdk" | |
|
||
The only microcontroller the micro-RDK currently supports is the [ESP32](https://www.espressif.com/en/products/socs/esp32). | ||
|
||
[Client API](/build/program/apis/) usage with the micro-RDK currently supports only the following {{< glossary_tooltip term_id="resource" text="resources" >}}: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great change! |
||
[Client API](/build/program/apis/) usage with the micro-RDK currently supports the following {{< glossary_tooltip term_id="resource" text="resources" >}}: | ||
|
||
- [Base](/build/micro-rdk/base/) | ||
- [Board](/build/micro-rdk/board/) | ||
- [Encoder](/build/micro-rdk/encoder/) | ||
- [Movement Sensor](/build/micro-rdk/movement-sensor/) | ||
- [Motor](/build/micro-rdk/motor/) | ||
- [Sensor](/build/micro-rdk/sensor/) | ||
- [Servo](/build/micro-rdk/servo/) | ||
- [Generic](/build/micro-rdk/generic/) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.