CTRE Phoenix C++ 5.35.1
Loading...
Searching...
No Matches
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 * Analog potentiometer/encoder
21 */
22 Analog = 2,
23 //3
24 /**
25 * Tachometer
26 */
27 Tachometer = 4,
28 /**
29 * CTRE Mag Encoder in Absolute mode or
30 * any other device that uses PWM to encode its output
31 */
33 /**
34 * Sum0 + Sum1
35 */
36 SensorSum = 9,
37 /**
38 * Diff0 - Diff1
39 */
41 /**
42 * Sensor configured in RemoteFilter0
43 */
44 RemoteSensor0 = 11,
45 /**
46 * Sensor configured in RemoteFilter1
47 */
48 RemoteSensor1 = 12,
49 //13
50 /**
51 * Position and velocity will read 0.
52 */
53 None = 14,
54 /**
55 * Motor Controller will fake a sensor based on applied motor output.
56 */
58 /**
59 * CTR mag encoder configured in absolute, is the same
60 * as a PWM sensor.
61 */
63 /**
64 * CTR mag encoder configured in relative, is the same
65 * as an quadrature encoder sensor.
66 */
68 };
69 /**
70 * Choose the feedback device for a Talon SRX
71 */
73 /**
74 * Quadrature encoder
75 */
76 QuadEncoder = 0,
77 //1
78 /**
79 * Analog potentiometer/encoder
80 */
81 Analog = 2,
82 //3
83 /**
84 * Tachometer
85 */
86 Tachometer = 4,
87 /**
88 * CTRE Mag Encoder in Absolute mode or
89 * any other device that uses PWM to encode its output
90 */
92 /**
93 * Sum0 + Sum1
94 */
95 SensorSum = 9,
96 /**
97 * Diff0 - Diff1
98 */
100 /**
101 * Sensor configured in RemoteFilter0
102 */
103 RemoteSensor0 = 11,
104 /**
105 * Sensor configured in RemoteFilter1
106 */
107 RemoteSensor1 = 12,
108 //13
109 /**
110 * Position and velocity will read 0.
111 */
112 None = 14,
113 /**
114 * Motor Controller will fake a sensor based on applied motor output.
115 */
117 /**
118 * CTR mag encoder configured in absolute, is the same
119 * as a PWM sensor.
120 */
122 /**
123 * CTR mag encoder configured in relative, is the same
124 * as an quadrature encoder sensor.
125 */
127 };
128 /**
129 * Choose the remote feedback device for a motor controller.
130 */
132 /**
133 * [[deprecated("Use None instead.")]]
134 * Factory default setting for non-enhanced motor controllers
135 */
137 /**
138 * [[deprecated("Use None instead.")]]
139 * Factory default setting for non-enhanced motor controllers
140 */
142 /**
143 * [[deprecated("Use SensorSum instead.")]]
144 * Use Sum0 + Sum1
145 */
147 /**
148 * Use Sum0 + Sum1
149 */
151 /**
152 * [[deprecated("Use SensorDifference instead.")]]
153 * Use Diff0 - Diff1
154 */
156 /**
157 * Use Diff0 - Diff1
158 */
160 /**
161 * [[deprecated("Use RemoteSensor0 instead.")]]
162 * Use the sensor configured
163 * in filter0
164 */
166 /**
167 * Use the sensor configured
168 * in filter0
169 */
171 /**
172 * [[deprecated("Use RemoteSensor1 instead.")]]
173 * Use the sensor configured
174 * in filter1
175 */
177 /**
178 * Use the sensor configured
179 * in filter1
180 */
182 //13
183 /**
184 * [[deprecated("Use None instead.")]]
185 * Position and velocity will read 0.
186 */
188 /**
189 * Position and velocity will read 0.
190 */
192 /**
193 * [[deprecated("Use SoftwareEmulatedSensor instead.")]]
194 * Motor Controller will fake a sensor based on applied motor output.
195 */
197 /**
198 * Motor Controller will fake a sensor based on applied motor output.
199 */
201 };
202 /**
203 * Class to handle feedback device routines
204 */
206 public:
207 /**
208 * Gets the string representation of selected feedback device
209 * @param value feedback device to get string representation of
210 * @return String representation of selected feedback device
211 */
212 static std::string toString(FeedbackDevice value) {
213 switch (value) {
214 case FeedbackDevice::QuadEncoder: return "QuadEncoder";
215 case FeedbackDevice::Analog: return "Analog";
216 case FeedbackDevice::Tachometer: return "Tachometer";
217 case FeedbackDevice::PulseWidthEncodedPosition: return "PulseWidthEncodedPosition";
218 case FeedbackDevice::SensorSum: return "SensorSum";
219 case FeedbackDevice::SensorDifference: return "SensorDifference";
220 case FeedbackDevice::RemoteSensor0: return "RemoteSensor0";
221 case FeedbackDevice::RemoteSensor1: return "RemoteSensor1";
222 case FeedbackDevice::None: return "None";
223 case FeedbackDevice::SoftwareEmulatedSensor: return "SoftwareEmulatedSensor";
224 default: return "InvalidValue";
225 }
226 }
227 /**
228 * Gets the string representation of selected feedback device
229 * @param value feedback device to get string representation of
230 * @return String representation of selected feedback device
231 */
232 static std::string toString(TalonSRXFeedbackDevice value) {
233 switch (value) {
234 case TalonSRXFeedbackDevice::QuadEncoder: return "QuadEncoder";
235 case TalonSRXFeedbackDevice::Analog: return "Analog";
236 case TalonSRXFeedbackDevice::Tachometer: return "Tachometer";
237 case TalonSRXFeedbackDevice::PulseWidthEncodedPosition: return "PulseWidthEncodedPosition";
238 case TalonSRXFeedbackDevice::SensorSum: return "SensorSum";
239 case TalonSRXFeedbackDevice::SensorDifference: return "SensorDifference";
240 case TalonSRXFeedbackDevice::RemoteSensor0: return "RemoteSensor0";
241 case TalonSRXFeedbackDevice::RemoteSensor1: return "RemoteSensor1";
242 case TalonSRXFeedbackDevice::None: return "None";
243 case TalonSRXFeedbackDevice::SoftwareEmulatedSensor: return "SoftwareEmulatedSensor";
244 default: return "InvalidValue";
245 }
246 }
247 /**
248 * Gets the string representation of selected remote feedback device
249 * @param value remote feedback device to get string representation of
250 * @return String representation of selected remote feedback device
251 */
252 static std::string toString(RemoteFeedbackDevice value) {
253 switch (value) {
254 case RemoteFeedbackDevice::FactoryDefaultOff: return "None (factory default value)";
255 case RemoteFeedbackDevice::None: return "None";
256 case RemoteFeedbackDevice::SensorSum: return "SensorSum";
257 case RemoteFeedbackDevice::SensorDifference: return "SensorDifference";
258 case RemoteFeedbackDevice::RemoteSensor0: return "RemoteSensor0";
259 case RemoteFeedbackDevice::RemoteSensor1: return "RemoteSensor1";
260 case RemoteFeedbackDevice::SoftwareEmulatedSensor: return "SoftwareEmulatedSensor";
261 default: return "InvalidValue";
262 }
263 }
264 };
265 } // namespace motorcontrol
266 } // namespace phoenix
267} // namespace ctre
Class to handle feedback device routines.
Definition FeedbackDevice.h:205
static std::string toString(TalonSRXFeedbackDevice value)
Gets the string representation of selected feedback device.
Definition FeedbackDevice.h:232
static std::string toString(RemoteFeedbackDevice value)
Gets the string representation of selected remote feedback device.
Definition FeedbackDevice.h:252
static std::string toString(FeedbackDevice value)
Gets the string representation of selected feedback device.
Definition FeedbackDevice.h:212
RemoteFeedbackDevice
Choose the remote feedback device for a motor controller.
Definition FeedbackDevice.h:131
@ 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.
@ 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:72
@ 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.
WPI Compliant CANcoder class.
Definition CANCoderStatusFrame.h:4