14#include <units/angle.h>
15#include <units/angular_velocity.h>
16#include <units/dimensionless.h>
17#include <units/voltage.h>
87 ctre::phoenix::StatusCode
Deserialize(
const std::string&
string)
252 ctre::phoenix::StatusCode
SetPosition(units::angle::turn_t newValue)
269 ctre::phoenix::StatusCode
SetPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
271 std::stringstream ss;
314 std::stringstream ss;
335 bool _isInitialized =
false;
336 bool _isVersionOk =
false;
341 units::time::second_t _resetTimestamp{0_s};
345 void ReportIfTooOld();
399 std::unique_ptr<sim::CANcoderSimState> _simState{};
412 if (_simState ==
nullptr)
413 _simState = std::make_unique<sim::CANcoderSimState>(*
this);
794 ctre::phoenix::StatusCode
SetPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
806 ctre::phoenix::StatusCode
SetPosition(units::angle::turn_t newValue)
ii that the Software will be uninterrupted or error free
Definition: CTRE_LICENSE.txt:191
CTREXPORT int c_ctre_phoenixpro_serialize_double(int spn, double value, char **str)
@ OK
No Error.
Definition: StatusCodes.h:1101
@ NotSupported
This is not supported.
Definition: StatusCodes.h:1704
Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along w...
Definition: CoreCANcoder.hpp:37
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Take a string and deserialize it to this configuration.
Definition: CoreCANcoder.hpp:87
std::string Serialize() const
Get the serialized form of this configuration.
Definition: CoreCANcoder.hpp:77
MagnetSensorConfigs MagnetSensor
Configs that affect the magnet sensor and how to interpret it.
Definition: CoreCANcoder.hpp:62
bool FutureProofConfigs
True if we should factory default newer unsupported configs, false to leave newer unsupported configs...
Definition: CoreCANcoder.hpp:52
std::string ToString() const
Get the string representation of this configuration.
Definition: CoreCANcoder.hpp:67
Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along w...
Definition: CoreCANcoder.hpp:102
ctre::phoenix::StatusCode Refresh(MagnetSensorConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreCANcoder.hpp:187
CANcoderConfigurator(const CANcoderConfigurator &)=delete
Delete the copy constructor, we can only pass by reference.
ctre::phoenix::StatusCode Apply(const CANcoderConfiguration &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreCANcoder.hpp:171
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition: CoreCANcoder.hpp:293
ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs) const
Refreshes the values of the specified config group.
Definition: CoreCANcoder.hpp:125
ctre::phoenix::StatusCode Apply(const MagnetSensorConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreCANcoder.hpp:232
ctre::phoenix::StatusCode Refresh(MagnetSensorConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreCANcoder.hpp:200
ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
The position to set the sensor position to right now.
Definition: CoreCANcoder.hpp:269
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition: CoreCANcoder.hpp:312
ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreCANcoder.hpp:139
ctre::phoenix::StatusCode Apply(const MagnetSensorConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreCANcoder.hpp:218
ctre::phoenix::StatusCode Apply(const CANcoderConfiguration &configs)
Applies the contents of the specified config to the device.
Definition: CoreCANcoder.hpp:157
ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue)
The position to set the sensor position to right now.
Definition: CoreCANcoder.hpp:252
Configs that affect the magnet sensor and how to interpret it.
Definition: Configs.hpp:42
std::string Serialize() const
Definition: Configs.hpp:81
std::string ToString() const
Definition: Configs.hpp:69
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:91
Definition: Configs.hpp:22
Definition: Configurator.hpp:21
ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, units::time::second_t timeoutSeconds) const
Definition: Configurator.hpp:61
units::time::second_t defaultTimeoutSeconds
The default amount of time to wait for a config.
Definition: Configurator.hpp:26
ctre::phoenix::StatusCode SetConfigsPrivate(const std::string &serializedString, units::time::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate)
Definition: Configurator.hpp:37
Abstract Control Request class that other control requests extend for use.
Definition: ControlRequest.hpp:65
Definition: DeviceIdentifier.hpp:19
Parent class for all devices.
Definition: ParentDevice.hpp:30
Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along w...
Definition: CoreCANcoder.hpp:331
CoreCANcoder & operator=(CoreCANcoder const &)=delete
StatusSignalValue< bool > & GetStickyFault_BadMagnet()
The magnet distance is not correct or magnet is missing.
StatusSignalValue< int > & GetVersionMajor()
App Major Version number.
StatusSignalValue< units::voltage::volt_t > & GetSupplyVoltage()
Measured supply voltage to the CANcoder.
StatusSignalValue< units::angle::turn_t > & GetPositionSinceBoot()
The relative position reported by the CANcoder since boot.
StatusSignalValue< units::angular_velocity::turns_per_second_t > & GetVelocity()
Velocity of device.
ctre::phoenix::StatusCode SetControl(controls::ControlRequest &request)
Control motor with generic control request object.
Definition: CoreCANcoder.hpp:765
StatusSignalValue< int > & GetStickyFaultField()
Integer representing all sticky faults.
StatusSignalValue< bool > & GetStickyFault_Hardware()
Hardware fault occurred.
StatusSignalValue< units::angle::turn_t > & GetAbsolutePosition()
Absolute Position of device.
StatusSignalValue< units::angular_velocity::turns_per_second_t > & GetUnfilteredVelocity()
The unfiltered velocity reported by CANcoder.
StatusSignalValue< bool > & GetFault_Undervoltage()
Device supply voltage dropped to near brownout levels.
StatusSignalValue< int > & GetVersionBuild()
App Build Version number.
StatusSignalValue< int > & GetVersionBugfix()
App Bugfix Version number.
StatusSignalValue< bool > & GetFault_BootDuringEnable()
Device boot while detecting the enable signal.
StatusSignalValue< units::angle::turn_t > & GetPosition()
Position of device.
CoreCANcoder(CoreCANcoder const &)=delete
ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
The position to set the sensor position to right now.
Definition: CoreCANcoder.hpp:794
StatusSignalValue< bool > & GetFault_Hardware()
Hardware fault occurred.
sim::CANcoderSimState & GetSimState()
Get the simulation state for this device.
Definition: CoreCANcoder.hpp:410
StatusSignalValue< int > & GetVersionMinor()
App Minor Version number.
StatusSignalValue< int > & GetFaultField()
Integer representing all faults.
configs::CANcoderConfigurator const & GetConfigurator() const
Gets the configurator for this CANcoder.
Definition: CoreCANcoder.hpp:392
StatusSignalValue< bool > & GetFault_BadMagnet()
The magnet distance is not correct or magnet is missing.
StatusSignalValue< bool > & GetStickyFault_BootDuringEnable()
Device boot while detecting the enable signal.
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition: CoreCANcoder.hpp:820
StatusSignalValue< bool > & GetStickyFault_Undervoltage()
Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue)
The position to set the sensor position to right now.
Definition: CoreCANcoder.hpp:806
CoreCANcoder(int deviceId, std::string canbus="")
Constructs a new CANcoder object.
StatusSignalValue< signals::MagnetHealthValue > & GetMagnetHealth()
Magnet health as measured by CANcoder.
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition: CoreCANcoder.hpp:834
configs::CANcoderConfigurator & GetConfigurator()
Gets the configurator for this CANcoder.
Definition: CoreCANcoder.hpp:380
StatusSignalValue< int > & GetVersion()
Full Version.
ctre::phoenix::StatusCode SetControl(controls::ControlRequest &&request)
Control motor with generic control request object.
Definition: CoreCANcoder.hpp:781
Class to control the state of a simulated hardware::CANcoder.
Definition: CANcoderSimState.hpp:31
static constexpr int Startup_ResetFlags
Definition: SpnValue.hpp:26
CTREXPORT double GetCurrentTimeSeconds()
Get the current timestamp in seconds.
Definition: string_util.hpp:14