Loading [MathJax]/extensions/tex2jax.js
CTRE Phoenix 6 C++ 25.3.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
12
13#include <units/angle.h>
14#include <units/angular_velocity.h>
15#include <units/temperature.h>
16#include <units/voltage.h>
17
18namespace ctre {
19namespace phoenix6 {
20namespace hardware {
21namespace traits {
22
23/**
24 * Contains all status signals for motor controllers that support external
25 * motors.
26 */
28{
29public:
30 virtual ~HasExternalMotor() = default;
31
32 /**
33 * \brief Status of the temperature sensor of the external motor.
34 *
35 *
36 * This refreshes and returns a cached StatusSignal object.
37 *
38 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
39 * \returns ExternalMotorTempStatus Status Signal Object
40 */
42
43 /**
44 * \brief Temperature of the external motor.
45 *
46 * - Minimum Value: 0.0
47 * - Maximum Value: 255.0
48 * - Default Value: 0
49 * - Units: ℃
50 *
51 * This refreshes and returns a cached StatusSignal object.
52 *
53 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
54 * \returns ExternalMotorTemp Status Signal Object
55 */
57
58 /**
59 * \brief The measured voltage of the 5V rail available on the JST and
60 * dataport connectors.
61 *
62 * - Minimum Value: 0.0
63 * - Maximum Value: 40.95
64 * - Default Value: 0
65 * - Units: Volts
66 *
67 * This refreshes and returns a cached StatusSignal object.
68 *
69 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
70 * \returns FiveVRailVoltage Status Signal Object
71 */
73
74 /**
75 * \brief The voltage of the analog pin (pin 3) of the Talon FXS data
76 * port. The analog pin reads a nominal voltage of 0-5V.
77 *
78 * - Minimum Value: 0
79 * - Maximum Value: 6
80 * - Default Value: 0
81 * - Units: Volts
82 *
83 * This refreshes and returns a cached StatusSignal object.
84 *
85 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
86 * \returns AnalogVoltage Status Signal Object
87 */
88 virtual StatusSignal<units::voltage::volt_t> &GetAnalogVoltage(bool refresh = true) = 0;
89
90 /**
91 * \brief The raw position retrieved from the connected quadrature
92 * encoder. This is only affected by the QuadratureEdgesPerRotation
93 * config. In most situations, the user should instead configure the
94 * ExternalFeedbackSensorSource and use the regular position getter.
95 *
96 * This signal must have its update frequency configured before it
97 * will have data.
98 *
99 * - Minimum Value: -16384.0
100 * - Maximum Value: 16383.999755859375
101 * - Default Value: 0
102 * - Units: rotations
103 *
104 * This refreshes and returns a cached StatusSignal object.
105 *
106 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
107 * \returns RawQuadraturePosition Status Signal Object
108 */
110
111 /**
112 * \brief The raw velocity retrieved from the connected quadrature
113 * encoder. This is only affected by the QuadratureEdgesPerRotation
114 * config. In most situations, the user should instead configure the
115 * ExternalFeedbackSensorSource and use the regular velocity getter.
116 *
117 * This signal must have its update frequency configured before it
118 * will have data.
119 *
120 * - Minimum Value: -512.0
121 * - Maximum Value: 511.998046875
122 * - Default Value: 0
123 * - Units: rotations per second
124 *
125 * This refreshes and returns a cached StatusSignal object.
126 *
127 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
128 * \returns RawQuadratureVelocity Status Signal Object
129 */
131
132 /**
133 * \brief The raw position retrieved from the connected pulse-width
134 * encoder. This is not affected by any config. In most situations,
135 * the user should instead configure the ExternalFeedbackSensorSource
136 * and use the regular position getter.
137 *
138 * This signal must have its update frequency configured before it
139 * will have data.
140 *
141 * - Minimum Value: -16384.0
142 * - Maximum Value: 16383.999755859375
143 * - Default Value: 0
144 * - Units: rotations
145 *
146 * This refreshes and returns a cached StatusSignal object.
147 *
148 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
149 * \returns RawPulseWidthPosition Status Signal Object
150 */
152
153 /**
154 * \brief The raw velocity retrieved from the connected pulse-width
155 * encoder. This is not affected by any config. In most situations,
156 * the user should instead configure the ExternalFeedbackSensorSource
157 * and use the regular velocity getter.
158 *
159 * This signal must have its update frequency configured before it
160 * will have data.
161 *
162 * - Minimum Value: -512.0
163 * - Maximum Value: 511.998046875
164 * - Default Value: 0
165 * - Units: rotations per second
166 *
167 * This refreshes and returns a cached StatusSignal object.
168 *
169 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
170 * \returns RawPulseWidthVelocity Status Signal Object
171 */
173
174 /**
175 * \brief Bridge was disabled most likely due to a short in the motor
176 * leads.
177 *
178 * - Default Value: False
179 *
180 * This refreshes and returns a cached StatusSignal object.
181 *
182 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
183 * \returns Fault_BridgeShort Status Signal Object
184 */
185 virtual StatusSignal<bool> &GetFault_BridgeShort(bool refresh = true) = 0;
186
187 /**
188 * \brief Bridge was disabled most likely due to a short in the motor
189 * leads.
190 *
191 * - Default Value: False
192 *
193 * This refreshes and returns a cached StatusSignal object.
194 *
195 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
196 * \returns StickyFault_BridgeShort Status Signal Object
197 */
198 virtual StatusSignal<bool> &GetStickyFault_BridgeShort(bool refresh = true) = 0;
199
200 /**
201 * \brief Hall sensor signals are invalid. Check hall sensor and
202 * cabling. This fault can be used to detect when hall cable is
203 * unplugged.
204 *
205 * - Default Value: False
206 *
207 * This refreshes and returns a cached StatusSignal object.
208 *
209 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
210 * \returns Fault_HallSensorMissing Status Signal Object
211 */
212 virtual StatusSignal<bool> &GetFault_HallSensorMissing(bool refresh = true) = 0;
213
214 /**
215 * \brief Hall sensor signals are invalid. Check hall sensor and
216 * cabling. This fault can be used to detect when hall cable is
217 * unplugged.
218 *
219 * - Default Value: False
220 *
221 * This refreshes and returns a cached StatusSignal object.
222 *
223 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
224 * \returns StickyFault_HallSensorMissing Status Signal Object
225 */
226 virtual StatusSignal<bool> &GetStickyFault_HallSensorMissing(bool refresh = true) = 0;
227
228 /**
229 * \brief Hall sensor signals are invalid during motor drive, so motor
230 * was disabled. Check hall sensor and cabling.
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; defaults to true
237 * \returns Fault_DriveDisabledHallSensor Status Signal Object
238 */
239 virtual StatusSignal<bool> &GetFault_DriveDisabledHallSensor(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; defaults to true
250 * \returns StickyFault_DriveDisabledHallSensor Status Signal Object
251 */
253
254 /**
255 * \brief Motor temperature signal appears to not be connected.
256 *
257 * - Default Value: False
258 *
259 * This refreshes and returns a cached StatusSignal object.
260 *
261 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
262 * \returns Fault_MotorTempSensorMissing Status Signal Object
263 */
264 virtual StatusSignal<bool> &GetFault_MotorTempSensorMissing(bool refresh = true) = 0;
265
266 /**
267 * \brief Motor temperature signal appears to not be connected.
268 *
269 * - Default Value: False
270 *
271 * This refreshes and returns a cached StatusSignal object.
272 *
273 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
274 * \returns StickyFault_MotorTempSensorMissing Status Signal Object
275 */
277
278 /**
279 * \brief Motor temperature signal indicates motor is too hot.
280 *
281 * - Default Value: False
282 *
283 * This refreshes and returns a cached StatusSignal object.
284 *
285 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
286 * \returns Fault_MotorTempSensorTooHot Status Signal Object
287 */
288 virtual StatusSignal<bool> &GetFault_MotorTempSensorTooHot(bool refresh = true) = 0;
289
290 /**
291 * \brief Motor temperature signal indicates motor is too hot.
292 *
293 * - Default Value: False
294 *
295 * This refreshes and returns a cached StatusSignal object.
296 *
297 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
298 * \returns StickyFault_MotorTempSensorTooHot Status Signal Object
299 */
301
302
303
304 /**
305 * \brief Clear sticky fault: Bridge was disabled most likely due to a
306 * short in the motor leads.
307 *
308 * \param timeoutSeconds Maximum time to wait up to in seconds.
309 * \returns StatusCode of the set command
310 */
311 virtual ctre::phoenix::StatusCode ClearStickyFault_BridgeShort(units::time::second_t timeoutSeconds) = 0;
312 /**
313 * \brief Clear sticky fault: Bridge was disabled most likely due to a
314 * short in the motor leads.
315 *
316 * This will wait up to 0.100 seconds (100ms) by default.
317 *
318 * \returns StatusCode of the set command
319 */
321
322 /**
323 * \brief Clear sticky fault: Hall sensor signals are invalid. Check
324 * hall sensor and cabling. This fault can be used to detect when
325 * hall cable is unplugged.
326 *
327 * \param timeoutSeconds Maximum time to wait up to in seconds.
328 * \returns StatusCode of the set command
329 */
330 virtual ctre::phoenix::StatusCode ClearStickyFault_HallSensorMissing(units::time::second_t timeoutSeconds) = 0;
331 /**
332 * \brief Clear sticky fault: Hall sensor signals are invalid. Check
333 * hall sensor and cabling. This fault can be used to detect when
334 * hall cable is unplugged.
335 *
336 * This will wait up to 0.100 seconds (100ms) by default.
337 *
338 * \returns StatusCode of the set command
339 */
341
342 /**
343 * \brief Clear sticky fault: Hall sensor signals are invalid during
344 * motor drive, so motor was disabled. Check hall sensor and cabling.
345 *
346 * \param timeoutSeconds Maximum time to wait up to in seconds.
347 * \returns StatusCode of the set command
348 */
349 virtual ctre::phoenix::StatusCode ClearStickyFault_DriveDisabledHallSensor(units::time::second_t timeoutSeconds) = 0;
350 /**
351 * \brief Clear sticky fault: Hall sensor signals are invalid during
352 * motor drive, so motor was disabled. Check hall sensor and cabling.
353 *
354 * This will wait up to 0.100 seconds (100ms) by default.
355 *
356 * \returns StatusCode of the set command
357 */
359
360 /**
361 * \brief Clear sticky fault: Motor temperature signal appears to not
362 * be connected.
363 *
364 * \param timeoutSeconds Maximum time to wait up to in seconds.
365 * \returns StatusCode of the set command
366 */
367 virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorMissing(units::time::second_t timeoutSeconds) = 0;
368 /**
369 * \brief Clear sticky fault: Motor temperature signal appears to not
370 * be connected.
371 *
372 * This will wait up to 0.100 seconds (100ms) by default.
373 *
374 * \returns StatusCode of the set command
375 */
377
378 /**
379 * \brief Clear sticky fault: Motor temperature signal indicates motor
380 * is too hot.
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_MotorTempSensorTooHot(units::time::second_t timeoutSeconds) = 0;
386 /**
387 * \brief Clear sticky fault: Motor temperature signal indicates motor
388 * is too hot.
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}
398}
399}
400}
401
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:656
Contains all status signals for motor controllers that support external motors.
Definition HasExternalMotor.hpp:28
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 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_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 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:27
Definition MotionMagicExpoTorqueCurrentFOC.hpp:18