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