Skip to content

Commit

Permalink
DOCS-3167: Update python doc strings for tabular_data_by_sql (#3717)
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel authored Dec 2, 2024
1 parent 8b3a00b commit 49b57ef
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 28 deletions.
16 changes: 4 additions & 12 deletions static/include/app/apis/generated/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Obtain unified tabular data and metadata, queried with SQL.

**Returns:**

- (List[Dict[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), viam.utils.ValueTypes | [datetime.datetime](https://docs.python.org/3/library/datetime.html)]]): An array of data objects.
- (List[Dict[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), viam.utils.ValueTypes | [datetime.datetime](https://docs.python.org/3/library/datetime.html)]]): An array of decoded BSON data objects.

**Example:**

Expand All @@ -82,32 +82,24 @@ Obtain unified tabular data and metadata, queried with MQL.
**Parameters:**

- `organization_id` ([str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str)) (required): The ID of the organization that owns the data. You can obtain your organization ID from the Viam app’s organization settings page.
- `mql_binary` (List[[bytes](https://docs.python.org/3/library/stdtypes.html#bytes-objects)]) (required): The MQL query to run as a list of BSON queries. You can encode your bson queries using a library like pymongo or bson.
- `mql_binary` (List[[bytes](https://docs.python.org/3/library/stdtypes.html#bytes-objects)]) (required): The MQL query to run as a list of BSON queries. You can encode your bson queries using a library like pymongo.

**Returns:**

- (List[Dict[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), viam.utils.ValueTypes | [datetime.datetime](https://docs.python.org/3/library/datetime.html)]]): An array of data objects.
- (List[Dict[[str](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str), viam.utils.ValueTypes | [datetime.datetime](https://docs.python.org/3/library/datetime.html)]]): An array of decoded BSON data objects.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
import bson

# using bson package (pip install bson)
tabular_data = await data_client.tabular_data_by_mql(organization_id="<YOUR-ORG-ID>", mql_binary=[
bson.dumps({ '$match': { 'location_id': '<YOUR-LOCATION-ID>' } }),
bson.dumps({ '$limit': 5 })
])

print(f"Tabular Data 1: {tabular_data}")

# using pymongo package (pip install pymongo)
tabular_data = await data_client.tabular_data_by_mql(organization_id="<YOUR-ORG-ID>", mql_binary=[
bson.encode({ '$match': { 'location_id': '<YOUR-LOCATION-ID>' } }),
bson.encode({ "$limit": 5 })
])

print(f"Tabular Data 2: {tabular_data}")
print(f"Tabular Data: {tabular_data}")
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/app/data_client/index.html#viam.app.data_client.DataClient.tabular_data_by_mql).
Expand Down
1 change: 1 addition & 0 deletions static/include/components/apis/generated/arm-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
| [`GetEndPosition`](/appendix/apis/components/arm/#getendposition) | Get the current position of the arm as a pose. |
| [`MoveToPosition`](/appendix/apis/components/arm/#movetoposition) | Move the end of the arm in a straight line to the desired pose, relative to the base of the arm. |
| [`MoveToJointPositions`](/appendix/apis/components/arm/#movetojointpositions) | Move each joint on the arm to the position specified in `positions`. |
| [`MoveThroughJointPositions`](/appendix/apis/components/arm/#movethroughjointpositions) | Move the arm's joints through the given positions in the order they are specified. |
| [`GetJointPositions`](/appendix/apis/components/arm/#getjointpositions) | Get the current position of each joint on the arm. |
| [`GetKinematics`](/appendix/apis/components/arm/#getkinematics) | Get the kinematics information associated with the arm as the format and byte contents of the kinematics file. |
| [`IsMoving`](/appendix/apis/components/arm/#ismoving) | Get if the arm is currently moving. |
Expand Down
24 changes: 24 additions & 0 deletions static/include/components/apis/generated/arm.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,30 @@ For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_s
{{% /tab %}}
{{< /tabs >}}

### MoveThroughJointPositions

Move the arm's joints through the given positions in the order they are specified.
This will block until done or a new operation cancels this one.

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

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
- `positions` [([][]referenceframe.Input)](https://pkg.go.dev/go.viam.com/rdk/referenceframe#Input)
- `options` [(*MoveOptions)](https://pkg.go.dev/go.viam.com/rdk/components/arm#MoveOptions)
- `extra` [(map[string]interface{})](https://go.dev/blog/maps): Extra options to pass to the underlying RPC call.

**Returns:**

- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/components/arm#Arm).

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

### GetJointPositions

Get the current position of each joint on the arm.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Move the arm's joints through the given positions in the order they are specified.
This will block until done or a new operation cancels this one.
20 changes: 20 additions & 0 deletions static/include/robot/apis/generated/robot.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,26 @@ const componentConfigs = await machine.discoverComponents(queries);

For more information, see the [Typescript SDK Docs](https://ts.viam.dev/classes/RobotClient.html).

{{% /tab %}}
{{% tab name="Flutter" %}}

**Parameters:**

- `queries` [List](https://api.flutter.dev/flutter/dart-core/List-class.html)\<[DiscoveryQuery](https://flutter.viam.dev/viam_sdk/DiscoveryQuery-class.html)\> (required)

**Returns:**

- [Future](https://api.flutter.dev/flutter/dart-async/Future-class.html)\<[List](https://api.flutter.dev/flutter/dart-core/List-class.html)\<[Discovery](https://flutter.viam.dev/viam_sdk/Discovery-class.html)\>\>

**Example:**

```dart {class="line-numbers linkable-line-numbers"}
var queries = [DiscoveryQuery(subtype: 'camera', model: 'webcam', extra: {'username': 'admin', 'password': 'admin'})];
var discoveredComponents = await machine.discoverComponents(queries);
```

For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_sdk/RobotClient/discoverComponents.html).

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

Expand Down
17 changes: 1 addition & 16 deletions static/include/services/apis/generated/mlmodel.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import numpy as np

my_mlmodel = MLModelClient.from_robot(robot=machine, name="my_mlmodel_service")

output_tensors = await my_mlmodel.infer(input_tensors)

image_data = np.zeros((1, 384, 384, 3), dtype=np.uint8)

# Create the input tensors dictionary
Expand Down Expand Up @@ -52,20 +50,7 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/
**Example:**

```go {class="line-numbers linkable-line-numbers"}
import (
"go.viam.com/rdk/ml"
"gorgonia.org/tensor"
)

myMLModel, err := mlmodel.FromRobot(machine, "my_mlmodel_service")

input_tensors := ml.Tensors{
"image": tensor.New(
tensor.Of(tensor.Uint8),
tensor.WithShape(1, 384, 384, 3),
tensor.WithBacking(make([]uint8, 1*384*384*3)),
),
}
input_tensors := ml.Tensors{"0": tensor.New(tensor.WithShape(1, 2, 3), tensor.WithBacking([]int{1, 2, 3, 4, 5, 6}))}

output_tensors, err := myMLModel.Infer(context.Background(), input_tensors)
```
Expand Down

0 comments on commit 49b57ef

Please sign in to comment.