From f42fb270c58aefd01a065de9db658adb6ebd0523 Mon Sep 17 00:00:00 2001 From: hexbabe Date: Thu, 31 Aug 2023 15:32:26 -0400 Subject: [PATCH 01/11] Changed triplets to follow new convention --- docs/examples/example.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/examples/example.ipynb b/docs/examples/example.ipynb index fe0ca241b..a08920fd0 100644 --- a/docs/examples/example.ipynb +++ b/docs/examples/example.ipynb @@ -321,7 +321,7 @@ "\n", "class MySensor(Sensor):\n", " # Subclass the Viam Sensor component and implement the required functions\n", - " MODEL: ClassVar[Model] = Model(ModelFamily(\"acme\",\"wifi_sensor\"), \"linux\")\n", + " MODEL: ClassVar[Model] = Model(ModelFamily(\"viam\",\"sensor\"), \"wifi-sensor\")\n", "\n", " @classmethod\n", " def new(cls, config: ComponentConfig, dependencies: Mapping[ResourceName, ResourceBase]) -> Self:\n", @@ -491,7 +491,7 @@ "{\n", " \"components\": [\n", " {\n", - " \"model\": \"acme:wifi_sensor:linux\",\n", + " \"model\": \"viam:sensor:linux-wifi\",\n", " \"attributes\": {},\n", " \"depends_on\": [],\n", " \"name\": \"my-sensor\",\n", @@ -538,7 +538,7 @@ "\n", "class MyModularArm(Arm):\n", " # Subclass the Viam Arm component and implement the required functions\n", - " MODEL: ClassVar[Model] = Model(ModelFamily(\"acme\", \"demo\"), \"myarm\")\n", + " MODEL: ClassVar[Model] = Model(ModelFamily(\"viam\", \"arm\"), \"my-arm\")\n", "\n", " def __init__(self, name: str):\n", " # Starting joint positions\n", From 4eed12c4da67ca1ba278fbe96c1a8dc88c70e043 Mon Sep 17 00:00:00 2001 From: hexbabe Date: Thu, 31 Aug 2023 15:42:03 -0400 Subject: [PATCH 02/11] Added note about namespace:family:name nomenclature. TODO: still have to link to Andrew's updated docs about custom namespaces once that is up --- docs/examples/example.ipynb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/examples/example.ipynb b/docs/examples/example.ipynb index a08920fd0..abba66b21 100644 --- a/docs/examples/example.ipynb +++ b/docs/examples/example.ipynb @@ -505,7 +505,13 @@ " }\n", " ]\n", "}\n", - "```\n" + "```\n", + "\n", + "Note the nomenclature of the above `model` field, `viam:sensor:linux-wifi`. Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](link-to-andrew's-new-updated-namespace-docs).\n", + "\n", + "Viam also provides many built-in models that implement API capabilities, each using `rdk` as the `namespace`, and `builtin` as the `family`:\n", + "- The `rdk:builtin:gpio` model of the `rdk:component:motor` API provides RDK support for [GPIO-controlled DC motors](https://docs.viam.com/components/motor/gpio/).\n", + "- The `rdk:builtin:DMC4000` model of the same `rdk:component:motor` API provides RDK support for the [DMC4000](https://docs.viam.com/components/motor/dmc4000/) motor." ] }, { From 2ad8de2f9889ccd0d1f1388b77cd84ca8af7f3ac Mon Sep 17 00:00:00 2001 From: hexbabe Date: Tue, 5 Sep 2023 14:20:47 -0400 Subject: [PATCH 03/11] Revised placeholder url with real url --- docs/examples/example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/example.ipynb b/docs/examples/example.ipynb index abba66b21..73a6e1ed6 100644 --- a/docs/examples/example.ipynb +++ b/docs/examples/example.ipynb @@ -507,7 +507,7 @@ "}\n", "```\n", "\n", - "Note the nomenclature of the above `model` field, `viam:sensor:linux-wifi`. Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](link-to-andrew's-new-updated-namespace-docs).\n", + "Note the nomenclature of the above `model` field, `viam:sensor:linux-wifi`. Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#namespace-1).\n", "\n", "Viam also provides many built-in models that implement API capabilities, each using `rdk` as the `namespace`, and `builtin` as the `family`:\n", "- The `rdk:builtin:gpio` model of the `rdk:component:motor` API provides RDK support for [GPIO-controlled DC motors](https://docs.viam.com/components/motor/gpio/).\n", From dc5a690873cb50ff14dad54321097814d9d19e49 Mon Sep 17 00:00:00 2001 From: hexbabe Date: Wed, 6 Sep 2023 11:13:55 -0400 Subject: [PATCH 04/11] Added namespace paragraph; revised model names in JSON samples --- examples/complex_module/README.md | 10 ++++++---- examples/simple_module/README.md | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/complex_module/README.md b/examples/complex_module/README.md index 9c1088fac..ed0541b61 100644 --- a/examples/complex_module/README.md +++ b/examples/complex_module/README.md @@ -36,6 +36,8 @@ The `run.sh` script is the entrypoint for this module. To connect this module wi Once the module has been added to your robot, add a `Gizmo` component that uses the `MyGizmo` model. See the [documentation](https://docs.viam.com/program/extend/modular-resources/#configure-a-component-instance-for-a-modular-resource) for more details. You can also add an `Arm` component that uses the `MyArm` model and a `Summation` service that uses the `MySum` model in a similar manner. +Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#namespace-1). + An example configuration for an Arm component, a Gizmo component, and a Summation service could look like this: ```json @@ -44,7 +46,7 @@ An example configuration for an Arm component, a Gizmo component, and a Summatio { "name": "arm1", "type": "arm", - "model": "acme:demo:myarm", + "model": "viam:arm:myarm", "attributes": {}, "depends_on": [] }, @@ -52,7 +54,7 @@ An example configuration for an Arm component, a Gizmo component, and a Summatio "name": "gizmo1", "type": "gizmo", "namespace": "acme", - "model": "acme:demo:mygizmo", + "model": "viam:gizmo:mygizmo", "attributes": { "arg1": "arg1", "motor": "motor1" @@ -92,7 +94,7 @@ An example configuration for an Arm component, a Gizmo component, and a Summatio "left": "motor1", "right": "motor2" }, - "model": "acme:demo:mybase", + "model": "viam:base:mybase", "depends_on": [] } ], @@ -101,7 +103,7 @@ An example configuration for an Arm component, a Gizmo component, and a Summatio "name": "mysum1", "type": "summation", "namespace": "acme", - "model": "acme:demo:mysum", + "model": "viam:sum:mysum", "attributes": { "subtract": false } diff --git a/examples/simple_module/README.md b/examples/simple_module/README.md index 43638ceb1..fe32db600 100644 --- a/examples/simple_module/README.md +++ b/examples/simple_module/README.md @@ -26,6 +26,8 @@ The `run.sh` script is the entrypoint for this module. To connect this module wi Once the module has been added to your robot, add a new component that uses the `MySensor` model. See the [documentation](https://docs.viam.com/program/extend/modular-resources/#configure-a-component-instance-for-a-modular-resource) for more details. +Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#namespace-1). + An example configuration for a Sensor component could look like this: ```json { @@ -33,7 +35,7 @@ An example configuration for a Sensor component could look like this: { "name": "sensor1", "type": "sensor", - "model": "acme:demo:mysensor", + "model": "viam:sensor:mysensor", "attributes": {}, "depends_on": [] } From 5a0d083eb5b9d7b791c69be8f94238d0e011118a Mon Sep 17 00:00:00 2001 From: sean yu <55464069+hexbabe@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:10:12 -0400 Subject: [PATCH 05/11] Update examples/simple_module/README.md Co-authored-by: andf-viam <132301587+andf-viam@users.noreply.github.com> --- examples/simple_module/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/simple_module/README.md b/examples/simple_module/README.md index fe32db600..6485f6c54 100644 --- a/examples/simple_module/README.md +++ b/examples/simple_module/README.md @@ -26,7 +26,7 @@ The `run.sh` script is the entrypoint for this module. To connect this module wi Once the module has been added to your robot, add a new component that uses the `MySensor` model. See the [documentation](https://docs.viam.com/program/extend/modular-resources/#configure-a-component-instance-for-a-modular-resource) for more details. -Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#namespace-1). +Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#models). An example configuration for a Sensor component could look like this: ```json From 9b7770f38471778c726c261877c58cd0e06ba458 Mon Sep 17 00:00:00 2001 From: sean yu <55464069+hexbabe@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:10:21 -0400 Subject: [PATCH 06/11] Update examples/complex_module/README.md Co-authored-by: andf-viam <132301587+andf-viam@users.noreply.github.com> --- examples/complex_module/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/complex_module/README.md b/examples/complex_module/README.md index ed0541b61..a440aede1 100644 --- a/examples/complex_module/README.md +++ b/examples/complex_module/README.md @@ -34,7 +34,7 @@ These steps assume that you have a robot available at [app.viam.com](app.viam.co The `run.sh` script is the entrypoint for this module. To connect this module with your robot, you must add this module's entrypoint to the robot's config. For example, the entrypoint file may be at `/home/viam-python-sdk/examples/complex_module/run.sh` and you must add this file path to your configuration. See the [documentation](https://docs.viam.com/program/extend/modular-resources/#use-a-modular-resource-with-your-robot) for more details. -Once the module has been added to your robot, add a `Gizmo` component that uses the `MyGizmo` model. See the [documentation](https://docs.viam.com/program/extend/modular-resources/#configure-a-component-instance-for-a-modular-resource) for more details. You can also add an `Arm` component that uses the `MyArm` model and a `Summation` service that uses the `MySum` model in a similar manner. +Once the module has been added to your robot, add a `Gizmo` component that uses the `MyGizmo` model. See the [documentation](https://docs.viam.com/extend/modular-resources/configure/) for more details. You can also add an `Arm` component that uses the `MyArm` model and a `Summation` service that uses the `MySum` model in a similar manner. Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#namespace-1). From 438eb70b8410a133cb58260fdc1ed01d0b38b246 Mon Sep 17 00:00:00 2001 From: sean yu <55464069+hexbabe@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:10:33 -0400 Subject: [PATCH 07/11] Update examples/complex_module/README.md Co-authored-by: andf-viam <132301587+andf-viam@users.noreply.github.com> --- examples/complex_module/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/complex_module/README.md b/examples/complex_module/README.md index a440aede1..1eca9a12b 100644 --- a/examples/complex_module/README.md +++ b/examples/complex_module/README.md @@ -36,7 +36,7 @@ The `run.sh` script is the entrypoint for this module. To connect this module wi Once the module has been added to your robot, add a `Gizmo` component that uses the `MyGizmo` model. See the [documentation](https://docs.viam.com/extend/modular-resources/configure/) for more details. You can also add an `Arm` component that uses the `MyArm` model and a `Summation` service that uses the `MySum` model in a similar manner. -Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#namespace-1). +Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#models). An example configuration for an Arm component, a Gizmo component, and a Summation service could look like this: From 7d301bddbe12ab0f55c48eaae15a3c5d0c302ffe Mon Sep 17 00:00:00 2001 From: hexbabe Date: Fri, 8 Sep 2023 13:14:32 -0400 Subject: [PATCH 08/11] Changed last link to updated link from andrew --- docs/examples/example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/example.ipynb b/docs/examples/example.ipynb index 73a6e1ed6..6b79182d3 100644 --- a/docs/examples/example.ipynb +++ b/docs/examples/example.ipynb @@ -507,7 +507,7 @@ "}\n", "```\n", "\n", - "Note the nomenclature of the above `model` field, `viam:sensor:linux-wifi`. Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#namespace-1).\n", + "Note the nomenclature of the above `model` field, `viam:sensor:linux-wifi`. Models are uniquely namespaced as colon-delimited-triplets in the form `namespace:family:name`, and are named according to the Viam API that your model implements. A model with the `viam` namespace is always Viam-provided. Read more about making custom namespaces [here](https://docs.viam.com/extend/modular-resources/key-concepts/#models).\n", "\n", "Viam also provides many built-in models that implement API capabilities, each using `rdk` as the `namespace`, and `builtin` as the `family`:\n", "- The `rdk:builtin:gpio` model of the `rdk:component:motor` API provides RDK support for [GPIO-controlled DC motors](https://docs.viam.com/components/motor/gpio/).\n", From 8670877cfaa5125c282b18563dc550ea240db222 Mon Sep 17 00:00:00 2001 From: hexbabe Date: Fri, 8 Sep 2023 13:45:47 -0400 Subject: [PATCH 09/11] Changed path to be the same as linux-wifi (name of module); changed 'viam' namespace gizmo and service back to 'acme' because i dont think we have gizmo and summation service...; changed simple module code to be same as readme --- docs/examples/example.ipynb | 2 +- examples/complex_module/README.md | 4 ++-- examples/complex_module/src/arm/my_arm.py | 2 +- examples/complex_module/src/base/my_base.py | 2 +- examples/simple_module/src/main.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/examples/example.ipynb b/docs/examples/example.ipynb index 6b79182d3..a21932c12 100644 --- a/docs/examples/example.ipynb +++ b/docs/examples/example.ipynb @@ -483,7 +483,7 @@ "### 5. Configure a modular resource\n", "**NOTE:** *These instructions are for local development. Soon we will launch a `Registry` which will allow users to upload modules to app.viam.com directly. We will update the documentation with instructions on how to do that shortly.*\n", "\n", - "[Configure your new module](https://docs.viam.com/extend/modular-resources/#configure-your-module) on your robot by navigating to the **Config** tab of the robot's page on the Viam app, then click on the **Modules** subtab. Add the name of your module and the executable path. For our example, the path would be `/wifi-sensor/run.sh`.\n", + "[Configure your new module](https://docs.viam.com/extend/modular-resources/#configure-your-module) on your robot by navigating to the **Config** tab of the robot's page on the Viam app, then click on the **Modules** subtab. Add the name of your module and the executable path. For our example, the path would be `/linux-wifi/run.sh`.\n", "\n", "Once you have configured a module as part of your robot configuration, [configure your modular resource](https://docs.viam.com/extend/modular-resources/#configure-your-modular-resource) made available by that module by adding new components or services configured with your modular resources' new type or model. To instantiate a new resource from your module, specify the `type`, `model`, and `name` of your modular resource. This is a JSON example:\n", "\n", diff --git a/examples/complex_module/README.md b/examples/complex_module/README.md index 1eca9a12b..583c5a476 100644 --- a/examples/complex_module/README.md +++ b/examples/complex_module/README.md @@ -54,7 +54,7 @@ An example configuration for an Arm component, a Gizmo component, and a Summatio "name": "gizmo1", "type": "gizmo", "namespace": "acme", - "model": "viam:gizmo:mygizmo", + "model": "acme:demo:mygizmo", "attributes": { "arg1": "arg1", "motor": "motor1" @@ -103,7 +103,7 @@ An example configuration for an Arm component, a Gizmo component, and a Summatio "name": "mysum1", "type": "summation", "namespace": "acme", - "model": "viam:sum:mysum", + "model": "acme:demo:mysum", "attributes": { "subtract": false } diff --git a/examples/complex_module/src/arm/my_arm.py b/examples/complex_module/src/arm/my_arm.py index 186be32c1..1cb65c6a0 100644 --- a/examples/complex_module/src/arm/my_arm.py +++ b/examples/complex_module/src/arm/my_arm.py @@ -14,7 +14,7 @@ class MyArm(Arm): # Subclass the Viam Arm component and implement the required functions - MODEL: ClassVar[Model] = Model(ModelFamily("acme", "demo"), "myarm") + MODEL: ClassVar[Model] = Model(ModelFamily("viam", "arm"), "myarm") def __init__(self, name: str): # Starting position diff --git a/examples/complex_module/src/base/my_base.py b/examples/complex_module/src/base/my_base.py index 8ea994308..443f90586 100644 --- a/examples/complex_module/src/base/my_base.py +++ b/examples/complex_module/src/base/my_base.py @@ -24,7 +24,7 @@ class MyBase(Base, Reconfigurable): """ # Subclass the Viam Base component and implement the required functions - MODEL: ClassVar[Model] = Model(ModelFamily("acme", "demo"), "mybase") + MODEL: ClassVar[Model] = Model(ModelFamily("viam", "base"), "mybase") def __init__(self, name: str): super().__init__(name) diff --git a/examples/simple_module/src/main.py b/examples/simple_module/src/main.py index fa9120c3c..19332ed0d 100644 --- a/examples/simple_module/src/main.py +++ b/examples/simple_module/src/main.py @@ -15,7 +15,7 @@ class MySensor(Sensor): # Subclass the Viam Sensor component and implement the required functions - MODEL: ClassVar[Model] = Model(ModelFamily("acme", "demo"), "mysensor") + MODEL: ClassVar[Model] = Model(ModelFamily("viam", "sensor"), "mysensor") multiplier: float def __init__(self, name: str): From 0178b11035641d50abb873407d9637013000c436 Mon Sep 17 00:00:00 2001 From: hexbabe Date: Mon, 11 Sep 2023 11:02:47 -0400 Subject: [PATCH 10/11] Revised path to linux-wifi not wifi-sensor --- docs/examples/example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/example.ipynb b/docs/examples/example.ipynb index a21932c12..e27b32f44 100644 --- a/docs/examples/example.ipynb +++ b/docs/examples/example.ipynb @@ -500,7 +500,7 @@ " ],\n", " \"modules\": [\n", " {\n", - " \"executable_path\": \"/wifi-sensor/run.sh\",\n", + " \"executable_path\": \"/linux-wifi/run.sh\",\n", " \"name\": \"wifi_sensor\"\n", " }\n", " ]\n", From af465915b8f67f209bea0da412085bb8f9345cef Mon Sep 17 00:00:00 2001 From: hexbabe Date: Wed, 13 Sep 2023 12:26:28 -0400 Subject: [PATCH 11/11] Small init fix wifi-sensor -> linux-wifi --- docs/examples/example.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/example.ipynb b/docs/examples/example.ipynb index e27b32f44..a3956389e 100644 --- a/docs/examples/example.ipynb +++ b/docs/examples/example.ipynb @@ -321,7 +321,7 @@ "\n", "class MySensor(Sensor):\n", " # Subclass the Viam Sensor component and implement the required functions\n", - " MODEL: ClassVar[Model] = Model(ModelFamily(\"viam\",\"sensor\"), \"wifi-sensor\")\n", + " MODEL: ClassVar[Model] = Model(ModelFamily(\"viam\",\"sensor\"), \"linux-wifi\")\n", "\n", " @classmethod\n", " def new(cls, config: ComponentConfig, dependencies: Mapping[ResourceName, ResourceBase]) -> Self:\n",