Skip to content

Commit

Permalink
DOCS-1247: Document Navigation Paths() (#2173)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguequierre authored Nov 8, 2023
1 parent cf9ff5e commit 64b088b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions docs/services/navigation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,55 @@ obstacles = await my_nav.get_obstacles()
{{% /tab %}}
{{< /tabs >}}

### Paths

Get each path, the series of geo points the robot plans to travel through to get to a destination waypoint, in the robot's motion planning.

{{< tabs >}}
{{% 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.
- `extra` [(map\[string\]interface{})](https://go.dev/blog/maps): Extra options to pass to the underlying RPC call.

**Returns:**

- [([]\*Path](https://pkg.go.dev/go.viam.com/[email protected]/services/navigation#Path): An array of paths, each path being a user-provided destination, or, [`Waypoint`](#addwaypoint), and the set of [geo `Point`s](https://pkg.go.dev/github.com/kellydunn/golang-geo#Point) the robot plans to travel through to get there.
- [(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/services/navigation#Service).

```go
myNav, err := navigation.FromRobot(robot, "my_nav_service")

// Get an array containing each path stored by the navigation service
paths, err := myNav.Paths(context.Background(), nil)
```

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

**Parameters:**

- `timeout` [(Optional\[float\])](https://docs.python.org/library/typing.html#typing.Optional): An option to set how long to wait (in seconds) before calling a time-out and closing the underlying RPC call.

**Returns:**

- [(List[navigation.Path])](https://python.viam.dev/autoapi/viam/proto/service/navigation/index.html#viam.proto.service.navigation.Path): An array comprised of `Path`s, each path being a user-provided destination, or, [`Waypoint`](#addwaypoint) and the set of `geopoints` that the robot expects to travel through to get there.

For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/services/navigation/client/index.html#viam.services.navigation.client.NavigationClient.get_paths).

```python
my_nav = NavigationClient.from_robot(robot=robot, name="my_nav_service")

# Get a list containing each path stored by the navigation service
paths = await my_nav.get_paths()
```

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

### DoCommand

Execute model-specific commands that are not otherwise defined by the service API.
Expand Down
1 change: 1 addition & 0 deletions static/include/services/apis/navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ Method Name | Description
[`Waypoints`](/services/navigation/#waypoints) | Get the waypoints currently in the service's data storage.
[`AddWaypoint`](/services/navigation/#addwaypoint) | Add a waypoint to the service's data storage.
[`RemoveWaypoint`](/services/navigation/#removewaypoint) | Remove a waypoint from the service's data storage.
[`Paths`](/services/navigation/#paths) | Get each path, the series of geo points the robot plans to travel through to get to a destination waypoint, in the robot's motion planning.
[`Obstacles`](/services/navigation/#obstacles) | Get the obstacles currently in the service's data storage.
[`DoCommand`](/services/navigation/#docommand) | Execute model-specific commands that are not otherwise defined by the service API.

0 comments on commit 64b088b

Please sign in to comment.