Class TalonSRXSimCollection
-
Constructor Summary
ConstructorDescriptionTalonSRXSimCollection
(BaseTalon motorController) Constructor for TalonSRXSimCollection -
Method Summary
Modifier and TypeMethodDescriptionaddAnalogPosition
(int dPos) Adds to the simulated analog position of the TalonSRX.addPulseWidthPosition
(int dPos) Adds to the simulated pulse width position of the TalonSRX.addQuadraturePosition
(int dPos) Adds to the simulated quadrature position of the TalonSRX.Gets the last error generated by this object.double
Gets the simulated output voltage across M+ and M- for the motor.setAnalogPosition
(int newPos) Sets the simulated analog position of the TalonSRX.setAnalogVelocity
(int newVel) Sets the simulated analog velocity of the TalonSRX.setBusVoltage
(double vbat) Sets the simulated bus voltage of the TalonSRX.setLimitFwd
(boolean isClosed) Sets the simulated forward limit switch of the TalonSRX.setLimitRev
(boolean isClosed) Sets the simulated reverse limit switch of the TalonSRX.setPulseWidthConnected
(boolean isConnected) Sets if the simulated pulse width sensor is connected to the TalonSRX.setPulseWidthPosition
(int newPos) Sets the simulated pulse width position of the TalonSRX.setPulseWidthRiseToRiseUs
(double periodUs) Sets the simulated pulse width rise to rise time of the TalonSRX.setPulseWidthVelocity
(int newVel) Sets the simulated pulse width velocity of the TalonSRX.setQuadratureRawPosition
(int newPos) Sets the simulated raw quadrature position of the TalonSRX.setQuadratureVelocity
(int newVel) Sets the simulated quadrature velocity of the TalonSRX.setStatorCurrent
(double currA) Sets the simulated stator current of the TalonSRX.setSupplyCurrent
(double currA) Sets the simulated supply current of the TalonSRX.
-
Constructor Details
-
TalonSRXSimCollection
Constructor for TalonSRXSimCollection- Parameters:
motorController
- Motor Controller to connect Collection to
-
-
Method Details
-
getLastError
Gets the last error generated by this object. Not all functions return an error code but can potentially report errors. This function can be used to retrieve those error codes.- Returns:
- Last Error Code generated by a function.
-
getMotorOutputLeadVoltage
Gets the simulated output voltage across M+ and M- for the motor.- Returns:
- applied voltage to the motor in volts
-
setBusVoltage
Sets the simulated bus voltage of the TalonSRX.The minimum allowed bus voltage is 4 V - values below this will be promoted to 4 V.
- Parameters:
vbat
- the bus voltage in volts- Returns:
- error code
-
setSupplyCurrent
Sets the simulated supply current of the TalonSRX.- Parameters:
currA
- the supply current in amps- Returns:
- error code
-
setStatorCurrent
Sets the simulated stator current of the TalonSRX.- Parameters:
currA
- the stator current in amps- Returns:
- error code
-
setLimitFwd
Sets the simulated forward limit switch of the TalonSRX.- Parameters:
isClosed
- true if the limit switch is closed- Returns:
- error code
-
setLimitRev
Sets the simulated reverse limit switch of the TalonSRX.- Parameters:
isClosed
- true if the limit switch is closed- Returns:
- error code
-
setAnalogPosition
Sets the simulated analog position of the TalonSRX.- Parameters:
newPos
- the new position in native units- Returns:
- error code
-
addAnalogPosition
Adds to the simulated analog position of the TalonSRX.- Parameters:
dPos
- the change in position in native units- Returns:
- error code
-
setAnalogVelocity
Sets the simulated analog velocity of the TalonSRX.- Parameters:
newVel
- the new velocity in native units per 100ms- Returns:
- error code
-
setPulseWidthConnected
Sets if the simulated pulse width sensor is connected to the TalonSRX.- Parameters:
isConnected
- true if the pulse width sensor is connected- Returns:
- error code
-
setPulseWidthRiseToRiseUs
Sets the simulated pulse width rise to rise time of the TalonSRX.- Parameters:
periodUs
- the pulse width rise to rise time in microseconds- Returns:
- error code
-
setPulseWidthPosition
Sets the simulated pulse width position of the TalonSRX.- Parameters:
newPos
- the new position in native units- Returns:
- error code
-
addPulseWidthPosition
Adds to the simulated pulse width position of the TalonSRX.- Parameters:
dPos
- the change in position in native units- Returns:
- error code
-
setPulseWidthVelocity
Sets the simulated pulse width velocity of the TalonSRX.- Parameters:
newVel
- the new velocity in native units per 100ms- Returns:
- error code
-
setQuadratureRawPosition
Sets the simulated raw quadrature position of the TalonSRX.The TalonSRX integrates this to calculate the true reported quadrature position.
When using the WPI Sim GUI, you will notice a readonly 'position' and settable 'rawPositionInput'. The readonly signal is the emulated position which will match self-test in Tuner and the hardware API. Changes to 'rawPositionInput' will be integrated into the emulated position. This way a simulator can modify the position without overriding your hardware API calls for home-ing your sensor.
Inputs to this function over time should be continuous, as user calls of setSelectedSensorPosition() and setQuadraturePosition() will be accounted for in the calculation.
- Parameters:
newPos
- the new raw position in native units- Returns:
- error code
-
addQuadraturePosition
Adds to the simulated quadrature position of the TalonSRX.- Parameters:
dPos
- the change in position in native units- Returns:
- error code
-
setQuadratureVelocity
Sets the simulated quadrature velocity of the TalonSRX.- Parameters:
newVel
- the new velocity in native units per 100ms- Returns:
- error code
-