Record Class CANMotorControllerInfo
java.lang.Object
java.lang.Record
xbot.common.injection.electrical_contract.CANMotorControllerInfo
- Record Components:
name- device nametype- motor-controller typebusId- CAN bus identitydeviceId- CAN device numberpdhPort- power-distribution port metadataoutputConfig- 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();
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCANMotorControllerInfo(String name, MotorControllerType type, CANBusId busId, int deviceId, PDHPort pdhPort, CANMotorControllerOutputConfig outputConfig) Creates an instance of aCANMotorControllerInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionStarts a SparkMax builder on CAN_S0 with no PDH port.busId()Returns the value of thebusIdrecord component.intdeviceId()Returns the value of thedeviceIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.Returns the value of theoutputConfigrecord component.pdhPort()Returns the value of thepdhPortrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
CANMotorControllerInfo
public CANMotorControllerInfo(String name, MotorControllerType type, CANBusId busId, int deviceId, PDHPort pdhPort, CANMotorControllerOutputConfig outputConfig) Creates an instance of aCANMotorControllerInforecord class.- Parameters:
name- the value for thenamerecord componenttype- the value for thetyperecord componentbusId- the value for thebusIdrecord componentdeviceId- the value for thedeviceIdrecord componentpdhPort- the value for thepdhPortrecord componentoutputConfig- the value for theoutputConfigrecord component
-
-
Method Details
-
builder
Starts a SparkMax builder on CAN_S0 with no PDH port. Set the CAN address withCANMotorControllerInfo.Builder.withCanBus(CANPort, int); an unspecified device ID is -1. Each build gets a fresh default output configuration unless one is explicitly supplied. -
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
-
type
-
busId
-
deviceId
-
pdhPort
-
outputConfig
Returns the value of theoutputConfigrecord component.- Returns:
- the value of the
outputConfigrecord component
-