CTRE Phoenix C++ 5.33.1
ctre::phoenix::motorcontrol::TalonSRXSimCollection Class Reference

Collection of simulation commands available to a TalonSRX motor controller. More...

#include <ctre/phoenix/motorcontrol/TalonSRXSimCollection.h>

Public Member Functions

 TalonSRXSimCollection (ctre::phoenix::motorcontrol::can::BaseTalon &motorController)
 Constructor for TalonSRXSimCollection. 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 TalonSRX. More...
 
ErrorCode SetSupplyCurrent (double currA)
 Sets the simulated supply current of the TalonSRX. More...
 
ErrorCode SetStatorCurrent (double currA)
 Sets the simulated stator current of the TalonSRX. More...
 
ErrorCode SetLimitFwd (bool isClosed)
 Sets the simulated forward limit switch of the TalonSRX. More...
 
ErrorCode SetLimitRev (bool isClosed)
 Sets the simulated reverse limit switch of the TalonSRX. More...
 
ErrorCode SetAnalogPosition (int newPos)
 Sets the simulated analog position of the TalonSRX. More...
 
ErrorCode AddAnalogPosition (int dPos)
 Adds to the simulated analog position of the TalonSRX. More...
 
ErrorCode SetAnalogVelocity (int newVel)
 Sets the simulated analog velocity of the TalonSRX. More...
 
ErrorCode SetPulseWidthConnected (bool isConnected)
 Sets if the simulated pulse width sensor is connected to the TalonSRX. More...
 
ErrorCode SetPulseWidthRiseToRiseUs (double periodUs)
 Sets the simulated pulse width rise to rise time of the TalonSRX. More...
 
ErrorCode SetPulseWidthPosition (int newPos)
 Sets the simulated pulse width position of the TalonSRX. More...
 
ErrorCode AddPulseWidthPosition (int dPos)
 Adds to the simulated pulse width position of the TalonSRX. More...
 
ErrorCode SetPulseWidthVelocity (int newVel)
 Sets the simulated pulse width velocity of the TalonSRX. More...
 
ErrorCode SetQuadratureRawPosition (int newPos)
 Sets the simulated raw quadrature position of the TalonSRX. More...
 
ErrorCode AddQuadraturePosition (int dPos)
 Adds to the simulated quadrature position of the TalonSRX. More...
 
ErrorCode SetQuadratureVelocity (int newVel)
 Sets the simulated quadrature velocity of the TalonSRX. More...
 

Detailed Description

Collection of simulation commands available to a TalonSRX motor controller.

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

Constructor & Destructor Documentation

◆ TalonSRXSimCollection()

ctre::phoenix::motorcontrol::TalonSRXSimCollection::TalonSRXSimCollection ( ctre::phoenix::motorcontrol::can::BaseTalon motorController)

Constructor for TalonSRXSimCollection.

Parameters
motorControllerTalonSRX Motor Controller to connect Collection to

Member Function Documentation

◆ AddAnalogPosition()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::AddAnalogPosition ( int  dPos)

Adds to the simulated analog position of the TalonSRX.

Parameters
dPosthe change in position in native units
Returns
error code

◆ AddPulseWidthPosition()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::AddPulseWidthPosition ( int  dPos)

Adds to the simulated pulse width position of the TalonSRX.

Parameters
dPosthe change in position in native units
Returns
error code

◆ AddQuadraturePosition()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::AddQuadraturePosition ( int  dPos)

Adds to the simulated quadrature position of the TalonSRX.

Parameters
dPosthe change in position in native units
Returns
error code

◆ GetLastError()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::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()

double ctre::phoenix::motorcontrol::TalonSRXSimCollection::GetMotorOutputLeadVoltage ( )

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

Returns
applied voltage to the motor in volts

◆ SetAnalogPosition()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetAnalogPosition ( int  newPos)

Sets the simulated analog position of the TalonSRX.

Parameters
newPosthe new position in native units
Returns
error code

◆ SetAnalogVelocity()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetAnalogVelocity ( int  newVel)

Sets the simulated analog velocity of the TalonSRX.

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

◆ SetBusVoltage()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetBusVoltage ( double  vbat)

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
vbatthe bus voltage in volts
Returns
error code

◆ SetLimitFwd()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetLimitFwd ( bool  isClosed)

Sets the simulated forward limit switch of the TalonSRX.

Parameters
isClosedtrue if the limit switch is closed
Returns
error code

◆ SetLimitRev()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetLimitRev ( bool  isClosed)

Sets the simulated reverse limit switch of the TalonSRX.

Parameters
isClosedtrue if the limit switch is closed
Returns
error code

◆ SetPulseWidthConnected()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetPulseWidthConnected ( bool  isConnected)

Sets if the simulated pulse width sensor is connected to the TalonSRX.

Parameters
isConnectedtrue if the pulse width sensor is connected
Returns
error code

◆ SetPulseWidthPosition()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetPulseWidthPosition ( int  newPos)

Sets the simulated pulse width position of the TalonSRX.

Parameters
newPosthe new position in native units
Returns
error code

◆ SetPulseWidthRiseToRiseUs()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetPulseWidthRiseToRiseUs ( double  periodUs)

Sets the simulated pulse width rise to rise time of the TalonSRX.

Parameters
periodUsthe pulse width rise to rise time in microseconds
Returns
error code

◆ SetPulseWidthVelocity()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetPulseWidthVelocity ( int  newVel)

Sets the simulated pulse width velocity of the TalonSRX.

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

◆ SetQuadratureRawPosition()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetQuadratureRawPosition ( int  newPos)

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
newPosthe new raw position in native units
Returns
error code

◆ SetQuadratureVelocity()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetQuadratureVelocity ( int  newVel)

Sets the simulated quadrature velocity of the TalonSRX.

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

◆ SetStatorCurrent()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetStatorCurrent ( double  currA)

Sets the simulated stator current of the TalonSRX.

Parameters
currAthe stator current in amps
Returns
error code

◆ SetSupplyCurrent()

ErrorCode ctre::phoenix::motorcontrol::TalonSRXSimCollection::SetSupplyCurrent ( double  currA)

Sets the simulated supply current of the TalonSRX.

Parameters
currAthe supply current in amps
Returns
error code

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