21#include <wpi/units/angle.hpp>
22#include <wpi/units/angular_velocity.hpp>
23#include <wpi/units/current.hpp>
24#include <wpi/units/time.hpp>
25#include <wpi/units/voltage.hpp>
243 PWM1 = std::move(newPWM1);
271 PWM2 = std::move(newPWM2);
908#if defined(_WIN32) || defined(_WIN64)
910#pragma warning(disable : 4250)
973 std::unique_ptr<sim::CANdiSimState> _simState{};
986 if (_simState ==
nullptr)
987 _simState = std::make_unique<sim::CANdiSimState>(*
this);
1631 return GetConfigurator().SetQuadraturePosition(newValue, timeoutSeconds);
1707 return GetConfigurator().ClearStickyFault_Undervoltage(timeoutSeconds);
1731 return GetConfigurator().ClearStickyFault_BootDuringEnable(timeoutSeconds);
1755 return GetConfigurator().ClearStickyFault_UnlicensedFeatureInUse(timeoutSeconds);
1799#if defined(_WIN32) || defined(_WIN64)
Collection of objects that can report alerts.
Definition Alertable.hpp:109
Class for getting information about an available CAN bus.
Definition CANBus.hpp:142
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:523
All configurations for the hardware::CANdi.
Definition CoreCANdi.hpp:42
QuadratureConfigs Quadrature
Configs related to the CANdi™ branded device's quadrature interface using both the S1IN and S2IN inpu...
Definition CoreCANdi.hpp:106
std::string Serialize() const final
Get the serialized form of this configuration.
bool FutureProofConfigs
True if we should factory default newer unsupported configs, false to leave newer unsupported configs...
Definition CoreCANdi.hpp:59
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Take a string and deserialize it to this configuration.
constexpr CANdiConfiguration & WithPWM1(PWM1Configs newPWM1)
Modifies this configuration's PWM1 parameter and returns itself for method-chaining and easier to use...
Definition CoreCANdi.hpp:241
PWM2Configs PWM2
Configs related to the CANdi™ branded device's PWM interface on the Signal 2 input (S2IN).
Definition CoreCANdi.hpp:142
constexpr CANdiConfiguration & WithCustomParams(CustomParamsConfigs newCustomParams)
Modifies this configuration's CustomParams parameter and returns itself for method-chaining and easie...
Definition CoreCANdi.hpp:161
DigitalInputsConfigs DigitalInputs
Configs related to the CANdi™ branded device's digital I/O settings.
Definition CoreCANdi.hpp:90
std::string ToString() const override
Get the string representation of this configuration.
constexpr CANdiConfiguration & WithDigitalInputs(DigitalInputsConfigs newDigitalInputs)
Modifies this configuration's DigitalInputs parameter and returns itself for method-chaining and easi...
Definition CoreCANdi.hpp:187
constexpr CANdiConfiguration()=default
CustomParamsConfigs CustomParams
Custom Params.
Definition CoreCANdi.hpp:73
constexpr CANdiConfiguration & WithPWM2(PWM2Configs newPWM2)
Modifies this configuration's PWM2 parameter and returns itself for method-chaining and easier to use...
Definition CoreCANdi.hpp:269
constexpr CANdiConfiguration & WithQuadrature(QuadratureConfigs newQuadrature)
Modifies this configuration's Quadrature parameter and returns itself for method-chaining and easier ...
Definition CoreCANdi.hpp:213
PWM1Configs PWM1
Configs related to the CANdi™ branded device's PWM interface on the Signal 1 input (S1IN).
Definition CoreCANdi.hpp:124
Handles applying and refreshing configurations for the hardware::CANdi.
Definition CoreCANdi.hpp:294
ctre::phoenix::StatusCode Refresh(PWM1Configs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:625
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdi.hpp:750
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode SetQuadraturePosition(wpi::units::turn_t newValue)
Sets the position of the quadrature input.
Definition CoreCANdi.hpp:679
ctre::phoenix::StatusCode Apply(const QuadratureConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:400
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(wpi::units::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:356
ctre::phoenix::StatusCode Refresh(PWM2Configs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:656
ctre::phoenix::StatusCode Apply(const PWM1Configs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:443
ctre::phoenix::StatusCode Refresh(DigitalInputsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:550
ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds)
Clear the sticky faults in the device.
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:532
ctre::phoenix::StatusCode Refresh(DigitalInputsConfigs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:563
ctre::phoenix::StatusCode Apply(const PWM1Configs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:429
ctre::phoenix::StatusCode Apply(const CANdiConfiguration &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:327
ctre::phoenix::StatusCode Apply(const DigitalInputsConfigs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:385
ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
ctre::phoenix::StatusCode Apply(const QuadratureConfigs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:414
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdi.hpp:782
ctre::phoenix::StatusCode Refresh(QuadratureConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:581
ctre::phoenix::StatusCode Apply(const CANdiConfiguration &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:313
ctre::phoenix::StatusCode SetQuadraturePosition(wpi::units::turn_t newValue, wpi::units::second_t timeoutSeconds)
Sets the position of the quadrature input.
ctre::phoenix::StatusCode Refresh(QuadratureConfigs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:594
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANdi.hpp:715
ctre::phoenix::StatusCode Refresh(PWM1Configs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:612
ctre::phoenix::StatusCode Refresh(CANdiConfiguration &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:487
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:519
ctre::phoenix::StatusCode ClearStickyFault_5V(wpi::units::second_t timeoutSeconds)
Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault.
ctre::phoenix::StatusCode Apply(const DigitalInputsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:371
ctre::phoenix::StatusCode Refresh(PWM2Configs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:643
ctre::phoenix::StatusCode Apply(const PWM2Configs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:458
ctre::phoenix::StatusCode ClearStickyFault_5V()
Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault.
Definition CoreCANdi.hpp:882
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:342
ctre::phoenix::StatusCode Refresh(CANdiConfiguration &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:501
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdi.hpp:815
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdi.hpp:848
ctre::phoenix::StatusCode Apply(const PWM2Configs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:472
Custom Params.
Definition CustomParamsConfigs.hpp:23
Configs related to the CANdi™ branded device's PWM interface on the Signal 1 input (S1IN).
Definition PWM1Configs.hpp:27
Configs related to the CANdi™ branded device's PWM interface on the Signal 2 input (S2IN).
Definition PWM2Configs.hpp:27
Common interface for all configuration objects.
Definition Configuration.hpp:20
ctre::phoenix::StatusCode SetConfigsPrivate(std::string_view serializedString, wpi::units::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate)
wpi::units::second_t DefaultTimeoutSeconds
The default maximum amount of time to wait for a config.
Definition Configurator.hpp:27
ParentConfigurator(hardware::DeviceIdentifier deviceIdentifier)
ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, wpi::units::second_t timeoutSeconds) const
Configs related to the CANdi™ branded device's quadrature interface using both the S1IN and S2IN inpu...
Definition QuadratureConfigs.hpp:26
The unique identifier for a device.
Definition DeviceIdentifier.hpp:19
ParentDevice(int deviceID, std::string model, CANBus canbus)
Class for CTR Electronics' CANdi™ branded device, a device that integrates digital signals into the e...
Definition CoreCANdi.hpp:918
StatusSignal< bool > & GetFault_Hardware(bool refresh=true)
Hardware fault occurred.
configs::CANdiConfigurator const & GetConfigurator() const
Gets the configurator for this CANdi.
Definition CoreCANdi.hpp:966
ctre::phoenix::StatusCode SetQuadraturePosition(wpi::units::turn_t newValue)
Sets the position of the quadrature input.
Definition CoreCANdi.hpp:1641
StatusSignal< bool > & GetStickyFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
StatusSignal< wpi::units::turns_per_second_t > & GetQuadratureVelocity(bool refresh=true)
Velocity from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.
ctre::phoenix::StatusCode ClearStickyFault_5V(wpi::units::second_t timeoutSeconds)
Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault.
Definition CoreCANdi.hpp:1778
StatusSignal< bool > & GetFault_5V(bool refresh=true)
The CTR Electronics' CANdi™ branded device has detected a 5V fault.
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdi.hpp:1717
StatusSignal< int > & GetVersionBuild(bool refresh=true)
App Build Version number.
StatusSignal< wpi::units::turn_t > & GetPWM2Position(bool refresh=true)
Measured position of the PWM sensor at the S2 input of the CTR Electronics' CANdi™.
StatusSignal< bool > & GetS2Closed(bool refresh=true)
True if the Signal 2 input (S2IN) matches the configured S2 Closed State.
sim::CANdiSimState & GetSimState()
Get the simulation state for this device.
Definition CoreCANdi.hpp:984
StatusSignal< int > & GetVersionBugfix(bool refresh=true)
App Bugfix Version number.
StatusSignal< bool > & GetStickyFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
StatusSignal< bool > & GetStickyFault_5V(bool refresh=true)
The CTR Electronics' CANdi™ branded device has detected a 5V fault.
StatusSignal< bool > & GetFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
StatusSignal< wpi::units::turn_t > & GetPWM1Position(bool refresh=true)
Measured position of the PWM sensor at the S1 input of the CTR Electronics' CANdi™.
StatusSignal< bool > & GetFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
configs::CANdiConfigurator & GetConfigurator()
Gets the configurator for this CANdi.
Definition CoreCANdi.hpp:954
ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition CoreCANdi.hpp:1656
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdi.hpp:1705
StatusSignal< signals::S1StateValue > & GetS1State(bool refresh=true)
State of the Signal 1 input (S1IN).
StatusSignal< int > & GetVersion(bool refresh=true)
Full Version of firmware in device.
CoreCANdi(int deviceId, CANBus canbus)
Constructs a new CANdi object.
StatusSignal< bool > & GetStickyFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
StatusSignal< int > & GetStickyFaultField(bool refresh=true)
Integer representing all (persistent) sticky fault flags reported by the device.
StatusSignal< bool > & GetIsProLicensed(bool refresh=true)
Whether the device is Phoenix Pro licensed.
ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdi.hpp:1682
StatusSignal< wpi::units::microsecond_t > & GetPWM1RiseToRise(bool refresh=true)
Measured rise to rise time of the PWM signal at the S1 input of the CTR Electronics' CANdi™.
StatusSignal< wpi::units::volt_t > & GetSupplyVoltage(bool refresh=true)
Measured supply voltage to the CANdi™.
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANdi.hpp:1671
StatusSignal< int > & GetVersionMajor(bool refresh=true)
App Major Version number.
StatusSignal< bool > & GetOvercurrent(bool refresh=true)
True when the CANdi™ is in overcurrent protection mode.
StatusSignal< wpi::units::turns_per_second_t > & GetPWM1Velocity(bool refresh=true)
Measured velocity of the PWM sensor at the S1 input of the CTR Electronics' CANdi™.
StatusSignal< int > & GetFaultField(bool refresh=true)
Integer representing all fault flags reported by the device.
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdi.hpp:1693
StatusSignal< bool > & GetS1Closed(bool refresh=true)
True if the Signal 1 input (S1IN) matches the configured S1 Closed State.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(wpi::units::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdi.hpp:1753
StatusSignal< int > & GetVersionMinor(bool refresh=true)
App Minor Version number.
configs::CANdiConfiguration Configuration
The configuration class for this device.
Definition CoreCANdi.hpp:926
StatusSignal< wpi::units::ampere_t > & GetOutputCurrent(bool refresh=true)
Measured output current.
StatusSignal< wpi::units::microsecond_t > & GetPWM2RiseToRise(bool refresh=true)
Measured rise to rise time of the PWM signal at the S2 input of the CTR Electronics' CANdi™.
StatusSignal< bool > & GetStickyFault_Hardware(bool refresh=true)
Hardware fault occurred.
ctre::phoenix::StatusCode SetQuadraturePosition(wpi::units::turn_t newValue, wpi::units::second_t timeoutSeconds)
Sets the position of the quadrature input.
Definition CoreCANdi.hpp:1629
void RegisterAlerts(AlertableCollection &collection) override
Registers all alerts for this type to the provided collection.
StatusSignal< bool > & GetFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
StatusSignal< signals::S2StateValue > & GetS2State(bool refresh=true)
State of the Signal 2 input (S2IN).
static CoreCANdi None()
Constructs a stubbed-out CoreCANdi, where all status signals, controls, configs, etc.
Definition CoreCANdi.hpp:943
StatusSignal< wpi::units::turn_t > & GetQuadraturePosition(bool refresh=true)
Position from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdi.hpp:1741
StatusSignal< wpi::units::turns_per_second_t > & GetPWM2Velocity(bool refresh=true)
Measured velocity of the PWM sensor at the S2 input of the CTR Electronics' CANdi™.
ctre::phoenix::StatusCode ClearStickyFault_5V()
Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault.
Definition CoreCANdi.hpp:1791
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdi.hpp:1729
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdi.hpp:1765
Class to control the state of a simulated hardware::CANdi.
Definition CANdiSimState.hpp:33
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition ExternalFeedbackConfigs.hpp:21
Definition ExternalFeedbackConfigs.hpp:17
Definition ExternalFeedbackConfigs.hpp:17
Definition ExternalFeedbackConfigs.hpp:16
Definition StatusCodes.h:22
Definition motor_constants.h:14