Control your generic component with the generic API | Component APIs

Control your generic component with the generic API

The generic API allows you to give commands to your generic components for running model-specific commands using DoCommand.

Example usage

See Deploy control logic for an example of how to use the generic component API, including how to call DoCommand() from the SDKs or the web UI.

The generic component supports the following method:

Method Name Description viam-micro-server Support
GetGeometries Get all the geometries associated with the generic component in its current configuration, in the frame of the generic component.
DoCommand Execute model-specific commands.
GetResourceName Get the ResourceName for this generic component.
Close Safely shut down the resource and prevent further use.

API

GetGeometries

Get all the geometries associated with the generic component in its current configuration, in the frame of the generic component.
The motion and navigation services use the relative position of inherent geometries to configured geometries representing obstacles for collision detection and obstacle avoidance while motion planning.

Parameters:

Returns:

Example:


Copy

For more information, see the Python SDK Docs.

Parameters:

Returns:

Example:


Copy

For more information, see the Go SDK Docs.

Parameters:

Returns:

Example:


Copy

For more information, see the TypeScript SDK Docs.

DoCommand

Execute model-specific commands.
If you are implementing your own generic component and want to add features that have no corresponding built-in API method, you can implement them with DoCommand.
Supported by viam-micro-server.

Parameters:

Returns:

Raises:

Example:


Copy

For more information, see the Python SDK Docs.

Parameters:

Returns:

Example:


Copy

For more information, see the Go SDK Docs.

Parameters:

Returns:

Example:


Copy

For more information, see the TypeScript SDK Docs.

Parameters:

Returns:

Example:


Copy

For more information, see the Flutter SDK Docs.

GetResourceName

Get the ResourceName for this generic component.

Parameters:

Returns:

Example:


Copy

For more information, see the Python SDK Docs.

Parameters:

Returns:

Example:


Copy

For more information, see the Go SDK Docs.

Parameters:

Returns:

Example:


Copy

For more information, see the TypeScript SDK Docs.

Parameters:

Returns:

Example:


Copy

For more information, see the Flutter SDK Docs.

Close

Safely shut down the resource and prevent further use.

Parameters:

Returns:

Example:


Copy

For more information, see the Python SDK Docs.