phoenix6.sim
¶
Submodules¶
Package Contents¶
- class phoenix6.sim.ChassisReference(*args, **kwds)¶
Bases:
enum.Enum
Represents the orientation of a device relative to the robot chassis.
- CounterClockwise_Positive = 1¶
The device should read a counter-clockwise rotation as positive motion.
- Clockwise_Positive¶
The device should read a clockwise rotation as positive motion.
- class phoenix6.sim.TalonFXSimState(device: phoenix6.hardware.core.core_talon_fx.CoreTalonFX, orientation: phoenix6.sim.chassis_reference.ChassisReference = ChassisReference.CounterClockwise_Positive)¶
Creates an object to control the state of a simulated TalonFX.
Note the recommended method of accessing simulation features is to use TalonFX.sim_state.
- Parameters:
device (CoreTalonFX) – Device to which this simulation state is attached
orientation (ChassisReference) – Orientation of the device relative to the robot chassis
- property last_status_code: phoenix6.status_code.StatusCode¶
Gets the last status code generated by a simulation function.
Not all functions return a status code but can potentially report errors. This function can be used to retrieve those status codes.
- Returns:
Last status code generated by a simulation function
- Return type:
- property motor_voltage: phoenix6.units.volt¶
Gets the simulated output voltage of the motor.
- Returns:
Voltage applied to the motor in Volts
- Return type:
volt
- property torque_current: phoenix6.units.ampere¶
Gets the simulated output torque current of the motor.
Phoenix 6 simulation automatically calculates current.
- Returns:
Torque current applied to the motor in Amperes
- Return type:
ampere
- property supply_current: phoenix6.units.ampere¶
Gets the simulated supply current of the TalonFX.
Phoenix 6 simulation automatically calculates current.
- Returns:
Supply current of the TalonFX in Amperes
- Return type:
ampere
- orientation¶
The orientation of the TalonFX relative to the robot chassis.
This value should not be changed based on the TalonFX invert. Rather, this value should be changed when the mechanical linkage between the TalonFX and the robot changes.
- set_supply_voltage(volts: phoenix6.units.volt) phoenix6.status_code.StatusCode ¶
Sets the simulated supply voltage of the TalonFX.
The minimum allowed supply voltage is 4 V - values below this will be promoted to 4 V.
- Parameters:
volts (volt) – The supply voltage in Volts
- Returns:
Status code
- Return type:
- set_forward_limit(closed: bool) phoenix6.status_code.StatusCode ¶
Sets the simulated forward limit switch of the TalonFX.
- Parameters:
closed (bool) – Whether the limit switch is closed
- Returns:
Status code
- Return type:
- set_reverse_limit(closed: bool) phoenix6.status_code.StatusCode ¶
Sets the simulated reverse limit switch of the TalonFX.
- Parameters:
closed (bool) – Whether the limit switch is closed
- Returns:
Status code
- Return type:
- set_raw_rotor_position(rotations: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
Sets the simulated raw rotor position of the TalonFX. This is the position of the rotor (before gear ratio) used for the RotorSensor feedback source.
Inputs to this function over time should be continuous, as user calls of TalonFX.set_position will be accounted for in the callee.
The TalonFX integrates this to calculate the true reported rotor 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 (rotation) – The raw position in rotations
- Returns:
Status code
- Return type:
- add_rotor_position(drotations: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
Adds to the simulated rotor position of the TalonFX. This adds to the position of the rotor (before gear ratio) used for the RotorSensor feedback source.
- Parameters:
drotations (rotation) – The change in position in rotations
- Returns:
Status code
- Return type:
- set_rotor_velocity(rps: phoenix6.units.rotations_per_second) phoenix6.status_code.StatusCode ¶
Sets the simulated rotor velocity of the TalonFX. This is the velocity of the rotor (before gear ratio) used for the RotorSensor feedback source.
- Parameters:
rps (rotations_per_second) – The new velocity in rotations per second
- Returns:
Status code
- Return type:
- set_rotor_acceleration(rpss: phoenix6.units.rotations_per_second_squared) phoenix6.status_code.StatusCode ¶
Sets the simulated rotor acceleration of the TalonFX. This is the acceleration of the rotor (before gear ratio) used for the RotorSensor feedback source.
- Parameters:
rpss (rotations_per_second_squared) – The new acceleration in rotations per second²
- Returns:
Status code
- Return type:
- class phoenix6.sim.CANcoderSimState(device: phoenix6.hardware.core.core_cancoder.CoreCANcoder, orientation: phoenix6.sim.chassis_reference.ChassisReference = ChassisReference.CounterClockwise_Positive)¶
Creates an object to control the state of a simulated CANcoder.
Note the recommended method of accessing simulation features is to use CANcoder.sim_state.
- Parameters:
device (CoreCANcoder) – Device to which this simulation state is attached
orientation (ChassisReference) – Orientation of the device relative to the robot chassis
- orientation¶
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.
- set_supply_voltage(volts: phoenix6.units.volt) phoenix6.status_code.StatusCode ¶
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 (volt) – The supply voltage in Volts
- Returns:
Status code
- Return type:
- set_raw_position(rotations: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
Sets the simulated raw position of the CANcoder.
Inputs to this function over time should be continuous, as user calls of CANcoder.set_position 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 (rotation) – The raw position in rotations
- Returns:
Status code
- Return type:
- add_position(drotations: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
Adds to the simulated position of the CANcoder.
- Parameters:
drotations (rotation) – The change in position in rotations
- Returns:
Status code
- Return type:
- set_velocity(rps: phoenix6.units.rotations_per_second) phoenix6.status_code.StatusCode ¶
Sets the simulated velocity of the CANcoder.
- Parameters:
rps (rotations_per_second) – The new velocity in rotations per second
- Returns:
Status code
- Return type:
- set_magnet_health(value: phoenix6.signals.spn_enums.MagnetHealthValue) phoenix6.status_code.StatusCode ¶
Sets the simulated magnet health of the CANcoder.
- Parameters:
value (MagnetHealthValue) – The magnet health to simulate. This directly correlates to the red/green/orange state of the simulated LED.
- Returns:
Status code
- Return type:
- class phoenix6.sim.Pigeon2SimState(device: phoenix6.hardware.core.core_pigeon2.CorePigeon2)¶
Creates an object to control the state of a simulated Pigeon2.
Note the recommended method of accessing simulation features is to use Pigeon2.sim_state.
- Parameters:
device (CorePigeon2) – Device to which this simulation state is attached
- set_supply_voltage(volts: phoenix6.units.volt) phoenix6.status_code.StatusCode ¶
Sets the simulated supply voltage of the Pigeon2.
The minimum allowed supply voltage is 4 V - values below this will be promoted to 4 V.
- Parameters:
volts (volt) – The supply voltage in Volts
- Returns:
Status code
- Return type:
- set_raw_yaw(deg: phoenix6.units.degree) phoenix6.status_code.StatusCode ¶
Sets the simulated raw yaw of the Pigeon2.
Inputs to this function over time should be continuous, as user calls of Pigeon2.set_yaw will be accounted for in the callee.
The Pigeon2 integrates this to calculate the true reported yaw.
When using the WPI Sim GUI, you will notice a readonly yaw and settable rawYawInput. The readonly signal is the emulated yaw which will match self-test in Tuner and the hardware API. Changes to rawYawInput will be integrated into the emulated yaw. This way a simulator can modify the yaw without overriding hardware API calls for home-ing the sensor.
- Parameters:
deg (degree) – The yaw in degrees
- Returns:
Status code
- Return type:
- add_yaw(ddeg: phoenix6.units.degree) phoenix6.status_code.StatusCode ¶
Adds to the simulated yaw of the Pigeon2.
- Parameters:
ddeg (degree) – The change in position in rotations
- Returns:
Status code
- Return type:
- set_pitch(deg: phoenix6.units.degree) phoenix6.status_code.StatusCode ¶
Sets the simulated pitch of the Pigeon2.
- Parameters:
deg (degree) – The pitch in degrees
- Returns:
Status code
- Return type:
- set_roll(deg: phoenix6.units.degree) phoenix6.status_code.StatusCode ¶
Sets the simulated roll of the Pigeon2.
- Parameters:
deg (degree) – The roll in degrees
- Returns:
Status code
- Return type:
- set_angular_velocity_x(dps: phoenix6.units.degrees_per_second) phoenix6.status_code.StatusCode ¶
Sets the simulated angular velocity X component of the Pigeon2.
- Parameters:
dps – The X component of the angular velocity in degrees per second
- Returns:
Status code
- Return type:
- set_angular_velocity_y(dps: phoenix6.units.degrees_per_second) phoenix6.status_code.StatusCode ¶
Sets the simulated angular velocity Y component of the Pigeon2.
- Parameters:
dps – The Y component of the angular velocity in degrees per second
- Returns:
Status code
- Return type:
- set_angular_velocity_z(dps: phoenix6.units.degrees_per_second) phoenix6.status_code.StatusCode ¶
Sets the simulated angular velocity Z component of the Pigeon2.
- Parameters:
dps – The Z component of the angular velocity in degrees per second
- Returns:
Status code
- Return type:
- class phoenix6.sim.TalonFXSSimState(device: phoenix6.hardware.core.core_talon_fxs.CoreTalonFXS, motor_orientation: phoenix6.sim.chassis_reference.ChassisReference = ChassisReference.CounterClockwise_Positive, ext_sensor_orientation: phoenix6.sim.chassis_reference.ChassisReference = ChassisReference.CounterClockwise_Positive)¶
Creates an object to control the state of a simulated TalonFXS.
Note the recommended method of accessing simulation features is to use TalonFXS.sim_state.
- Parameters:
device (CoreTalonFXS) – Device to which this simulation state is attached
motor_orientation – Orientation of the motor (and commutation sensor) relative to the robot chassis
ext_sensor_orientation (ChassisReference) – Orientation of the external sensor relative to the robot chassis
- property last_status_code: phoenix6.status_code.StatusCode¶
Gets the last status code generated by a simulation function.
Not all functions return a status code but can potentially report errors. This function can be used to retrieve those status codes.
- Returns:
Last status code generated by a simulation function
- Return type:
- property motor_voltage: phoenix6.units.volt¶
Gets the simulated output voltage of the motor.
- Returns:
Voltage applied to the motor in Volts
- Return type:
volt
- property torque_current: phoenix6.units.ampere¶
Gets the simulated output torque current of the motor.
Phoenix 6 simulation automatically calculates current.
- Returns:
Torque current applied to the motor in Amperes
- Return type:
ampere
- property supply_current: phoenix6.units.ampere¶
Gets the simulated supply current of the TalonFXS.
Phoenix 6 simulation automatically calculates current.
- Returns:
Supply current of the TalonFXS in Amperes
- Return type:
ampere
- property analog_voltage: phoenix6.units.volt¶
Gets the simulated analog voltage of the TalonFXS.
- Returns:
Voltage of the simulated analog input pin on the TalonFXS.
- Return type:
volt
- motor_orientation¶
- The orientation of the motor attached to the TalonFXS relative
to the robot chassis. This include the Commutation sensor source.
This value should not be changed based on the TalonFXS invert. Rather, this value should be changed when the mechanical linkage between the motor and the robot changes.
- ext_sensor_orientation¶
The orientation of an external sensor attached to the TalonFXS relative to the robot chassis. This does NOT include the Commutation sensor source.
This value should not be changed based on the TalonFXS invert. Rather, this value should be changed when the mechanical linkage between the external sensor and the robot changes.
- quadrature_edges_per_rotation: int = 4096¶
The number of quadrature edges per sensor rotation for an external quadrature sensor attached to the TalonFXS.
- set_supply_voltage(volts: phoenix6.units.volt) phoenix6.status_code.StatusCode ¶
Sets the simulated supply voltage of the TalonFXS.
The minimum allowed supply voltage is 4 V - values below this will be promoted to 4 V.
- Parameters:
volts (volt) – The supply voltage in Volts
- Returns:
Status code
- Return type:
- set_forward_limit(closed: bool) phoenix6.status_code.StatusCode ¶
Sets the simulated forward limit switch of the TalonFXS.
- Parameters:
closed (bool) – Whether the limit switch is closed
- Returns:
Status code
- Return type:
- set_reverse_limit(closed: bool) phoenix6.status_code.StatusCode ¶
Sets the simulated reverse limit switch of the TalonFXS.
- Parameters:
closed (bool) – Whether the limit switch is closed
- Returns:
Status code
- Return type:
- set_raw_rotor_position(rotations: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
- Sets the simulated raw rotor position of the TalonFXS. This is the position
of the rotor (before gear ratio) used for the Commutation feedback source.
Inputs to this function over time should be continuous, as user calls of TalonFXS.set_position will be accounted for in the callee.
The TalonFXS integrates this to calculate the true reported rotor 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 (rotation) – The raw position in rotations
- Returns:
Status code
- Return type:
- add_rotor_position(drotations: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
- Adds to the simulated rotor position of the TalonFXS. This adds to the position
of the rotor (before gear ratio) used for the Commutation feedback source.
- Parameters:
drotations (rotation) – The change in position in rotations
- Returns:
Status code
- Return type:
- set_rotor_velocity(rps: phoenix6.units.rotations_per_second) phoenix6.status_code.StatusCode ¶
- Sets the simulated rotor velocity of the TalonFXS. This is the velocity
of the rotor (before gear ratio) used for the Commutation feedback source.
- Parameters:
rps (rotations_per_second) – The new velocity in rotations per second
- Returns:
Status code
- Return type:
- set_rotor_acceleration(rpss: phoenix6.units.rotations_per_second_squared) phoenix6.status_code.StatusCode ¶
- Sets the simulated rotor acceleration of the TalonFXS. This is the acceleration
of the rotor (before gear ratio) used for the Commutation feedback source.
- Parameters:
rpss (rotations_per_second_squared) – The new acceleration in rotations per second²
- Returns:
Status code
- Return type:
- set_raw_quadrature_position(rotations: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
- Sets the simulated raw quadrature position of the TalonFXS. This is the position
of an external quadrature encoder after any gear ratio between the rotor and the sensor.
Inputs to this function over time should be continuous, as user calls of TalonFXS.set_position will be accounted for in the callee.
The TalonFXS 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 hardware API calls for home-ing the sensor.
- Parameters:
rotations (rotation) – The raw position in rotations
- Returns:
Status code
- Return type:
- add_quadrature_position(drotations: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
- Adds to the simulated quadrature position of the TalonFXS. This adds to the position
of an external quadrature encoder after any gear ratio between the rotor and the sensor.
- Parameters:
drotations (rotation) – The change in position in rotations
- Returns:
Status code
- Return type:
- set_quadrature_velocity(rps: phoenix6.units.rotations_per_second) phoenix6.status_code.StatusCode ¶
- Sets the simulated quadrature velocity of the TalonFXS. This is the velocity
of an external quadrature encoder after any gear ratio between the rotor and the sensor.
- Parameters:
rps (rotations_per_second) – The new velocity in rotations per second
- Returns:
Status code
- Return type:
- set_quadrature_acceleration(rpss: phoenix6.units.rotations_per_second_squared) phoenix6.status_code.StatusCode ¶
- Sets the simulated quadrature acceleration of the TalonFXS. This is the acceleration
of an external quadrature encoder after any gear ratio between the rotor and the sensor.
- Parameters:
rpss (rotations_per_second_squared) – The new acceleration in rotations per second²
- Returns:
Status code
- Return type:
- set_pulse_width_position(rotations: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
- Sets the simulated pulse width position of the TalonFXS. This is the position
of an external PWM encoder after any gear ratio between the rotor and the sensor.
- Parameters:
rotations (rotation) – The new position in rotations
- Returns:
Status code
- Return type:
- set_pulse_width_velocity(rps: phoenix6.units.rotations_per_second) phoenix6.status_code.StatusCode ¶
- Sets the simulated pulse width velocity of the TalonFXS. This is the position
of an external PWM encoder after any gear ratio between the rotor and the sensor.
- Parameters:
rps (rotations_per_second) – The new velocity in rotations per second
- Returns:
Status code
- Return type:
- set_analog_voltage(volts: phoenix6.units.volt) phoenix6.status_code.StatusCode ¶
Sets the simulated voltage of the analog input pin on the TalonFXS data port.
- Parameters:
volts (volt) – Voltage of the pin
- Returns:
Status code
- Return type:
- class phoenix6.sim.CANrangeSimState(device: phoenix6.hardware.core.core_canrange.CoreCANrange)¶
Creates an object to control the state of a simulated CANrange.
Note the recommended method of accessing simulation features is to use CANrange.sim_state.
- Parameters:
device (CoreCANrange) – Device to which this simulation state is attached
- set_supply_voltage(volts: phoenix6.units.volt) phoenix6.status_code.StatusCode ¶
Sets the simulated supply voltage of the CANrange.
The minimum allowed supply voltage is 4 V - values below this will be promoted to 4 V.
- Parameters:
volts (volt) – The supply voltage in Volts
- Returns:
Status code
- Return type:
- set_distance(meters: phoenix6.units.meter) phoenix6.status_code.StatusCode ¶
Sets the simulated distance of the CANrange.
- Parameters:
meters (meter) – The distance in meters
- Returns:
Status code
- Return type:
- class phoenix6.sim.CANdiSimState(device: phoenix6.hardware.core.core_candi.CoreCANdi, pwm1_orientation=ChassisReference.CounterClockwise_Positive, pwm2_orientation=ChassisReference.CounterClockwise_Positive, quadrature_orientation=ChassisReference.CounterClockwise_Positive, quadrature_edges_per_rotation=4096)¶
Creates an object to control the state of a simulated CANdi.
Note the recommended method of accessing simulation features is to use CANdi.sim_state.
- Parameters:
device (CoreCANdi) – Device to which this simulation state is attached
pwm1_orientation (ChassisReference) – The orientation of the PWM1 sensor relative to the robot chassis.
pwm2_orientation (ChassisReference) – The orientation of the PWM2 sensor relative to the robot chassis.
quadrature_orientation (ChassisReference) – The orientation of the Quadrature sensor relative to the robot chassis.
quadrature_edges_per_rotation (int) – The number of quadrature edges per sensor rotation for an external quadrature sensor attached to the CANdi.
- pwm1_orientation¶
The orientation of the PWM1 sensor relative to the robot chassis.
This value should not be changed based on the CANdi PWM1 invert. Rather, this value should be changed when the mechanical linkage between the sensor and the robot changes.
- pwm2_orientation¶
The orientation of the PWM2 sensor relative to the robot chassis.
This value should not be changed based on the CANdi PWM2 invert. Rather, this value should be changed when the mechanical linkage between the sensor and the robot changes.
- quadrature_orientation¶
The orientation of the Quadrature sensor relative to the robot chassis. <p> This value should not be changed based on the CANdi Quadrature invert. Rather, this value should be changed when the mechanical linkage between the sensor and the robot changes.
- quadrature_edges_per_rotation¶
The number of quadrature edges per sensor rotation for an external quadrature sensor attached to the CANdi.
- set_supply_voltage(volts: phoenix6.units.volt) phoenix6.status_code.StatusCode ¶
Sets the simulated supply voltage of the CANdi.
The minimum allowed supply voltage is 4 V - values below this will be promoted to 4 V.
- Parameters:
volts (volt) – The supply voltage in Volts
- Returns:
Status code
- Return type:
- set_output_current(current: phoenix6.units.ampere) phoenix6.status_code.StatusCode ¶
Sets the simulated output current of the CANdi.
- Parameters:
current (ampere) – The output current
- Returns:
Status Code
- Return type:
- set_pwm1_rise_rise(time: phoenix6.units.second) phoenix6.status_code.StatusCode ¶
Sets the simulated PWM1 Rise to Rise timing of the CANdi.
- Parameters:
time (second) – The time between two Rise events
- Returns:
Status Code
- Return type:
- set_pwm1_rise_fall(time: phoenix6.units.second) phoenix6.status_code.StatusCode ¶
Sets the simulated PWM1 Rise to Fall timing of the CANdi.
- Parameters:
time (second) – The time between the Rise and Fall events in seconds
- Returns:
Status Code
- Return type:
- set_pwm1_connected(connected: bool) phoenix6.status_code.StatusCode ¶
Sets whether a PWM sensor is connected to the S1 pin.
- Parameters:
connected (bool) – True if sensor is connected
- Returns:
Status Code
- Return type:
- set_pwm1_position(position: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
Sets the simulated pulse width position of the CANdi. This is the position of an external PWM encoder connected to the S1 pin.
- Parameters:
position (rotation) – The new position
- Returns:
Status Code
- Return type:
- set_pwm1_velocity(velocity: phoenix6.units.rotations_per_second) phoenix6.status_code.StatusCode ¶
Sets the simulated pulse width velocity of the CANdi. This is the velocity of an external PWM encoder connected to the S1 pin.
- Parameters:
velocity (rotations_per_second) – The new velocity
- Returns:
Status Code
- Return type:
- set_pwm2_rise_rise(time: phoenix6.units.second) phoenix6.status_code.StatusCode ¶
Sets the simulated PWM2 Rise to Rise timing of the CANdi.
- Parameters:
time (second) – The time between two Rise events
- Returns:
Status Code
- Return type:
- set_pwm2_rise_fall(time: phoenix6.units.second) phoenix6.status_code.StatusCode ¶
Sets the simulated PWM2 Rise to Fall timing of the CANdi.
- Parameters:
time (second) – The time between the Rise and Fall events in seconds
- Returns:
Status Code
- Return type:
- set_pwm2_connected(connected: bool) phoenix6.status_code.StatusCode ¶
Sets whether a PWM sensor is connected to the S2 pin.
- Parameters:
connected (bool) – True if sensor is connected
- Returns:
Status Code
- Return type:
- set_pwm2_position(position: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
Sets the simulated pulse width position of the CANdi. This is the position of an external PWM encoder connected to the S2 pin.
- Parameters:
position (rotation) – The new position
- Returns:
Status Code
- Return type:
- set_pwm2_velocity(velocity: phoenix6.units.rotations_per_second) phoenix6.status_code.StatusCode ¶
Sets the simulated pulse width velocity of the CANdi. This is the velocity of an external PWM encoder connected to the S2 pin.
- Parameters:
velocity (rotations_per_second) – The new velocity
- Returns:
Status Code
- Return type:
- set_raw_quadrature_position(position: phoenix6.units.rotation) phoenix6.status_code.StatusCode ¶
Sets the simulated raw quadrature position of the CANdi.
Inputs to this function over time should be continuous, as user calls of CANdi.set_quadrature_position will be accounted for in the callee.
The CANdi 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 hardware API calls for home-ing the sensor.
- Parameters:
position (rotation) – The raw position
- Returns:
Status Code
- Return type:
- set_quadrature_velocity(velocity: phoenix6.units.rotations_per_second) phoenix6.status_code.StatusCode ¶
Sets the simulated pulse width velocity of the CANdi.
- Parameters:
velocity (rotations_per_second) – The new velocity
- Returns:
Status Code
- Return type:
- set_s1_state(state: phoenix6.signals.spn_enums.S1StateValue) phoenix6.status_code.StatusCode ¶
Sets the state of the S1 pin
- Parameters:
state (S1StateValue) – The state to set the S1 pin to
- Returns:
Status Code
- Return type:
- set_s2_state(state: phoenix6.signals.spn_enums.S2StateValue) phoenix6.status_code.StatusCode ¶
Sets the state of the S2 pin
- Parameters:
state (S2StateValue) – The state to St the S2 pin to
- Returns:
Status Code
- Return type:
- class phoenix6.sim.CANdleSimState(device: phoenix6.hardware.core.core_candle.CoreCANdle)¶
Creates an object to control the state of a simulated CANdle.
Note the recommended method of accessing simulation features is to use CANdle.sim_state.
- Parameters:
device (CoreCANdle) – Device to which this simulation state is attached
- property last_status_code: phoenix6.status_code.StatusCode¶
Gets the last status code generated by a simulation function.
Not all functions return a status code but can potentially report errors. This function can be used to retrieve those status codes.
- Returns:
Last status code generated by a simulation function
- Return type:
- property v_bat_modulation: float¶
Gets the simulated VBat modulated output of the CANdle.
- Returns:
VBat modulation duty cycle
- Return type:
float
- set_supply_voltage(volts: phoenix6.units.volt) phoenix6.status_code.StatusCode ¶
Sets the simulated supply voltage of the CANdle.
The minimum allowed supply voltage is 4 V - values below this will be promoted to 4 V.
- Parameters:
volts (volt) – The supply voltage in Volts
- Returns:
Status code
- Return type:
- set_five_v_rail_voltage(volts: phoenix6.units.volt) phoenix6.status_code.StatusCode ¶
Sets the simulated 5V rail voltage of the CANdle.
- Parameters:
volts (volt) – The 5V rail voltage in Volts
- Returns:
Status code
- Return type:
- set_output_current(amps: phoenix6.units.ampere) phoenix6.status_code.StatusCode ¶
Sets the simulated output current of the CANdle.
- Parameters:
amps (ampere) – The output current in Amps
- Returns:
Status code
- Return type:
- set_device_temp(temperature: phoenix6.units.celsius) phoenix6.status_code.StatusCode ¶
Sets the simulated temperature of the CANdle.
- Parameters:
temperature (celsius) – The device temperature in ℃
- Returns:
Status code
- Return type: