コード例 #1
0
    def getPeriod(self) -> float:
        """Returns the period of the most recent pulse. Returns the period of
        the most recent Encoder pulse in seconds. This method compensates for
        the decoding type.

        .. deprecated::
            Use :func:`getRate` in favor of this method. This returns unscaled
            periods and :func:`getRate` scales using value from
            :func:`getDistancePerPulse`.

        :returns: Period in seconds of the most recent pulse.
        """
        warnings.warn("use getRate instead", DeprecationWarning)
        return hal.getEncoderPeriod(self.encoder)
コード例 #2
0
ファイル: encoder.py プロジェクト: robotpy/robotpy-wpilib
    def getPeriod(self) -> float:
        """Returns the period of the most recent pulse. Returns the period of
        the most recent Encoder pulse in seconds. This method compensates for
        the decoding type.

        .. deprecated::
            Use :func:`getRate` in favor of this method. This returns unscaled
            periods and :func:`getRate` scales using value from
            :func:`getDistancePerPulse`.

        :returns: Period in seconds of the most recent pulse.
        """
        warnings.warn("use getRate instead", DeprecationWarning)
        return hal.getEncoderPeriod(self.encoder)
コード例 #3
0
ファイル: encoder.py プロジェクト: james-ward/robotpy-wpilib
    def getPeriod(self):
        """Returns the period of the most recent pulse. Returns the period of
        the most recent Encoder pulse in seconds. This method compensates for
        the decoding type.

        .. deprecated::
            Use :func:`getRate` in favor of this method. This returns unscaled
            periods and :func:`getRate` scales using value from
            :func:`getDistancePerPulse`.

        :returns: Period in seconds of the most recent pulse.
        """
        warnings.warn("use getRate instead", DeprecationWarning)
        if self.counter is not None:
            measuredPeriod = self.counter.getPeriod() / self.decodingScaleFactor()
        else:
            measuredPeriod = hal.getEncoderPeriod(self.encoder)
        return measuredPeriod
コード例 #4
0
    def getPeriod(self):
        """Returns the period of the most recent pulse. Returns the period of
        the most recent Encoder pulse in seconds. This method compensates for
        the decoding type.

        .. deprecated::
            Use :func:`getRate` in favor of this method. This returns unscaled
            periods and :func:`getRate` scales using value from
            :func:`getDistancePerPulse`.

        :returns: Period in seconds of the most recent pulse.
        """
        warnings.warn("use getRate instead", DeprecationWarning)
        if self.counter is not None:
            measuredPeriod = self.counter.getPeriod(
            ) / self.decodingScaleFactor()
        else:
            measuredPeriod = hal.getEncoderPeriod(self.encoder)
        return measuredPeriod