Class API.Servo

  • Enclosing class:
    API

    public class API.Servo
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getPosition()
      Gets the current position of the servo.
      void setDirection​(API.Direction direction, boolean immediate)
      Sets the direction of the servo.
      void setPosition​(double degrees)
      Sets the intended position of the servo, in degrees.
      void start​(double power)
      Starts the servo
      void stop()
      Stops the servo by setting the power to 0.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setPosition

        public void setPosition​(double degrees)
        Sets the intended position of the servo, in degrees. Note that intended means it will not necessarily get to this position, but that it will constantly attempt to get there.
        Parameters:
        degrees - The intended position.
      • getPosition

        public double getPosition()
        Gets the current position of the servo. Might not match up with setPosition.
        Returns:
        The position in degrees.
      • start

        public void start​(double power)
        Starts the servo
        Parameters:
        power - The power to use, from 0 to 1
      • stop

        public void stop()
        Stops the servo by setting the power to 0.
      • setDirection

        public void setDirection​(API.Direction direction,
                                 boolean immediate)
        Sets the direction of the servo.
        Parameters:
        direction - The direction.
        immediate - Whether to start the servo upon setting direction or not.