Add Custom Components as Remotes of Your Robot

If a type or model of component you are working with is not built-in to the Viam RDK, you can use a Viam SDK to code a custom resource implementation, host it on a server, and add it as a remote of your robot.

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.

For example, you may have a robotic arm that is not one of the models supported by Viam’s arm component, and you want to integrate it with Viam. To use is with Viam, you can create a custom component and register the new arm model with a Viam SDK. Then you can control it as part of your robot with the same API methods available for arm models built-in to the RDK.

This example is available in the Python SDK documentation.

Instructions

To add a custom resource as a remote:

  1. Code a new model of a built-in resource type. You can do this by creating a new interface that implements required methods. The new model must implement any functions of the built-in resource type marked as required in its RDK API definition.
  2. Register the custom component on a new gRPC server instance and start the server.
  3. Add the server as a remote of your robot.
  4. Configure a command to launch this remote server as a process of your robot to make sure the remote server is always running alongside the rest of your robot.

Each remote server can host one or many custom components.

  1. Code a new model of a built-in resource type. You can do this by subclassing a built in resource type like sensor or arm. The new model must implement any functions of the built-in resource type marked as required in its RDK API definition.
  2. Register the custom component on a new gRPC server instance and start the server. You can do this with the viam.rpc library by creating a new rpc.server.Server instance.
  3. Add the server as a remote of your robot.
  4. Configure a command to launch this remote server as a process of your robot to make sure the remote server is always running alongside the rest of your robot.

Each remote server can host one or many custom components.

The following tutorials also explain how to add custom components as remotes:



Have questions, or want to meet other people working on robots? Join our Community Discord.