Valid module identifiers
Each modular resource has two associated triplets: an API namespace triplet to indicate which API it implements, and a model namespace triplet to uniquely identify the modular resource model.
Valid API identifiers
Each existing component or service API has a unique identifier in the form of a colon-delimited triplet. You will use this API namespace triplet when creating your new model, to indicate which API it uses.
The API namespace triplet is the same for all built-in and modular models that implement a given API.
For example, every model of motor built into Viam, as well as every custom model of motor provided by a module, all use the same API namespace triplet rdk:component:motor
to indicate that they implement the motor API.
The three pieces of the API namespace triplet are as follows:
namespace
:rdk
type
:component
api
: any one of these component proto files, for examplemotor
if you are creating a new model of motor
namespace
:rdk
type
:service
api
: any one of these service proto files, for examplevision
if you are creating a new model of vision service
Valid model identifiers
In addition to determining which existing API namespace triplet to use when creating your module, you need to decide on a separate triplet unique to your model.
The viam
namespace is reserved for models provided by Viam.
A resource model is identified by a unique name, called the model namespace triplet, using the format: namespace:module-name:model-name
, where:
namespace
is the namespace of your organization, which you can find or create in your organization settings page.- For example, if your organization uses the
acme
namespace, your models must all begin withacme
, likeacme:module-name:mybase
. If you do not intend to upload your module to the registry, you do not need to use your organization’s namespace as your model’s namespace. - The
viam
namespace is reserved for models provided by Viam.
- For example, if your organization uses the
module-name
is the name of your module. Yourmodule-name
should describe the common functionality provided across the model or models provided by that module.- Many people also choose to use the module name as the name of the code repository (GitHub repo) that houses the module code.
model-name
is the name of the new resource model that your module will provide.
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.
More requirements:
- Your model triplet must be all-lowercase.
- Your model triplet may only use alphanumeric (
a-z
and0-9
), hyphen (-
), and underscore (_
) characters.
Determine the model name you want to use based on these requirements, then proceed to the next section.
Create a namespace for your organization
When uploading modules to the Viam Registry, you must set a unique namespace for your organization to associate your module with.
To create a new namespace for your organization, click on the org’s Settings in the top right of the navigation bar, then click the Set a public namespace button.
Enter a name or use the suggested name for your namespace, and then click Set namespace.
A namespace may only contain letters, numbers, and the dash (-
) character.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!