Generic Component

Generic components provide an API for running model-specific commands using DoCommand.

If you have a physical device or a program that does not fit into any of the provided components APIs, use a generic component.

For example, if you want to use an LED display, you need functionality that isn’t currently exposed in an existing API. Instead, you can use the generic component API to add support for your unique type of hardware, like LED displays, to your machine.

You should use the generic component for modular resources that represent a unique type of hardware. If you are adding new high-level software functionality, rather than supporting new hardware components, use the generic service instead.

Configuration

To use a generic component, check whether one of the following models supports it.

For configuration information, click on the model name:

Model
Description

If your viam-micro-server machine includes a resource that isn’t a base, board,encoder, movement sensor, motor, or servo, you can create a modular resource to add support for it as a custom model of the generic subtype.

API

The generic API supports the following methods:

Method NameDescriptionviam-micro-server Support
DoCommandExecute model-specific commands.

GetResourceNameGet the ResourceName for this generic component with the given name.

CloseSafely shut down the resource and prevent further use.

Troubleshooting

If your generic component is not working as expected, follow these steps:

  1. Check your machine logs on the LOGS tab to check for errors.
  2. Review your generic component model’s documentation to ensure you have configured all required attributes.
  3. Click on the TEST panel on the CONFIGURE or CONTROL tab and test if you can use the generic component there.

If none of these steps work, reach out to us on the Community Discord and we will be happy to help.

Next steps

For general configuration and development info, see: