Class CustomBrushlessMotorConfigs
Configs related to using a custom brushless motor that is not formally supported by Talon FXS.
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.public class CustomBrushlessMotorConfigs : IParentConfiguration, ISerializable, ICloneable
- Inheritance
-
CustomBrushlessMotorConfigs
- Implements
- Inherited Members
Fields
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 ValueFalse
public bool HallCCWSelect
Field Value
HallDirection
Determines expected Hall direction for rotor velocity signage.
If RotorVelocity is signed opposite of applied voltage, flip this configuration.- Default ValueFalse
public bool HallDirection
Field Value
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 Value0
- Maximum Value6
- Default Value0
- Units
public int HallDuringAB
Field Value
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 Value0
- Maximum Value6
- Default Value0
- Units
public int HallDuringAC
Field Value
MotorKv
Kv constant of the connected custom brushless motor. This can usually be determined by consulting the motor manufacturer data sheet.
- Minimum Value0
- Maximum Value2047
- Default Value500
- UnitsRPM/V
public double MotorKv
Field Value
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 Value1
- Maximum Value8
- Default Value1
- Units
public int PolePairCount
Field Value
Methods
Clone()
Creates a copy of this config group.
public CustomBrushlessMotorConfigs Clone()
Returns
Deserialize(string)
Deserialize string and put values into this object
public StatusCode Deserialize(string to_deserialize)
Parameters
to_deserializestringString to deserialize
Returns
- StatusCode
OK if deserialization is OK
Serialize()
Serialize this object into a string
public string Serialize()
Returns
- string
This object's data serialized into a string
ToString()
Provides the string representation of this object
public override string ToString()
Returns
WithHallCCWSelect(bool)
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 ValueFalse
public CustomBrushlessMotorConfigs WithHallCCWSelect(bool newHallCCWSelect)
Parameters
newHallCCWSelectboolParameter to modify
Returns
- CustomBrushlessMotorConfigs
Itself
WithHallDirection(bool)
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 ValueFalse
public CustomBrushlessMotorConfigs WithHallDirection(bool newHallDirection)
Parameters
newHallDirectionboolParameter to modify
Returns
- CustomBrushlessMotorConfigs
Itself
WithHallDuringAB(int)
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 Value0
- Maximum Value6
- Default Value0
- Units
public CustomBrushlessMotorConfigs WithHallDuringAB(int newHallDuringAB)
Parameters
newHallDuringABintParameter to modify
Returns
- CustomBrushlessMotorConfigs
Itself
WithHallDuringAC(int)
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 Value0
- Maximum Value6
- Default Value0
- Units
public CustomBrushlessMotorConfigs WithHallDuringAC(int newHallDuringAC)
Parameters
newHallDuringACintParameter to modify
Returns
- CustomBrushlessMotorConfigs
Itself
WithMotorKv(double)
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 Value0
- Maximum Value2047
- Default Value500
- UnitsRPM/V
public CustomBrushlessMotorConfigs WithMotorKv(double newMotorKv)
Parameters
newMotorKvdoubleParameter to modify
Returns
- CustomBrushlessMotorConfigs
Itself
WithPolePairCount(int)
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 Value1
- Maximum Value8
- Default Value1
- Units
public CustomBrushlessMotorConfigs WithPolePairCount(int newPolePairCount)
Parameters
newPolePairCountintParameter to modify
Returns
- CustomBrushlessMotorConfigs
Itself