Record Class IMUInfo

java.lang.Object
java.lang.Record
xbot.common.injection.electrical_contract.IMUInfo
Record Components:
name - device name
imuType - IMU implementation type
interfaceType - hardware interface
canBusId - CAN bus identity
deviceId - device number
mountOrientation - onboard IMU mounting orientation
powerFrom - power-source metadata

public record IMUInfo(String name, XGyro.ImuType imuType, XGyro.InterfaceType interfaceType, CANBusId canBusId, int deviceId, org.wpilib.hardware.imu.OnboardIMU.MountOrientation mountOrientation, PowerSource powerFrom) extends Record
IMU configuration. No bus, interface, orientation, or power metadata is inferred from the IMU type. Construction does not validate or reserve hardware.
IMUInfo imu = IMUInfo.builder("IMU", XGyro.ImuType.onboard).withDeviceId(1).withMountOrientation(MountOrientation.FLAT).withPowerFrom(PowerSource.RIO)
        .build();
  • Constructor Details

    • IMUInfo

      public IMUInfo(String name, XGyro.ImuType imuType, XGyro.InterfaceType interfaceType, CANBusId canBusId, int deviceId, org.wpilib.hardware.imu.OnboardIMU.MountOrientation mountOrientation, PowerSource powerFrom)
      Creates an instance of a IMUInfo record class.
      Parameters:
      name - the value for the name record component
      imuType - the value for the imuType record component
      interfaceType - the value for the interfaceType record component
      canBusId - the value for the canBusId record component
      deviceId - the value for the deviceId record component
      mountOrientation - the value for the mountOrientation record component
      powerFrom - the value for the powerFrom record component
  • Method Details

    • builder

      public static IMUInfo.Builder builder(String name, XGyro.ImuType imuType)
      Starts a builder with an explicit name and IMU type. All optional metadata defaults to null. Set the CAN address with IMUInfo.Builder.withCanBus(CANPort, int), or a non-CAN device ID with IMUInfo.Builder.withDeviceId(int). An unspecified device ID is -1.
    • createMock

      public static IMUInfo createMock(IMUInfo realInstance)
      Preserves identity, interface, bus, and power metadata for a mock, without mounting orientation.
    • 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
    • imuType

      public XGyro.ImuType imuType()
      Returns the value of the imuType record component.
      Returns:
      the value of the imuType record component
    • interfaceType

      public XGyro.InterfaceType interfaceType()
      Returns the value of the interfaceType record component.
      Returns:
      the value of the interfaceType record component
    • canBusId

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

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

      public org.wpilib.hardware.imu.OnboardIMU.MountOrientation mountOrientation()
      Returns the value of the mountOrientation record component.
      Returns:
      the value of the mountOrientation record component
    • powerFrom

      public PowerSource powerFrom()
      Returns the value of the powerFrom record component.
      Returns:
      the value of the powerFrom record component