CTRE Phoenix C++ 5.33.1
FeedbackDevice.h
Go to the documentation of this file.
1/* Copyright (C) Cross The Road Electronics 2024 */
2#pragma once
3
5#include <string>
6
7namespace ctre {
8 namespace phoenix {
9 namespace motorcontrol {
10 /**
11 * Choose the feedback device for a motor controller.
12 * Consult product specific documentation to determine what is available/supported.
13 */
14 enum class FeedbackDevice {
15 /**
16 * Quadrature encoder
17 */
18 QuadEncoder = 0,
19 /**
20 * TalonFX supports an integrated sensor.
21 */
23 /**
24 * Analog potentiometer/encoder
25 */
26 Analog = 2,
27 //3
28 /**
29 * Tachometer
30 */
31 Tachometer = 4,
32 /**
33 * CTRE Mag Encoder in Absolute mode or
34 * any other device that uses PWM to encode its output
35 */
37 /**
38 * Sum0 + Sum1
39 */
40 SensorSum = 9,
41 /**
42 * Diff0 - Diff1
43 */
45 /**
46 * Sensor configured in RemoteFilter0
47 */
48 RemoteSensor0 = 11,
49 /**
50 * Sensor configured in RemoteFilter1
51 */
52 RemoteSensor1 = 12,
53 //13
54 /**
55 * Position and velocity will read 0.
56 */
57 None = 14,
58 /**
59 * Motor Controller will fake a sensor based on applied motor output.
60 */
62 /**
63 * CTR mag encoder configured in absolute, is the same
64 * as a PWM sensor.
65 */
67 /**
68 * CTR mag encoder configured in relative, is the same
69 * as an quadrature encoder sensor.
70 */
72 };
73 /**
74 * Choose the feedback device for a Talon SRX
75 */
77 /**
78 * Quadrature encoder
79 */
80 QuadEncoder = 0,
81 //1
82 /**
83 * Analog potentiometer/encoder
84 */
85 Analog = 2,
86 //3
87 /**
88 * Tachometer
89 */
90 Tachometer = 4,
91 /**
92 * CTRE Mag Encoder in Absolute mode or
93 * any other device that uses PWM to encode its output
94 */
96 /**
97 * Sum0 + Sum1
98 */
99 SensorSum = 9,
100 /**
101 * Diff0 - Diff1
102 */
103 SensorDifference = 10,
104 /**
105 * Sensor configured in RemoteFilter0
106 */
107 RemoteSensor0 = 11,
108 /**
109 * Sensor configured in RemoteFilter1
110 */
111 RemoteSensor1 = 12,
112 //13
113 /**
114 * Position and velocity will read 0.
115 */
116 None = 14,
117 /**
118 * Motor Controller will fake a sensor based on applied motor output.
119 */
121 /**
122 * CTR mag encoder configured in absolute, is the same
123 * as a PWM sensor.
124 */
126 /**
127 * CTR mag encoder configured in relative, is the same
128 * as an quadrature encoder sensor.
129 */
131 };
132 /**
133 * Choose the feedback device for a Talon FX/Falcon 500.
134 *
135 * @deprecated This device's Phoenix 5 API is deprecated for removal in the
136 * 2025 season. Users should update to Phoenix 6 firmware and migrate to the
137 * Phoenix 6 API. A migration guide is available at
138 * https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html.
139 *
140 * If the Phoenix 5 API must be used for this device, the device must have 22.X
141 * firmware. This firmware is available in Tuner X after selecting Phoenix 5 in
142 * the firmware year dropdown.
143 */
145 //0
146 /**
147 * TalonFX supports an integrated sensor.
148 */
150 /**
151 * Sum0 + Sum1
152 */
153 SensorSum = 9,
154 /**
155 * Diff0 - Diff1
156 */
157 SensorDifference = 10,
158 /**
159 * Sensor configured in RemoteFilter0
160 */
161 RemoteSensor0 = 11,
162 /**
163 * Sensor configured in RemoteFilter1
164 */
165 RemoteSensor1 = 12,
166 //13
167 /**
168 * Position and velocity will read 0.
169 */
170 None = 14,
171 /**
172 * Motor Controller will fake a sensor based on applied motor output.
173 */
175 };
176 /**
177 * Choose the remote feedback device for a motor controller.
178 */
180 /**
181 * [[deprecated("Use None instead.")]]
182 * Factory default setting for non-enhanced motor controllers
183 */
185 /**
186 * [[deprecated("Use None instead.")]]
187 * Factory default setting for non-enhanced motor controllers
188 */
190 /**
191 * [[deprecated("Use SensorSum instead.")]]
192 * Use Sum0 + Sum1
193 */
195 /**
196 * Use Sum0 + Sum1
197 */
199 /**
200 * [[deprecated("Use SensorDifference instead.")]]
201 * Use Diff0 - Diff1
202 */
204 /**
205 * Use Diff0 - Diff1
206 */
208 /**
209 * [[deprecated("Use RemoteSensor0 instead.")]]
210 * Use the sensor configured
211 * in filter0
212 */
214 /**
215 * Use the sensor configured
216 * in filter0
217 */
219 /**
220 * [[deprecated("Use RemoteSensor1 instead.")]]
221 * Use the sensor configured
222 * in filter1
223 */
225 /**
226 * Use the sensor configured
227 * in filter1
228 */
230 //13
231 /**
232 * [[deprecated("Use None instead.")]]
233 * Position and velocity will read 0.
234 */
236 /**
237 * Position and velocity will read 0.
238 */
240 /**
241 * [[deprecated("Use SoftwareEmulatedSensor instead.")]]
242 * Motor Controller will fake a sensor based on applied motor output.
243 */
245 /**
246 * Motor Controller will fake a sensor based on applied motor output.
247 */
249 };
250 /**
251 * Class to handle feedback device routines
252 */
254 public:
255 /**
256 * Gets the string representation of selected feedback device
257 * @param value feedback device to get string representation of
258 * @return String representation of selected feedback device
259 */
260 static std::string toString(FeedbackDevice value) {
261 switch (value) {
262 case FeedbackDevice::QuadEncoder: return "QuadEncoder";
263 case FeedbackDevice::IntegratedSensor: return "Integrated Sensor";
264 case FeedbackDevice::Analog: return "Analog";
265 case FeedbackDevice::Tachometer: return "Tachometer";
266 case FeedbackDevice::PulseWidthEncodedPosition: return "PulseWidthEncodedPosition";
267 case FeedbackDevice::SensorSum: return "SensorSum";
268 case FeedbackDevice::SensorDifference: return "SensorDifference";
269 case FeedbackDevice::RemoteSensor0: return "RemoteSensor0";
270 case FeedbackDevice::RemoteSensor1: return "RemoteSensor1";
271 case FeedbackDevice::None: return "None";
272 case FeedbackDevice::SoftwareEmulatedSensor: return "SoftwareEmulatedSensor";
273 default: return "InvalidValue";
274 }
275 }
276 /**
277 * Gets the string representation of selected feedback device
278 * @param value feedback device to get string representation of
279 * @return String representation of selected feedback device
280 */
281 static std::string toString(TalonSRXFeedbackDevice value) {
282 switch (value) {
283 case TalonSRXFeedbackDevice::QuadEncoder: return "QuadEncoder";
284 case TalonSRXFeedbackDevice::Analog: return "Analog";
285 case TalonSRXFeedbackDevice::Tachometer: return "Tachometer";
286 case TalonSRXFeedbackDevice::PulseWidthEncodedPosition: return "PulseWidthEncodedPosition";
287 case TalonSRXFeedbackDevice::SensorSum: return "SensorSum";
288 case TalonSRXFeedbackDevice::SensorDifference: return "SensorDifference";
289 case TalonSRXFeedbackDevice::RemoteSensor0: return "RemoteSensor0";
290 case TalonSRXFeedbackDevice::RemoteSensor1: return "RemoteSensor1";
291 case TalonSRXFeedbackDevice::None: return "None";
292 case TalonSRXFeedbackDevice::SoftwareEmulatedSensor: return "SoftwareEmulatedSensor";
293 default: return "InvalidValue";
294 }
295 }
296 /**
297 * Gets the string representation of selected feedback device
298 * @param value feedback device to get string representation of
299 * @return String representation of selected feedback device
300 */
301 [[deprecated("This device's Phoenix 5 API is deprecated for removal in the 2025 season."
302 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
303 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
304 static std::string toString(TalonFXFeedbackDevice value) {
305 switch (value) {
306 case TalonFXFeedbackDevice::IntegratedSensor: return "Integrated Sensor";
307 case TalonFXFeedbackDevice::SensorSum: return "SensorSum";
308 case TalonFXFeedbackDevice::SensorDifference: return "SensorDifference";
309 case TalonFXFeedbackDevice::RemoteSensor0: return "RemoteSensor0";
310 case TalonFXFeedbackDevice::RemoteSensor1: return "RemoteSensor1";
311 case TalonFXFeedbackDevice::None: return "None";
312 case TalonFXFeedbackDevice::SoftwareEmulatedSensor: return "SoftwareEmulatedSensor";
313 default: return "InvalidValue";
314 }
315 }
316 /**
317 * Gets the string representation of selected remote feedback device
318 * @param value remote feedback device to get string representation of
319 * @return String representation of selected remote feedback device
320 */
321 static std::string toString(RemoteFeedbackDevice value) {
322 switch (value) {
323 case RemoteFeedbackDevice::FactoryDefaultOff: return "None (factory default value)";
324 case RemoteFeedbackDevice::None: return "None";
325 case RemoteFeedbackDevice::SensorSum: return "SensorSum";
326 case RemoteFeedbackDevice::SensorDifference: return "SensorDifference";
327 case RemoteFeedbackDevice::RemoteSensor0: return "RemoteSensor0";
328 case RemoteFeedbackDevice::RemoteSensor1: return "RemoteSensor1";
329 case RemoteFeedbackDevice::SoftwareEmulatedSensor: return "SoftwareEmulatedSensor";
330 default: return "InvalidValue";
331 }
332 }
333 };
334 } // namespace motorcontrol
335 } // namespace phoenix
336} // namespace ctre
Class to handle feedback device routines.
Definition: FeedbackDevice.h:253
static std::string toString(TalonSRXFeedbackDevice value)
Gets the string representation of selected feedback device.
Definition: FeedbackDevice.h:281
static std::string toString(TalonFXFeedbackDevice value)
Gets the string representation of selected feedback device.
Definition: FeedbackDevice.h:304
static std::string toString(RemoteFeedbackDevice value)
Gets the string representation of selected remote feedback device.
Definition: FeedbackDevice.h:321
static std::string toString(FeedbackDevice value)
Gets the string representation of selected feedback device.
Definition: FeedbackDevice.h:260
@ None
Same as SetInverted(false)
TalonFXFeedbackDevice
Choose the feedback device for a Talon FX/Falcon 500.
Definition: FeedbackDevice.h:144
@ None
Position and velocity will read 0.
@ RemoteSensor0
Sensor configured in RemoteFilter0.
@ IntegratedSensor
TalonFX supports an integrated sensor.
@ RemoteSensor1
Sensor configured in RemoteFilter1.
@ SoftwareEmulatedSensor
Motor Controller will fake a sensor based on applied motor output.
RemoteFeedbackDevice
Choose the remote feedback device for a motor controller.
Definition: FeedbackDevice.h:179
@ RemoteFeedbackDevice_SensorSum
[[deprecated("Use SensorSum instead.")]] Use Sum0 + Sum1
@ RemoteFeedbackDevice_SoftwareEmulatedSensor
[[deprecated("Use SoftwareEmulatedSensor instead.")]] Motor Controller will fake a sensor based on ap...
@ RemoteFeedbackDevice_FactoryDefaultOff
[[deprecated("Use None instead.")]] Factory default setting for non-enhanced motor controllers
@ RemoteFeedbackDevice_RemoteSensor0
[[deprecated("Use RemoteSensor0 instead.")]] Use the sensor configured in filter0
@ None
Position and velocity will read 0.
@ RemoteFeedbackDevice_None
[[deprecated("Use None instead.")]] Position and velocity will read 0.
@ RemoteSensor0
Use the sensor configured in filter0.
@ RemoteFeedbackDevice_SensorDifference
[[deprecated("Use SensorDifference instead.")]] Use Diff0 - Diff1
@ RemoteSensor1
Use the sensor configured in filter1.
@ FactoryDefaultOff
[[deprecated("Use None instead.")]] Factory default setting for non-enhanced motor controllers
@ SoftwareEmulatedSensor
Motor Controller will fake a sensor based on applied motor output.
@ RemoteFeedbackDevice_RemoteSensor1
[[deprecated("Use RemoteSensor1 instead.")]] Use the sensor configured in filter1
FeedbackDevice
Choose the feedback device for a motor controller.
Definition: FeedbackDevice.h:14
@ CTRE_MagEncoder_Absolute
CTR mag encoder configured in absolute, is the same as a PWM sensor.
@ Analog
Analog potentiometer/encoder.
@ None
Position and velocity will read 0.
@ RemoteSensor0
Sensor configured in RemoteFilter0.
@ PulseWidthEncodedPosition
CTRE Mag Encoder in Absolute mode or any other device that uses PWM to encode its output.
@ IntegratedSensor
TalonFX supports an integrated sensor.
@ RemoteSensor1
Sensor configured in RemoteFilter1.
@ CTRE_MagEncoder_Relative
CTR mag encoder configured in relative, is the same as an quadrature encoder sensor.
@ SoftwareEmulatedSensor
Motor Controller will fake a sensor based on applied motor output.
TalonSRXFeedbackDevice
Choose the feedback device for a Talon SRX.
Definition: FeedbackDevice.h:76
@ None
Position and velocity will read 0.
@ RemoteSensor0
Sensor configured in RemoteFilter0.
@ PulseWidthEncodedPosition
CTRE Mag Encoder in Absolute mode or any other device that uses PWM to encode its output.
@ RemoteSensor1
Sensor configured in RemoteFilter1.
@ SoftwareEmulatedSensor
Motor Controller will fake a sensor based on applied motor output.
namespace ctre
Definition: paramEnum.h:5