Record Class CANMotorControllerInfo

java.lang.Object
java.lang.Record
xbot.common.injection.electrical_contract.CANMotorControllerInfo
Record Components:
name - device name
type - motor-controller type
busId - CAN bus identity
deviceId - CAN device number
pdhPort - power-distribution port metadata
outputConfig - output configuration, retained by reference

public record CANMotorControllerInfo(String name, MotorControllerType type, CANBusId busId, int deviceId, PDHPort pdhPort, CANMotorControllerOutputConfig outputConfig) extends Record
Motor-controller configuration. Construction does not validate or reserve hardware.
CANMotorControllerInfo motor = CANMotorControllerInfo.builder("Drive").withType(MotorControllerType.TalonFx).withCanBus(CANBusId.Canivore, 1)
        .withPdhPort(PDHPort.PDH01).build();
  • Constructor Details

    • CANMotorControllerInfo

      public CANMotorControllerInfo(String name, MotorControllerType type, CANBusId busId, int deviceId, PDHPort pdhPort, CANMotorControllerOutputConfig outputConfig)
      Creates an instance of a CANMotorControllerInfo record class.
      Parameters:
      name - the value for the name record component
      type - the value for the type record component
      busId - the value for the busId record component
      deviceId - the value for the deviceId record component
      pdhPort - the value for the pdhPort record component
      outputConfig - the value for the outputConfig record component
  • Method Details

    • builder

      public static CANMotorControllerInfo.Builder builder(String name)
      Starts a SparkMax builder on CAN_S0 with no PDH port. Set the CAN address with CANMotorControllerInfo.Builder.withCanBus(CANPort, int); an unspecified device ID is -1. Each build gets a fresh default output configuration unless one is explicitly supplied.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • type

      public MotorControllerType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • busId

      public CANBusId busId()
      Returns the value of the busId record component.
      Returns:
      the value of the busId record component
    • deviceId

      public int deviceId()
      Returns the value of the deviceId record component.
      Returns:
      the value of the deviceId record component
    • pdhPort

      public PDHPort pdhPort()
      Returns the value of the pdhPort record component.
      Returns:
      the value of the pdhPort record component
    • outputConfig

      public CANMotorControllerOutputConfig outputConfig()
      Returns the value of the outputConfig record component.
      Returns:
      the value of the outputConfig record component