94 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
95 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
96 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
116 retstr += prependString +
".absoluteSensorRange = " + std::to_string(
absoluteSensorRange) +
";\n";
117 retstr += prependString +
".magnetOffsetDegrees = " + std::to_string(
magnetOffsetDegrees) +
";\n";
118 retstr += prependString +
".sensorDirection = " + std::to_string(
sensorDirection) +
";\n";
120 retstr += prependString +
".sensorCoefficient = " + std::to_string(
sensorCoefficient) +
";\n";
121 retstr += prependString +
".unitString = \"" +
unitString.c_str() +
"\";\n";
122 retstr += prependString +
".sensorTimeBase = " + std::to_string(
sensorTimeBase) +
";\n";
142 struct [[deprecated("This device's Phoenix 5 API is deprecated for removal in the 2025 season."
143 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
144 "A migration guide is available at https:
155 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
156 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
157 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
159 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
160 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
161 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
163 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
164 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
165 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
167 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
168 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
169 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
171 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
172 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
173 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
175 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
176 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
177 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
179 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
180 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
181 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
183 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
184 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
185 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
187 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
188 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
189 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
230 class [[deprecated("This device's Phoenix 5 API is deprecated for removal in the 2025 season."
231 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
232 "A migration guide is available at https:
241 CANCoder(
int deviceNumber, std::string
const &canbus =
"");
374 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
375 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
376 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
390 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
391 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
392 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
479 uint8_t subValue,
int ordinal,
int timeoutMs = 0);
516 int32_t& valueReceived, uint8_t& subValue, int32_t ordinal,
530 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
531 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
532 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
534 uint8_t periodMs,
int timeoutMs = 0);
544 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
545 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
546 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
567 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
568 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
569 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
578 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
579 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
580 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
604 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
605 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
606 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
617 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
618 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
619 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
635 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
636 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
637 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
Simple address holder.
Definition: CANBusAddressable.h:9
CTRE CANCoder.
Definition: CANCoder.h:233
ErrorCode SetPositionToAbsolute(int timeoutMs=0)
Sets the position of the sensor to match the magnet's "Absolute Sensor".
int GetStatusFramePeriod(CANCoderStatusFrame frame, int timeoutMs=0)
Gets the period of the given status frame.
ErrorCode ConfigSensorInitializationStrategy(ctre::phoenix::sensors::SensorInitializationStrategy initializationStrategy, int timeoutMs=0)
Pick the strategy on how to initialize the CANCoder's "Position" register.
ErrorCode ConfigSetParameter(ParamEnum param, double value, uint8_t subValue, int ordinal, int timeoutMs=0)
Sets a parameter.
double GetLastTimestamp()
Get the timestamp of the CAN frame retrieved in the last called get routine.
ErrorCode ConfigMagnetOffset(double offsetDegrees, int timeoutMs=0)
Adjusts the zero point for the absolute position register.
ErrorCode GetFaults(CANCoderFaults &toFill)
Gets the CANCoder fault status.
ErrorCode GetLastError()
Call GetLastError() generated by this object.
int GetFirmwareVersion()
Gets the firmware version of the device.
ErrorCode ConfigVelocityMeasurementWindow(int windowSize, int timeoutMs=0)
Sets the number of velocity samples used in the rolling average velocity measurement.
CANCoderSimCollection & GetSimCollection()
double GetPosition()
Gets the position of the sensor.
ErrorCode ClearStickyFaults(int timeoutMs=0)
Clears the Sticky Faults.
double GetVelocity()
Sets the position of the sensor.
ErrorCode ConfigVelocityMeasurementPeriod(SensorVelocityMeasPeriod period, int timeoutMs=0)
Configures the period of each velocity sample.
static void DestroyAllCANCoders()
Destructs all CANCoder objects.
ctre::phoenix::sensors::MagnetFieldStrength GetMagnetFieldStrength()
Gets the magnet's health.
int ConfigGetCustomParam(int paramIndex, int timeoutMs=0)
Gets the value of a custom parameter.
double GetBusVoltage()
Gets the bus voltage seen by the device.
ErrorCode ConfigSetCustomParam(int newValue, int paramIndex, int timeoutMs=0)
Sets the value of a custom parameter.
ErrorCode ConfigFeedbackCoefficient(double sensorCoefficient, const std::string &unitString, ctre::phoenix::sensors::SensorTimeBase sensortimeBase, int timeoutMs=0)
Choose what units you want the API to get/set.
ErrorCode GetStickyFaults(CANCoderStickyFaults &toFill)
Gets the CANCoder sticky fault status.
ErrorCode ConfigSensorDirection(bool bSensorDirection, int timeoutMs=0)
Choose which direction is interpreted as positive displacement.
CANCoder(int deviceNumber, std::string const &canbus="")
Constructor.
ErrorCode ConfigAbsoluteSensorRange(ctre::phoenix::sensors::AbsoluteSensorRange absoluteSensorRange, int timeoutMs=0)
Sets the signage and range of the "Absolute Position" signal.
double GetAbsolutePosition()
Gets the absolute position of the sensor.
ErrorCode SetStatusFramePeriod(CANCoderStatusFrame statusFrame, uint8_t periodMs, int timeoutMs=0)
Sets the period of the given status frame.
ErrorCode SetPosition(double newPosition, int timeoutMs=0)
Sets the position of the sensor.
ErrorCode ConfigGetParameter(ParamEnum param, int32_t valueToSend, int32_t &valueReceived, uint8_t &subValue, int32_t ordinal, int32_t timeoutMs)
Gets a parameter by passing an int by reference.
double ConfigGetParameter(ParamEnum param, int ordinal, int timeoutMs=0)
Gets a parameter.
ErrorCode GetAllConfigs(CANCoderConfiguration &allConfigs, int timeoutMs=50)
Gets all persistant settings.
ErrorCode ConfigFactoryDefault(int timeoutMs=50)
Configures all persistent settings to defaults (overloaded so timeoutMs is 50 ms).
std::string GetLastUnitString()
Get the units for the signal retrieved in the last called get routine.
ctre::phoenix::ErrorCode ConfigAllSettings(const CANCoderConfiguration &allConfigs, int timeoutMs=50)
Configures all persistent settings.
bool HasResetOccurred()
Returns true if the device has reset since last call.
Collection of simulation functions available to a CANCoder.
Definition: CANCoderSimCollection.h:33
static std::string toString(SensorVelocityMeasPeriod value)
String representation of specified CANCoderVelocityMeasPeriod.
Definition: SensorVelocityMeasPeriod.h:58
SensorInitializationStrategy
Enum for how CANCoder should initialize its position register on boot.
Definition: SensorInitializationStrategy.h:22
@ BootToZero
On boot up, set position to zero.
Definition: SensorInitializationStrategy.h:26
MagnetFieldStrength
Indicates the magnet field strength of a magnet-based sensor.
Definition: MagnetFieldStrength.h:21
CANCoderStatusFrame
Enumerated type for status frame types.
Definition: CANCoderStatusFrame.h:23
SensorTimeBase
Velocity Measurement Periods.
Definition: SensorTimeBase.h:23
@ PerSecond
Per-Second Velocities.
Definition: SensorTimeBase.h:31
SensorVelocityMeasPeriod
Enumerate filter periods for any sensor that measures velocity.
Definition: SensorVelocityMeasPeriod.h:13
AbsoluteSensorRange
Enum for how to range the absolute sensor position.
Definition: AbsoluteSensorRange.h:22
@ Unsigned_0_to_360
Express the absolute position as an unsigned value.
Definition: AbsoluteSensorRange.h:27
ParamEnum
Signal enumeration for generic signal access.
Definition: paramEnum.h:13
ErrorCode
Definition: ErrorCode.h:13
@ Period_100Ms
100ms velocity measurement period
Definition: CANifierVelocityMeasPeriod.h:44
namespace ctre
Definition: paramEnum.h:5
Util class to help custom configs.
Definition: CustomParamConfiguration.h:53
Configurables for any custom param configs.
Definition: CustomParamConfiguration.h:11
bool enableOptimizations
Enable optimizations for ConfigAll (defaults true)
Definition: CustomParamConfiguration.h:23
std::string toString()
Definition: CustomParamConfiguration.h:34
Util class to help with configuring CANCoder.
Definition: CANCoder.h:145
static bool UnitStringDifferent(const CANCoderConfiguration &settings)
Definition: CANCoder.h:186
static bool SensorTimeBaseDifferent(const CANCoderConfiguration &settings)
Definition: CANCoder.h:190
static bool AbsoluteSensorRangeDifferent(const CANCoderConfiguration &settings)
Definition: CANCoder.h:166
static bool MagnetOffsetDegreesDifferent(const CANCoderConfiguration &settings)
Definition: CANCoder.h:170
static bool SensorDirectionDifferent(const CANCoderConfiguration &settings)
Definition: CANCoder.h:174
static bool VelocityMeasurementPeriodDifferent(const CANCoderConfiguration &settings)
Determine if specified value is different from default.
Definition: CANCoder.h:158
static bool InitializationStrategyDifferent(const CANCoderConfiguration &settings)
Definition: CANCoder.h:178
static bool VelocityMeasurementWindowDifferent(const CANCoderConfiguration &settings)
Definition: CANCoder.h:162
static bool SensorCoefficientDifferent(const CANCoderConfiguration &settings)
Definition: CANCoder.h:182
Configurables available to CANCoder.
Definition: CANCoder.h:35
ctre::phoenix::sensors::AbsoluteSensorRange absoluteSensorRange
Desired Sign / Range for the absolute position register.
Definition: CANCoder.h:49
int velocityMeasurementWindow
Velocity measurement window to use.
Definition: CANCoder.h:43
ctre::phoenix::sensors::SensorTimeBase sensorTimeBase
Desired denominator to report velocity in.
Definition: CANCoder.h:89
double sensorCoefficient
Scalar to multiply the CANCoder's native 12-bit resolute sensor.
Definition: CANCoder.h:77
std::string toString(std::string prependString)
Definition: CANCoder.h:111
bool sensorDirection
Choose which direction is interpreted as positive displacement.
Definition: CANCoder.h:63
double magnetOffsetDegrees
Adjusts the zero point for the absolute position register.
Definition: CANCoder.h:56
SensorVelocityMeasPeriod velocityMeasurementPeriod
Velocity measurement period to use.
Definition: CANCoder.h:39
std::string toString()
Definition: CANCoder.h:102
ctre::phoenix::sensors::SensorInitializationStrategy initializationStrategy
The sensor initialization strategy to use.This will impact the behavior the next time CANCoder boots ...
Definition: CANCoder.h:73
std::string unitString
String holding the unit to report in.
Definition: CANCoder.h:84
CANCoderConfiguration()
Constructor.
Definition: CANCoder.h:97
Faults available to CANCoderFaults.
Definition: CANCoderFaults.h:23
Sticky Faults for CANCoder (Currently has none)
Definition: CANCoderStickyFaults.h:23