CTRE Phoenix C++ 5.33.1
|
Collection of simulation commands available to a TalonFX motor controller. More...
#include <ctre/phoenix/motorcontrol/TalonFXSimCollection.h>
Public Member Functions | |
TalonFXSimCollection (ctre::phoenix::motorcontrol::can::BaseTalon &motorController) | |
Constructor for TalonFXSimCollection. More... | |
ErrorCode | GetLastError () |
Gets the last error generated by this object. More... | |
double | GetMotorOutputLeadVoltage () |
Gets the simulated output voltage across M+ and M- for the motor. More... | |
ErrorCode | SetBusVoltage (double vbat) |
Sets the simulated bus voltage of the TalonFX. More... | |
ErrorCode | SetSupplyCurrent (double currA) |
Sets the simulated supply current of the TalonFX. More... | |
ErrorCode | SetStatorCurrent (double currA) |
Sets the simulated stator current of the TalonFX. More... | |
ErrorCode | SetLimitFwd (bool isClosed) |
Sets the simulated forward limit switch of the TalonFX. More... | |
ErrorCode | SetLimitRev (bool isClosed) |
Sets the simulated reverse limit switch of the TalonFX. More... | |
ErrorCode | SetIntegratedSensorRawPosition (int newPos) |
Sets the simulated raw integrated sensor position of the TalonFX. More... | |
ErrorCode | AddIntegratedSensorPosition (int dPos) |
Adds to the simulated integrated sensor position of the TalonFX. More... | |
ErrorCode | SetIntegratedSensorVelocity (int newVel) |
Sets the simulated integrated sensor velocity of the TalonFX. More... | |
Collection of simulation commands available to a TalonFX motor controller.
Use the getSimCollection() routine inside your motor controller to create the respective sim collection.
If the Phoenix 5 API must be used for this device, the device must have 22.X firmware. This firmware is available in Tuner X after selecting Phoenix 5 in the firmware year dropdown.
ctre::phoenix::motorcontrol::TalonFXSimCollection::TalonFXSimCollection | ( | ctre::phoenix::motorcontrol::can::BaseTalon & | motorController | ) |
Constructor for TalonFXSimCollection.
motorController | TalonFX Motor Controller to connect Collection to |
ErrorCode ctre::phoenix::motorcontrol::TalonFXSimCollection::AddIntegratedSensorPosition | ( | int | dPos | ) |
Adds to the simulated integrated sensor position of the TalonFX.
dPos | the change in position in native units |
ErrorCode ctre::phoenix::motorcontrol::TalonFXSimCollection::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.
double ctre::phoenix::motorcontrol::TalonFXSimCollection::GetMotorOutputLeadVoltage | ( | ) |
Gets the simulated output voltage across M+ and M- for the motor.
ErrorCode ctre::phoenix::motorcontrol::TalonFXSimCollection::SetBusVoltage | ( | double | vbat | ) |
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.
vbat | the bus voltage in volts |
ErrorCode ctre::phoenix::motorcontrol::TalonFXSimCollection::SetIntegratedSensorRawPosition | ( | int | newPos | ) |
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.
newPos | the new raw position in native units |
ErrorCode ctre::phoenix::motorcontrol::TalonFXSimCollection::SetIntegratedSensorVelocity | ( | int | newVel | ) |
Sets the simulated integrated sensor velocity of the TalonFX.
newVel | the new velocity in native units per 100ms |
ErrorCode ctre::phoenix::motorcontrol::TalonFXSimCollection::SetLimitFwd | ( | bool | isClosed | ) |
Sets the simulated forward limit switch of the TalonFX.
isClosed | true if the limit switch is closed |
ErrorCode ctre::phoenix::motorcontrol::TalonFXSimCollection::SetLimitRev | ( | bool | isClosed | ) |
Sets the simulated reverse limit switch of the TalonFX.
isClosed | true if the limit switch is closed |
ErrorCode ctre::phoenix::motorcontrol::TalonFXSimCollection::SetStatorCurrent | ( | double | currA | ) |
Sets the simulated stator current of the TalonFX.
currA | the stator current in amps |
ErrorCode ctre::phoenix::motorcontrol::TalonFXSimCollection::SetSupplyCurrent | ( | double | currA | ) |
Sets the simulated supply current of the TalonFX.
currA | the supply current in amps |