Advanced Modular Resources

Some use cases may require advanced considerations when designing or deploying modular resources. Depending on your needs, you may wish to define a new API subtype, deploy a custom component using a server on a remote part, or design a custom ML model.

New API subtypes

The component APIs and service APIs provide a standard interface for controlling common hardware components and higher level functionality. If your use case aligns closely with an existing API, you should use that API to program your new resource.

If you want to use most of an existing API but need just a few other functions, you can use the DoCommand endpoint together with extra parameters to add custom functionality to an existing resource subtype.

Or, if your resource does not fit into an existing resource subtype, you can use one of the following:

  • If you are working with a component that doesn’t fit into any of the existing component APIs, you can use the generic component to build your own component API.
  • If you are designing a service that doesn’t fit into any of the existing service APIs, you can use the generic service to build your own service API.

Both generic resources use the DoCommand endpoint to enable you to make arbitrary calls as needed for your resource.

Alternatively, you can also define a new resource subtype and an API for that subtype if none of the above options are a good fit for your use case.

Custom components as remotes

Running modular resources on the board 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 may need to implement a custom component and register it on a server configured as a remote on your machine.

Design a custom ML model

When working with the ML model service, you can deploy an existing model or train your own model.

However, if you are writing your own module that uses the ML model service together with the vision service, you can also design your own ML model to better match your specific use case.