Skip to content

Commit

Permalink
DOCS-1219: Document GetGeometries (#1980)
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel authored Oct 11, 2023
1 parent aab654c commit 8a85bd5
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 6 deletions.
69 changes: 63 additions & 6 deletions docs/components/base/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Move the base in a straight line across the given distance (mm) at the given vel

**Returns:**

- None
- None.

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

Expand Down Expand Up @@ -157,7 +157,7 @@ Turn the base in place, rotating it to the given angle (degrees) at the given an

**Returns:**

- None
- None.

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

Expand Down Expand Up @@ -217,7 +217,7 @@ Set the linear and angular power of the base, represented as a percentage of max

**Returns:**

- None
- None.

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

Expand Down Expand Up @@ -311,7 +311,7 @@ Set the linear velocity (mm/sec) and angular velocity (degrees/sec) of the base.

**Returns:**

- None
- None.

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

Expand Down Expand Up @@ -363,7 +363,7 @@ Stop the base from moving immediately.

**Parameters:**

- None
- None.

**Returns:**

Expand Down Expand Up @@ -417,7 +417,7 @@ Returns whether the base is actively moving (or attempting to move) under its ow

**Parameters:**

- None
- None.

**Returns:**

Expand Down Expand Up @@ -521,6 +521,63 @@ myBaseTurningRadius := properties.TurningRadiusMeters
{{% /tab %}}
{{< /tabs >}}

### GetGeometries

Get all the geometries associated with the base in its current configuration, in the [frame](/services/frame-system/) of the base.
The [motion](/services/motion/) and [navigation](/services/navigation/) services generally use geometries and may require them for obstacle avoidance.

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

**Parameters:**

- None.

**Returns:**

- List[(Geometry)](https://python.viam.dev/autoapi/viam/proto/common/index.html#viam.proto.common.Geometry): The geometries associated with the base, in any order.

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_geometries).

```python {class="line-numbers linkable-line-numbers"}
my_base = Base.from_robot(robot=robot, name="my_base")

geometries = await my_base.get_geometries()

if geometries:
# Get the center of the first geometry
print(f"Pose of the first geometry's center point: {geometries[0].center}")
```

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

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.

**Returns:**

- [`[]spatialmath.Geometry`](https://pkg.go.dev/go.viam.com/[email protected]/spatialmath#Geometry): The geometries associated with the base, in any order.
- [(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/base#Base).

```go {class="line-numbers linkable-line-numbers"}
myBase, err := base.FromRobot(robot, "my_base")

geometries, err := myBase.Geometries(context.Background(), nil)

if len(geometries) > 0 {
// Get the center of the first geometry
elem := geometries[0]
fmt.Println("Pose of the first geometry's center point:", elem.center)
}
```

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

### DoCommand

Execute model-specific commands that are not otherwise defined by the component API.
Expand Down
2 changes: 2 additions & 0 deletions static/include/components/apis/base.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- prettier-ignore -->
Method Name | Description
----------- | -----------
[`MoveStraight`](/components/base/#movestraight) | Move the base in a straight line across the given distance at the given velocity.
Expand All @@ -7,4 +8,5 @@ Method Name | Description
[`IsMoving`](/components/base/#ismoving) | Return whether the base is moving or not.
[`Stop`](/components/base/#stop) | Stop the base.
[`GetProperties`](/components/base/#getproperties) | Get the width and turning radius of the base in meters.
[`GetGeometries`](/components/base/#getgeometries) | Get all the geometries associated with the base in its current configuration, in the frame of the base.
[`DoCommand`](/components/base/#docommand) | Send or receive model-specific commands.

0 comments on commit 8a85bd5

Please sign in to comment.