Class TetrixRegulatedMotor

    • Method Detail

      • setRegulate

        public void setRegulate​(boolean regulate)
        OVERRIDDEN TO NOT ALLOW CHANGE OF REGULATED STATE as the TetrixRegulatedMotor class must use regulation. Motors are always in regulated mode when using the TetrixRegulatedMotor class.
        Overrides:
        setRegulate in class TetrixEncoderMotor
        Parameters:
        regulate - Ignored
      • getRotationSpeed

        public int getRotationSpeed()
        Return the current rotational speed calculated from the encoder position every 100 ms. This will likely differ from what was specified in setSpeed.
        Specified by:
        getRotationSpeed in interface Tachometer
        Returns:
        The current rotational speed in deg/sec
      • stop

        public void stop​(boolean immediateReturn)
        Description copied from interface: RegulatedMotor
        Causes motor to stop, pretty much instantaneously. In other words, the motor doesn't just stop; it will resist any further motion. Cancels any rotate() orders in progress
        Specified by:
        stop in interface RegulatedMotor
        Parameters:
        immediateReturn - if true do not wait for the motor to actually stop
      • flt

        public void flt​(boolean immediateReturn)
        Description copied from interface: RegulatedMotor
        Set the motor into float mode. This will stop the motor without braking and the position of the motor will not be maintained.
        Specified by:
        flt in interface RegulatedMotor
        Parameters:
        immediateReturn - If true do not wait for the motor to actually stop
      • waitComplete

        public void waitComplete()
        Description copied from interface: RegulatedMotor
        Wait until the current movement operation is complete (this can include the motor stalling).
        Specified by:
        waitComplete in interface RegulatedMotor
      • rotate

        public void rotate​(int angle)
        Rotate by the requested number of degrees while blocking until completion.
        Specified by:
        rotate in interface RegulatedMotor
        Parameters:
        angle - number of degrees to rotate relative to the current position.
      • rotateTo

        public void rotateTo​(int limitAngle)
        Rotate to the target angle while blocking until completion.
        Specified by:
        rotateTo in interface RegulatedMotor
        Parameters:
        limitAngle - Angle [in degrees] to rotate to.
      • setSpeed

        public void setSpeed​(int speed)
        Sets desired motor speed, in degrees per second. Since the TETRIX Motor Controller only has power adjustment, the power value is derived from the passed speed value as:
          power = Math.round((speed - 0.5553f) * 0.102247398f);
        and as such, the actual speed value will not be exact.

        The maximum reliably sustainable velocity for the TETRIX DC Gear motor P/N 739023 (which was used as the test case for creating this class) is 154 RPM => 924 degs/sec.

        Specified by:
        setSpeed in interface RegulatedMotor
        Parameters:
        speed - value in degrees/sec
        See Also:
        getSpeed()
      • getSpeed

        public int getSpeed()
        Return the speed value calculated from the actual power value as:
          speed = Math.round(9.7802f * super.getPower() + 0.5553f);
        and as such, the actual speed value may not be what was set with setSpeed.
        Specified by:
        getSpeed in interface RegulatedMotor
        Returns:
        The speed value (converted from power value) in degrees/sec
        See Also:
        setSpeed(int)
      • getMaxSpeed

        public float getMaxSpeed()
        NOT IMPLEMENTED as the TEXTRIX motor controller does not support this command.
        Specified by:
        getMaxSpeed in interface RegulatedMotor
        Returns:
        Always 924 degrees/sec
      • isStalled

        public boolean isStalled()
        NOT IMPLEMENTED as the TEXTRIX motor controller does not support this command.
        Specified by:
        isStalled in interface RegulatedMotor
        Returns:
        Always false
      • setStallThreshold

        public void setStallThreshold​(int error,
                                      int time)
        NOT IMPLEMENTED as the TEXTRIX motor controller does not support this command.
        Specified by:
        setStallThreshold in interface RegulatedMotor
        Parameters:
        error - The error threshold
        time - The time that the error threshold needs to be exceeded for.
      • setAcceleration

        public void setAcceleration​(int acceleration)
        NOT IMPLEMENTED as the TEXTRIX motor controller does not support this command.
        Specified by:
        setAcceleration in interface RegulatedMotor
        Parameters:
        acceleration - Ignored
      • close

        public void close()
        Description copied from interface: RegulatedMotor
        Close the port, the port can not be used after this call.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface RegulatedMotor
      • synchronizeWith

        public void synchronizeWith​(RegulatedMotor[] syncList)
        Description copied from interface: RegulatedMotor
        Specify a set of motors that should be kept in synchronization with this one. The synchronization mechanism simply ensures that operations between a startSynchronization call and an endSynchronization call will all be executed at the same time (when the endSynchronization method is called). This is all that is needed to ensure that motors will operate in a synchronized fashion. The start/end methods can also be used to ensure that reads of the motor state will also be consistent.
        Specified by:
        synchronizeWith in interface RegulatedMotor
        Parameters:
        syncList - an array of motors to synchronize with.