Class CANCoderSimCollection

java.lang.Object
com.ctre.phoenix.sensors.CANCoderSimCollection

@Deprecated(since="2024",
            forRemoval=true)
public class CANCoderSimCollection
extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
This device's Phoenix 5 API is deprecated for removal in the 2025 season. Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API. A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html.

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.

Collection of simulation commands available to a CANCoder. Use the getSimCollection() routine inside your CANCoder to create the respective sim collection.
  • Constructor Summary

    Constructors 
    Constructor Description
    CANCoderSimCollection​(CANCoder canCoder)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Constructor for CANCoderSimCollection
  • Method Summary

    Modifier and Type Method Description
    ErrorCode addPosition​(int dPos)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Adds to the simulated position of the CANCoder.
    ErrorCode setBusVoltage​(double vbat)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the simulated bus voltage of the CANCoder.
    ErrorCode setRawPosition​(int newPos)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the simulated raw position of the CANCoder.
    ErrorCode setVelocity​(int newVel)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the simulated velocity of the CANCoder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CANCoderSimCollection

      public CANCoderSimCollection​(CANCoder canCoder)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructor for CANCoderSimCollection
      Parameters:
      canCoder - CANCoder to connect Collection to
  • Method Details

    • setBusVoltage

      public ErrorCode setBusVoltage​(double vbat)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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:
      vbat - the bus voltage in volts
      Returns:
      error code
    • setRawPosition

      public ErrorCode setRawPosition​(int newPos)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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:
      newPos - the new raw position in native units
      Returns:
      error code
    • addPosition

      public ErrorCode addPosition​(int dPos)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Adds to the simulated position of the CANCoder.
      Parameters:
      dPos - the change in position in native units
      Returns:
      error code
    • setVelocity

      public ErrorCode setVelocity​(int newVel)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the simulated velocity of the CANCoder.
      Parameters:
      newVel - the new velocity in native units per 100ms
      Returns:
      error code