CTRE Phoenix 6 C++ 26.0.0-beta-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
349 /**
350 * \brief Clear sticky fault: Bridge was disabled most likely due to a
351 * short in the motor leads.
352 *
353 * \param timeoutSeconds Maximum time to wait up to in seconds.
354 * \returns StatusCode of the set command
355 */
356 virtual ctre::phoenix::StatusCode ClearStickyFault_BridgeShort(units::time::second_t timeoutSeconds) = 0;
357 /**
358 * \brief Clear sticky fault: Bridge was disabled most likely due to a
359 * short in the motor leads.
360 *
361 * This will wait up to 0.100 seconds (100ms) by default.
362 *
363 * \returns StatusCode of the set command
364 */
366
367 /**
368 * \brief Clear sticky fault: Hall sensor signals are invalid. Check
369 * hall sensor and cabling. This fault can be used to detect when
370 * hall cable is unplugged.
371 *
372 * \param timeoutSeconds Maximum time to wait up to in seconds.
373 * \returns StatusCode of the set command
374 */
375 virtual ctre::phoenix::StatusCode ClearStickyFault_HallSensorMissing(units::time::second_t timeoutSeconds) = 0;
376 /**
377 * \brief Clear sticky fault: Hall sensor signals are invalid. Check
378 * hall sensor and cabling. This fault can be used to detect when
379 * hall cable is unplugged.
380 *
381 * This will wait up to 0.100 seconds (100ms) by default.
382 *
383 * \returns StatusCode of the set command
384 */
386
387 /**
388 * \brief Clear sticky fault: Hall sensor signals are invalid during
389 * motor drive, so motor was disabled. Check hall sensor and cabling.
390 *
391 * \param timeoutSeconds Maximum time to wait up to in seconds.
392 * \returns StatusCode of the set command
393 */
394 virtual ctre::phoenix::StatusCode ClearStickyFault_DriveDisabledHallSensor(units::time::second_t timeoutSeconds) = 0;
395 /**
396 * \brief Clear sticky fault: Hall sensor signals are invalid during
397 * motor drive, so motor was disabled. Check hall sensor and cabling.
398 *
399 * This will wait up to 0.100 seconds (100ms) by default.
400 *
401 * \returns StatusCode of the set command
402 */
404
405 /**
406 * \brief Clear sticky fault: Motor temperature signal appears to not
407 * be connected.
408 *
409 * \param timeoutSeconds Maximum time to wait up to in seconds.
410 * \returns StatusCode of the set command
411 */
412 virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorMissing(units::time::second_t timeoutSeconds) = 0;
413 /**
414 * \brief Clear sticky fault: Motor temperature signal appears to not
415 * be connected.
416 *
417 * This will wait up to 0.100 seconds (100ms) by default.
418 *
419 * \returns StatusCode of the set command
420 */
422
423 /**
424 * \brief Clear sticky fault: Motor temperature signal indicates motor
425 * is too hot.
426 *
427 * \param timeoutSeconds Maximum time to wait up to in seconds.
428 * \returns StatusCode of the set command
429 */
430 virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorTooHot(units::time::second_t timeoutSeconds) = 0;
431 /**
432 * \brief Clear sticky fault: Motor temperature signal indicates motor
433 * is too hot.
434 *
435 * This will wait up to 0.100 seconds (100ms) by default.
436 *
437 * \returns StatusCode of the set command
438 */
440
441 /**
442 * \brief Clear sticky fault: Motor arrangement has not been set in
443 * configuration.
444 *
445 * \param timeoutSeconds Maximum time to wait up to in seconds.
446 * \returns StatusCode of the set command
447 */
448 virtual ctre::phoenix::StatusCode ClearStickyFault_MotorArrangementNotSelected(units::time::second_t timeoutSeconds) = 0;
449 /**
450 * \brief Clear sticky fault: Motor arrangement has not been set in
451 * configuration.
452 *
453 * This will wait up to 0.100 seconds (100ms) by default.
454 *
455 * \returns StatusCode of the set command
456 */
458};
459
460}
461}
462}
463}
464
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 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.
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition motor_constants.h:14