CTRE_Phoenix 5.20.2
com.ctre.phoenix.sensors.CANCoderSimCollection Class Reference

Public Member Functions

 CANCoderSimCollection (CANCoder canCoder)
 
ErrorCode setBusVoltage (double vbat)
 
ErrorCode setRawPosition (int newPos)
 
ErrorCode addPosition (int dPos)
 
ErrorCode setVelocity (int newVel)
 

Detailed Description

Collection of simulation commands available to a CANCoder.

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

Constructor & Destructor Documentation

◆ CANCoderSimCollection()

com.ctre.phoenix.sensors.CANCoderSimCollection.CANCoderSimCollection ( CANCoder  canCoder)
inline

Constructor for CANCoderSimCollection

Parameters
canCoderCANCoder to connect Collection to

Member Function Documentation

◆ addPosition()

ErrorCode com.ctre.phoenix.sensors.CANCoderSimCollection.addPosition ( int  dPos)
inline

Adds to the simulated position of the CANCoder.

Parameters
dPosthe change in position in native units
Returns
error code

◆ setBusVoltage()

ErrorCode com.ctre.phoenix.sensors.CANCoderSimCollection.setBusVoltage ( double  vbat)
inline

Sets the simulated bus voltage of the CANCoder.

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

◆ setRawPosition()

ErrorCode com.ctre.phoenix.sensors.CANCoderSimCollection.setRawPosition ( int  newPos)
inline

Sets the simulated raw position of the CANCoder.

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

Parameters
newPosthe new raw position in native units
Returns
error code

◆ setVelocity()

ErrorCode com.ctre.phoenix.sensors.CANCoderSimCollection.setVelocity ( int  newVel)
inline

Sets the simulated velocity of the CANCoder.

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

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