Previous
New API Subtype
Running modular resources on the computer directly connected to your components is the preferred way of managing and controlling custom components.
However, if you are unable to use modular resources because you need to host viam-server
on a non-Linux system or have an issue with compilation, you can use a Viam SDK to code a custom resource implementation, host it on a server, and add it as a remote part of your machine.
Once you have coded your custom component and configured the remote servers, you can control and monitor your component with the Viam SDKs, like any other component.
To show how to create a custom resource, the following example creates an arm as a custom component and registers the new arm model with a Viam SDK. Then you can control it as part of your machine with the same API methods available for arm models built into the RDK.
To add a custom resource as a remote part:
Each remote server can host one or many custom components.
For more detailed instructions, see the full example in the Python SDK documentation.
sensor
or arm
.
The new model must implement any methods of the built-in resource type marked as required in its RDK API definition.viam.rpc
library by creating a new rpc.server.Server
instance.Each remote server can host one or many custom components.
You must define all methods belonging to a built-in resource type when defining a new model. Otherwise, the class will not instantiate.
NotImplementedError()
in the body of functions you do not want to implement or put pass
.errUnimplemented
.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!