Package frclib.motor
Class FrcMotorActuator.Params
java.lang.Object
frclib.motor.FrcMotorActuator.Params
- Enclosing class:
- FrcMotorActuator
This class contains all the parameters for creating the motor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
boolean
boolean
boolean
int
boolean
int
boolean
double
double[]
double
double
double
boolean
boolean
int
boolean
int
boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetExternalEncoder
(String name, int channel, boolean inverted) This method sets the external encoder parameters.setExternalEncoder
(TrcEncoder encoder) This method sets the external encoder parameters.setFollowerMotor
(String name, int motorId, FrcMotorActuator.MotorType motorType, boolean brushless, boolean absEnc, boolean inverted) This method sets the parameters of the follower motor.setLowerLimitSwitch
(String name, int channel, boolean inverted) This method sets the lower limit switch parameters.setPositionPresets
(double tolerance, double... posPresets) This method sets an array of preset positions.setPositionScaleAndOffset
(double scale, double offset) This method sets the position sensor scale factor and offset.setPositionScaleAndOffset
(double scale, double offset, double zeroOffset) This method sets the position sensor scale factor and offset.setPrimaryMotor
(String name, int motorId, FrcMotorActuator.MotorType motorType, boolean brushless, boolean absEnc, boolean inverted) This method sets the parameters of the primary motor.setUpperLimitSwitch
(String name, int channel, boolean inverted) This method sets the upper limit switch parameters.toString()
This method returns the string format of the Params info.
-
Field Details
-
-
primaryMotorId
public int primaryMotorId -
primaryMotorType
-
primaryMotorBrushless
public boolean primaryMotorBrushless -
primaryMotorAbsEnc
public boolean primaryMotorAbsEnc -
primaryMotorInverted
public boolean primaryMotorInverted -
followerMotorName
-
followerMotorId
public int followerMotorId -
followerMotorType
-
followerMotorBrushless
public boolean followerMotorBrushless -
followerMotorAbsEnc
public boolean followerMotorAbsEnc -
followerMotorInverted
public boolean followerMotorInverted -
lowerLimitSwitchName
-
lowerLimitSwitchChannel
public int lowerLimitSwitchChannel -
lowerLimitSwitchInverted
public boolean lowerLimitSwitchInverted -
upperLimitSwitchName
-
upperLimitSwitchChannel
public int upperLimitSwitchChannel -
upperLimitSwitchInverted
public boolean upperLimitSwitchInverted -
externalEncoder
-
externalEncoderName
-
externalEncoderChannel
public int externalEncoderChannel -
externalEncoderInverted
public boolean externalEncoderInverted -
positionScale
public double positionScale -
positionOffset
public double positionOffset -
positionZeroOffset
public double positionZeroOffset -
positionPresets
public double[] positionPresets -
positionPresetTolerance
public double positionPresetTolerance
-
-
Constructor Details
-
Params
public Params()
-
-
Method Details
-
toString
This method returns the string format of the Params info. -
setPrimaryMotor
public FrcMotorActuator.Params setPrimaryMotor(String name, int motorId, FrcMotorActuator.MotorType motorType, boolean brushless, boolean absEnc, boolean inverted) This method sets the parameters of the primary motor.- Parameters:
name
- specifies the name of the motor.motorId
- specifies the ID for the motor (CAN ID for CAN motor, PWM channel for PWM motor).motorType
- specifies the motor type.motorBrushless
- specifies true if motor is brushless, false if brushed (only applicable for SparkMax).motorAbsEnc
- specifies true if uses DutyCycle absolute encoder, false to use relative encoder (only applicable for SparkMax).motorInverted
- specifies true to invert the motor direction, false otherwise.- Returns:
- this object for chaining.
-
setFollowerMotor
public FrcMotorActuator.Params setFollowerMotor(String name, int motorId, FrcMotorActuator.MotorType motorType, boolean brushless, boolean absEnc, boolean inverted) This method sets the parameters of the follower motor.- Parameters:
name
- specifies the name of the motor.motorId
- specifies the ID for the motor (CAN ID for CAN motor, PWM channel for PWM motor).motorType
- specifies the motor type.motorBrushless
- specifies true if motor is brushless, false if brushed (only applicable for SparkMax).motorAbsEnc
- specifies true if uses DutyCycle absolute encoder, false to use relative encoder (only applicable for SparkMax).motorInverted
- specifies true to invert the motor direction, false otherwise.- Returns:
- this object for chaining.
-
setLowerLimitSwitch
This method sets the lower limit switch parameters.- Parameters:
name
- specifies the name of the limit switch.channel
- specifies the digital input channel if there is a lower limit switch, -1 otherwise.inverted
- specifies true if the limit switch is normally open, false if normally close.- Returns:
- this object for chaining.
-
setUpperLimitSwitch
This method sets the upper limit switch parameters.- Parameters:
name
- specifies the name of the limit switch.channel
- specifies the digital input channel if there is a lower limit switch, -1 otherwise.inverted
- specifies true if the limit switch is normally open, false if normally close.- Returns:
- this object for chaining.
-
setExternalEncoder
This method sets the external encoder parameters.- Parameters:
encoder
- specifies the external analog encoder.- Returns:
- this object for chaining.
-
setExternalEncoder
This method sets the external encoder parameters.- Parameters:
name
- specifies the name of the encoder.channel
- specifies analog channel if there is an external encoder, -1 otherwise.inverted
- specifies true if the encoder is inverted, false otherwise.- Returns:
- this object for chaining.
-
setPositionScaleAndOffset
public FrcMotorActuator.Params setPositionScaleAndOffset(double scale, double offset, double zeroOffset) This method sets the position sensor scale factor and offset.- Parameters:
scale
- specifies scale factor to multiply the position sensor reading.offset
- specifies offset added to the scaled sensor reading.zeroOffset
- specifies the zero offset for absolute encoder.- Returns:
- this object for chaining.
-
setPositionScaleAndOffset
This method sets the position sensor scale factor and offset.- Parameters:
scale
- specifies scale factor to multiply the position sensor reading.offset
- specifies offset added to the scaled sensor reading.- Returns:
- this object for chaining.
-
setPositionPresets
This method sets an array of preset positions.- Parameters:
tolerance
- specifies the preset tolerance.posPresets
- specifies an array of preset positions in scaled unit.- Returns:
- this object for chaining.
-