Skip to content

Commit

Permalink
Merge branch 'main' into R2D2
Browse files Browse the repository at this point in the history
  • Loading branch information
sguequierre authored Mar 6, 2024
2 parents 99f8e66 + c12ecb5 commit d428b64
Show file tree
Hide file tree
Showing 130 changed files with 2,147 additions and 873 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_python_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def parse(type, names):
service = "data-client"

if service == "app_client":
service = "cloud"
service = "fleet"

# Find all python methods objects on Python docs site soup
py_methods_sdk_docs = soup.find_all("dl", class_="py method")
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.venv
.jpg_original
.jpeg_original
.png_original
Expand Down
Binary file added assets/data/data-sync-temp.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/get-started/installation/rpi-setup/advanced-options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/get-started/installation/rpi-setup/imager-done.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/get-started/installation/rpi-setup/imager-permission.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/get-started/installation/rpi-setup/imager-set-ssh.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/get-started/installation/rpi-setup/imager-set-wifi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/get-started/installation/rpi-setup/imager-writing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/get-started/installation/rpi-setup/select-other-rpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/mobility/motion/motion-rc-card.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 added assets/mobility/slam/imu-capture.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 added assets/mobility/slam/merged-capture.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 added assets/mobility/slam/odometer-capture.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 added assets/mobility/slam/rplidar-capture.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 added assets/mobility/slam/select-merged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions assets/scss/_styles_project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ a > code {
p, li {
color: #515151;
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
}
Expand Down Expand Up @@ -370,11 +373,11 @@ END MARKETING CSS
}

.alert a {
text-decoration: underline;
text-decoration: none;
}

.alert a:hover {
text-decoration: none;
text-decoration: underline;
}


Expand Down Expand Up @@ -484,6 +487,10 @@ END MARKETING CSS
color: black;
}

.hover-card > a > div {
color: black;
}

.hover-card > div > div {
margin-bottom: 0.5rem;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/appendix/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ The `2gif` commands only turn the first 5 seconds of a video into a low res gif.

{{% alert title="Note" color="note" %}}

If you use `webmSrc` and `mp4Src` to add a card video for a page (such as to a tutorial), you should also add a <file>.gif</file> version of the video to the front matter.
If you use `videos` to add a video preview for a page (such as to a tutorial), you should also add a <file>.gif</file> version of the video to the front matter.
Hugo uses the GIF as a link preview image that gets displayed on external sites when someone shares the link, for example on Slack or Twitter.

Why?
Expand Down
2 changes: 1 addition & 1 deletion docs/appendix/glossary/modular-resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Modular Resource
id: modular-resource
full_link: /registry/
short_description: A modular resource is a custom model of a component or service that implements the standadized API methods for that resource.
short_description: A modular resource is a custom model of a component or service that implements the standardized API methods for that resource.
aka:
---

Expand Down
12 changes: 12 additions & 0 deletions docs/appendix/glossary/viam-agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Viam Agent
id: viam-agent
full_link:
short_description: The Viam provisioning application for deploying viam-server.
aka:
---

The Viam Agent is a provisioning application for deploying and managing `viam-server` across a fleet of machines.
You can use the Viam Agent to provision a machine as it first comes online with a pre-defined configuration, including WiFi networks or additional build or provision steps.

See [Provision Machines](/build/provision/) for more information.
1 change: 1 addition & 0 deletions docs/build/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ For example, you can send the same commands to any kind of motor, using any of t
{{% card link="/build/configure/" %}}
{{% card link="/build/program/" %}}
{{% card link="/build/micro-rdk/" %}}
{{% card link="/build/provision/" %}}
{{< /cards >}}
2 changes: 1 addition & 1 deletion docs/build/configure/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ Switch to **Raw JSON** mode to configure webhooks as follows:
"Robot-ID": request.headers['robot-id'] if 'robot-id' in request.headers else 'no value'
}

slack_url = "<paste in your own Slack URL"
slack_url = "<paste in your own Slack URL>"
headers = {}

response = requests.post(slack_url, json=payload, headers=headers)
Expand Down
4 changes: 2 additions & 2 deletions docs/build/micro-rdk/motor/gpio.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ The following attributes are available for `gpio` motors:
| ---- | ---- | --------- | ----------- |
| `board` | string | **Required** | `name` of the [board](/build/micro-rdk/board/) to which the motor driver is wired. |
| `pins` | object | **Required** | A structure that holds pin configuration information; [see below](#pins). |
| `min_power_pct` | number | Optional | Sets a limit on minimum power percentage sent to the motor. <br> Default: `0.0` |
| `max_power_pct` | number | Optional | Range is 0.06 to 1.0; sets a limit on maximum power percentage sent to the motor. <br> Default: `1.0` |
| `min_power_pct` | float | Optional | Sets a limit on minimum power percentage sent to the motor. <br> Default: `0.0` |
| `max_power_pct` | float | Optional | Range is 0.06 to 1.0; sets a limit on maximum power percentage sent to the motor. <br> Default: `1.0` |
| `pwm_freq` | int | Optional | Sets the PWM pulse frequency in Hz. Many motors operate optimally in the kHz range. <br> Default: `800` |
| `dir_flip` | bool | Optional | Flips the direction of "forward" versus "backward" rotation. Default: `false` |
| `encoder` | string | Optional | The name of an encoder attached to this motor. See [encoded motor](/components/motor/gpio/encoded-motor/). |
Expand Down
4 changes: 4 additions & 0 deletions docs/build/program/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ go get go.viam.com/rdk/robot/client
npm install --save @viamrobotics/sdk
```

{{< alert title="Info" color="info" >}}
The TypeScript SDK currently only supports building web browser apps.
{{< /alert >}}

{{% /tab %}}
{{% tab name="C++" %}}

Expand Down
6 changes: 3 additions & 3 deletions docs/build/program/apis/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ All machines support the following methods through the [robot API](/build/progra

{{< readfile "/static/include/services/apis/robot.md" >}}

### Cloud API
### Fleet management API

The [cloud API](/build/program/apis/cloud/) supports the following methods:
The [fleet management API](/build/program/apis/fleet/) supports the following methods:

{{< readfile "/static/include/services/apis/cloud.md" >}}
{{< readfile "/static/include/services/apis/fleet.md" >}}

### Data client API

Expand Down
243 changes: 238 additions & 5 deletions docs/build/program/apis/data-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ Data client API methods are only available in the Python SDK.

## Establish a connection

To use the Viam data client API, you first need to instantiate a [`ViamClient`](https://python.viam.dev/autoapi/viam/app/viam_client/index.html#viam.app.viam_client.ViamClient) and then instantiate an [`DataClient`](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient).
To use the Viam data client API, you first need to instantiate a [`ViamClient`](https://python.viam.dev/autoapi/viam/app/viam_client/index.html#viam.app.viam_client.ViamClient) and then instantiate a [`DataClient`](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient).

You will also need an API key and API key ID to authenticate your session.
To get an API key (and corresponding ID), you have two options:
See the following example for reference.

<!-- After sveltekit migration we should also be able to get a key from the UI-->
To get an API key and API key ID to authenticate, you have two options:

Use the Viam CLI [to generate an API key to authenticate](/fleet/cli/#authenticate).
- [Create an API key using the Viam app](/fleet/rbac/#add-an-api-key)
- [Create an API key using the Viam CLI](/fleet/cli/#create-an-organization-api-key)

```python {class="line-numbers linkable-line-numbers"}
import asyncio
Expand Down Expand Up @@ -74,8 +78,8 @@ Once you have instantiated a `DataClient`, you can run the following [API method
## Find part ID

To find the ID of your machine part, navigate to its **Setup** tab in the [Viam app](https://app.viam.com).
Keep architecture selection at default.
In Step 1, grab the part id from the second string of the generated command as the token following `id=`.
Select any of the Linux architecture tabs.
In Step 1, grab the part ID from the second string of the generated command as the token following `id=`.
For example:

![Part ID displayed in the Viam app.](/build/program/data-client/grab-part-id.png)
Expand Down Expand Up @@ -842,3 +846,232 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/

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

### CreateDataset

Create a new dataset.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `name` [(str)](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str): The name of the dataset being created.
- `organization_id` [(str)](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str): The ID of the organization where the dataset is being created.

**Returns:**

- [(str)](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str): The dataset ID of the created dataset.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.create_dataset).

```python {class="line-numbers linkable-line-numbers"}
name = await data_client.create_dataset(
name="<dataset-name>",
organization_id="<your-org-id>"
)
print(name)
```

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

### ListDatasetByIds

Get a list of datasets using their IDs.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `ids` (List[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)]): The IDs of the datasets being called for.

**Returns:**

- (Sequence[[Dataset](https://python.viam.dev/autoapi/viam/gen/app/dataset/v1/dataset_pb2/index.html#viam.gen.app.dataset.v1.dataset_pb2.Dataset)]): The list of datasets.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.list_dataset_by_ids).

```python {class="line-numbers linkable-line-numbers"}
datasets = await data_client.list_dataset_by_ids(
ids=["abcd-1234xyz-8765z-123abc"]
)
print(datasets)
```

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

### ListDatasetByOrganizationId

Get the datasets in an organization.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `organization_id` [(str)](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str): The ID of the organization.

**Returns:**

- (Sequence[[Dataset](https://python.viam.dev/autoapi/viam/gen/app/dataset/v1/dataset_pb2/index.html#viam.gen.app.dataset.v1.dataset_pb2.Dataset)]): The list of datasets in the organization.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.list_datasets_by_organization_id).

```python {class="line-numbers linkable-line-numbers"}
datasets = await data_client.list_datasets_by_organization_id(
organization_id="<your-org-id>"
)
print(datasets)
```

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

### RenameDataset

Rename a dataset specified by the dataset ID.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `id` [(str)](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str): The ID of the dataset.
- `name` [(str)](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str): The new name of the dataset.

**Returns:**

- None.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.rename_dataset).

```python {class="line-numbers linkable-line-numbers"}
await data_client.rename_dataset(
id="abcd-1234xyz-8765z-123abc",
name="<dataset-name>"
)
```

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

### DeleteDataset

Delete a dataset.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `id` [(str)](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str): The ID of the dataset.

**Returns:**

- None.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.delete_dataset).

```python {class="line-numbers linkable-line-numbers"}
await data_client.delete_dataset(
id="abcd-1234xyz-8765z-123abc"
)
```

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

### AddBinaryDataToDatasetByIds

Add the [BinaryData](https://python.viam.dev/autoapi/viam/proto/app/data/index.html#viam.proto.app.data.BinaryData) to the provided dataset.
This BinaryData will be tagged with the VIAM_DATASET\_{id} label.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `binary_ids` (List[[BinaryID](https://python.viam.dev/autoapi/viam/gen/app/data/v1/data_pb2/index.html#viam.gen.app.data.v1.data_pb2.BinaryID "viam.gen.app.data.v1.data_pb2.BinaryID")]): The IDs of binary data to add to dataset.
- `dataset_id` [(str)](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str): The ID of the dataset to be added to.

**Returns:**

- None.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.add_binary_data_to_dataset_by_ids).

```python {class="line-numbers linkable-line-numbers"}
from viam.proto.app.data import BinaryID

binary_metadata = await data_client.binary_data_by_filter(
include_file_data=False
)

my_binary_ids = []

for obj in binary_metadata:
my_binary_ids.append(
BinaryID(
file_id=obj.metadata.id,
organization_id=obj.metadata.capture_metadata.organization_id,
location_id=obj.metadata.capture_metadata.location_id
)
)

await data_client.add_binary_data_to_dataset_by_ids(
binary_ids=my_binary_ids,
dataset_id="abcd-1234xyz-8765z-123abc"
)
```

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

### RemoveBinaryDataFromDatasetByIds

Remove the BinaryData from the provided dataset.
This BinaryData will lose the VIAM_DATASET\_{id} tag.

{{< tabs >}}
{{% tab name="Python" %}}

**Parameters:**

- `binary_ids` (List[[BinaryID](https://python.viam.dev/autoapi/viam/gen/app/data/v1/data_pb2/index.html#viam.gen.app.data.v1.data_pb2.BinaryID "viam.gen.app.data.v1.data_pb2.BinaryID")]): The IDs of binary data to remove from dataset.
- `dataset_id` [(str)](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str): The ID of the dataset to be removed from.

**Returns:**

- None.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.remove_binary_data_from_dataset_by_ids).

```python {class="line-numbers linkable-line-numbers"}
from viam.proto.app.data import BinaryID

binary_metadata = await data_client.binary_data_by_filter(
include_file_data=False
)

my_binary_ids = []

for obj in binary_metadata:
my_binary_ids.append(
BinaryID(
file_id=obj.metadata.id,
organization_id=obj.metadata.capture_metadata.organization_id,
location_id=obj.metadata.capture_metadata.location_id
)
)

await data_client.remove_binary_data_from_dataset_by_ids(
binary_ids=my_binary_ids,
dataset_id="abcd-1234xyz-8765z-123abc"
)
```

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

0 comments on commit d428b64

Please sign in to comment.