j5.components.servo module

Classes for supporting Servomotors.

class j5.components.servo.Servo(identifier: int, backend: j5.components.servo.ServoInterface)[source]

Bases: j5.components.component.Component

A standard servomotor.

identifier

An integer to identify the component on a board.

Returns:component identifier.
static interface_class() → Type[j5.components.servo.ServoInterface][source]

Get the interface class that is required to use this component.

Returns:interface class.
position

Get the current position of the Servo.

Returns:current position of the Servo
class j5.components.servo.ServoInterface[source]

Bases: j5.components.component.Interface

An interface containing the methods required to control a Servo.

get_servo_position(identifier: int) → Optional[float][source]

Get the position of a servo.

Parameters:identifier – Port of servo to check.
Returns:Position of servo.
set_servo_position(identifier: int, position: Optional[float]) → None[source]

Set the position of a servo.

Parameters:
  • identifier – Port of servo to set position.
  • position – Position to set the servo to.