Class XServo

java.lang.Object
xbot.common.controls.actuators.XServo
All Implemented Interfaces:
DataFrameRefreshable, XBaseIO
Direct Known Subclasses:
MockServo, ServoWPIAdapter

public abstract class XServo extends Object implements XBaseIO, DataFrameRefreshable
A servo motor. This class is abstract because the actual implementation of a servo motor will depend on the hardware being used. For example, for a real implementation, we have the ServoWPIAdapter class, and the Mock library has a MockServo class.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    XServo(int channel, String name, DevicePolice police)
    Create a new servo motor.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract double
    get()
    Get the current value of the servo.
    int
    Get the PWM channel that this servo is connected to.
    void
    Consumes and processes inputs from the device or subsystem.
    abstract void
    set(double value)
    Set the servo to a specific value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • channel

      protected int channel
    • name

      protected String name
  • Constructor Details

    • XServo

      protected XServo(int channel, String name, DevicePolice police)
      Create a new servo motor.
      Parameters:
      channel - The PWM channel that the servo is connected to.
      name - The name of the servo for logging.
      police - The device police to register the servo with.
  • Method Details

    • getChannel

      public int getChannel()
      Get the PWM channel that this servo is connected to.
      Specified by:
      getChannel in interface XBaseIO
      Returns:
      The PWM channel that this servo is connected to.
    • set

      public abstract void set(double value)
      Set the servo to a specific value.
      Parameters:
      value - The value to set the servo to. This should be a value between 0 and 1.
    • get

      public abstract double get()
      Get the current value of the servo.
      Returns:
      The current value of the servo, between 0 and 1.
    • refreshDataFrame

      public void refreshDataFrame()
      Description copied from interface: DataFrameRefreshable
      Consumes and processes inputs from the device or subsystem.
      Specified by:
      refreshDataFrame in interface DataFrameRefreshable