viam.components.servo.servo

Module Contents

Classes

Servo

Servo represents a physical servo.

class viam.components.servo.servo.Servo(name: str)[source]

Servo represents a physical servo.

This acts as an abstract base class for any drivers representing specific servo implementations. This cannot be used on its own. If the __init__() function is overridden, it must call the super().__init__() function.

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

Move the servo to the provided angle.

Parameters:

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

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

Get the current angle (degrees) of the servo.

Returns:

The current angle of the servo in degrees.

Return type:

int

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

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

abstract async is_moving() bool[source]

Get if the servo is currently moving.

Returns:

Whether the servo is moving.

Return type:

bool