CTRE Phoenix 6 C++ 25.3.1
|
Class to control the state of a simulated hardware::CANdi. More...
#include <ctre/phoenix6/sim/CANdiSimState.hpp>
Public Member Functions | |
CANdiSimState (hardware::core::CoreCANdi const &device) | |
Creates an object to control the state of the given hardware::CANdi. | |
CANdiSimState (hardware::core::CoreCANdi const &device, ChassisReference pwm1Orientation, ChassisReference pwm2Orientation, ChassisReference quadratureOrientation) | |
Creates an object to control the state of the given hardware::CANdi. | |
CANdiSimState (CANdiSimState const &)=delete | |
CANdiSimState (CANdiSimState &&)=default | |
CANdiSimState & | operator= (CANdiSimState const &)=delete |
CANdiSimState & | operator= (CANdiSimState &&)=default |
ctre::phoenix::StatusCode | SetSupplyVoltage (units::voltage::volt_t volts) |
Sets the simulated supply voltage of the CANdi. | |
ctre::phoenix::StatusCode | SetOutputCurrent (units::current::ampere_t current) |
Sets the simulated output current of the CANdi. | |
ctre::phoenix::StatusCode | SetPwm1RiseRise (units::time::second_t time) |
Sets the simulated PWM1 Rise to Rise timing of the CANdi. | |
ctre::phoenix::StatusCode | SetPwm1RiseFall (units::time::second_t time) |
Sets the simulated PWM1 Rise to Fall timing of the CANdi. | |
ctre::phoenix::StatusCode | SetPwm1Connected (bool connected) |
Sets whether a PWM sensor is connected to the S1 pin. | |
ctre::phoenix::StatusCode | SetPwm1Position (units::angle::turn_t position) |
Sets the simulated pulse width position of the CANdi. | |
ctre::phoenix::StatusCode | SetPwm1Velocity (units::angular_velocity::turns_per_second_t velocity) |
Sets the simulated pulse width velocity of the CANdi. | |
ctre::phoenix::StatusCode | SetPwm2RiseRise (units::time::second_t time) |
Sets the simulated PWM2 Rise to Rise timing of the CANdi. | |
ctre::phoenix::StatusCode | SetPwm2RiseFall (units::time::second_t time) |
Sets the simulated PWM2 Rise to Fall timing of the CANdi. | |
ctre::phoenix::StatusCode | SetPwm2Connected (bool connected) |
Sets whether a PWM sensor is connected to the S2 pin. | |
ctre::phoenix::StatusCode | SetPwm2Position (units::angle::turn_t position) |
Sets the simulated pulse width position of the CANdi. | |
ctre::phoenix::StatusCode | SetPwm2Velocity (units::angular_velocity::turns_per_second_t velocity) |
Sets the simulated pulse width velocity of the CANdi. | |
ctre::phoenix::StatusCode | SetRawQuadraturePosition (units::angle::turn_t position) |
Sets the simulated raw quadrature position of the CANdi. | |
ctre::phoenix::StatusCode | SetQuadratureVelocity (units::angular_velocity::turns_per_second_t velocity) |
Sets the simulated pulse width velocity of the CANdi. | |
ctre::phoenix::StatusCode | SetS1State (ctre::phoenix6::signals::S1StateValue state) |
Sets the state of the S1 pin. | |
ctre::phoenix::StatusCode | SetS2State (ctre::phoenix6::signals::S2StateValue state) |
Sets the state of the S2 pin. | |
Public Attributes | |
ChassisReference | Pwm1Orientation |
The orientation of the PWM1 sensor relative to the robot chassis. | |
ChassisReference | Pwm2Orientation |
The orientation of the PWM2 sensor relative to the robot chassis. | |
ChassisReference | QuadratureOrientation |
The orientation of the Quadrature sensor relative to the robot chassis. | |
int | QuadratureEdgesPerRotation = 4096 |
The number of quadrature edges per sensor rotation for an external quadrature sensor attached to the CANdi. | |
Class to control the state of a simulated hardware::CANdi.
|
inline |
Creates an object to control the state of the given hardware::CANdi.
Note the recommended method of accessing simulation features is to use hardware::CANdi::GetSimState.
device | Device to which this simulation state is attached |
ctre::phoenix6::sim::CANdiSimState::CANdiSimState | ( | hardware::core::CoreCANdi const & | device, |
ChassisReference | pwm1Orientation, | ||
ChassisReference | pwm2Orientation, | ||
ChassisReference | quadratureOrientation ) |
Creates an object to control the state of the given hardware::CANdi.
Note the recommended method of accessing simulation features is to use hardware::CANdi::GetSimState.
device | Device to which this simulation state is attached |
pwm1Orientation | Orientation of the PWM1 sensor relative to the robot chassis |
pwm2Orientation | Orientation of the PWM2 sensor relative to the robot chassis |
quadratureOrientation | Orientation of the Quadrature sensor relative to the robot chassis |
|
delete |
|
default |
|
default |
|
delete |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetOutputCurrent | ( | units::current::ampere_t | current | ) |
Sets the simulated output current of the CANdi.
current | The output current |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm1Connected | ( | bool | connected | ) |
Sets whether a PWM sensor is connected to the S1 pin.
connected | True if sensor is connected |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm1Position | ( | units::angle::turn_t | position | ) |
Sets the simulated pulse width position of the CANdi.
This is the position of an external PWM encoder connected to the S1 pin.
position | The new position |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm1RiseFall | ( | units::time::second_t | time | ) |
Sets the simulated PWM1 Rise to Fall timing of the CANdi.
time | The time between the Rise and Fall events in seconds |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm1RiseRise | ( | units::time::second_t | time | ) |
Sets the simulated PWM1 Rise to Rise timing of the CANdi.
time | The time between two Rise events |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm1Velocity | ( | units::angular_velocity::turns_per_second_t | velocity | ) |
Sets the simulated pulse width velocity of the CANdi.
This is the velocity of an external PWM encoder connected to the S1 pin.
velocity | The new velocity |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm2Connected | ( | bool | connected | ) |
Sets whether a PWM sensor is connected to the S2 pin.
connected | True if sensor is connected |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm2Position | ( | units::angle::turn_t | position | ) |
Sets the simulated pulse width position of the CANdi.
This is the position of an external PWM encoder connected to the S2 pin.
position | The new position |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm2RiseFall | ( | units::time::second_t | time | ) |
Sets the simulated PWM2 Rise to Fall timing of the CANdi.
time | The time between the Rise and Fall events in seconds |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm2RiseRise | ( | units::time::second_t | time | ) |
Sets the simulated PWM2 Rise to Rise timing of the CANdi.
time | The time between two Rise events |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetPwm2Velocity | ( | units::angular_velocity::turns_per_second_t | velocity | ) |
Sets the simulated pulse width velocity of the CANdi.
This is the velocity of an external PWM encoder connected to the S2 pin.
velocity | The new velocity |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetQuadratureVelocity | ( | units::angular_velocity::turns_per_second_t | velocity | ) |
Sets the simulated pulse width velocity of the CANdi.
velocity | The new velocity |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetRawQuadraturePosition | ( | units::angle::turn_t | position | ) |
Sets the simulated raw quadrature position of the CANdi.
Inputs to this function over time should be continuous, as user calls of hardware::CANdi::SetQuadraturePosition 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.
position | The raw position |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetS1State | ( | ctre::phoenix6::signals::S1StateValue | state | ) |
Sets the state of the S1 pin.
state | The state to set the S1 pin to |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetS2State | ( | ctre::phoenix6::signals::S2StateValue | state | ) |
Sets the state of the S2 pin.
state | The state to St the S2 pin to |
ctre::phoenix::StatusCode ctre::phoenix6::sim::CANdiSimState::SetSupplyVoltage | ( | units::voltage::volt_t | volts | ) |
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.
volts | The supply voltage in Volts |
ChassisReference ctre::phoenix6::sim::CANdiSimState::Pwm1Orientation |
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.
ChassisReference ctre::phoenix6::sim::CANdiSimState::Pwm2Orientation |
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.
int ctre::phoenix6::sim::CANdiSimState::QuadratureEdgesPerRotation = 4096 |
The number of quadrature edges per sensor rotation for an external quadrature sensor attached to the CANdi.
ChassisReference ctre::phoenix6::sim::CANdiSimState::QuadratureOrientation |
The orientation of the Quadrature sensor relative to the robot chassis.
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.