Class SpeedControllerGroup

  • All Implemented Interfaces:
    ComposedComponent<edu.wpi.first.wpilibj.SpeedController>, edu.wpi.first.wpilibj.SpeedController

    public final class SpeedControllerGroup
    extends java.lang.Object
    implements edu.wpi.first.wpilibj.SpeedController, ComposedComponent<edu.wpi.first.wpilibj.SpeedController>
    Implements a container for SpeedControllers.
    • Constructor Summary

      Constructors 
      Constructor Description
      SpeedControllerGroup​(edu.wpi.first.wpilibj.SpeedController... controllers)
      Create a new SpeedControllerGroup instance.
      SpeedControllerGroup​(java.util.Collection<edu.wpi.first.wpilibj.SpeedController> controllers)
      Create a new SpeedControllerGroup instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void disable()
      Disable each SpeedController in the collection.
      double get()
      The current speed of this SpeedControllerGroup.
      java.util.List<java.lang.Double> getAll()
      The speeds of all SpeedControllers within this SpeedControllerGroup.
      java.util.Collection<edu.wpi.first.wpilibj.SpeedController> getComposedComponents()
      Return the list of SpeedControllers which this SpeedControllerGroup was constructed with.
      boolean getInverted()  
      void set​(double pwm)
      Set the pwm value (-1.0 to 1.0).
      SpeedControllerGroup setInversion​(boolean inversion)
      Same as setInverted(boolean), but returns "this" rather than void.
      void setInverted​(boolean inverted)
      Invert all PWM values for this SpeedControllerGroup.
      void stopMotor()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface edu.wpi.first.wpilibj.SpeedController

        setVoltage
    • Constructor Detail

      • SpeedControllerGroup

        public SpeedControllerGroup​(edu.wpi.first.wpilibj.SpeedController... controllers)
        Create a new SpeedControllerGroup instance.
        Parameters:
        controllers - a varargs list or array of SpeedController objects. May be all the same type, or may be mixed.
      • SpeedControllerGroup

        public SpeedControllerGroup​(java.util.Collection<edu.wpi.first.wpilibj.SpeedController> controllers)
        Create a new SpeedControllerGroup instance.
        Parameters:
        controllers - a collection of SpeedControllers for this SpeedControllerGroup to manage
    • Method Detail

      • setInverted

        public void setInverted​(boolean inverted)
        Invert all PWM values for this SpeedControllerGroup.
        Specified by:
        setInverted in interface edu.wpi.first.wpilibj.SpeedController
        Parameters:
        inverted - whether the PWM values should be inverted or not
      • setInversion

        public SpeedControllerGroup setInversion​(boolean inversion)
        Same as setInverted(boolean), but returns "this" rather than void.
        Parameters:
        inversion - whether the PWM values should be inverted or not
        Returns:
        this
      • get

        public double get()
        The current speed of this SpeedControllerGroup.
        Specified by:
        get in interface edu.wpi.first.wpilibj.SpeedController
        Returns:
        the current PWM value of the SpeedController collection (-1.0 to 1.0)
      • getComposedComponents

        public java.util.Collection<edu.wpi.first.wpilibj.SpeedController> getComposedComponents()
        Return the list of SpeedControllers which this SpeedControllerGroup was constructed with.
        Specified by:
        getComposedComponents in interface ComposedComponent<edu.wpi.first.wpilibj.SpeedController>
        Returns:
        the SpeedControllers.
      • getAll

        public java.util.List<java.lang.Double> getAll()
        The speeds of all SpeedControllers within this SpeedControllerGroup. They should all be nearly identical, other than error due to floating point precision.
        Returns:
        a list enumerating all the current PWM values of the SpeedController collection (-1.0 to 1.0)
      • set

        public void set​(double pwm)
        Set the pwm value (-1.0 to 1.0).
        Specified by:
        set in interface edu.wpi.first.wpilibj.SpeedController
        Parameters:
        pwm - the PWM value to assign to each SpeedController in the collection
      • disable

        public void disable()
        Disable each SpeedController in the collection.
        Specified by:
        disable in interface edu.wpi.first.wpilibj.SpeedController
      • getInverted

        public boolean getInverted()
        Specified by:
        getInverted in interface edu.wpi.first.wpilibj.SpeedController
      • stopMotor

        public void stopMotor()
        Specified by:
        stopMotor in interface edu.wpi.first.wpilibj.SpeedController