CTRE Phoenix 6 C++ 25.3.0
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
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 raw position retrieved from the connected quadrature
76 * encoder. This is only affected by the QuadratureEdgesPerRotation
77 * config. In most situations, the user should instead configure the
78 * ExternalFeedbackSensorSource and use the regular position getter.
79 *
80 * This signal must have its update frequency configured before it
81 * will have data.
82 *
83 * - Minimum Value: -16384.0
84 * - Maximum Value: 16383.999755859375
85 * - Default Value: 0
86 * - Units: rotations
87 *
88 * This refreshes and returns a cached StatusSignal object.
89 *
90 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
91 * \returns RawQuadraturePosition Status Signal Object
92 */
94
95 /**
96 * \brief The raw velocity 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 velocity getter.
100 *
101 * This signal must have its update frequency configured before it
102 * will have data.
103 *
104 * - Minimum Value: -512.0
105 * - Maximum Value: 511.998046875
106 * - Default Value: 0
107 * - Units: rotations per second
108 *
109 * This refreshes and returns a cached StatusSignal object.
110 *
111 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
112 * \returns RawQuadratureVelocity Status Signal Object
113 */
115
116 /**
117 * \brief The raw position retrieved from the connected pulse-width
118 * encoder. This is not affected by any config. In most situations,
119 * the user should instead configure the ExternalFeedbackSensorSource
120 * and use the regular position getter.
121 *
122 * This signal must have its update frequency configured before it
123 * will have data.
124 *
125 * - Minimum Value: -16384.0
126 * - Maximum Value: 16383.999755859375
127 * - Default Value: 0
128 * - Units: rotations
129 *
130 * This refreshes and returns a cached StatusSignal object.
131 *
132 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
133 * \returns RawPulseWidthPosition Status Signal Object
134 */
136
137 /**
138 * \brief The raw velocity retrieved from the connected pulse-width
139 * encoder. This is not affected by any config. In most situations,
140 * the user should instead configure the ExternalFeedbackSensorSource
141 * and use the regular velocity getter.
142 *
143 * This signal must have its update frequency configured before it
144 * will have data.
145 *
146 * - Minimum Value: -512.0
147 * - Maximum Value: 511.998046875
148 * - Default Value: 0
149 * - Units: rotations per second
150 *
151 * This refreshes and returns a cached StatusSignal object.
152 *
153 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
154 * \returns RawPulseWidthVelocity Status Signal Object
155 */
157
158 /**
159 * \brief Bridge was disabled most likely due to a short in the motor
160 * leads.
161 *
162 * - Default Value: False
163 *
164 * This refreshes and returns a cached StatusSignal object.
165 *
166 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
167 * \returns Fault_BridgeShort Status Signal Object
168 */
169 virtual StatusSignal<bool> &GetFault_BridgeShort(bool refresh = true) = 0;
170
171 /**
172 * \brief Bridge was disabled most likely due to a short in the motor
173 * leads.
174 *
175 * - Default Value: False
176 *
177 * This refreshes and returns a cached StatusSignal object.
178 *
179 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
180 * \returns StickyFault_BridgeShort Status Signal Object
181 */
182 virtual StatusSignal<bool> &GetStickyFault_BridgeShort(bool refresh = true) = 0;
183
184 /**
185 * \brief Hall sensor signals are invalid. Check hall sensor and
186 * cabling. This fault can be used to detect when hall cable is
187 * unplugged.
188 *
189 * - Default Value: False
190 *
191 * This refreshes and returns a cached StatusSignal object.
192 *
193 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
194 * \returns Fault_HallSensorMissing Status Signal Object
195 */
196 virtual StatusSignal<bool> &GetFault_HallSensorMissing(bool refresh = true) = 0;
197
198 /**
199 * \brief Hall sensor signals are invalid. Check hall sensor and
200 * cabling. This fault can be used to detect when hall cable is
201 * unplugged.
202 *
203 * - Default Value: False
204 *
205 * This refreshes and returns a cached StatusSignal object.
206 *
207 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
208 * \returns StickyFault_HallSensorMissing Status Signal Object
209 */
210 virtual StatusSignal<bool> &GetStickyFault_HallSensorMissing(bool refresh = true) = 0;
211
212 /**
213 * \brief Hall sensor signals are invalid during motor drive, so motor
214 * was disabled. Check hall sensor and cabling.
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; defaults to true
221 * \returns Fault_DriveDisabledHallSensor Status Signal Object
222 */
223 virtual StatusSignal<bool> &GetFault_DriveDisabledHallSensor(bool refresh = true) = 0;
224
225 /**
226 * \brief Hall sensor signals are invalid during motor drive, so motor
227 * was disabled. Check hall sensor and cabling.
228 *
229 * - Default Value: False
230 *
231 * This refreshes and returns a cached StatusSignal object.
232 *
233 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
234 * \returns StickyFault_DriveDisabledHallSensor Status Signal Object
235 */
237
238 /**
239 * \brief Motor temperature signal appears to not be connected.
240 *
241 * - Default Value: False
242 *
243 * This refreshes and returns a cached StatusSignal object.
244 *
245 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
246 * \returns Fault_MotorTempSensorMissing Status Signal Object
247 */
248 virtual StatusSignal<bool> &GetFault_MotorTempSensorMissing(bool refresh = true) = 0;
249
250 /**
251 * \brief Motor temperature signal appears to not be connected.
252 *
253 * - Default Value: False
254 *
255 * This refreshes and returns a cached StatusSignal object.
256 *
257 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
258 * \returns StickyFault_MotorTempSensorMissing Status Signal Object
259 */
261
262 /**
263 * \brief Motor temperature signal indicates motor is too hot.
264 *
265 * - Default Value: False
266 *
267 * This refreshes and returns a cached StatusSignal object.
268 *
269 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
270 * \returns Fault_MotorTempSensorTooHot Status Signal Object
271 */
272 virtual StatusSignal<bool> &GetFault_MotorTempSensorTooHot(bool refresh = true) = 0;
273
274 /**
275 * \brief Motor temperature signal indicates motor is too hot.
276 *
277 * - Default Value: False
278 *
279 * This refreshes and returns a cached StatusSignal object.
280 *
281 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
282 * \returns StickyFault_MotorTempSensorTooHot Status Signal Object
283 */
285
286
287
288 /**
289 * \brief Clear sticky fault: Bridge was disabled most likely due to a
290 * short in the motor leads.
291 *
292 * \param timeoutSeconds Maximum time to wait up to in seconds.
293 * \returns StatusCode of the set command
294 */
295 virtual ctre::phoenix::StatusCode ClearStickyFault_BridgeShort(units::time::second_t timeoutSeconds) = 0;
296 /**
297 * \brief Clear sticky fault: Bridge was disabled most likely due to a
298 * short in the motor leads.
299 *
300 * This will wait up to 0.100 seconds (100ms) by default.
301 *
302 * \returns StatusCode of the set command
303 */
305
306 /**
307 * \brief Clear sticky fault: Hall sensor signals are invalid. Check
308 * hall sensor and cabling. This fault can be used to detect when
309 * hall cable is unplugged.
310 *
311 * \param timeoutSeconds Maximum time to wait up to in seconds.
312 * \returns StatusCode of the set command
313 */
314 virtual ctre::phoenix::StatusCode ClearStickyFault_HallSensorMissing(units::time::second_t timeoutSeconds) = 0;
315 /**
316 * \brief Clear sticky fault: Hall sensor signals are invalid. Check
317 * hall sensor and cabling. This fault can be used to detect when
318 * hall cable is unplugged.
319 *
320 * This will wait up to 0.100 seconds (100ms) by default.
321 *
322 * \returns StatusCode of the set command
323 */
325
326 /**
327 * \brief Clear sticky fault: Hall sensor signals are invalid during
328 * motor drive, so motor was disabled. Check hall sensor and cabling.
329 *
330 * \param timeoutSeconds Maximum time to wait up to in seconds.
331 * \returns StatusCode of the set command
332 */
333 virtual ctre::phoenix::StatusCode ClearStickyFault_DriveDisabledHallSensor(units::time::second_t timeoutSeconds) = 0;
334 /**
335 * \brief Clear sticky fault: Hall sensor signals are invalid during
336 * motor drive, so motor was disabled. Check hall sensor and cabling.
337 *
338 * This will wait up to 0.100 seconds (100ms) by default.
339 *
340 * \returns StatusCode of the set command
341 */
343
344 /**
345 * \brief Clear sticky fault: Motor temperature signal appears to not
346 * be connected.
347 *
348 * \param timeoutSeconds Maximum time to wait up to in seconds.
349 * \returns StatusCode of the set command
350 */
351 virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorMissing(units::time::second_t timeoutSeconds) = 0;
352 /**
353 * \brief Clear sticky fault: Motor temperature signal appears to not
354 * be connected.
355 *
356 * This will wait up to 0.100 seconds (100ms) by default.
357 *
358 * \returns StatusCode of the set command
359 */
361
362 /**
363 * \brief Clear sticky fault: Motor temperature signal indicates motor
364 * is too hot.
365 *
366 * \param timeoutSeconds Maximum time to wait up to in seconds.
367 * \returns StatusCode of the set command
368 */
369 virtual ctre::phoenix::StatusCode ClearStickyFault_MotorTempSensorTooHot(units::time::second_t timeoutSeconds) = 0;
370 /**
371 * \brief Clear sticky fault: Motor temperature signal indicates motor
372 * is too hot.
373 *
374 * This will wait up to 0.100 seconds (100ms) by default.
375 *
376 * \returns StatusCode of the set command
377 */
379};
380
381}
382}
383}
384}
385
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< 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