From a5f12fcb32d356b163940328742e78427e9086b0 Mon Sep 17 00:00:00 2001 From: sky leilani <45158875+skyleilani@users.noreply.github.com> Date: Wed, 17 Jan 2024 12:32:16 -0500 Subject: [PATCH] Document SLAM and Nav methods --- docs/mobility/navigation/_index.md | 49 ++++++++++++++++++++++ docs/mobility/slam/_index.md | 49 ++++++++++++++++++++++ static/include/services/apis/navigation.md | 1 + static/include/services/apis/slam.md | 1 + 4 files changed, 100 insertions(+) diff --git a/docs/mobility/navigation/_index.md b/docs/mobility/navigation/_index.md index a8acd01d3d..038b0c7b18 100644 --- a/docs/mobility/navigation/_index.md +++ b/docs/mobility/navigation/_index.md @@ -434,6 +434,55 @@ waypoints, err := myNav.Waypoints(context.Background(), nil) {{% /tab %}} {{< /tabs >}} +### GetProperties + +Get information regarding the current navigation service. + +{{< tabs >}} +{{% 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:** + +- [`MapType.ValueType`](https://python.viam.dev/autoapi/viam/proto/service/navigation/index.html#viam.proto.service.navigation.GetPropertiesResponse): Property information for the named navigation service. + +```python {class="line-numbers linkable-line-numbers"} +my_nav = NavigationClient.from_robot(robot=robot, name="my_nav_service") + +# Get the properties of the current navigation service. +nav_properties = await my_nav.get_properties() +``` + +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_properties). +{{% /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:** + +- [Properties](https://pkg.go.dev/go.viam.com/rdk@v0.18.0/services/navigation#Properties): Information regarding the current navigation service. + This includes the map type being ingested and used by the navigation service. +- [(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 {class="line-numbers linkable-line-numbers"} +ctx := context.Background() +myNav, err := navigation.FromRobot(robot, "my_nav_service") + +// Get the properties of your current service +navProperties, err := myNav.Properties(ctx) +``` + +{{% /tab %}} +{{< /tabs >}} + ### AddWaypoint Add a waypoint to the service's data storage. diff --git a/docs/mobility/slam/_index.md b/docs/mobility/slam/_index.md index 61132a9fb9..48072242d9 100644 --- a/docs/mobility/slam/_index.md +++ b/docs/mobility/slam/_index.md @@ -160,6 +160,55 @@ pcd_map, err := slam_svc.GetPointCloudMap(context.Background()) {{% /tab %}} {{< /tabs >}} +### GetProperties + +Get information regarding the current SLAM session. + +{{< tabs >}} +{{% 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:** + +- Tuple[[bool](https://docs.python.org/3/library/functions.html#bool), [MappingMode.ValueType](https://python.viam.dev/autoapi/viam/proto/service/slam/index.html#viam.proto.service.slam.MappingMode)]: A tuple containing a boolean which indicates whether the session is being run in the cloud, as well as the current session's mode. + +For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/services/slam/client/index.html#viam.services.slam.client.SLAMClient.get_properties). + +```python {class="line-numbers linkable-line-numbers"} +slam_svc = SLAMClient.from_robot(robot=robot, name="my_slam_service") + +# Get the properties of your current SLAM session. +slam_properties = await slam_svc.get_properties() +``` + +{{% /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:** + +- [Properties](https://pkg.go.dev/go.viam.com/services/slam#Properties): Information regarding the current SLAM session. + This includes whether the SLAM process is running in the cloud, as well as its mapping mode. +- [(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/slam#Properties). + +```go {class="line-numbers linkable-line-numbers"} +slam_svc, err := slam.FromRobot(robot, "my_slam_service") + +// Get the properties of your current SLAM session +properties, err := slam_svc.Properties(context.Background()) +``` + +{{% /tab %}} +{{< /tabs >}} + ### GetInternalState Get the internal state of the SLAM algorithm required to continue mapping/localization. diff --git a/static/include/services/apis/navigation.md b/static/include/services/apis/navigation.md index e854d91d09..21e77d23ee 100644 --- a/static/include/services/apis/navigation.md +++ b/static/include/services/apis/navigation.md @@ -5,6 +5,7 @@ Method Name | Description [`SetMode`](/mobility/navigation/#setmode) | Set the mode the service is operating in. [`Location`](/mobility/navigation/#location) | Get the current location of the robot. [`Waypoints`](/mobility/navigation/#waypoints) | Get the waypoints currently in the service's data storage. +[`GetProperties`](/mobility/navigation/#getproperties) | Get information regarding the current service. [`AddWaypoint`](/mobility/navigation/#addwaypoint) | Add a waypoint to the service's data storage. [`RemoveWaypoint`](/mobility/navigation/#removewaypoint) | Remove a waypoint from the service's data storage. [`Paths`](/mobility/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. diff --git a/static/include/services/apis/slam.md b/static/include/services/apis/slam.md index 1ed02b0831..28894381e4 100644 --- a/static/include/services/apis/slam.md +++ b/static/include/services/apis/slam.md @@ -3,6 +3,7 @@ | ------------| ----------- | | [`GetPosition`](/mobility/slam/#getposition) | Get the current position of the specified source component in the point cloud SLAM map. | | [`GetPointCloudMap`](/mobility/slam/#getpointcloudmap) | Get the point cloud SLAM map. | +| [`GetProperties`](/mobility/slam/#getproperties) | Get information regarding the current SLAM session. | | [`GetInternalState`](/mobility/slam/#getinternalstate) | Get the internal state of the SLAM algorithm required to continue mapping/localization. | | [`GetLatestMapInfo`](/mobility/slam/#getlatestmapinfo) | Get the timestamp of the last update to the point cloud SLAM map. | | [`DoCommand`](/mobility/slam/#docommand) | Send arbitrary commands to the resource. |