Interface Motor

Represents a physical motor.

interface Motor {
    doCommand(command): Promise<JsonValue>;
    getPosition(extra?): Promise<number>;
    getProperties(extra?): Promise<Properties>;
    goFor(rpm, revolutions, extra?): Promise<void>;
    goTo(rpm, positionRevolutions, extra?): Promise<void>;
    isMoving(): Promise<boolean>;
    isPowered(extra?): Promise<readonly [boolean, number]>;
    resetZeroPosition(offset, extra?): Promise<void>;
    setPower(power, extra?): Promise<void>;
    setRPM(rpm, extra?): Promise<void>;
    stop(extra?): Promise<void>;
}

Hierarchy (view full)

Implemented by

Methods

  • Return the position of the motor relative to its zero position. Raise an error if position reporting is not supported.

    Parameters

    Returns Promise<number>

  • Return the motor's properties.

    Parameters

    Returns Promise<Properties>

  • Turn the motor at a specified speed for either a specified number of revolutions or indefinitely. Raise an error if position reporting is not supported.

    Parameters

    • rpm: number

      Speed in revolutions per minute.

    • revolutions: number

      Number of revolutions relative to the motor's starting position. If this value is 0, this will run the motor at the given rpm indefinitely. If this value is nonzero, this will block until the number of revolutions has been completed or another operation comes in.

    • Optional extra: Struct

    Returns Promise<void>

  • Move the motor to a specific position relative to its home position at a specified speed. Raise an error if position reporting is not supported.

    Parameters

    • rpm: number

      Speed in revolutions per minute.

    • positionRevolutions: number

      Number of revolutions relative to the motor's home position.

    • Optional extra: Struct

    Returns Promise<void>

  • Return true if the motor is in motion.

    Returns Promise<boolean>

  • Return true if the motor is on.

    Parameters

    Returns Promise<readonly [boolean, number]>

  • Set the current position of the motor as the new zero position, offset by a given position. Raise an error if position reporting is not supported.

    Parameters

    • offset: number

      Position from which to offset the current position.

    • Optional extra: Struct

    Returns Promise<void>

  • Set the percentage of the motor's total power that should be employed.

    Parameters

    • power: number

      A value between -1 and 1 where negative values indicate a backwards direction and positive values a forward direction.

    • Optional extra: Struct

    Returns Promise<void>

  • Move the motor indefinitely at a specified speed. Raise an error if position reporting is not supported.

    Parameters

    • rpm: number

      Speed in revolutions per minute.

    • Optional extra: Struct

    Returns Promise<void>

  • Turn the motor off.

    Parameters

    Returns Promise<void>

Generated using TypeDoc