ugokukun.keigan_wrapper

Wrapper for the pykeigan library, the official library for Keigan motor.

class ugokukun.keigan_wrapper.KeiganWrapper(port: str = '/dev/ttyUSB0', speed: int = 30, baudrate: int = 115200, log_path: str = 'log.txt')[source]

Bases: object

Class to supplement the pykeigan library, the official library for Keigan motor.

port

Serial port to connect to.

Type:

str

baudrate

Baudrate for serial communication.

Type:

int

motor

Motor object. motor.serial is the serial.Serial object.

Type:

pykeigan.usbcontroller.USBController

speed

Motor speed in rpm.

Type:

int

log_path

Path to log file.

Type:

str

logger

Logger object.

Type:

logging.Logger

Notes

Anything not implemented in this class should be accessed directly from motor object. pykeigan is poorly documented so I advise you to just go read the source code. https://github.com/keigan-motor/pykeigan_motor/tree/master

connect_motor() None[source]

pykeigan.usbcontorller.USBcontroller() with timeout.

turn_relative(clock_wise: False, degrees: int) None[source]

Turn motor based on relative position.

Parameters:
  • clock_wise (bool, optional) – Direction to turn the motor. Clockwise if True, counter-clockwise if False., by default False

  • degrees (int) – Degrees to rotate. Will accept negative values, if that’s what you want.

Raises:

ValueError – If the motor is not connected.