Skip to content

Commit

Permalink
DOCS-2165: Add Name to board API (#3127)
Browse files Browse the repository at this point in the history
  • Loading branch information
andf-viam authored Jul 12, 2024
1 parent a2a4601 commit d7b3cab
Show file tree
Hide file tree
Showing 63 changed files with 537 additions and 43 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/sdk_protos_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ arm,GetGeometries,get_geometries,Geometries,
arm,Reconfigure,,Reconfigure,
arm,DoCommand,do_command,DoCommand,doCommand
arm,FromRobot,,,fromRobot
arm,Name,,,getResourceName
arm,GetResourceName,get_resource_name,,getResourceName
arm,Close,close,Close,

## Base
Expand All @@ -29,7 +29,7 @@ base,GetGeometries,get_geometries,Geometries,
base,Reconfigure,,Reconfigure,
base,DoCommand,do_command,DoCommand,doCommand
base,FromRobot,,,fromRobot
base,Name,,,getResourceName
base,GetResourceName,get_resource_name,,getResourceName
base,Close,close,Close,

## Board
Expand Down Expand Up @@ -57,7 +57,8 @@ board,GPIOPinByName,gpio_pin_by_name,GPIOPinByName,
board,Reconfigure,,Reconfigure,
board,DoCommand,do_command,DoCommand,doCommand
board,FromRobot,,,fromRobot
board,Name,,,getResourceName
board,Name,,Name,
board,GetResourceName,get_resource_name,,getResourceName
board,Close,close,Close,

## Camera
Expand All @@ -71,7 +72,7 @@ camera,DoCommand,do_command,,doCommand
camera,GetGeometries,get_geometries,,
## HACK: No proto for close, manually mapping:
camera,FromRobot,,,fromRobot
camera,Name,,,getResourceName
camera,GetResourceName,get_resource_name,,getResourceName
camera,Close,close,Close,

## Encoder
Expand All @@ -82,6 +83,7 @@ encoder,GetGeometries,get_geometries,,
## HACK: No proto for these (and/or inherited in Go SDK), manually mapping:
encoder,Reconfigure,,Reconfigure,
encoder,DoCommand,do_command,DoCommand,
encoder,GetResourceName,get_resource_name,,
encoder,Close,close,Close,

## Gantry
Expand All @@ -97,7 +99,7 @@ gantry,Stop,stop,Stop,stop
gantry,Reconfigure,,Reconfigure,
gantry,DoCommand,do_command,DoCommand,doCommand
gantry,FromRobot,,,fromRobot
gantry,Name,,,getResourceName
gantry,GetResourceName,get_resource_name,,getResourceName
gantry,Close,close,Close,

## Generic Component
Expand All @@ -107,7 +109,7 @@ generic_component,GetGeometries,get_geometries,,
## HACK: No proto for close, manually mapping:
## NOTED: Go SDK also missing Close, but we have it in our docs?:
generic_component,FromRobot,,,fromRobot
generic_component,Name,,,getResourceName
generic_component,GetResourceName,get_resource_name,,getResourceName
generic_component,Close,close,,

## Gripper
Expand All @@ -120,7 +122,7 @@ gripper,GetGeometries,get_geometries,Geometries,
gripper,Reconfigure,,Reconfigure,
gripper,DoCommand,do_command,DoCommand,doCommand
gripper,FromRobot,,,fromRobot
gripper,Name,,,getResourceName
gripper,GetResourceName,get_resource_name,,getResourceName
gripper,Close,close,Close,

## Input Controller
Expand All @@ -135,6 +137,7 @@ input_controller,RegisterControlCallback,register_control_callback,RegisterContr
## HACK: No proto for these (and/or inherited in Go SDK), manually mapping:
input_controller,Reconfigure,,Reconfigure,
input_controller,DoCommand,do_command,DoCommand,
input_controller,GetResourceName,get_resource_name,,
input_controller,Close,close,Close,

## Motor
Expand All @@ -153,7 +156,7 @@ motor,Stop,stop,Stop,stop
motor,Reconfigure,,Reconfigure,
motor,DoCommand,do_command,DoCommand,doCommand
motor,FromRobot,,,fromRobot
motor,Name,,,getResourceName
motor,GetResourceName,get_resource_name,,getResourceName
motor,Close,close,Close,

## Movement Sensor
Expand All @@ -172,7 +175,7 @@ movement_sensor,GetReadings,get_readings,Readings,readings
movement_sensor,Reconfigure,,Reconfigure,
movement_sensor,DoCommand,do_command,DoCommand,doCommand
movement_sensor,FromRobot,,,fromRobot
movement_sensor,Name,,,getResourceName
movement_sensor,GetResourceName,get_resource_name,,getResourceName
movement_sensor,Close,close,Close,

## Power Sensor
Expand All @@ -187,7 +190,7 @@ power_sensor,GetGeometries,get_geometries,,
power_sensor,Reconfigure,,Reconfigure,
power_sensor,DoCommand,do_command,DoCommand,doCommand
power_sensor,FromRobot,,,fromRobot
power_sensor,Name,,,getResourceName
power_sensor,GetResourceName,get_resource_name,,getResourceName
power_sensor,Close,close,Close,

## Sensor
Expand All @@ -197,7 +200,7 @@ sensor,GetGeometries,get_geometries,,
sensor,Reconfigure,,Reconfigure,
sensor,DoCommand,do_command,DoCommand,doCommand
sensor,FromRobot,,,fromRobot
sensor,Name,,,getResourceName
sensor,GetResourceName,get_resource_name,,getResourceName
sensor,Close,close,Close,

## Servo
Expand All @@ -210,7 +213,7 @@ servo,Stop,stop,Stop,stop
servo,Reconfigure,,Reconfigure,
servo,DoCommand,do_command,DoCommand,doCommand
servo,FromRobot,,,fromRobot
servo,Name,,,getResourceName
servo,GetResourceName,get_resource_name,,getResourceName
servo,Close,close,Close,

## Base Remote Control
Expand All @@ -231,6 +234,7 @@ data_manager,Close,,Close,
## Generic Service
## NOTED:Generic Component in Go SDK doesn't appear to implement (inherit) these:
generic_service,DoCommand,do_command,DoCommand,
generic_service,GetResourceName,get_resource_name,,
## HACK: No proto for close, manually mapping:
## NOTED: Go SDK also missing Close, but we have it in our docs?:
generic_service,Close,close,,
Expand All @@ -241,6 +245,7 @@ mlmodel,Metadata,metadata,Metadata,
## HACK: No proto for DoCommand or Close (and/or inherited in Go SDK), manually mapping:
mlmodel,Reconfigure,,Reconfigure,
mlmodel,DoCommand,do_command,DoCommand,
mlmodel,GetResourceName,get_resource_name,,
mlmodel,Close,close,Close,

## Motion
Expand All @@ -254,6 +259,7 @@ motion,GetPlan,get_plan,PlanHistory,
## HACK: No proto for these (and/or inherited in Go SDK), manually mapping:
motion,Reconfigure,,Reconfigure,
motion,DoCommand,do_command,DoCommand,
motion,GetResourceName,get_resource_name,,
motion,Close,close,Close,

## Navigation
Expand All @@ -269,6 +275,7 @@ navigation,GetProperties,get_properties,Properties,
## HACK: No proto for these (and/or inherited in Go SDK), manually mapping:
navigation,Reconfigure,,Reconfigure,
navigation,DoCommand,do_command,DoCommand,
navigation,GetResourceName,get_resource_name,,
navigation,Close,close,Close,

## SLAM
Expand All @@ -284,6 +291,7 @@ slam,PointCloudMapFull,,PointCloudMapFull,
## HACK: No proto for these (and/or inherited in Go SDK), manually mapping:
slam,Reconfigure,,Reconfigure,
slam,DoCommand,do_command,DoCommand,
slam,GetResourceName,get_resource_name,,
slam,Close,close,Close,

## Vision
Expand All @@ -297,7 +305,7 @@ vision,CaptureAllFromCamera,capture_all_from_camera,CaptureAllFromCamera,
vision,Reconfigure,,Reconfigure,
vision,DoCommand,do_command,DoCommand,doCommand
vision,FromRobot,,,fromRobot
vision,Name,,,getResourceName
vision,GetResourceName,get_resource_name,,getResourceName
vision,GetProperties,get_properties,GetProperties,
vision,Close,close,Close,

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/update_sdk_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,11 +976,11 @@ def parse(type, names):

id = tag.find("dt", class_="sig sig-object py").get("id")

if not id.endswith(".from_robot") and not id.endswith(".get_resource_name") \
and not id.endswith(".get_operation") and not id.endswith(".from_proto") \
and not id.endswith(".to_proto") and not id.endswith(".from_string") \
and not id.endswith("__") and not id.endswith("HasField") \
and not id.endswith("WhichOneof") and not id in python_ignore_apis:
if not id.endswith(".from_robot") and not id.endswith(".get_operation") \
and not id.endswith(".from_proto") and not id.endswith(".to_proto") \
and not id.endswith(".from_string") and not id.endswith("__") \
and not id.endswith("HasField") and not id.endswith("WhichOneof") \
and not id in python_ignore_apis:

## Determine method name, but don't save to dictionary as value; we use it as a key instead:
method_name = id.rsplit('.',1)[1]
Expand Down
2 changes: 1 addition & 1 deletion static/include/components/apis/generated/arm-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
| [`Reconfigure`](/components/arm/#reconfigure) | Reconfigure this resource. |
| [`DoCommand`](/components/arm/#docommand) | Execute model-specific commands that are not otherwise defined by the component API. |
| [`FromRobot`](/components/arm/#fromrobot) | Get the resource from the provided robot with the given name. |
| [`Name`](/components/arm/#name) | Get the `ResourceName` for this arm with the given name. |
| [`GetResourceName`](/components/arm/#getresourcename) | Get the `ResourceName` for this arm with the given name. |
| [`Close`](/components/arm/#close) | Safely shut down the resource and prevent further use. |
22 changes: 21 additions & 1 deletion static/include/components/apis/generated/arm.md
Original file line number Diff line number Diff line change
Expand Up @@ -709,11 +709,31 @@ For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_s
{{% /tab %}}
{{< /tabs >}}

### Name
### GetResourceName

Get the `ResourceName` for this arm with the given name.

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

**Parameters:**

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

**Returns:**

- ([viam.proto.common.ResourceName](https://python.viam.dev/autoapi/viam/proto/common/index.html#viam.proto.common.ResourceName)): The ResourceName of this Resource.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
# Can be used with any resource, using an arm as an example
my_arm_name = my_arm.get_resource_name("my_arm")
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/arm/client/index.html#viam.components.arm.client.ArmClient.get_resource_name).

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

**Parameters:**
Expand Down
2 changes: 1 addition & 1 deletion static/include/components/apis/generated/base-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
| [`Reconfigure`](/components/base/#reconfigure) | Reconfigure this resource. |
| [`DoCommand`](/components/base/#docommand) | Execute model-specific commands that are not otherwise defined by the component API. |
| [`FromRobot`](/components/base/#fromrobot) | Get the resource from the provided robot with the given name. |
| [`Name`](/components/base/#name) | Get the `ResourceName` for this base with the given name. |
| [`GetResourceName`](/components/base/#getresourcename) | Get the `ResourceName` for this base with the given name. |
| [`Close`](/components/base/#close) | Safely shut down the resource and prevent further use. |
22 changes: 21 additions & 1 deletion static/include/components/apis/generated/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -777,11 +777,31 @@ For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_s
{{% /tab %}}
{{< /tabs >}}

### Name
### GetResourceName

Get the `ResourceName` for this base with the given name.

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

**Parameters:**

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

**Returns:**

- ([viam.proto.common.ResourceName](https://python.viam.dev/autoapi/viam/proto/common/index.html#viam.proto.common.ResourceName)): The ResourceName of this Resource.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
# Can be used with any resource, using an arm as an example
my_arm_name = my_arm.get_resource_name("my_arm")
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/base/client/index.html#viam.components.base.client.BaseClient.get_resource_name).

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

**Parameters:**
Expand Down
3 changes: 2 additions & 1 deletion static/include/components/apis/generated/board-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
| [`Reconfigure`](/components/board/#reconfigure) | Reconfigure this resource. |
| [`DoCommand`](/components/board/#docommand) | Execute model-specific commands that are not otherwise defined by the component API. |
| [`FromRobot`](/components/board/#fromrobot) | Get the resource from the provided robot with the given name. |
| [`Name`](/components/board/#name) | Get the `ResourceName` for this board with the given name. |
| [`Name`](/components/board/#name) | Get the name of the digital interrupt. |
| [`GetResourceName`](/components/board/#getresourcename) | Get the `ResourceName` for this board with the given name. |
| [`Close`](/components/board/#close) | Safely shut down the resource and prevent further use. |
40 changes: 40 additions & 0 deletions static/include/components/apis/generated/board.md
Original file line number Diff line number Diff line change
Expand Up @@ -1303,9 +1303,49 @@ For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_s

### Name

Get the name of the digital interrupt.

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

**Parameters:**

- None.

**Returns:**

- [(string)](https://pkg.go.dev/builtin#string): The name of the digital interrupt.

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

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

### GetResourceName

Get the `ResourceName` for this board with the given name.

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

**Parameters:**

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

**Returns:**

- ([viam.proto.common.ResourceName](https://python.viam.dev/autoapi/viam/proto/common/index.html#viam.proto.common.ResourceName)): The ResourceName of this Resource.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
# Can be used with any resource, using an arm as an example
my_arm_name = my_arm.get_resource_name("my_arm")
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/board/client/index.html#viam.components.board.client.BoardClient.get_resource_name).

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

**Parameters:**
Expand Down
2 changes: 1 addition & 1 deletion static/include/components/apis/generated/camera-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
| [`DoCommand`](/components/camera/#docommand) | Execute model-specific commands that are not otherwise defined by the component API. |
| [`GetGeometries`](/components/camera/#getgeometries) | Get all the geometries associated with the camera in its current configuration, in the frame of the camera. |
| [`FromRobot`](/components/camera/#fromrobot) | Get the resource from the provided robot with the given name. |
| [`Name`](/components/camera/#name) | Get the `ResourceName` for this camera with the given name. |
| [`GetResourceName`](/components/camera/#getresourcename) | Get the `ResourceName` for this camera with the given name. |
| [`Close`](/components/camera/#close) | Safely shut down the resource and prevent further use. |
22 changes: 21 additions & 1 deletion static/include/components/apis/generated/camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,31 @@ For more information, see the [Flutter SDK Docs](https://flutter.viam.dev/viam_s
{{% /tab %}}
{{< /tabs >}}

### Name
### GetResourceName

Get the `ResourceName` for this camera with the given name.

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

**Parameters:**

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

**Returns:**

- ([viam.proto.common.ResourceName](https://python.viam.dev/autoapi/viam/proto/common/index.html#viam.proto.common.ResourceName)): The ResourceName of this Resource.

**Example:**

```python {class="line-numbers linkable-line-numbers"}
# Can be used with any resource, using an arm as an example
my_arm_name = my_arm.get_resource_name("my_arm")
```

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/components/camera/client/index.html#viam.components.camera.client.CameraClient.get_resource_name).

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

**Parameters:**
Expand Down
1 change: 1 addition & 0 deletions static/include/components/apis/generated/encoder-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
| [`GetGeometries`](/components/encoder/#getgeometries) | Get all the geometries associated with the encoder in its current configuration, in the frame of the encoder. |
| [`Reconfigure`](/components/encoder/#reconfigure) | Reconfigure this resource. |
| [`DoCommand`](/components/encoder/#docommand) | Execute model-specific commands that are not otherwise defined by the component API. |
| [`GetResourceName`](/components/encoder/#getresourcename) | Get the `ResourceName` for this encoder with the given name. |
| [`Close`](/components/encoder/#close) | Safely shut down the resource and prevent further use. |
Loading

0 comments on commit d7b3cab

Please sign in to comment.