CTRE Phoenix 6 C++ 26.1.1
Loading...
Searching...
No Matches
HasExternalMotor.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) Cross The Road Electronics.  All rights reserved.
3 * License information can be found in CTRE_LICENSE.txt
4 * For support and suggestions contact support@ctr-electronics.com or file
5 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
6 */
7#pragma once
8
13
14#include <units/angle.h>
15#include <units/angular_velocity.h>
16#include <units/temperature.h>
17#include <units/voltage.h>
18
19namespace ctre {
20namespace phoenix6 {
21namespace hardware {
22namespace traits {
23
24/**
25 * Contains all status signals for motor controllers that support external
26 * motors.
27 */
28class HasExternalMotor : public virtual CommonDevice
29{
30public:
31 virtual ~HasExternalMotor() = default;
32
33 /**
34 * \brief Status of the temperature sensor of the external motor.
35 *
36 *
37 * This refreshes and returns a cached StatusSignal object.
38 *
39 * \param refresh Whether to refresh the StatusSignal before returning it;
40 * defaults to true
41 * \returns ExternalMotorTempStatus Status Signal Object
42 */
44
45 /**
46 * \brief Temperature of the external motor.
47 *
48 * - Minimum Value: 0.0
49 * - Maximum Value: 255.0
50 * - Default Value: 0
51 * - Units: ℃
52 *
53 * This refreshes and returns a cached StatusSignal object.
54 *
55 * \param refresh Whether to refresh the StatusSignal before returning it;
56 * defaults to true
57 * \returns ExternalMotorTemp Status Signal Object
58 */
60
61 /**
62 * \brief The measured voltage of the 5V rail available on the JST and
63 * dataport connectors.
64 *
65 * - Minimum Value: 0.0
66 * - Maximum Value: 40.95
67 * - Default Value: 0
68 * - Units: Volts
69 *
70 * This refreshes and returns a cached StatusSignal object.
71 *
72 * \param refresh Whether to refresh the StatusSignal before returning it;
73 * defaults to true
74 * \returns FiveVRailVoltage Status Signal Object
75 */
77
78 /**
79 * \brief The voltage of the analog pin (pin 3) of the Talon FXS data
80 * port. The analog pin reads a nominal voltage of 0-5V.
81 *
82 * - Minimum Value: 0
83 * - Maximum Value: 6
84 * - Default Value: 0
85 * - Units: Volts
86 *
87 * This refreshes and returns a cached StatusSignal object.
88 *
89 * \param refresh Whether to refresh the StatusSignal before returning it;
90 * defaults to true
91 * \returns AnalogVoltage Status Signal Object
92 */
93 virtual StatusSignal<units::voltage::volt_t> &GetAnalogVoltage(bool refresh = true) = 0;
94
95 /**
96 * \brief The raw position retrieved from the connected quadrature
97 * encoder. This is only affected by the QuadratureEdgesPerRotation
98 * config. In most situations, the user should instead configure the
99 * ExternalFeedbackSensorSource and use the regular position getter.
100 *
101 * This signal must have its update frequency configured before it
102 * will have data.
103 *
104 * - Minimum Value: -16384.0
105 * - Maximum Value: 16383.999755859375
106 * - Default Value: 0
107 * - Units: rotations
108 *
109 * This refreshes and returns a cached StatusSignal object.
110 *
111 * \param refresh Whether to refresh the StatusSignal before returning it;
112 * defaults to true
113 * \returns RawQuadraturePosition Status Signal Object
114 */
116
117 /**
118 * \brief The raw velocity retrieved from the connected quadrature
119 * encoder. This is only affected by the QuadratureEdgesPerRotation
120 * config. In most situations, the user should instead configure the
121 * ExternalFeedbackSensorSource and use the regular velocity getter.
122 *
123 * This signal must have its update frequency configured before it
124 * will have data.
125 *
126 * - Minimum Value: -512.0
127 * - Maximum Value: 511.998046875
128 * - Default Value: 0
129 * - Units: rotations per second
130 *
131 * This refreshes and returns a cached StatusSignal object.
132 *
133 * \param refresh Whether to refresh the StatusSignal before returning it;
134 * defaults to true
135 * \returns RawQuadratureVelocity Status Signal Object
136 */
138
139 /**
140 * \brief The raw position retrieved from the connected pulse-width
141 * encoder. This is not affected by any config. In most situations,
142 * the user should instead configure the ExternalFeedbackSensorSource
143 * and use the regular position getter.
144 *
145 * This signal must have its update frequency configured before it
146 * will have data.
147 *
148 * - Minimum Value: -16384.0
149 * - Maximum Value: 16383.999755859375
150 * - Default Value: 0
151 * - Units: rotations
152 *
153 * This refreshes and returns a cached StatusSignal object.
154 *
155 * \param refresh Whether to refresh the StatusSignal before returning it;
156 * defaults to true
157 * \returns RawPulseWidthPosition Status Signal Object
158 */
160
161 /**
162 * \brief The raw velocity retrieved from the connected pulse-width
163 * encoder. This is not affected by any config. In most situations,
164 * the user should instead configure the ExternalFeedbackSensorSource
165 * and use the regular velocity getter.
166 *
167 * This signal must have its update frequency configured before it
168 * will have data.
169 *
170 * - Minimum Value: -512.0
171 * - Maximum Value: 511.998046875
172 * - Default Value: 0
173 * - Units: rotations per second
174 *
175 * This refreshes and returns a cached StatusSignal object.
176 *
177 * \param refresh Whether to refresh the StatusSignal before returning it;
178 * defaults to true
179 * \returns RawPulseWidthVelocity Status Signal Object
180 */
182
183 /**
184 * \brief Bridge was disabled most likely due to a short in the motor
185 * leads.
186 *
187 * - Default Value: False
188 *
189 * This refreshes and returns a cached StatusSignal object.
190 *
191 * \param refresh Whether to refresh the StatusSignal before returning it;
192 * defaults to true
193 * \returns Fault_BridgeShort Status Signal Object
194 */
195 virtual StatusSignal<bool> &GetFault_BridgeShort(bool refresh = true) = 0;
196
197 /**
198 * \brief Bridge was disabled most likely due to a short in the motor
199 * leads.
200 *
201 * - Default Value: False
202 *
203 * This refreshes and returns a cached StatusSignal object.
204 *
205 * \param refresh Whether to refresh the StatusSignal before returning it;
206 * defaults to true
207 * \returns StickyFault_BridgeShort Status Signal Object
208 */
209 virtual StatusSignal<bool> &GetStickyFault_BridgeShort(bool refresh = true) = 0;
210
211 /**
212 * \brief Hall sensor signals are invalid. Check hall sensor and
213 * cabling. This fault can be used to detect when hall cable is
214 * unplugged.
215 *
216 * - Default Value: False
217 *
218 * This refreshes and returns a cached StatusSignal object.
219 *
220 * \param refresh Whether to refresh the StatusSignal before returning it;
221 * defaults to true
222 * \returns Fault_HallSensorMissing Status Signal Object
223 */
224 virtual StatusSignal<bool> &GetFault_HallSensorMissing(bool refresh = true) = 0;
225
226 /**
227 * \brief Hall sensor signals are invalid. Check hall sensor and
228 * cabling. This fault can be used to detect when hall cable is
229 * unplugged.
230 *
231 * - Default Value: False
232 *
233 * This refreshes and returns a cached StatusSignal object.
234 *
235 * \param refresh Whether to refresh the StatusSignal before returning it;
236 * defaults to true
237 * \returns StickyFault_HallSensorMissing Status Signal Object
238 */
239 virtual StatusSignal<bool> &GetStickyFault_HallSensorMissing(bool refresh = true) = 0;
240
241 /**
242 * \brief Hall sensor signals are invalid during motor drive, so motor
243 * was disabled. Check hall sensor and cabling.
244 *
245 * - Default Value: False
246 *
247 * This refreshes and returns a cached StatusSignal object.
248 *
249 * \param refresh Whether to refresh the StatusSignal before returning it;
250 * defaults to true
251 * \returns Fault_DriveDisabledHallSensor Status Signal Object
252 */
253 virtual StatusSignal<bool> &GetFault_DriveDisabledHallSensor(bool refresh = true) = 0;
254
255 /**
256 * \brief Hall sensor signals are invalid during motor drive, so motor
257 * was disabled. Check hall sensor and cabling.
258 *
259 * - Default Value: False
260 *
261 * This refreshes and returns a cached StatusSignal object.
262 *
263 * \param refresh Whether to refresh the StatusSignal before returning it;
264 * defaults to true
265 * \returns StickyFault_DriveDisabledHallSensor Status Signal Object
266 */
268
269 /**
270 * \brief Motor temperature signal appears to not be connected.
271 *
272 * - Default Value: False
273 *
274 * This refreshes and returns a cached StatusSignal object.
275 *
276 * \param refresh Whether to refresh the StatusSignal before returning it;
277 * defaults to true
278 * \returns Fault_MotorTempSensorMissing Status Signal Object
279 */
280 virtual StatusSignal<bool> &GetFault_MotorTempSensorMissing(bool refresh = true) = 0;
281
282 /**
283 * \brief Motor temperature signal appears to not be connected.
284 *
285 * - Default Value: False
286 *
287 * This refreshes and returns a cached StatusSignal object.
288 *
289 * \param refresh Whether to refresh the StatusSignal before returning it;
290 * defaults to true
291 * \returns StickyFault_MotorTempSensorMissing Status Signal Object
292 */
294
295 /**
296 * \brief Motor temperature signal indicates motor is too hot.
297 *
298 * - Default Value: False
299 *
300 * This refreshes and returns a cached StatusSignal object.
301 *
302 * \param refresh Whether to refresh the StatusSignal before returning it;
303 * defaults to true
304 * \returns Fault_MotorTempSensorTooHot Status Signal Object
305 */
306 virtual StatusSignal<bool> &GetFault_MotorTempSensorTooHot(bool refresh = true) = 0;
307
308 /**
309 * \brief Motor temperature signal indicates motor is too hot.
310 *
311 * - Default Value: False
312 *
313 * This refreshes and returns a cached StatusSignal object.
314 *
315 * \param refresh Whether to refresh the StatusSignal before returning it;
316 * defaults to true
317 * \returns StickyFault_MotorTempSensorTooHot Status Signal Object
318 */
320
321 /**
322 * \brief Motor arrangement has not been set in configuration.
323 *
324 * - Default Value: False
325 *
326 * This refreshes and returns a cached StatusSignal object.
327 *
328 * \param refresh Whether to refresh the StatusSignal before returning it;
329 * defaults to true
330 * \returns Fault_MotorArrangementNotSelected Status Signal Object
331 */
333
334 /**
335 * \brief Motor arrangement has not been set in configuration.
336 *
337 * - Default Value: False
338 *
339 * This refreshes and returns a cached StatusSignal object.
340 *
341 * \param refresh Whether to refresh the StatusSignal before returning it;
342 * defaults to true
343 * \returns StickyFault_MotorArrangementNotSelected Status Signal Object
344 */
346
347 /**
348 * \brief The CTR Electronics' TalonFX device has detected a 5V fault.
349 * This may be due to overcurrent or a short-circuit.
350 *
351 * - Default Value: False
352 *
353 * This refreshes and returns a cached StatusSignal object.
354 *
355 * \param refresh Whether to refresh the StatusSignal before returning it;
356 * defaults to true
357 * \returns Fault_5V Status Signal Object
358 */
359 virtual StatusSignal<bool> &GetFault_5V(bool refresh = true) = 0;
360
361 /**
362 * \brief The CTR Electronics' TalonFX device has detected a 5V fault.
363 * This may be due to overcurrent or a short-circuit.
364 *
365 * - Default Value: False
366 *
367 * This refreshes and returns a cached StatusSignal object.
368 *
369 * \param refresh Whether to refresh the StatusSignal before returning it;
370 * defaults to true
371 * \returns StickyFault_5V Status Signal Object
372 */
373 virtual StatusSignal<bool> &GetStickyFault_5V(bool refresh = true) = 0;
374
375
376
377 /**
378 * \brief Clear sticky fault: Bridge was disabled most likely due to a
379 * short in the motor leads.
380 *
381 * \param timeoutSeconds Maximum time to wait up to in seconds.
382 * \returns StatusCode of the set command
383 */
384 virtual ctre::phoenix::StatusCode ClearStickyFault_BridgeShort(units::time::second_t timeoutSeconds) = 0;
385 /**
386 * \brief Clear sticky fault: Bridge was disabled most likely due to a
387 * short in the motor leads.
388 *
389 * This will wait up to 0.100 seconds (100ms) by default.
390 *
391 * \returns StatusCode of the set command
392 */
394
395 /**
396 * \brief Clear sticky fault: Hall sensor signals are invalid. Check
397 * hall sensor and cabling. This fault can be used to detect when
398 * hall cable is unplugged.
399 *
400 * \param timeoutSeconds Maximum time to wait up to in seconds.
401 * \returns StatusCode of the set command
402 */
403 virtual ctre::phoenix::StatusCode ClearStickyFault_HallSensorMissing(units::time::second_t timeoutSeconds) = 0;
404 /**
405 * \brief Clear sticky fault: Hall sensor signals are invalid. Check
406 * hall sensor and cabling. This fault can be used to detect when
407 * hall cable is unplugged.
408 *
409 * This will wait up to 0.100 seconds (100ms) by default.
410 *
411 * \returns StatusCode of the set command
412 */
414
415 /**
416 * \brief Clear sticky fault: Hall sensor signals are invalid during
417 * motor drive, so motor was disabled. Check hall sensor and cabling.
418 *
419 * \param timeoutSeconds Maximum time to wait up to in seconds.
420 * \returns StatusCode of the set command
421 */
422 virtual ctre::phoenix::StatusCode ClearStickyFault_DriveDisabledHallSensor(units::time::second_t timeoutSeconds) = 0;
423 /**
424 * \brief Clear sticky fault: Hall sensor signals are invalid during
425 * motor drive, so motor was disabled. Check hall sensor and cabling.
426 *
427 * This will wait up to 0.100 seconds (100ms) by default.
428 *
429 * \returns StatusCode of the set command
430 */
432
433 /**
434 * \brief Clear sticky fault: Motor temperature signal appears to not
435 * be connected.
436 *
437 * \param timeoutSeconds Maximum time to wait up to in seconds.
438 * \returns StatusCode of the set command
439 */
440 virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorMissing(units::time::second_t timeoutSeconds) = 0;
441 /**
442 * \brief Clear sticky fault: Motor temperature signal appears to not
443 * be connected.
444 *
445 * This will wait up to 0.100 seconds (100ms) by default.
446 *
447 * \returns StatusCode of the set command
448 */
450
451 /**
452 * \brief Clear sticky fault: Motor temperature signal indicates motor
453 * is too hot.
454 *
455 * \param timeoutSeconds Maximum time to wait up to in seconds.
456 * \returns StatusCode of the set command
457 */
458 virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorTooHot(units::time::second_t timeoutSeconds) = 0;
459 /**
460 * \brief Clear sticky fault: Motor temperature signal indicates motor
461 * is too hot.
462 *
463 * This will wait up to 0.100 seconds (100ms) by default.
464 *
465 * \returns StatusCode of the set command
466 */
468
469 /**
470 * \brief Clear sticky fault: Motor arrangement has not been set in
471 * configuration.
472 *
473 * \param timeoutSeconds Maximum time to wait up to in seconds.
474 * \returns StatusCode of the set command
475 */
476 virtual ctre::phoenix::StatusCode ClearStickyFault_MotorArrangementNotSelected(units::time::second_t timeoutSeconds) = 0;
477 /**
478 * \brief Clear sticky fault: Motor arrangement has not been set in
479 * configuration.
480 *
481 * This will wait up to 0.100 seconds (100ms) by default.
482 *
483 * \returns StatusCode of the set command
484 */
486};
487
488}
489}
490}
491}
492
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:474
Contains everything common between Phoenix 6 devices.
Definition CommonDevice.hpp:23
Contains all status signals for motor controllers that support external motors.
Definition HasExternalMotor.hpp:29
virtual StatusSignal< bool > & GetStickyFault_MotorTempSensorTooHot(bool refresh=true)=0
Motor temperature signal indicates motor is too hot.
virtual StatusSignal< units::angle::turn_t > & GetRawQuadraturePosition(bool refresh=true)=0
The raw position retrieved from the connected quadrature encoder.
virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorTooHot()=0
Clear sticky fault: Motor temperature signal indicates motor is too hot.
virtual StatusSignal< units::voltage::volt_t > & GetFiveVRailVoltage(bool refresh=true)=0
The measured voltage of the 5V rail available on the JST and dataport connectors.
virtual ctre::phoenix::StatusCode ClearStickyFault_BridgeShort(units::time::second_t timeoutSeconds)=0
Clear sticky fault: Bridge was disabled most likely due to a short in the motor leads.
virtual StatusSignal< units::angle::turn_t > & GetRawPulseWidthPosition(bool refresh=true)=0
The raw position retrieved from the connected pulse-width encoder.
virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorMissing()=0
Clear sticky fault: Motor temperature signal appears to not be connected.
virtual ctre::phoenix::StatusCode ClearStickyFault_DriveDisabledHallSensor(units::time::second_t timeoutSeconds)=0
Clear sticky fault: Hall sensor signals are invalid during motor drive, so motor was disabled.
virtual StatusSignal< units::angular_velocity::turns_per_second_t > & GetRawQuadratureVelocity(bool refresh=true)=0
The raw velocity retrieved from the connected quadrature encoder.
virtual ctre::phoenix::StatusCode ClearStickyFault_MotorArrangementNotSelected(units::time::second_t timeoutSeconds)=0
Clear sticky fault: Motor arrangement has not been set in configuration.
virtual StatusSignal< bool > & GetFault_MotorTempSensorTooHot(bool refresh=true)=0
Motor temperature signal indicates motor is too hot.
virtual ctre::phoenix::StatusCode ClearStickyFault_BridgeShort()=0
Clear sticky fault: Bridge was disabled most likely due to a short in the motor leads.
virtual StatusSignal< bool > & GetStickyFault_5V(bool refresh=true)=0
The CTR Electronics' TalonFX device has detected a 5V fault.
virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorTooHot(units::time::second_t timeoutSeconds)=0
Clear sticky fault: Motor temperature signal indicates motor is too hot.
virtual StatusSignal< bool > & GetFault_DriveDisabledHallSensor(bool refresh=true)=0
Hall sensor signals are invalid during motor drive, so motor was disabled.
virtual StatusSignal< bool > & GetFault_MotorTempSensorMissing(bool refresh=true)=0
Motor temperature signal appears to not be connected.
virtual StatusSignal< units::temperature::celsius_t > & GetExternalMotorTemp(bool refresh=true)=0
Temperature of the external motor.
virtual StatusSignal< bool > & GetFault_HallSensorMissing(bool refresh=true)=0
Hall sensor signals are invalid.
virtual StatusSignal< signals::ExternalMotorTempStatusValue > & GetExternalMotorTempStatus(bool refresh=true)=0
Status of the temperature sensor of the external motor.
virtual StatusSignal< units::angular_velocity::turns_per_second_t > & GetRawPulseWidthVelocity(bool refresh=true)=0
The raw velocity retrieved from the connected pulse-width encoder.
virtual StatusSignal< bool > & GetStickyFault_HallSensorMissing(bool refresh=true)=0
Hall sensor signals are invalid.
virtual ctre::phoenix::StatusCode ClearStickyFault_HallSensorMissing()=0
Clear sticky fault: Hall sensor signals are invalid.
virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorMissing(units::time::second_t timeoutSeconds)=0
Clear sticky fault: Motor temperature signal appears to not be connected.
virtual ctre::phoenix::StatusCode ClearStickyFault_DriveDisabledHallSensor()=0
Clear sticky fault: Hall sensor signals are invalid during motor drive, so motor was disabled.
virtual StatusSignal< bool > & GetFault_MotorArrangementNotSelected(bool refresh=true)=0
Motor arrangement has not been set in configuration.
virtual StatusSignal< bool > & GetStickyFault_MotorArrangementNotSelected(bool refresh=true)=0
Motor arrangement has not been set in configuration.
virtual StatusSignal< bool > & GetFault_BridgeShort(bool refresh=true)=0
Bridge was disabled most likely due to a short in the motor leads.
virtual StatusSignal< bool > & GetStickyFault_BridgeShort(bool refresh=true)=0
Bridge was disabled most likely due to a short in the motor leads.
virtual ctre::phoenix::StatusCode ClearStickyFault_MotorArrangementNotSelected()=0
Clear sticky fault: Motor arrangement has not been set in configuration.
virtual StatusSignal< units::voltage::volt_t > & GetAnalogVoltage(bool refresh=true)=0
The voltage of the analog pin (pin 3) of the Talon FXS data port.
virtual StatusSignal< bool > & GetStickyFault_MotorTempSensorMissing(bool refresh=true)=0
Motor temperature signal appears to not be connected.
virtual StatusSignal< bool > & GetStickyFault_DriveDisabledHallSensor(bool refresh=true)=0
Hall sensor signals are invalid during motor drive, so motor was disabled.
virtual ctre::phoenix::StatusCode ClearStickyFault_HallSensorMissing(units::time::second_t timeoutSeconds)=0
Clear sticky fault: Hall sensor signals are invalid.
virtual StatusSignal< bool > & GetFault_5V(bool refresh=true)=0
The CTR Electronics' TalonFX device has detected a 5V fault.
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition motor_constants.h:14