Class CANcoderSimState

java.lang.Object
com.ctre.phoenixpro.sim.CANcoderSimState

@Deprecated(forRemoval=true)
public class CANcoderSimState
extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Classes in the phoenixpro package will be removed in 2024. Users should instead use classes from the phoenix6 package.
Class to control the state of a simulated CANcoder.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    ChassisReference Orientation
    Deprecated, for removal: This API element is subject to removal in a future version.
    The orientation of the CANcoder relative to the robot chassis.
  • Constructor Summary

    Constructors 
    Constructor Description
    CANcoderSimState​(CoreCANcoder device)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Classes in the phoenixpro package will be removed in 2024.
    CANcoderSimState​(CoreCANcoder device, ChassisReference orientation)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Classes in the phoenixpro package will be removed in 2024.
  • Method Summary

    Modifier and Type Method Description
    StatusCode addPosition​(double dRotations)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Adds to the simulated position of the CANcoder.
    StatusCode setRawPosition​(double rotations)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the simulated raw position of the CANcoder.
    StatusCode setSupplyVoltage​(double volts)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the simulated supply voltage of the CANcoder.
    StatusCode setVelocity​(double rps)
    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
  • Field Details

    • Orientation

      Deprecated, for removal: This API element is subject to removal in a future version.
      The orientation of the CANcoder relative to the robot chassis.

      This value should not be changed based on the CANcoder invert. Rather, this value should be changed when the mechanical linkage between the CANcoder and the robot changes.

  • Constructor Details

    • CANcoderSimState

      Deprecated, for removal: This API element is subject to removal in a future version.
      Classes in the phoenixpro package will be removed in 2024. Users should instead use classes from the phoenix6 package.
      Creates an object to control the state of the given CANcoder.

      This constructor defaults to a counter-clockwise positive orientation relative to the robot chassis.

      Parameters:
      device - Device to which this simulation state is attached
    • CANcoderSimState

      @Deprecated(forRemoval=true) public CANcoderSimState​(CoreCANcoder device, ChassisReference orientation)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Classes in the phoenixpro package will be removed in 2024. Users should instead use classes from the phoenix6 package.
      Creates an object to control the state of the given CANcoder.
      Parameters:
      device - Device to which this simulation state is attached
      orientation - Orientation of the device relative to the robot chassis
  • Method Details

    • setSupplyVoltage

      public StatusCode setSupplyVoltage​(double volts)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the simulated supply voltage of the CANcoder.

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

      Parameters:
      volts - The supply voltage in Volts
      Returns:
      Status code
    • setRawPosition

      public StatusCode setRawPosition​(double rotations)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the simulated raw position of the CANcoder.

      Inputs to this function over time should be continuous, as user calls of CoreCANcoder.setPosition(double, double) will be accounted for in the callee.

      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 hardware API calls for home-ing the sensor.

      Parameters:
      rotations - The raw position in rotations
      Returns:
      Status code
    • addPosition

      public StatusCode addPosition​(double dRotations)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Adds to the simulated position of the CANcoder.
      Parameters:
      dRotations - The change in position in rotations
      Returns:
      Status code
    • setVelocity

      public StatusCode setVelocity​(double rps)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the simulated velocity of the CANcoder.
      Parameters:
      rps - The new velocity in rotations per second
      Returns:
      Status code