CTRE_Phoenix 5.20.2
com.ctre.phoenix.motorcontrol.TalonFXSimCollection Class Reference

Public Member Functions

 TalonFXSimCollection (BaseTalon motorController)
 
ErrorCode getLastError ()
 
double getMotorOutputLeadVoltage ()
 
ErrorCode setBusVoltage (double vbat)
 
ErrorCode setSupplyCurrent (double currA)
 
ErrorCode setStatorCurrent (double currA)
 
ErrorCode setLimitFwd (boolean isClosed)
 
ErrorCode setLimitRev (boolean isClosed)
 
ErrorCode setIntegratedSensorRawPosition (int newPos)
 
ErrorCode addIntegratedSensorPosition (int dPos)
 
ErrorCode setIntegratedSensorVelocity (int newVel)
 

Detailed Description

Collection of simulation commands available to a TalonFX motor controller.

Use the getSimCollection() routine inside your motor controller to create the respective sim collection.

Constructor & Destructor Documentation

◆ TalonFXSimCollection()

com.ctre.phoenix.motorcontrol.TalonFXSimCollection.TalonFXSimCollection ( BaseTalon  motorController)
inline

Constructor for TalonFXSimCollection

Parameters
motorControllerMotor Controller to connect Collection to

Member Function Documentation

◆ addIntegratedSensorPosition()

ErrorCode com.ctre.phoenix.motorcontrol.TalonFXSimCollection.addIntegratedSensorPosition ( int  dPos)
inline

Adds to the simulated integrated sensor position of the TalonFX.

Parameters
dPosthe change in position in native units
Returns
error code

◆ getLastError()

ErrorCode com.ctre.phoenix.motorcontrol.TalonFXSimCollection.getLastError ( )
inline

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()

double com.ctre.phoenix.motorcontrol.TalonFXSimCollection.getMotorOutputLeadVoltage ( )
inline

Gets the simulated output voltage across M+ and M- for the motor.

Returns
applied voltage to the motor in volts

◆ setBusVoltage()

ErrorCode com.ctre.phoenix.motorcontrol.TalonFXSimCollection.setBusVoltage ( double  vbat)
inline

Sets the simulated bus voltage of the TalonFX.

The minimum allowed bus voltage is 4 V - values below this will be promoted to 4 V.

Parameters
vbatthe bus voltage in volts
Returns
error code

◆ setIntegratedSensorRawPosition()

ErrorCode com.ctre.phoenix.motorcontrol.TalonFXSimCollection.setIntegratedSensorRawPosition ( int  newPos)
inline

Sets the simulated raw integrated sensor position of the TalonFX.

The TalonFX integrates this to calculate the true reported integrated sensor 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 setIntegratedSensorPosition() will be accounted for in the calculation.

Parameters
newPosthe new raw position in native units
Returns
error code

◆ setIntegratedSensorVelocity()

ErrorCode com.ctre.phoenix.motorcontrol.TalonFXSimCollection.setIntegratedSensorVelocity ( int  newVel)
inline

Sets the simulated integrated sensor velocity of the TalonFX.

Parameters
newVelthe new velocity in native units per 100ms
Returns
error code

◆ setLimitFwd()

ErrorCode com.ctre.phoenix.motorcontrol.TalonFXSimCollection.setLimitFwd ( boolean  isClosed)
inline

Sets the simulated forward limit switch of the TalonFX.

Parameters
isClosedtrue if the limit switch is closed
Returns
error code

◆ setLimitRev()

ErrorCode com.ctre.phoenix.motorcontrol.TalonFXSimCollection.setLimitRev ( boolean  isClosed)
inline

Sets the simulated reverse limit switch of the TalonFX.

Parameters
isClosedtrue if the limit switch is closed
Returns
error code

◆ setStatorCurrent()

ErrorCode com.ctre.phoenix.motorcontrol.TalonFXSimCollection.setStatorCurrent ( double  currA)
inline

Sets the simulated stator current of the TalonFX.

Parameters
currAthe stator current in amps
Returns
error code

◆ setSupplyCurrent()

ErrorCode com.ctre.phoenix.motorcontrol.TalonFXSimCollection.setSupplyCurrent ( double  currA)
inline

Sets the simulated supply current of the TalonFX.

Parameters
currAthe supply current in amps
Returns
error code

The documentation for this class was generated from the following file: