viam.components.servo.client

Module Contents

Classes

ServoClient

gRPC client for the Servo component.

class viam.components.servo.client.ServoClient(name: str, channel: grpclib.client.Channel)[source]

gRPC client for the Servo component.

async get_position(*, extra: Optional[Mapping[str, Any]] = None, timeout: Optional[float] = None) int[source]

Get the current angle (degrees) of the servo.

Returns:

The current angle of the servo in degrees.

Return type:

int

async move(angle: int, *, extra: Optional[Mapping[str, Any]] = None, timeout: Optional[float] = None)[source]

Move the servo to the provided angle.

Parameters:

angle (int) – The desired angle of the servo in degrees.

async stop(*, extra: Optional[Mapping[str, Any]] = None, timeout: Optional[float] = None)[source]

Stop the servo. It is assumed that the servo stops immediately.

async is_moving(*, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None) bool[source]

Get if the servo is currently moving.

Returns:

Whether the servo is moving.

Return type:

bool

async do_command(command: Mapping[str, viam.utils.ValueTypes], *, timeout: Optional[float] = None) Mapping[str, viam.utils.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]