viam.components.component_base

Module Contents

Classes

ComponentBase

Base component.

Attributes

ValueTypes

viam.components.component_base.ValueTypes
class viam.components.component_base.ComponentBase(name: str)[source]

Base component. All components must inherit from this class.

SUBTYPE: ClassVar[viam.resource.types.Subtype]
classmethod from_robot(robot: viam.robot.client.RobotClient, name: str) typing_extensions.Self[source]

Get the component named name from the provided robot.

Parameters:
  • robot (RobotClient) – The robot

  • name (str) – The name of the component

Returns:

The component, if it exists on the robot

Return type:

Self

abstract async do_command(command: Mapping[str, ValueTypes], *, timeout: Optional[float] = None, **kwargs) Mapping[str, ValueTypes][source]

Send/Receive arbitrary commands to the Resource

Parameters:

command (Mapping[str, ValueTypes]) – The command to execute

Raises:

NotImplementedError – Raised if the Resource does not support arbitrary commands

Returns:

Result of the executed command

Return type:

Mapping[str, ValueTypes]