Enum API.Motor

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<API.Motor>
    Enclosing class:
    API

    public static enum API.Motor
    extends java.lang.Enum<API.Motor>
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      M0  
      M1  
      M2  
      M3  
      M4  
      M5  
      M6  
      M7  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void resetEncoder()
      Resets the encoder
      void setBehaviour​(API.MotorBehaviour behaviour)
      Set the zero-power behaviour of the motor.
      void setDirection​(API.Direction direction)
      Sets the direction the motor should move in, without starting the motor
      void setDirection​(API.Direction direction, boolean immediate)  
      void setPower​(double power)
      Sets the power without starting the motor
      void start()
      Starts the motor
      void start​(double power)
      Starts the motor with the specified power
      void stop()
      Stops the motor and sets the power to 0
      static API.Motor valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static API.Motor[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static API.Motor[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (API.Motor c : API.Motor.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static API.Motor valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • start

        public void start()
        Starts the motor
      • start

        public void start​(double power)
        Starts the motor with the specified power
        Parameters:
        power - the power to use for the motor
      • stop

        public void stop()
        Stops the motor and sets the power to 0
      • setPower

        public void setPower​(double power)
        Sets the power without starting the motor
        Parameters:
        power - the power to use for the motor
      • setDirection

        public void setDirection​(API.Direction direction)
        Sets the direction the motor should move in, without starting the motor
        Parameters:
        direction - the direction to use for the motor
      • setDirection

        public void setDirection​(API.Direction direction,
                                 boolean immediate)
      • resetEncoder

        public void resetEncoder()
        Resets the encoder
      • setBehaviour

        public void setBehaviour​(API.MotorBehaviour behaviour)
        Set the zero-power behaviour of the motor. BRAKE means to immediately apply brakes when power is 0, and FLOAT means to come to a rolling stop.
        Parameters:
        behaviour - The behaviour to use