Skip to content

Commit b71e1bc

Browse files
committed
DOCS-3236: Change repo name to module name, and delete sensor module
1 parent 149c992 commit b71e1bc

File tree

7 files changed

+27
-524
lines changed

7 files changed

+27
-524
lines changed

Diff for: docs/dev/reference/glossary/model-namespace-triplet.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: Model Namespace Triplet
33
id: model-namespace-triplet
44
full_link: /how-tos/create-module/#name-your-new-resource-model
5-
short_description: namespace:repo-name:name or rdk:builtin:name
5+
short_description: namespace:module-name:name or rdk:builtin:name
66
---
77

88
{{< glossary_tooltip term_id="model" text="Models" >}} are uniquely namespaced as colon-delimited-triplets.
9-
Modular resource model names have the form `namespace:repo-name:name`, for example `esmeraldaLabs:sensors:moisture`.
9+
Modular resource model names have the form `namespace:module-name:model-name`, for example `esmeraldaLabs:sensors:moisture`.
1010
Built-in model names have the form `rdk:builtin:name`, for example `rdk:builtin:gpio`.
1111
See [Name your new resource model](/how-tos/create-module/#name-your-new-resource-model) for more information.

Diff for: docs/dev/reference/glossary/model.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ Regardless, you can power any motor model that implements the `rdk:component:mot
1515
Models are either included with [`viam-server`](/architecture/viam-server/) or provided through {{< glossary_tooltip term_id="module" text="modules" >}}.
1616
All models are uniquely namespaced as colon-delimited-triplets.
1717
Built-in model names have the form `rdk:builtin:name`.
18-
Modular resource model names have the form `namespace:repo-name:name`.
18+
Modular resource model names have the form `namespace:module-name:model-name`.
1919
See [Name your new resource model](/how-tos/create-module/#name-your-new-resource-model) for more information.

Diff for: docs/operate/get-started/other-hardware/cpp-module.md

+18-17
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ In addition to determining which existing API namespace triplet to use when crea
120120

121121
{{< expand "API namespace triplet and model namespace triplet example" >}}
122122

123-
The `rand:yahboom:arm` model and the `rand:yahboom:gripper` model use the repository name [yahboom](https://github.com/viam-labs/yahboom).
123+
The `rand:yahboom:arm` model and the `rand:yahboom:gripper` model use the module name (and matching repo name) [yahboom](https://github.com/viam-labs/yahboom).
124124
The models implement the `rdk:component:arm` and the `rdk:component:gripper` API to support the Yahboom DOFBOT arm and gripper, respectively:
125125

126126
```json
@@ -136,17 +136,18 @@ The models implement the `rdk:component:arm` and the `rdk:component:gripper` API
136136

137137
{{< /expand >}}
138138

139-
A resource model is identified by a unique name, called the {{< glossary_tooltip term_id="model-namespace-triplet" text="model namespace triplet" >}}, using the format: `namespace:repo-name:model-name`, where:
139+
A resource model is identified by a unique name, called the {{< glossary_tooltip term_id="model-namespace-triplet" text="model namespace triplet" >}}, using the format: `namespace:module-name:model-name`, where:
140140

141141
- `namespace` is the [namespace of your organization](/cloud/organizations/#create-a-namespace-for-your-organization).
142-
- For example, if your organization uses the `acme` namespace, your models must all begin with `acme`, like `acme:repo-name:mybase`.
142+
- For example, if your organization uses the `acme` namespace, your models must all begin with `acme`, like `acme:module-name:mybase`.
143143
If you do not intend to [upload your module](#upload-your-module-to-the-modular-resource-registry) to the [Viam Registry](https://app.viam.com/registry), you do not need to use your organization's namespace as your model's namespace.
144144
- The `viam` namespace is reserved for models provided by Viam.
145-
- `repo-name` is the code repository (GitHub repo) that houses your module code.
146-
- Ideally, your `repo-name` should describe the common functionality provided across the model or models of that module.
145+
- `module-name` is the name of your module.
146+
Your `module-name` should describe the common functionality provided across the model or models provided by that module.
147+
- Many people also choose to use the module name as the name of the code repository (GitHub repo) that houses the module code.
147148
- `model-name` is the name of the new resource model that your module will provide.
148149

149-
For example, if your organization namespace is `acme`, and you have written a new base implementation named `mybase` which you have pushed to a repository named `my-custom-base-repo`, you would use the namespace `acme:my-custom-base-repo:mybase` for your model.
150+
For example, if your organization namespace is `acme`, and you have written a new base implementation named `mybase` which you have supported with a module named `my-custom-base-module`, you would use the namespace `acme:my-custom-base-module:mybase` for your model.
150151

151152
More requirements:
152153

@@ -259,7 +260,7 @@ This file will inherit from the existing class for your resource type, implement
259260

260261
For example, the following file, `my_base.py`:
261262

262-
- defines a new model `acme:my-custom-base-repo:mybase` by implementing a new `MyBase` class, which inherits from the built-in class `Base`.
263+
- defines a new model `acme:my-custom-base-module:mybase` by implementing a new `MyBase` class, which inherits from the built-in class `Base`.
263264
- defines a new constructor `new_base()` and a new method `validate_config()`.
264265
- does not implement several built-in methods, including `get_properties()` and `set_velocity()`, but instead raises a `NotImplementedError` error in the body of those functions.
265266
This prevents these methods from being used by new base components that use this modular resource, but meets the requirement that all built-in methods either be defined or raise a `NotImplementedError()` error, to ensure that the new `MyBase` class successfully instantiates.
@@ -300,10 +301,10 @@ class MyBase(Base, Reconfigurable):
300301
"""
301302

302303
# Here is where we define our new model's colon-delimited-triplet:
303-
# acme:my-custom-base-repo:mybase
304-
# acme = namespace, my-custom-base-repo = repo-name, mybase = model name.
304+
# acme:my-custom-base-module:mybase
305+
# acme = namespace, my-custom-base-module = module-name, mybase = model name.
305306
MODEL: ClassVar[Model] = Model(
306-
ModelFamily("acme", "my-custom-base-repo"), "mybase")
307+
ModelFamily("acme", "my-custom-base-module"), "mybase")
307308

308309
def __init__(self, name: str, left: str, right: str):
309310
super().__init__(name, left, right)
@@ -473,7 +474,7 @@ This file will inherit from the existing package for your resource type, impleme
473474

474475
For example, the following file, `mybase.go`:
475476

476-
- defines a new model `acme:my-custom-base-repo:mybase` by implementing a new `mybase` package, which inherits from the built-in package `base`.
477+
- defines a new model `acme:my-custom-base-module:mybase` by implementing a new `mybase` package, which inherits from the built-in package `base`.
477478
- defines a new constructor `newBase()` and a new method `Validate()`.
478479
- does not implement several built-in methods, including `MoveStraight()` and `SetVelocity()`, but instead returns an `errUnimplemented` error in the body of those methods.
479480
This prevents these methods from being used by new base components that use this modular resource, but meets the requirement that all built-in methods either be defined or return an `errUnimplemented` error, to ensure that the new `mybase` package successfully instantiates.
@@ -503,10 +504,10 @@ import (
503504
"go.viam.com/rdk/spatialmath"
504505
)
505506

506-
// Here is where we define your new model's colon-delimited-triplet (acme:my-custom-base-repo:mybase)
507-
// acme = namespace, my-custom-base-repo = repo-name, mybase = model name.
507+
// Here is where we define your new model's colon-delimited-triplet (acme:my-custom-base-module:mybase)
508+
// acme = namespace, my-custom-base-module = module-name, mybase = model name.
508509
var (
509-
Model = resource.NewModel("acme", "my-custom-base-repo", "mybase")
510+
Model = resource.NewModel("acme", "my-custom-base-module", "mybase")
510511
errUnimplemented = errors.New("unimplemented")
511512
)
512513

@@ -726,7 +727,7 @@ For example, the files below define the new `MyBase` class and its constituent f
726727
This prevents these functions from being used by new base components that use this modular resource, but meets the requirement that all built-in functions either be defined or `throw` a `runtime_error` error, to ensure that the new `MyBase` class successfully instantiates.
727728
- The `my_base.cpp` source file contains the function and object definitions used by the `MyBase` class.
728729

729-
Note that the model triplet itself, `acme:my-custom-base-repo:mybase` in this example, is defined in the entry point (main program) file `main.cpp`, which is described in the next section.
730+
Note that the model triplet itself, `acme:my-custom-base-module:mybase` in this example, is defined in the entry point (main program) file `main.cpp`, which is described in the next section.
730731

731732
{{< expand "Click to view sample code for the my_base.hpp header file" >}}
732733

@@ -1048,7 +1049,7 @@ Create a <file>main.cpp</file> file to serve as the module's entry point file, w
10481049
- creates and starts the module
10491050

10501051
For example, the following `main.cpp` file serves as the entry point file for the `mybase` custom model.
1051-
It imports the `mybase` model implementation from the `my_base.hpp` file that provides it, declares the model triplet `acme:my-custom-base-repo:mybase`, and defines a `main()` function that registers it.
1052+
It imports the `mybase` model implementation from the `my_base.hpp` file that provides it, declares the model triplet `acme:my-custom-base-module:mybase`, and defines a `main()` function that registers it.
10521053

10531054
{{< expand "Click to view sample code for main.cpp" >}}
10541055

@@ -1080,7 +1081,7 @@ using namespace viam::sdk;
10801081

10811082
int main(int argc, char** argv) {
10821083
API base_api = Base::static_api();
1083-
Model mybase_model("acme", "my-custom-base-repo", "mybase");
1084+
Model mybase_model("acme", "my-custom-base-module", "mybase");
10841085

10851086
std::shared_ptr<ModelRegistration> mybase_mr = std::make_shared<ModelRegistration>(
10861087
base_api,

0 commit comments

Comments
 (0)