Class CustomBrushlessMotorConfigs
- All Implemented Interfaces:
ParentConfiguration,ISerializable,Cloneable
Configs are only used when Motor Arrangement is set to Custom Brushless Motor. Note this feature will only work device is not FRC-Locked.
Users are responsible for ensuring that these configs are accurate to the motor. CTR Electronics is not responsible for damage caused by an incorrect custom motor configuration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanOptional configuration to correct clockwise versus counter-clockwise rotor spin.booleanDetermines expected Hall direction for rotor velocity signage.intExpected Hall Value when motor controller applies A+ and B-.intExpected Hall Value when motor controller applies A+ and C-.doubleKv constant of the connected custom brushless motor.intNumber of pole pairs in the connected custom brushless motor (number of poles divided by 2). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()final StatusCodedeserialize(String to_deserialize) Take a string and deserialize it to this configuration group.final Per<AngularVelocityUnit,VoltageUnit> Helper method to get this configuration's MotorKv parameter converted to a unit type.final StringGet the serialized form of this configuration group.toString()withHallCCWSelect(boolean newHallCCWSelect) Modifies this configuration's HallCCWSelect parameter and returns itself for method-chaining and easier to use config API.withHallDirection(boolean newHallDirection) Modifies this configuration's HallDirection parameter and returns itself for method-chaining and easier to use config API.withHallDuringAB(int newHallDuringAB) Modifies this configuration's HallDuringAB parameter and returns itself for method-chaining and easier to use config API.withHallDuringAC(int newHallDuringAC) Modifies this configuration's HallDuringAC parameter and returns itself for method-chaining and easier to use config API.withMotorKv(double newMotorKv) Modifies this configuration's MotorKv parameter and returns itself for method-chaining and easier to use config API.withMotorKv(Per<AngularVelocityUnit, VoltageUnit> newMotorKv) Modifies this configuration's MotorKv parameter and returns itself for method-chaining and easier to use config API.withPolePairCount(int newPolePairCount) Modifies this configuration's PolePairCount parameter and returns itself for method-chaining and easier to use config API.
-
Field Details
-
MotorKv
Kv constant of the connected custom brushless motor. This can usually be determined by consulting the motor manufacturer data sheet.- Minimum Value: 0
- Maximum Value: 2047
- Default Value: 500
- Units: RPM/V
-
PolePairCount
Number of pole pairs in the connected custom brushless motor (number of poles divided by 2). This can usually be determined by consulting the motor manufacturer data sheet.For example, if motor has ten poles, then specify five pole pairs.
- Minimum Value: 1
- Maximum Value: 8
- Default Value: 1
- Units:
-
HallDuringAB
Expected Hall Value when motor controller applies A+ and B-.Hall Values are little endian [CBA]. For example, if halls report: HA=0, HB=0, HC=1, then the Hall Value is 4.
- Minimum Value: 0
- Maximum Value: 6
- Default Value: 0
- Units:
-
HallDuringAC
Expected Hall Value when motor controller applies A+ and C-.Hall Values are little endian [CBA]. For example, if halls report: HA=0, HB=0, HC=1, then the Hall Value is 4.
- Minimum Value: 0
- Maximum Value: 6
- Default Value: 0
- Units:
-
HallCCWSelect
Optional configuration to correct clockwise versus counter-clockwise rotor spin.Depending on the mechanical design of the motor, rotor may spin clockwise during positive output when Inverted is set to counterclockwise. This configuration can be toggled so that the rest of the API is canonically true.
- Default Value: False
-
HallDirection
Determines expected Hall direction for rotor velocity signage.If RotorVelocity is signed opposite of applied voltage, flip this configuration.
- Default Value: False
-
-
Constructor Details
-
CustomBrushlessMotorConfigs
public CustomBrushlessMotorConfigs()
-
-
Method Details
-
withMotorKv
Modifies this configuration's MotorKv parameter and returns itself for method-chaining and easier to use config API.Kv constant of the connected custom brushless motor. This can usually be determined by consulting the motor manufacturer data sheet.
- Minimum Value: 0
- Maximum Value: 2047
- Default Value: 500
- Units: RPM/V
- Parameters:
newMotorKv- Parameter to modify- Returns:
- Itself
-
withMotorKv
public final CustomBrushlessMotorConfigs withMotorKv(Per<AngularVelocityUnit, VoltageUnit> newMotorKv) Modifies this configuration's MotorKv parameter and returns itself for method-chaining and easier to use config API.Kv constant of the connected custom brushless motor. This can usually be determined by consulting the motor manufacturer data sheet.
- Minimum Value: 0
- Maximum Value: 2047
- Default Value: 500
- Units: RPM/V
- Parameters:
newMotorKv- Parameter to modify- Returns:
- Itself
-
getMotorKvMeasure
Helper method to get this configuration's MotorKv parameter converted to a unit type. If not using the Java units library,MotorKvcan be accessed directly instead.Kv constant of the connected custom brushless motor. This can usually be determined by consulting the motor manufacturer data sheet.
- Minimum Value: 0
- Maximum Value: 2047
- Default Value: 500
- Units: RPM/V
- Returns:
- MotorKv
-
withPolePairCount
Modifies this configuration's PolePairCount parameter and returns itself for method-chaining and easier to use config API.Number of pole pairs in the connected custom brushless motor (number of poles divided by 2). This can usually be determined by consulting the motor manufacturer data sheet.
For example, if motor has ten poles, then specify five pole pairs.
- Minimum Value: 1
- Maximum Value: 8
- Default Value: 1
- Units:
- Parameters:
newPolePairCount- Parameter to modify- Returns:
- Itself
-
withHallDuringAB
Modifies this configuration's HallDuringAB parameter and returns itself for method-chaining and easier to use config API.Expected Hall Value when motor controller applies A+ and B-.
Hall Values are little endian [CBA]. For example, if halls report: HA=0, HB=0, HC=1, then the Hall Value is 4.
- Minimum Value: 0
- Maximum Value: 6
- Default Value: 0
- Units:
- Parameters:
newHallDuringAB- Parameter to modify- Returns:
- Itself
-
withHallDuringAC
Modifies this configuration's HallDuringAC parameter and returns itself for method-chaining and easier to use config API.Expected Hall Value when motor controller applies A+ and C-.
Hall Values are little endian [CBA]. For example, if halls report: HA=0, HB=0, HC=1, then the Hall Value is 4.
- Minimum Value: 0
- Maximum Value: 6
- Default Value: 0
- Units:
- Parameters:
newHallDuringAC- Parameter to modify- Returns:
- Itself
-
withHallCCWSelect
Modifies this configuration's HallCCWSelect parameter and returns itself for method-chaining and easier to use config API.Optional configuration to correct clockwise versus counter-clockwise rotor spin.
Depending on the mechanical design of the motor, rotor may spin clockwise during positive output when Inverted is set to counterclockwise. This configuration can be toggled so that the rest of the API is canonically true.
- Default Value: False
- Parameters:
newHallCCWSelect- Parameter to modify- Returns:
- Itself
-
withHallDirection
Modifies this configuration's HallDirection parameter and returns itself for method-chaining and easier to use config API.Determines expected Hall direction for rotor velocity signage.
If RotorVelocity is signed opposite of applied voltage, flip this configuration.
- Default Value: False
- Parameters:
newHallDirection- Parameter to modify- Returns:
- Itself
-
toString
-
serialize
Get the serialized form of this configuration group.- Specified by:
serializein interfaceISerializable- Returns:
- Serialized form of this config group
-
deserialize
Take a string and deserialize it to this configuration group.- Specified by:
deserializein interfaceParentConfiguration- Returns:
- Return code of the deserialize method
-
clone
-