Class RobotPropertyUtil


  • public class RobotPropertyUtil
    extends java.lang.Object
    RobotPropertyUtil is used to shortcut many component creations using common naming conventions such as motors, encoders, and more.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static CANMotorConfig getCANMotorConfig​(java.lang.String motorName)
      Shortcut to return a CANMotorConfig using the RobotProperty class and a motor name.
      static edu.wpi.first.wpilibj.Encoder getEncoder​(java.lang.String encoderName)
      Shortcut to return a CANMotorConfig using the RobotProperty class and an encoder name.
      static LimitSwitch getLimitSwitch​(java.lang.String switchName)
      Shortcut to return a LimitSwitch using the RobotProperty class and a motor name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RobotPropertyUtil

        public RobotPropertyUtil()
    • Method Detail

      • getCANMotorConfig

        public static CANMotorConfig getCANMotorConfig​(java.lang.String motorName)
        Shortcut to return a CANMotorConfig using the RobotProperty class and a motor name. It expects a few properties to be defined prefixed with whatever is passed as motorName.
        • <motorName>_id (integer): The CAN ID of the motor.
        • <motorName>_inverted (boolean): If the motor should be inverted. Defaults to false.
        • <motorName>_brake_mode_enabled (boolean): If the motor should be inverted. Defaults to false.
        Parameters:
        motorName - The motor name to fetch the appropriate values for.
        Returns:
        The CANMotorConfig generated from the dynamic property values.
      • getEncoder

        public static edu.wpi.first.wpilibj.Encoder getEncoder​(java.lang.String encoderName)
        Shortcut to return a CANMotorConfig using the RobotProperty class and an encoder name. It expects a few properties to be defined prefixed with whatever is passed as encoderName.
        • <encoderName>_chan_a_id (integer): The DIO ID of channel A of the encoder.
        • <encoderName>_chan_b_id (integer): The DIO ID of channel B of the encoder.
        Parameters:
        encoderName - The encoder name to fetch the appropriate values for.
        Returns:
        The Encoder generated from the dynamic property values.
      • getLimitSwitch

        public static LimitSwitch getLimitSwitch​(java.lang.String switchName)
        Shortcut to return a LimitSwitch using the RobotProperty class and a motor name.

        It expects an integer <switchName>_limit_switch_dio_id to be defined prefixed with whatever is passed as switchName.

        Parameters:
        switchName - The limit switch name to fetch the appropriate values for.
        Returns:
        The LimitSwitch generated from the dynamic property values.