From 01256fe1b6ea911d50f774e9d812eff40cde9689 Mon Sep 17 00:00:00 2001 From: JessamyT <75634662+JessamyT@users.noreply.github.com> Date: Fri, 15 Dec 2023 03:48:06 -0800 Subject: [PATCH] DOCS-1502: Remove sensors service (#2323) --- .github/workflows/check_python_methods.py | 3 +- docs/_index.md | 2 +- docs/build/program/apis/_index.md | 6 - docs/components/movement-sensor/_index.md | 1 - docs/components/power-sensor/_index.md | 1 - docs/components/sensor/_index.md | 1 - docs/mobility/sensors.md | 265 ------------------- docs/services.md | 1 - docs/tutorials/configure/pet-photographer.md | 2 - static/include/services/apis/sensors.md | 7 - 10 files changed, 2 insertions(+), 287 deletions(-) delete mode 100644 docs/mobility/sensors.md delete mode 100644 static/include/services/apis/sensors.md diff --git a/.github/workflows/check_python_methods.py b/.github/workflows/check_python_methods.py index 1185517e7c..57ee10ec77 100644 --- a/.github/workflows/check_python_methods.py +++ b/.github/workflows/check_python_methods.py @@ -11,7 +11,7 @@ args = parser.parse_args() -services = ["motion", "navigation", "sensors", "slam", "vision", "mlmodel"] +services = ["motion", "navigation", "slam", "vision", "mlmodel"] components = ["arm", "base", "board", "camera", "encoder", "gantry", "generic", "gripper", "input", "movement_sensor", "power_sensor", "sensor"] app_apis = ["data_client", "app_client"] @@ -29,7 +29,6 @@ services_page_mapping = { "motion": "mobility/motion", "navigation": "mobility/navigation", - "sensors": "mobility/sensors", "slam": "mobility/slam", "vision": "ml/vision", "ml": "ml/deploy" diff --git a/docs/_index.md b/docs/_index.md index f8ca2145d4..f765bbc234 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -196,7 +196,7 @@ sitemap:
-
Services
+
Services
diff --git a/docs/build/program/apis/_index.md b/docs/build/program/apis/_index.md index f00779612c..cbec1fc2b9 100644 --- a/docs/build/program/apis/_index.md +++ b/docs/build/program/apis/_index.md @@ -171,12 +171,6 @@ The [navigation service](/mobility/navigation/) supports the following methods: {{< readfile "/static/include/services/apis/navigation.md" >}} -### Sensors - -The [sensors service](/mobility/sensors/) supports the following methods: - -{{< readfile "/static/include/services/apis/sensors.md" >}} - ### SLAM The {{< glossary_tooltip term_id="slam" text="Simultaneous Localization And Mapping (SLAM) service" >}} supports the following methods: diff --git a/docs/components/movement-sensor/_index.md b/docs/components/movement-sensor/_index.md index 39facfcf29..1b3e870a74 100644 --- a/docs/components/movement-sensor/_index.md +++ b/docs/components/movement-sensor/_index.md @@ -27,7 +27,6 @@ Viam also supports generic [sensors](/components/sensor/) and [encoders](/compon ## Related Services {{< cards >}} -{{< relatedcard link="/mobility/sensors/" >}} {{< relatedcard link="/mobility/motion/" >}} {{< relatedcard link="/mobility/navigation/" >}} {{< /cards >}} diff --git a/docs/components/power-sensor/_index.md b/docs/components/power-sensor/_index.md index 6d868e179b..2d3aabbc85 100644 --- a/docs/components/power-sensor/_index.md +++ b/docs/components/power-sensor/_index.md @@ -22,7 +22,6 @@ Integrate this component to monitor your power levels. {{< cards >}} {{< relatedcard link="/data/" >}} -{{< relatedcard link="/mobility/sensors/" >}} {{< /cards >}} ## Supported Models diff --git a/docs/components/sensor/_index.md b/docs/components/sensor/_index.md index c168b74720..0c712a8eeb 100644 --- a/docs/components/sensor/_index.md +++ b/docs/components/sensor/_index.md @@ -37,7 +37,6 @@ Most robots with a sensor need at least the following hardware: {{< cards >}} {{< relatedcard link="/data/" >}} -{{< relatedcard link="/mobility/sensors/" >}} {{< /cards >}} ## Supported Models diff --git a/docs/mobility/sensors.md b/docs/mobility/sensors.md deleted file mode 100644 index cc3389c392..0000000000 --- a/docs/mobility/sensors.md +++ /dev/null @@ -1,265 +0,0 @@ ---- -title: "Sensors Service" -linkTitle: "Sensors" -weight: 70 -type: "docs" -description: "The sensors service provides a central interface for all of your robot's sensors." -tags: ["sensor", "services"] -icon: "/services/icons/sensor.svg" -images: ["/services/icons/sensor.svg"] -aliases: - - "/services/sensors/" -# SME: Cheuk ---- - -The sensors service is a built-in service that provides a central interface to all of your robot's [sensors](/components/sensor/), regardless of the sensor model. -With it you can obtain readings from multiple sensors on your robot at once. - -## Used With - -{{< cards >}} -{{< relatedcard link="/components/sensor/" required="yes" >}} -{{< /cards >}} - -{{% snippet "required-legend.md" %}} - -## API - -The sensors service supports the following methods: - -{{< readfile "/static/include/services/apis/sensors.md" >}} - -{{% alert title="Tip" color="tip" %}} - -The following code examples assume that you have a robot configured, and that you add the required code to connect to your robot and import any required packages at the top of your code file. -Go to your robot's **Code sample** tab on the [Viam app](https://app.viam.com) for boilerplate code to connect to your robot. - -{{% /alert %}} - -### GetSensors - -Returns a list containing the `name` of each available sensor. - -{{< tabs >}} -{{% tab name="Python" %}} - -**Parameters:** - -- `extra` [(Optional\[Dict\[str, Any\]\])](https://docs.python.org/library/typing.html#typing.Optional): Extra options to pass to the underlying RPC call. - -**Returns:** - -- (List[[ResourceName](https://python.viam.dev/autoapi/viam/gen/common/v1/common_pb2/index.html#viam.gen.common.v1.common_pb2.ResourceName)]): Names of the available sensors of the robot. - -For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/services/sensors/index.html#viam.services.sensors.SensorsClient.get_sensors). - -```python {class="line-numbers linkable-line-numbers"} -# Access the sensors service -sensors_svc = SensorsClient.from_robot(robot=robot, name="builtin") - -# Get available sensors -sensors = await sensors_svc.get_sensors() -``` - -{{% /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. - -- `extra` [(map\[string\]interface{})](https://go.dev/blog/maps): Extra options to pass to the underlying RPC call. - -**Returns:** - -- [([]resource.Name)](https://pkg.go.dev/go.viam.com/rdk/resource#Name): An array of sensor names. -- [(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/sensors#Service). - -```go {class="line-numbers linkable-line-numbers"} -// Access the sensors service -sensorsService, err := sensors.FromRobot(robot, "builtin") -if err != nil { - logger.Fatal(err) -} - -// Get available sensors -sensor_names, err := sensorsService.Sensors(context.Background(), nil) -``` - -{{% /tab %}} -{{< /tabs >}} - -### GetReadings - -Returns a list of sensor readings from a given list of sensors. - -{{< tabs >}} -{{% tab name="Python" %}} - -**Parameters:** - -- `sensors` ([ResourceName](https://python.viam.dev/autoapi/viam/gen/common/v1/common_pb2/index.html#viam.gen.common.v1.common_pb2.ResourceName)): An array of sensor names for which to return readings. - -- `extra` [(Optional\[Dict\[str, Any\]\])](https://docs.python.org/library/typing.html#typing.Optional): Extra options to pass to the underlying RPC call. - -**Returns:** - -- ([Mapping[[ResourceName](https://python.viam.dev/autoapi/viam/gen/common/v1/common_pb2/index.html#viam.gen.common.v1.common_pb2.ResourceName), Any]]): A list of readings from the requested sensors. - -For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/services/sensors/index.html#viam.services.sensors.SensorsClient.get_readings). - -```python {class="line-numbers linkable-line-numbers"} -# Access the sensors service -sensors_svc = SensorsClient.from_robot(robot=robot, name="builtin") - -# Get available sensors -sensors = await sensors_svc.get_sensors() -# Get readings for sensors -readings = await sensors_svc.get_readings(sensors) -``` - -{{% /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. - -- `sensorNames` [([]resource.Name)](https://pkg.go.dev/go.viam.com/rdk/resource#Name): An array of sensor names for which to return readings. - -- `extra` [(map\[string\]interface{})](https://go.dev/blog/maps): Extra options to pass to the underlying RPC call. - -**Returns:** - -- [([]Readings)](https://pkg.go.dev/go.viam.com/rdk/services/sensors#Readings): A list of readings from the requested sensors. -- [(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/sensors#Service). - -```go {class="line-numbers linkable-line-numbers"} -// Access the sensors service -sensorsService, err := sensors.FromRobot(robot, "builtin") -if err != nil { - logger.Fatal(err) -} - -// Get readings from all available sensors -sensor_names, err := sensorsService.Sensors(context.Background(), nil) -readings, err := sensorsService.Readings(context.Background(), sensor_names, nil) -``` - -{{% /tab %}} -{{< /tabs >}} - -## DoCommand - -Execute model-specific commands that are not otherwise defined by the service API. -For built-in service models, any model-specific commands available are covered with each model's documentation. -If you are implementing your own sensors service and add features that have no built-in API method, you can access them with `DoCommand`. - -{{< tabs >}} -{{% tab name="Python" %}} - -**Parameters:** - -- `command` [(Mapping[str, ValueTypes])](https://docs.python.org/3/library/stdtypes.html#typesmapping): The command to execute. -- `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:** - -- [(Mapping[str, ValueTypes])](https://docs.python.org/3/library/stdtypes.html#typesmapping): Result of the executed command. - -For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/services/sensors/client/index.html#viam.services.sensors.client.SensorsClient.do_command). - -```python {class="line-numbers linkable-line-numbers"} -# Access the sensors service -sensors_svc = SensorsClient.from_robot(robot=robot, name="builtin") - -my_command = { - "command": "dosomething", - "someparameter": 52 -} - -await sensors_svc.do_command(my_command) -``` - -{{% /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. -- `cmd` [(map\[string\]interface{})](https://go.dev/blog/maps): The command to execute. - -**Returns:** - -- [(map\[string\]interface{})](https://go.dev/blog/maps): Result of the executed command. -- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred. - -```go {class="line-numbers linkable-line-numbers"} -// Access the sensors service -sensorsService, err := sensors.FromRobot(robot, "builtin") -if err != nil { - logger.Fatal(err) -} - -resp, err := sensorsService.DoCommand(ctx, map[string]interface{}{"command": "dosomething", "someparameter": 52}) -``` - -For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource). - -{{% /tab %}} -{{< /tabs >}} - -### Close - -Safely shut down the resource and prevent further use. - -{{< tabs >}} -{{% tab name="Python" %}} - -**Parameters:** - -- None - -**Returns:** - -- None - -```python {class="line-numbers linkable-line-numbers"} -sensors_svc = SensorsClient.from_robot(robot, "builtin") - -await sensors_svc.close() -``` - -For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/viam/services/sensors/client/index.html#viam.services.sensors.client.SensorsClient.close). - -{{% /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:** - -- [(error)](https://pkg.go.dev/builtin#error) : An error, if one occurred. - -```go {class="line-numbers linkable-line-numbers"} -sensorsService, err := sensors.FromRobot(robot, "builtin") - -err := sensorsService.Close(ctx) -``` - -For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource). - -{{% /tab %}} -{{< /tabs >}} - -## Next steps - -{{< cards >}} -{{% card link="/tutorials/projects/tipsy/" %}} -{{< /cards >}} diff --git a/docs/services.md b/docs/services.md index cd5fd895df..c03d1cdac4 100644 --- a/docs/services.md +++ b/docs/services.md @@ -22,6 +22,5 @@ You can also add support for additional service types using {{< glossary_tooltip {{% card link="/ml/deploy/" %}} {{% card link="/mobility/navigation/" %}} {{% card link="/mobility/slam/" %}} -{{% card link="/mobility/sensors/" %}} {{% card link="/ml/vision/" %}} {{< /cards >}} diff --git a/docs/tutorials/configure/pet-photographer.md b/docs/tutorials/configure/pet-photographer.md index 5e94a44dfb..3680a7d0d5 100644 --- a/docs/tutorials/configure/pet-photographer.md +++ b/docs/tutorials/configure/pet-photographer.md @@ -823,8 +823,6 @@ Next, add the following services to your smart machine to support the color filt - The [data management service](/data/) enables your smart machine to capture data and sync it to the cloud. - The [vision service](/ml/vision/detection/) enables your smart machine to perform color detection on objects in a camera stream. -If you are filtering data from other components, such as [sensors](/components/sensor/), you may need to add different services, such as the [sensors service](/mobility/sensors/) which provides a central interface to all of your robot’s sensors. - ### Add the data management service To enable data capture on your robot, add and configure the [data management service](/data/) to capture and store data on your robot's computer: diff --git a/static/include/services/apis/sensors.md b/static/include/services/apis/sensors.md deleted file mode 100644 index b0eb667341..0000000000 --- a/static/include/services/apis/sensors.md +++ /dev/null @@ -1,7 +0,0 @@ - -| Method Name | Description | -| ----------------------------------------------- | ------------------------------------------------------- | -| [`GetSensors`](/mobility/sensors/#getsensors) | Return a list of names of the available sensors. | -| [`GetReadings`](/mobility/sensors/#getreadings) | Return a list of readings from a given list of sensors. | -| [`DoCommand`](/mobility/sensors/#docommand) | Send arbitrary commands to the resource. | -| [`Close`](/mobility/sensors/#close) | Safely shut down the resource and prevent further use. |