rxpoweredup
    Preparing search index...

    Interface IMotorsFeature

    interface IMotorsFeature {
        goToPosition(
            portId: number,
            targetDegree: number,
            options?: ServoCommandOptions,
        ): Observable<PortCommandExecutionStatus>;
        goToPositionSynchronized(
            virtualPortId: number,
            targetDegree1: number,
            targetDegree2: number,
            options?: ServoCommandOptions,
        ): Observable<PortCommandExecutionStatus>;
        rotateByDegree(
            portId: number,
            degree: number,
            options?: ServoCommandOptions,
        ): Observable<PortCommandExecutionStatus>;
        setAccelerationTime(
            portId: number,
            timeMs: number,
        ): Observable<PortCommandExecutionStatus>;
        setDecelerationTime(
            portId: number,
            timeMs: number,
        ): Observable<PortCommandExecutionStatus>;
        setSpeedSynchronized(
            virtualPortId: number,
            speed1: number,
            speed2: number,
            options?: StartSpeedOptions,
        ): Observable<PortCommandExecutionStatus>;
        setZeroPositionRelativeToCurrentPosition(
            portId: number,
            position: number,
            positionModeId?: number,
        ): Observable<PortCommandExecutionStatus>;
        startPower(
            portId: number,
            power: number,
            powerModeId: number,
            options?: StartPowerOptions,
        ): Observable<PortCommandExecutionStatus>;
        startSpeed(
            portId: number,
            speed: number,
            options?: StartSpeedOptions,
        ): Observable<PortCommandExecutionStatus>;
    }
    Index

    Methods

    • Rotates the motor to the specified position (relative to zero). Zero is the position when the motor was last switched on or connected to the hub. Positive values are calculated clockwise, negative values are calculated counter-clockwise.

      WARNING: setting noFeedback to true can lead to the motor rotating forever (until the hub is switched off) if the next command issued in quick succession. Use with caution.

      Parameters

      • portId: number
      • targetDegree: number

        must be in [-2147483647, 2147483647] range

      • Optionaloptions: ServoCommandOptions

      Returns Observable<PortCommandExecutionStatus>

    • Rotates the motor by the specified degree (positive values rotate clockwise, negative values rotate counter-clockwise). The sign of the speed is ignored

      WARNING: setting noFeedback to true can lead to the motor rotating forever (until the hub is switched off) if the next command is issued in quick succession. Use with caution.

      Parameters

      • portId: number

        The port to issue command at

      • degree: number

        Step in degrees

      • Optionaloptions: ServoCommandOptions

        See RotateByDegreeOptions

      Returns Observable<PortCommandExecutionStatus>

    • Shifts motor's encoder zero position relative to current position. Stream completes when the command is executed by the hub. Do not expect InProgress status to be emitted.

      Positive values shift the absolute zero clockwise, negative values shift the absolute zero counter-clockwise.

      Parameters

      • portId: number

        The port to set zero position at.

      • position: number

        Target position in degrees.

      • OptionalpositionModeId: number

        Position mode ID, defaults to WELL_KNOWN_PORT_MODE_IDS.motor[PortModeName.position]

      Returns Observable<PortCommandExecutionStatus>

    • Starts motor rotation at the specified power. Used to control Power Functions motors, e.g. LPF2-TRAIN Stream completes when the command is executed by the hub. Do not expect InProgress status to be emitted.

      Parameters

      • portId: number
      • power: number

        power in range [-100, 100]

      • powerModeId: number

        power mode ID, defaults to WELL_KNOWN_PORT_MODE_IDS.motor[PortModeName.power]

      • Optionaloptions: StartPowerOptions

      Returns Observable<PortCommandExecutionStatus>