Class RMIRemoteRegulatedMotor

    • Field Summary

      • Fields inherited from class java.rmi.server.RemoteObject

        ref
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected RMIRemoteRegulatedMotor​(java.lang.String portName, char motorType)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(RegulatedMotorListener listener)
      Adds a listener object that will be notified when rotation has started or stopped
      void backward()  
      void close()  
      void flt​(boolean immediateReturn)
      Set the motor into float mode.
      void forward()  
      int getLimitAngle()
      Return the limit angle (if any)
      float getMaxSpeed()
      Returns the maximim speed of the motor.
      int getSpeed()
      Returns the current motor speed.
      int getTachoCount()  
      boolean isMoving()  
      boolean isStalled()
      returns true if motor is stalled
      RegulatedMotorListener removeListener()
      Removes the RegulatedMotorListener from this class.
      void resetTachoCount()  
      void rotate​(int angle)
      Causes motor to rotate by a specified angle.
      void rotate​(int angle, boolean immediateReturn)
      causes motor to rotate through angle;
      iff immediateReturn is true, method returns immediately and the motor stops by itself
      If any motor method is called before the limit is reached, the rotation is canceled.
      void rotateTo​(int limitAngle)
      Causes motor to rotate to limitAngle;
      Then getTachoCount should be within +- 2 degrees of the limit angle when the method returns
      void rotateTo​(int limitAngle, boolean immediateReturn)
      causes motor to rotate to limitAngle;
      if immediateReturn is true, method returns immediately and the motor stops by itself
      and getTachoCount should be within +- 2 degrees if the limit angle If any motor method is called before the limit is reached, the rotation is canceled.
      void setAcceleration​(int acceleration)
      Set the required rate of acceleration degrees/s/s
      void setSpeed​(int speed)
      Set motor speed.
      void setStallThreshold​(int error, int time)
      Set the parameters for detecting a stalled motor.
      void stop​(boolean immediateReturn)
      Causes motor to stop, pretty much instantaneously.
      void waitComplete()
      Wait until the current movement operation is complete (this can include the motor stalling).
      • Methods inherited from class java.rmi.server.UnicastRemoteObject

        clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
      • Methods inherited from class java.rmi.server.RemoteServer

        getClientHost, getLog, setLog
      • Methods inherited from class java.rmi.server.RemoteObject

        equals, getRef, hashCode, toString, toStub
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RMIRemoteRegulatedMotor

        protected RMIRemoteRegulatedMotor​(java.lang.String portName,
                                          char motorType)
                                   throws java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException
    • Method Detail

      • addListener

        public void addListener​(RegulatedMotorListener listener)
                         throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Adds a listener object that will be notified when rotation has started or stopped
        Specified by:
        addListener in interface RMIRegulatedMotor
        Throws:
        java.rmi.RemoteException
      • removeListener

        public RegulatedMotorListener removeListener()
                                              throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Removes the RegulatedMotorListener from this class.
        Specified by:
        removeListener in interface RMIRegulatedMotor
        Returns:
        The RegulatedMotorListener that was removed, if any. Null if none existed.
        Throws:
        java.rmi.RemoteException
      • stop

        public void stop​(boolean immediateReturn)
                  throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        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 RMIRegulatedMotor
        Parameters:
        immediateReturn - if true do not wait for the motor to actually stop
        Throws:
        java.rmi.RemoteException
      • flt

        public void flt​(boolean immediateReturn)
                 throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        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 RMIRegulatedMotor
        Parameters:
        immediateReturn - If true do not wait for the motor to actually stop
        Throws:
        java.rmi.RemoteException
      • waitComplete

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

        public void rotate​(int angle,
                           boolean immediateReturn)
                    throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        causes motor to rotate through angle;
        iff immediateReturn is true, method returns immediately and the motor stops by itself
        If any motor method is called before the limit is reached, the rotation is canceled. When the angle is reached, the method isMoving() returns false;
        Specified by:
        rotate in interface RMIRegulatedMotor
        Parameters:
        angle - through which the motor will rotate
        immediateReturn - iff true, method returns immediately, thus allowing monitoring of sensors in the calling thread.
        Throws:
        java.rmi.RemoteException
        See Also:
        RegulatedMotor.rotate(int, boolean)
      • rotate

        public void rotate​(int angle)
                    throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Causes motor to rotate by a specified angle. The resulting tachometer count should be within +- 2 degrees on the NXT. This method does not return until the rotation is completed.
        Specified by:
        rotate in interface RMIRegulatedMotor
        Parameters:
        angle - by which the motor will rotate.
        Throws:
        java.rmi.RemoteException
      • rotateTo

        public void rotateTo​(int limitAngle)
                      throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Causes motor to rotate to limitAngle;
        Then getTachoCount should be within +- 2 degrees of the limit angle when the method returns
        Specified by:
        rotateTo in interface RMIRegulatedMotor
        Parameters:
        limitAngle - to which the motor will rotate, and then stop (in degrees). Includes any positive or negative int, even values > 360.
        Throws:
        java.rmi.RemoteException
      • rotateTo

        public void rotateTo​(int limitAngle,
                             boolean immediateReturn)
                      throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        causes motor to rotate to limitAngle;
        if immediateReturn is true, method returns immediately and the motor stops by itself
        and getTachoCount should be within +- 2 degrees if the limit angle If any motor method is called before the limit is reached, the rotation is canceled. When the angle is reached, the method isMoving() returns false;
        Specified by:
        rotateTo in interface RMIRegulatedMotor
        Parameters:
        limitAngle - to which the motor will rotate, and then stop (in degrees). Includes any positive or negative int, even values > 360.
        immediateReturn - iff true, method returns immediately, thus allowing monitoring of sensors in the calling thread.
        Throws:
        java.rmi.RemoteException
      • getLimitAngle

        public int getLimitAngle()
                          throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Return the limit angle (if any)
        Specified by:
        getLimitAngle in interface RMIRegulatedMotor
        Returns:
        the current limit angle
        Throws:
        java.rmi.RemoteException
      • setSpeed

        public void setSpeed​(int speed)
                      throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Set motor speed. As a rule of thumb 100 degrees per second are possible for each volt on an NXT motor. Therefore, disposable alkaline batteries can achieve a top speed of 900 deg/sec, while a rechargable lithium battery pack can achieve 740 deg/sec.
        Specified by:
        setSpeed in interface RMIRegulatedMotor
        Parameters:
        speed - in degrees per second.
        Throws:
        java.rmi.RemoteException
      • getSpeed

        public int getSpeed()
                     throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Returns the current motor speed.
        Specified by:
        getSpeed in interface RMIRegulatedMotor
        Returns:
        motor speed in degrees per second
        Throws:
        java.rmi.RemoteException
      • getMaxSpeed

        public float getMaxSpeed()
                          throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Returns the maximim speed of the motor.
        Specified by:
        getMaxSpeed in interface RMIRegulatedMotor
        Returns:
        the maximum speed of the Motor in degrees per second.
        Throws:
        java.rmi.RemoteException
      • isStalled

        public boolean isStalled()
                          throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        returns true if motor is stalled
        Specified by:
        isStalled in interface RMIRegulatedMotor
        Returns:
        true if stalled
        Throws:
        java.rmi.RemoteException
      • setStallThreshold

        public void setStallThreshold​(int error,
                                      int time)
                               throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Set the parameters for detecting a stalled motor. A motor will be recognized as stalled if the movement error (the amount the motor lags the regulated position) is greater than error for a period longer than time.
        Specified by:
        setStallThreshold in interface RMIRegulatedMotor
        Parameters:
        error - The error threshold
        time - The time that the error threshold needs to be exceeded for.
        Throws:
        java.rmi.RemoteException
      • setAcceleration

        public void setAcceleration​(int acceleration)
                             throws java.rmi.RemoteException
        Description copied from interface: RMIRegulatedMotor
        Set the required rate of acceleration degrees/s/s
        Specified by:
        setAcceleration in interface RMIRegulatedMotor
        Throws:
        java.rmi.RemoteException
      • close

        public void close()
                   throws java.rmi.RemoteException
        Specified by:
        close in interface RMIRegulatedMotor
        Throws:
        java.rmi.RemoteException
      • forward

        public void forward()
                     throws java.rmi.RemoteException
        Specified by:
        forward in interface RMIRegulatedMotor
        Throws:
        java.rmi.RemoteException
      • backward

        public void backward()
                      throws java.rmi.RemoteException
        Specified by:
        backward in interface RMIRegulatedMotor
        Throws:
        java.rmi.RemoteException
      • resetTachoCount

        public void resetTachoCount()
                             throws java.rmi.RemoteException
        Specified by:
        resetTachoCount in interface RMIRegulatedMotor
        Throws:
        java.rmi.RemoteException
      • getTachoCount

        public int getTachoCount()
                          throws java.rmi.RemoteException
        Specified by:
        getTachoCount in interface RMIRegulatedMotor
        Throws:
        java.rmi.RemoteException
      • isMoving

        public boolean isMoving()
                         throws java.rmi.RemoteException
        Specified by:
        isMoving in interface RMIRegulatedMotor
        Throws:
        java.rmi.RemoteException