CTRE Phoenix 6 C++ 25.2.1
|
Class to control the state of a simulated hardware::TalonFXS. More...
#include <ctre/phoenix6/sim/TalonFXSSimState.hpp>
Public Member Functions | |
TalonFXSSimState (hardware::core::CoreTalonFXS const &device) | |
Creates an object to control the state of the given hardware::TalonFXS. | |
TalonFXSSimState (hardware::core::CoreTalonFXS const &device, ChassisReference motorOrientation, ChassisReference extSensorOrientation) | |
Creates an object to control the state of the given hardware::TalonFXS. | |
TalonFXSSimState (TalonFXSSimState const &)=delete | |
TalonFXSSimState (TalonFXSSimState &&)=default | |
TalonFXSSimState & | operator= (TalonFXSSimState const &)=delete |
TalonFXSSimState & | operator= (TalonFXSSimState &&)=default |
ctre::phoenix::StatusCode | GetLastStatusCode () const |
Gets the last status code generated by a simulation function. | |
units::voltage::volt_t | GetMotorVoltage () const |
Gets the simulated output voltage of the motor. | |
units::current::ampere_t | GetTorqueCurrent () const |
Gets the simulated output torque current of the motor. | |
units::current::ampere_t | GetSupplyCurrent () const |
Gets the simulated supply current of the TalonFXS. | |
ctre::phoenix::StatusCode | SetSupplyVoltage (units::voltage::volt_t volts) |
Sets the simulated supply voltage of the TalonFXS. | |
ctre::phoenix::StatusCode | SetForwardLimit (bool closed) |
Sets the simulated forward limit switch of the TalonFXS. | |
ctre::phoenix::StatusCode | SetReverseLimit (bool closed) |
Sets the simulated reverse limit switch of the TalonFXS. | |
ctre::phoenix::StatusCode | SetRawRotorPosition (units::angle::turn_t rotations) |
Sets the simulated raw rotor position of the TalonFXS. | |
ctre::phoenix::StatusCode | AddRotorPosition (units::angle::turn_t dRotations) |
Adds to the simulated rotor position of the TalonFXS. | |
ctre::phoenix::StatusCode | SetRotorVelocity (units::angular_velocity::turns_per_second_t rps) |
Sets the simulated rotor velocity of the TalonFXS. | |
ctre::phoenix::StatusCode | SetRotorAcceleration (units::angular_acceleration::turns_per_second_squared_t rpss) |
Sets the simulated rotor acceleration of the TalonFXS. | |
ctre::phoenix::StatusCode | SetRawQuadraturePosition (units::angle::turn_t rotations) |
Sets the simulated raw quadrature position of the TalonFXS. | |
ctre::phoenix::StatusCode | AddQuadraturePosition (units::angle::turn_t dRotations) |
Adds to the simulated quadrature position of the TalonFXS. | |
ctre::phoenix::StatusCode | SetQuadratureVelocity (units::angular_velocity::turns_per_second_t rps) |
Sets the simulated quadrature velocity of the TalonFXS. | |
ctre::phoenix::StatusCode | SetQuadratureAcceleration (units::angular_acceleration::turns_per_second_squared_t rpss) |
Sets the simulated quadrature acceleration of the TalonFXS. | |
ctre::phoenix::StatusCode | SetPulseWidthPosition (units::angle::turn_t rotations) |
Sets the simulated pulse width position of the TalonFXS. | |
ctre::phoenix::StatusCode | SetPulseWidthVelocity (units::angular_velocity::turns_per_second_t rps) |
Sets the simulated pulse width velocity of the TalonFXS. | |
Public Attributes | |
ChassisReference | MotorOrientation |
The orientation of the motor attached to the TalonFXS relative to the robot chassis. | |
ChassisReference | ExtSensorOrientation |
The orientation of an external sensor attached to the TalonFXS relative to the robot chassis. | |
int | QuadratureEdgesPerRotation = 4096 |
The number of quadrature edges per sensor rotation for an external quadrature sensor attached to the TalonFXS. | |
Class to control the state of a simulated hardware::TalonFXS.
|
inline |
Creates an object to control the state of the given hardware::TalonFXS.
This constructor defaults to a counter-clockwise positive motor and eternal sensor orientation relative to the robot chassis. Note the recommended method of accessing simulation features is to use hardware::TalonFXS::GetSimState.
device | Device to which this simulation state is attached |
ctre::phoenix6::sim::TalonFXSSimState::TalonFXSSimState | ( | hardware::core::CoreTalonFXS const & | device, |
ChassisReference | motorOrientation, | ||
ChassisReference | extSensorOrientation ) |
Creates an object to control the state of the given hardware::TalonFXS.
Note the recommended method of accessing simulation features is to use hardware::TalonFXS::GetSimState.
device | Device to which this simulation state is attached |
motorOrientation | Orientation of the motor (and commutation sensor) relative to the robot chassis |
extSensorOrientation | Orientation of the external sensor relative to the robot chassis |
|
delete |
|
default |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::AddQuadraturePosition | ( | units::angle::turn_t | dRotations | ) |
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.
dRotations | The change in position in rotations |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::AddRotorPosition | ( | units::angle::turn_t | dRotations | ) |
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.
dRotations | The change in position in rotations |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::GetLastStatusCode | ( | ) | const |
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.
units::voltage::volt_t ctre::phoenix6::sim::TalonFXSSimState::GetMotorVoltage | ( | ) | const |
Gets the simulated output voltage of the motor.
units::current::ampere_t ctre::phoenix6::sim::TalonFXSSimState::GetSupplyCurrent | ( | ) | const |
Gets the simulated supply current of the TalonFXS.
Phoenix 6 simulation automatically calculates current.
units::current::ampere_t ctre::phoenix6::sim::TalonFXSSimState::GetTorqueCurrent | ( | ) | const |
Gets the simulated output torque current of the motor.
Phoenix 6 simulation automatically calculates current.
|
default |
|
delete |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetForwardLimit | ( | bool | closed | ) |
Sets the simulated forward limit switch of the TalonFXS.
closed | Whether the limit switch is closed |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetPulseWidthPosition | ( | units::angle::turn_t | rotations | ) |
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.
rotations | The new position in rotations |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetPulseWidthVelocity | ( | units::angular_velocity::turns_per_second_t | rps | ) |
Sets the simulated pulse width velocity of the TalonFXS.
This is the velocity of an external PWM encoder after any gear ratio between the rotor and the sensor.
rps | The new velocity in rotations per second |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetQuadratureAcceleration | ( | units::angular_acceleration::turns_per_second_squared_t | rpss | ) |
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.
rpss | The new acceleration in rotations per second² |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetQuadratureVelocity | ( | units::angular_velocity::turns_per_second_t | rps | ) |
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.
rps | The new velocity in rotations per second |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetRawQuadraturePosition | ( | units::angle::turn_t | rotations | ) |
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 hardware::TalonFXS::SetPosition 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.
rotations | The raw position in rotations |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetRawRotorPosition | ( | units::angle::turn_t | rotations | ) |
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 hardware::TalonFXS::SetPosition 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.
rotations | The raw position in rotations |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetReverseLimit | ( | bool | closed | ) |
Sets the simulated reverse limit switch of the TalonFXS.
closed | Whether the limit switch is closed |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetRotorAcceleration | ( | units::angular_acceleration::turns_per_second_squared_t | rpss | ) |
Sets the simulated rotor acceleration of the TalonFXS.
This is the acceleration of the rotor (before gear ratio) used for the Commutation feedback source.
rpss | The new acceleration in rotations per second² |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetRotorVelocity | ( | units::angular_velocity::turns_per_second_t | rps | ) |
Sets the simulated rotor velocity of the TalonFXS.
This is the velocity of the rotor (before gear ratio) used for the Commutation feedback source.
rps | The new velocity in rotations per second |
ctre::phoenix::StatusCode ctre::phoenix6::sim::TalonFXSSimState::SetSupplyVoltage | ( | units::voltage::volt_t | volts | ) |
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.
volts | The supply voltage in Volts |
ChassisReference ctre::phoenix6::sim::TalonFXSSimState::ExtSensorOrientation |
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.
ChassisReference ctre::phoenix6::sim::TalonFXSSimState::MotorOrientation |
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.
int ctre::phoenix6::sim::TalonFXSSimState::QuadratureEdgesPerRotation = 4096 |
The number of quadrature edges per sensor rotation for an external quadrature sensor attached to the TalonFXS.