CTRE Phoenix 6 C++ 26.1.1
Loading...
Searching...
No Matches
SupportsFOC.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
39
40
41namespace ctre {
42namespace phoenix6 {
43namespace hardware {
44namespace traits {
45
46/**
47 * Requires Phoenix Pro; Contains all FOC-exclusive control functions available
48 * for devices that support FOC.
49 */
50class SupportsFOC : public virtual CommonDevice
51{
52public:
53 virtual ~SupportsFOC() = default;
54
55
56 /**
57 * \brief Request a specified motor current (field oriented control).
58 *
59 * \details This control request will drive the motor to the requested
60 * motor (stator) current value. This leverages field oriented
61 * control (FOC), which means greater peak power than what is
62 * documented. This scales to torque based on Motor's kT constant.
63 *
64 * - TorqueCurrentFOC Parameters:
65 * - Output: Amount of motor current in Amperes
66 * - MaxAbsDutyCycle: The maximum absolute motor output that can be applied,
67 * which effectively limits the velocity. For example, 0.50
68 * means no more than 50% output in either direction. This
69 * is useful for preventing the motor from spinning to its
70 * terminal velocity when there is no external torque
71 * applied unto the rotor. Note this is absolute maximum,
72 * so the value should be between zero and one.
73 * - Deadband: Deadband in Amperes. If torque request is within deadband, the
74 * bridge output is neutral. If deadband is set to zero then there
75 * is effectively no deadband. Note if deadband is zero, a free
76 * spinning motor will spin for quite a while as the firmware
77 * attempts to hold the motor's bemf. If user expects motor to
78 * cease spinning quickly with a demand of zero, we recommend a
79 * deadband of one Ampere. This value will be converted to an
80 * integral value of amps.
81 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
82 * zero (or within deadband). Set to false to use
83 * the NeutralMode configuration setting (default).
84 * This flag exists to provide the fundamental
85 * behavior of this control when output is zero,
86 * which is to provide 0A (zero torque).
87 * - LimitForwardMotion: Set to true to force forward limiting. This allows
88 * users to use other limit switch sensors connected to
89 * robot controller. This also allows use of active
90 * sensors that require external power.
91 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
92 * users to use other limit switch sensors connected to
93 * robot controller. This also allows use of active
94 * sensors that require external power.
95 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
96 * the LimitForwardMotion and LimitReverseMotion
97 * parameters, instead allowing motion.
98 *
99 * This can be useful on mechanisms such as an
100 * intake/feeder, where a limit switch stops motion
101 * while intaking but should be ignored when feeding
102 * to a shooter.
103 *
104 * The hardware limit faults and Forward/ReverseLimit
105 * signals will still report the values of the limit
106 * switches regardless of this parameter.
107 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
108 * allowing motion.
109 *
110 * This can be useful when calibrating the zero point
111 * of a mechanism such as an elevator.
112 *
113 * The software limit faults will still report the
114 * values of the software limits regardless of this
115 * parameter.
116 * - UseTimesync: Set to true to delay applying this control request until a
117 * timesync boundary (requires Phoenix Pro and CANivore). This
118 * eliminates the impact of nondeterministic network delays in
119 * exchange for a larger but deterministic control latency.
120 *
121 * This requires setting the ControlTimesyncFreqHz config in
122 * MotorOutputConfigs. Additionally, when this is enabled, the
123 * UpdateFreqHz of this request should be set to 0 Hz.
124 *
125 * \param request Control object to request of the device
126 * \returns Status Code of the request, 0 is OK
127 */
129
130 /**
131 * \brief Request PID to target position with torque current
132 * feedforward.
133 *
134 * \details This control mode will set the motor's position setpoint
135 * to the position specified by the user. In addition, it will apply
136 * an additional torque current as an arbitrary feedforward value.
137 *
138 * - PositionTorqueCurrentFOC Parameters:
139 * - Position: Position to drive toward in rotations.
140 * - Velocity: Velocity to drive toward in rotations per second. This is
141 * typically used for motion profiles generated by the robot
142 * program.
143 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
144 * added to the output of the onboard feedforward terms.
145 *
146 * User can use motor's kT to scale Newton-meter to Amperes.
147 * - Slot: Select which gains are applied by selecting the slot. Use the
148 * configuration api to set the gain values for the selected slot
149 * before enabling this feature. Slot must be within [0,2].
150 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
151 * zero (or within deadband). Set to false to use
152 * the NeutralMode configuration setting (default).
153 * This flag exists to provide the fundamental
154 * behavior of this control when output is zero,
155 * which is to provide 0A (zero torque).
156 * - LimitForwardMotion: Set to true to force forward limiting. This allows
157 * users to use other limit switch sensors connected to
158 * robot controller. This also allows use of active
159 * sensors that require external power.
160 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
161 * users to use other limit switch sensors connected to
162 * robot controller. This also allows use of active
163 * sensors that require external power.
164 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
165 * the LimitForwardMotion and LimitReverseMotion
166 * parameters, instead allowing motion.
167 *
168 * This can be useful on mechanisms such as an
169 * intake/feeder, where a limit switch stops motion
170 * while intaking but should be ignored when feeding
171 * to a shooter.
172 *
173 * The hardware limit faults and Forward/ReverseLimit
174 * signals will still report the values of the limit
175 * switches regardless of this parameter.
176 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
177 * allowing motion.
178 *
179 * This can be useful when calibrating the zero point
180 * of a mechanism such as an elevator.
181 *
182 * The software limit faults will still report the
183 * values of the software limits regardless of this
184 * parameter.
185 * - UseTimesync: Set to true to delay applying this control request until a
186 * timesync boundary (requires Phoenix Pro and CANivore). This
187 * eliminates the impact of nondeterministic network delays in
188 * exchange for a larger but deterministic control latency.
189 *
190 * This requires setting the ControlTimesyncFreqHz config in
191 * MotorOutputConfigs. Additionally, when this is enabled, the
192 * UpdateFreqHz of this request should be set to 0 Hz.
193 *
194 * \param request Control object to request of the device
195 * \returns Status Code of the request, 0 is OK
196 */
198
199 /**
200 * \brief Request PID to target velocity with torque current
201 * feedforward.
202 *
203 * \details This control mode will set the motor's velocity setpoint
204 * to the velocity specified by the user. In addition, it will apply
205 * an additional torque current as an arbitrary feedforward value.
206 *
207 * - VelocityTorqueCurrentFOC Parameters:
208 * - Velocity: Velocity to drive toward in rotations per second.
209 * - Acceleration: Acceleration to drive toward in rotations per second
210 * squared. This is typically used for motion profiles
211 * generated by the robot program.
212 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
213 * added to the output of the onboard feedforward terms.
214 *
215 * User can use motor's kT to scale Newton-meter to Amperes.
216 * - Slot: Select which gains are applied by selecting the slot. Use the
217 * configuration api to set the gain values for the selected slot
218 * before enabling this feature. Slot must be within [0,2].
219 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
220 * zero (or within deadband). Set to false to use
221 * the NeutralMode configuration setting (default).
222 * This flag exists to provide the fundamental
223 * behavior of this control when output is zero,
224 * which is to provide 0A (zero torque).
225 * - LimitForwardMotion: Set to true to force forward limiting. This allows
226 * users to use other limit switch sensors connected to
227 * robot controller. This also allows use of active
228 * sensors that require external power.
229 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
230 * users to use other limit switch sensors connected to
231 * robot controller. This also allows use of active
232 * sensors that require external power.
233 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
234 * the LimitForwardMotion and LimitReverseMotion
235 * parameters, instead allowing motion.
236 *
237 * This can be useful on mechanisms such as an
238 * intake/feeder, where a limit switch stops motion
239 * while intaking but should be ignored when feeding
240 * to a shooter.
241 *
242 * The hardware limit faults and Forward/ReverseLimit
243 * signals will still report the values of the limit
244 * switches regardless of this parameter.
245 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
246 * allowing motion.
247 *
248 * This can be useful when calibrating the zero point
249 * of a mechanism such as an elevator.
250 *
251 * The software limit faults will still report the
252 * values of the software limits regardless of this
253 * parameter.
254 * - UseTimesync: Set to true to delay applying this control request until a
255 * timesync boundary (requires Phoenix Pro and CANivore). This
256 * eliminates the impact of nondeterministic network delays in
257 * exchange for a larger but deterministic control latency.
258 *
259 * This requires setting the ControlTimesyncFreqHz config in
260 * MotorOutputConfigs. Additionally, when this is enabled, the
261 * UpdateFreqHz of this request should be set to 0 Hz.
262 *
263 * \param request Control object to request of the device
264 * \returns Status Code of the request, 0 is OK
265 */
267
268 /**
269 * \brief Requests Motion Magic® to target a final position using a
270 * motion profile. Users can optionally provide a torque current
271 * feedforward.
272 *
273 * \details Motion Magic® produces a motion profile in real-time while
274 * attempting to honor the Cruise Velocity, Acceleration, and
275 * (optional) Jerk specified via the Motion Magic® configuration
276 * values. This control mode does not use the Expo_kV or Expo_kA
277 * configs.
278 *
279 * Target position can be changed on-the-fly and Motion Magic® will do
280 * its best to adjust the profile. This control mode is based on
281 * torque current, so relevant closed-loop gains will use Amperes for
282 * the numerator.
283 *
284 * - MotionMagicTorqueCurrentFOC Parameters:
285 * - Position: Position to drive toward in rotations.
286 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
287 * added to the output of the onboard feedforward terms.
288 *
289 * User can use motor's kT to scale Newton-meter to Amperes.
290 * - Slot: Select which gains are applied by selecting the slot. Use the
291 * configuration api to set the gain values for the selected slot
292 * before enabling this feature. Slot must be within [0,2].
293 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
294 * zero (or within deadband). Set to false to use
295 * the NeutralMode configuration setting (default).
296 * This flag exists to provide the fundamental
297 * behavior of this control when output is zero,
298 * which is to provide 0A (zero torque).
299 * - LimitForwardMotion: Set to true to force forward limiting. This allows
300 * users to use other limit switch sensors connected to
301 * robot controller. This also allows use of active
302 * sensors that require external power.
303 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
304 * users to use other limit switch sensors connected to
305 * robot controller. This also allows use of active
306 * sensors that require external power.
307 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
308 * the LimitForwardMotion and LimitReverseMotion
309 * parameters, instead allowing motion.
310 *
311 * This can be useful on mechanisms such as an
312 * intake/feeder, where a limit switch stops motion
313 * while intaking but should be ignored when feeding
314 * to a shooter.
315 *
316 * The hardware limit faults and Forward/ReverseLimit
317 * signals will still report the values of the limit
318 * switches regardless of this parameter.
319 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
320 * allowing motion.
321 *
322 * This can be useful when calibrating the zero point
323 * of a mechanism such as an elevator.
324 *
325 * The software limit faults will still report the
326 * values of the software limits regardless of this
327 * parameter.
328 * - UseTimesync: Set to true to delay applying this control request until a
329 * timesync boundary (requires Phoenix Pro and CANivore). This
330 * eliminates the impact of nondeterministic network delays in
331 * exchange for a larger but deterministic control latency.
332 *
333 * This requires setting the ControlTimesyncFreqHz config in
334 * MotorOutputConfigs. Additionally, when this is enabled, the
335 * UpdateFreqHz of this request should be set to 0 Hz.
336 *
337 * \param request Control object to request of the device
338 * \returns Status Code of the request, 0 is OK
339 */
341
342 /**
343 * \brief Requests Motion Magic® to target a final velocity using a
344 * motion profile. This allows smooth transitions between velocity
345 * set points. Users can optionally provide a torque feedforward.
346 *
347 * \details Motion Magic® Velocity produces a motion profile in
348 * real-time while attempting to honor the specified Acceleration and
349 * (optional) Jerk. This control mode does not use the
350 * CruiseVelocity, Expo_kV, or Expo_kA configs.
351 *
352 * If the specified acceleration is zero, the Acceleration under
353 * Motion Magic® configuration parameter is used instead. This allows
354 * for runtime adjustment of acceleration for advanced users. Jerk is
355 * also specified in the Motion Magic® persistent configuration
356 * values. If Jerk is set to zero, Motion Magic® will produce a
357 * trapezoidal acceleration profile.
358 *
359 * Target velocity can also be changed on-the-fly and Motion Magic®
360 * will do its best to adjust the profile. This control mode is based
361 * on torque current, so relevant closed-loop gains will use Amperes
362 * for the numerator.
363 *
364 * - MotionMagicVelocityTorqueCurrentFOC Parameters:
365 * - Velocity: Target velocity to drive toward in rotations per second. This
366 * can be changed on-the fly.
367 * - Acceleration: This is the absolute Acceleration to use generating the
368 * profile. If this parameter is zero, the Acceleration
369 * persistent configuration parameter is used instead.
370 * Acceleration is in rotations per second squared. If
371 * nonzero, the signage does not matter as the absolute value
372 * is used.
373 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
374 * added to the output of the onboard feedforward terms.
375 *
376 * User can use motor's kT to scale Newton-meter to Amperes.
377 * - Slot: Select which gains are applied by selecting the slot. Use the
378 * configuration api to set the gain values for the selected slot
379 * before enabling this feature. Slot must be within [0,2].
380 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
381 * zero (or within deadband). Set to false to use
382 * the NeutralMode configuration setting (default).
383 * This flag exists to provide the fundamental
384 * behavior of this control when output is zero,
385 * which is to provide 0A (zero torque).
386 * - LimitForwardMotion: Set to true to force forward limiting. This allows
387 * users to use other limit switch sensors connected to
388 * robot controller. This also allows use of active
389 * sensors that require external power.
390 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
391 * users to use other limit switch sensors connected to
392 * robot controller. This also allows use of active
393 * sensors that require external power.
394 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
395 * the LimitForwardMotion and LimitReverseMotion
396 * parameters, instead allowing motion.
397 *
398 * This can be useful on mechanisms such as an
399 * intake/feeder, where a limit switch stops motion
400 * while intaking but should be ignored when feeding
401 * to a shooter.
402 *
403 * The hardware limit faults and Forward/ReverseLimit
404 * signals will still report the values of the limit
405 * switches regardless of this parameter.
406 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
407 * allowing motion.
408 *
409 * This can be useful when calibrating the zero point
410 * of a mechanism such as an elevator.
411 *
412 * The software limit faults will still report the
413 * values of the software limits regardless of this
414 * parameter.
415 * - UseTimesync: Set to true to delay applying this control request until a
416 * timesync boundary (requires Phoenix Pro and CANivore). This
417 * eliminates the impact of nondeterministic network delays in
418 * exchange for a larger but deterministic control latency.
419 *
420 * This requires setting the ControlTimesyncFreqHz config in
421 * MotorOutputConfigs. Additionally, when this is enabled, the
422 * UpdateFreqHz of this request should be set to 0 Hz.
423 *
424 * \param request Control object to request of the device
425 * \returns Status Code of the request, 0 is OK
426 */
428
429 /**
430 * \brief Requests Motion Magic® to target a final position using an
431 * exponential motion profile. Users can optionally provide a torque
432 * current feedforward.
433 *
434 * \details Motion Magic® Expo produces a motion profile in real-time
435 * while attempting to honor the Cruise Velocity (optional) and the
436 * mechanism kV and kA, specified via the Motion Magic® configuration
437 * values. Note that unlike the slot gains, the Expo_kV and Expo_kA
438 * configs are always in output units of Volts.
439 *
440 * Setting Cruise Velocity to 0 will allow the profile to run to the
441 * max possible velocity based on Expo_kV. This control mode does not
442 * use the Acceleration or Jerk configs.
443 *
444 * Target position can be changed on-the-fly and Motion Magic® will do
445 * its best to adjust the profile. This control mode is based on
446 * torque current, so relevant closed-loop gains will use Amperes for
447 * the numerator.
448 *
449 * - MotionMagicExpoTorqueCurrentFOC Parameters:
450 * - Position: Position to drive toward in rotations.
451 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
452 * added to the output of the onboard feedforward terms.
453 *
454 * User can use motor's kT to scale Newton-meter to Amperes.
455 * - Slot: Select which gains are applied by selecting the slot. Use the
456 * configuration api to set the gain values for the selected slot
457 * before enabling this feature. Slot must be within [0,2].
458 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
459 * zero (or within deadband). Set to false to use
460 * the NeutralMode configuration setting (default).
461 * This flag exists to provide the fundamental
462 * behavior of this control when output is zero,
463 * which is to provide 0A (zero torque).
464 * - LimitForwardMotion: Set to true to force forward limiting. This allows
465 * users to use other limit switch sensors connected to
466 * robot controller. This also allows use of active
467 * sensors that require external power.
468 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
469 * users to use other limit switch sensors connected to
470 * robot controller. This also allows use of active
471 * sensors that require external power.
472 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
473 * the LimitForwardMotion and LimitReverseMotion
474 * parameters, instead allowing motion.
475 *
476 * This can be useful on mechanisms such as an
477 * intake/feeder, where a limit switch stops motion
478 * while intaking but should be ignored when feeding
479 * to a shooter.
480 *
481 * The hardware limit faults and Forward/ReverseLimit
482 * signals will still report the values of the limit
483 * switches regardless of this parameter.
484 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
485 * allowing motion.
486 *
487 * This can be useful when calibrating the zero point
488 * of a mechanism such as an elevator.
489 *
490 * The software limit faults will still report the
491 * values of the software limits regardless of this
492 * parameter.
493 * - UseTimesync: Set to true to delay applying this control request until a
494 * timesync boundary (requires Phoenix Pro and CANivore). This
495 * eliminates the impact of nondeterministic network delays in
496 * exchange for a larger but deterministic control latency.
497 *
498 * This requires setting the ControlTimesyncFreqHz config in
499 * MotorOutputConfigs. Additionally, when this is enabled, the
500 * UpdateFreqHz of this request should be set to 0 Hz.
501 *
502 * \param request Control object to request of the device
503 * \returns Status Code of the request, 0 is OK
504 */
506
507 /**
508 * \brief Requests Motion Magic® to target a final position using a
509 * motion profile. This dynamic request allows runtime changes to
510 * Cruise Velocity, Acceleration, and (optional) Jerk. Users can
511 * optionally provide a torque current feedforward.
512 *
513 * \details Motion Magic® produces a motion profile in real-time while
514 * attempting to honor the specified Cruise Velocity, Acceleration,
515 * and (optional) Jerk. This control mode does not use the Expo_kV or
516 * Expo_kA configs.
517 *
518 * Target position can be changed on-the-fly and Motion Magic® will do
519 * its best to adjust the profile. This control mode is based on
520 * torque current, so relevant closed-loop gains will use Amperes for
521 * the numerator.
522 *
523 * - DynamicMotionMagicTorqueCurrentFOC Parameters:
524 * - Position: Position to drive toward in rotations.
525 * - Velocity: Cruise velocity for profiling. The signage does not matter as
526 * the device will use the absolute value for profile generation.
527 * - Acceleration: Acceleration for profiling. The signage does not matter as
528 * the device will use the absolute value for profile
529 * generation.
530 * - Jerk: Jerk for profiling. The signage does not matter as the device will
531 * use the absolute value for profile generation.
532 *
533 * Jerk is optional; if this is set to zero, then Motion Magic® will
534 * not apply a Jerk limit.
535 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
536 * added to the output of the onboard feedforward terms.
537 *
538 * User can use motor's kT to scale Newton-meter to Amperes.
539 * - Slot: Select which gains are applied by selecting the slot. Use the
540 * configuration api to set the gain values for the selected slot
541 * before enabling this feature. Slot must be within [0,2].
542 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
543 * zero (or within deadband). Set to false to use
544 * the NeutralMode configuration setting (default).
545 * This flag exists to provide the fundamental
546 * behavior of this control when output is zero,
547 * which is to provide 0A (zero torque).
548 * - LimitForwardMotion: Set to true to force forward limiting. This allows
549 * users to use other limit switch sensors connected to
550 * robot controller. This also allows use of active
551 * sensors that require external power.
552 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
553 * users to use other limit switch sensors connected to
554 * robot controller. This also allows use of active
555 * sensors that require external power.
556 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
557 * the LimitForwardMotion and LimitReverseMotion
558 * parameters, instead allowing motion.
559 *
560 * This can be useful on mechanisms such as an
561 * intake/feeder, where a limit switch stops motion
562 * while intaking but should be ignored when feeding
563 * to a shooter.
564 *
565 * The hardware limit faults and Forward/ReverseLimit
566 * signals will still report the values of the limit
567 * switches regardless of this parameter.
568 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
569 * allowing motion.
570 *
571 * This can be useful when calibrating the zero point
572 * of a mechanism such as an elevator.
573 *
574 * The software limit faults will still report the
575 * values of the software limits regardless of this
576 * parameter.
577 * - UseTimesync: Set to true to delay applying this control request until a
578 * timesync boundary (requires Phoenix Pro and CANivore). This
579 * eliminates the impact of nondeterministic network delays in
580 * exchange for a larger but deterministic control latency.
581 *
582 * This requires setting the ControlTimesyncFreqHz config in
583 * MotorOutputConfigs. Additionally, when this is enabled, the
584 * UpdateFreqHz of this request should be set to 0 Hz.
585 *
586 * \param request Control object to request of the device
587 * \returns Status Code of the request, 0 is OK
588 */
590
591 /**
592 * \brief Requests Motion Magic® Expo to target a final position using
593 * an exponential motion profile. This dynamic request allows runtime
594 * changes to the profile kV, kA, and (optional) Cruise Velocity.
595 * Users can optionally provide a torque current feedforward.
596 *
597 * \details Motion Magic® Expo produces a motion profile in real-time
598 * while attempting to honor the specified Cruise Velocity (optional)
599 * and the mechanism kV and kA. Note that unlike the slot gains, the
600 * Expo_kV and Expo_kA parameters are always in output units of Volts.
601 *
602 * Setting the Cruise Velocity to 0 will allow the profile to run to
603 * the max possible velocity based on Expo_kV. This control mode does
604 * not use the Acceleration or Jerk configs.
605 *
606 * Target position can be changed on-the-fly and Motion Magic® will do
607 * its best to adjust the profile. This control mode is based on
608 * torque current, so relevant closed-loop gains will use Amperes for
609 * the numerator.
610 *
611 * - DynamicMotionMagicExpoTorqueCurrentFOC Parameters:
612 * - Position: Position to drive toward in rotations.
613 * - kV: Mechanism kV for profiling. Unlike the kV slot gain, this is always
614 * in units of V/rps.
615 *
616 * This represents the amount of voltage necessary to hold a velocity.
617 * In terms of the Motion Magic® Expo profile, a higher kV results in a
618 * slower maximum velocity.
619 * - kA: Mechanism kA for profiling. Unlike the kA slot gain, this is always
620 * in units of V/rps².
621 *
622 * This represents the amount of voltage necessary to achieve an
623 * acceleration. In terms of the Motion Magic® Expo profile, a higher
624 * kA results in a slower acceleration.
625 * - Velocity: Cruise velocity for profiling. The signage does not matter as
626 * the device will use the absolute value for profile generation.
627 * Setting this to 0 will allow the profile to run to the max
628 * possible velocity based on Expo_kV.
629 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
630 * added to the output of the onboard feedforward terms.
631 *
632 * User can use motor's kT to scale Newton-meter to Amperes.
633 * - Slot: Select which gains are applied by selecting the slot. Use the
634 * configuration api to set the gain values for the selected slot
635 * before enabling this feature. Slot must be within [0,2].
636 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
637 * zero (or within deadband). Set to false to use
638 * the NeutralMode configuration setting (default).
639 * This flag exists to provide the fundamental
640 * behavior of this control when output is zero,
641 * which is to provide 0A (zero torque).
642 * - LimitForwardMotion: Set to true to force forward limiting. This allows
643 * users to use other limit switch sensors connected to
644 * robot controller. This also allows use of active
645 * sensors that require external power.
646 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
647 * users to use other limit switch sensors connected to
648 * robot controller. This also allows use of active
649 * sensors that require external power.
650 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
651 * the LimitForwardMotion and LimitReverseMotion
652 * parameters, instead allowing motion.
653 *
654 * This can be useful on mechanisms such as an
655 * intake/feeder, where a limit switch stops motion
656 * while intaking but should be ignored when feeding
657 * to a shooter.
658 *
659 * The hardware limit faults and Forward/ReverseLimit
660 * signals will still report the values of the limit
661 * switches regardless of this parameter.
662 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
663 * allowing motion.
664 *
665 * This can be useful when calibrating the zero point
666 * of a mechanism such as an elevator.
667 *
668 * The software limit faults will still report the
669 * values of the software limits regardless of this
670 * parameter.
671 * - UseTimesync: Set to true to delay applying this control request until a
672 * timesync boundary (requires Phoenix Pro and CANivore). This
673 * eliminates the impact of nondeterministic network delays in
674 * exchange for a larger but deterministic control latency.
675 *
676 * This requires setting the ControlTimesyncFreqHz config in
677 * MotorOutputConfigs. Additionally, when this is enabled, the
678 * UpdateFreqHz of this request should be set to 0 Hz.
679 *
680 * \param request Control object to request of the device
681 * \returns Status Code of the request, 0 is OK
682 */
684
685 /**
686 * \brief Differential control with torque current average target and
687 * position difference target.
688 *
689 * - Diff_TorqueCurrentFOC_Position Parameters:
690 * - AverageRequest: Average TorqueCurrentFOC request of the mechanism.
691 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
692 * mechanism.
693 *
694 * \param request Control object to request of the device
695 * \returns Status Code of the request, 0 is OK
696 */
697 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_TorqueCurrentFOC_Position &request) = 0;
698
699 /**
700 * \brief Differential control with position average target and
701 * position difference target using torque current control.
702 *
703 * - Diff_PositionTorqueCurrentFOC_Position Parameters:
704 * - AverageRequest: Average PositionTorqueCurrentFOC request of the
705 * mechanism.
706 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
707 * mechanism.
708 *
709 * \param request Control object to request of the device
710 * \returns Status Code of the request, 0 is OK
711 */
712 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_PositionTorqueCurrentFOC_Position &request) = 0;
713
714 /**
715 * \brief Differential control with velocity average target and
716 * position difference target using torque current control.
717 *
718 * - Diff_VelocityTorqueCurrentFOC_Position Parameters:
719 * - AverageRequest: Average VelocityTorqueCurrentFOC request of the
720 * mechanism.
721 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
722 * mechanism.
723 *
724 * \param request Control object to request of the device
725 * \returns Status Code of the request, 0 is OK
726 */
727 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_VelocityTorqueCurrentFOC_Position &request) = 0;
728
729 /**
730 * \brief Differential control with Motion Magic® average target and
731 * position difference target using torque current control.
732 *
733 * - Diff_MotionMagicTorqueCurrentFOC_Position Parameters:
734 * - AverageRequest: Average MotionMagicTorqueCurrentFOC request of the
735 * mechanism.
736 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
737 * mechanism.
738 *
739 * \param request Control object to request of the device
740 * \returns Status Code of the request, 0 is OK
741 */
742 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicTorqueCurrentFOC_Position &request) = 0;
743
744 /**
745 * \brief Differential control with Motion Magic® Expo average target
746 * and position difference target using torque current control.
747 *
748 * - Diff_MotionMagicExpoTorqueCurrentFOC_Position Parameters:
749 * - AverageRequest: Average MotionMagicExpoTorqueCurrentFOC request of the
750 * mechanism.
751 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
752 * mechanism.
753 *
754 * \param request Control object to request of the device
755 * \returns Status Code of the request, 0 is OK
756 */
757 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Position &request) = 0;
758
759 /**
760 * \brief Differential control with Motion Magic® Velocity average
761 * target and position difference target using torque current control.
762 *
763 * - Diff_MotionMagicVelocityTorqueCurrentFOC_Position Parameters:
764 * - AverageRequest: Average MotionMagicVelocityTorqueCurrentFOC request of
765 * the mechanism.
766 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
767 * mechanism.
768 *
769 * \param request Control object to request of the device
770 * \returns Status Code of the request, 0 is OK
771 */
772 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Position &request) = 0;
773
774 /**
775 * \brief Differential control with torque current average target and
776 * velocity difference target.
777 *
778 * - Diff_TorqueCurrentFOC_Velocity Parameters:
779 * - AverageRequest: Average TorqueCurrentFOC request of the mechanism.
780 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
781 * mechanism.
782 *
783 * \param request Control object to request of the device
784 * \returns Status Code of the request, 0 is OK
785 */
786 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_TorqueCurrentFOC_Velocity &request) = 0;
787
788 /**
789 * \brief Differential control with position average target and
790 * velocity difference target using torque current control.
791 *
792 * - Diff_PositionTorqueCurrentFOC_Velocity Parameters:
793 * - AverageRequest: Average PositionTorqueCurrentFOC request of the
794 * mechanism.
795 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
796 * mechanism.
797 *
798 * \param request Control object to request of the device
799 * \returns Status Code of the request, 0 is OK
800 */
801 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_PositionTorqueCurrentFOC_Velocity &request) = 0;
802
803 /**
804 * \brief Differential control with velocity average target and
805 * velocity difference target using torque current control.
806 *
807 * - Diff_VelocityTorqueCurrentFOC_Velocity Parameters:
808 * - AverageRequest: Average VelocityTorqueCurrentFOC request of the
809 * mechanism.
810 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
811 * mechanism.
812 *
813 * \param request Control object to request of the device
814 * \returns Status Code of the request, 0 is OK
815 */
816 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_VelocityTorqueCurrentFOC_Velocity &request) = 0;
817
818 /**
819 * \brief Differential control with Motion Magic® average target and
820 * velocity difference target using torque current control.
821 *
822 * - Diff_MotionMagicTorqueCurrentFOC_Velocity Parameters:
823 * - AverageRequest: Average MotionMagicTorqueCurrentFOC request of the
824 * mechanism.
825 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
826 * mechanism.
827 *
828 * \param request Control object to request of the device
829 * \returns Status Code of the request, 0 is OK
830 */
831 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicTorqueCurrentFOC_Velocity &request) = 0;
832
833 /**
834 * \brief Differential control with Motion Magic® Expo average target
835 * and velocity difference target using torque current control.
836 *
837 * - Diff_MotionMagicExpoTorqueCurrentFOC_Velocity Parameters:
838 * - AverageRequest: Average MotionMagicExpoTorqueCurrentFOC request of the
839 * mechanism.
840 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
841 * mechanism.
842 *
843 * \param request Control object to request of the device
844 * \returns Status Code of the request, 0 is OK
845 */
846 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Velocity &request) = 0;
847
848 /**
849 * \brief Differential control with Motion Magic® Velocity average
850 * target and velocity difference target using torque current control.
851 *
852 * - Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity Parameters:
853 * - AverageRequest: Average MotionMagicVelocityTorqueCurrentFOC request of
854 * the mechanism.
855 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
856 * mechanism.
857 *
858 * \param request Control object to request of the device
859 * \returns Status Code of the request, 0 is OK
860 */
861 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity &request) = 0;
862
863 /**
864 * \brief Differential control with torque current average target and
865 * torque current difference target.
866 *
867 * - Diff_TorqueCurrentFOC_Open Parameters:
868 * - AverageRequest: Average TorqueCurrentFOC request of the mechanism.
869 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
870 * mechanism.
871 *
872 * \param request Control object to request of the device
873 * \returns Status Code of the request, 0 is OK
874 */
875 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_TorqueCurrentFOC_Open &request) = 0;
876
877 /**
878 * \brief Differential control with position average target and torque
879 * current difference target.
880 *
881 * - Diff_PositionTorqueCurrentFOC_Open Parameters:
882 * - AverageRequest: Average PositionTorqueCurrentFOC request of the
883 * mechanism.
884 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
885 * mechanism.
886 *
887 * \param request Control object to request of the device
888 * \returns Status Code of the request, 0 is OK
889 */
890 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_PositionTorqueCurrentFOC_Open &request) = 0;
891
892 /**
893 * \brief Differential control with velocity average target and torque
894 * current difference target.
895 *
896 * - Diff_VelocityTorqueCurrentFOC_Open Parameters:
897 * - AverageRequest: Average VelocityTorqueCurrentFOC request of the
898 * mechanism.
899 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
900 * mechanism.
901 *
902 * \param request Control object to request of the device
903 * \returns Status Code of the request, 0 is OK
904 */
905 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_VelocityTorqueCurrentFOC_Open &request) = 0;
906
907 /**
908 * \brief Differential control with Motion Magic® average target and
909 * torque current difference target.
910 *
911 * - Diff_MotionMagicTorqueCurrentFOC_Open Parameters:
912 * - AverageRequest: Average MotionMagicTorqueCurrentFOC request of the
913 * mechanism.
914 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
915 * mechanism.
916 *
917 * \param request Control object to request of the device
918 * \returns Status Code of the request, 0 is OK
919 */
920 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicTorqueCurrentFOC_Open &request) = 0;
921
922 /**
923 * \brief Differential control with Motion Magic® Expo average target
924 * and torque current difference target.
925 *
926 * - Diff_MotionMagicExpoTorqueCurrentFOC_Open Parameters:
927 * - AverageRequest: Average MotionMagicExpoTorqueCurrentFOC request of the
928 * mechanism.
929 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
930 * mechanism.
931 *
932 * \param request Control object to request of the device
933 * \returns Status Code of the request, 0 is OK
934 */
935 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Open &request) = 0;
936
937 /**
938 * \brief Differential control with Motion Magic® Velocity average
939 * target and torque current difference target.
940 *
941 * - Diff_MotionMagicVelocityTorqueCurrentFOC_Open Parameters:
942 * - AverageRequest: Average MotionMagicVelocityTorqueCurrentFOC request of
943 * the mechanism.
944 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
945 * mechanism.
946 *
947 * \param request Control object to request of the device
948 * \returns Status Code of the request, 0 is OK
949 */
950 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Open &request) = 0;
951
952 /**
953 * \brief Control device with generic control request object. User must make
954 * sure the specified object is castable to a valid control request,
955 * otherwise this function will fail at run-time and return the NotSupported
956 * StatusCode
957 *
958 * \param request Control object to request of the device
959 * \returns Status Code of the request, 0 is OK
960 */
962
963};
964
965}
966}
967}
968}
969
Common interface implemented by all control requests.
Definition ControlRequest.hpp:27
Requires Phoenix Pro and CANivore; Requests Motion Magic® Expo to target a final position using an ex...
Definition DynamicMotionMagicExpoTorqueCurrentFOC.hpp:38
Requires Phoenix Pro and CANivore; Requests Motion Magic® to target a final position using a motion p...
Definition DynamicMotionMagicTorqueCurrentFOC.hpp:36
Requires Phoenix Pro; Requests Motion Magic® to target a final position using an exponential motion p...
Definition MotionMagicExpoTorqueCurrentFOC.hpp:34
Requires Phoenix Pro; Requests Motion Magic® to target a final position using a motion profile.
Definition MotionMagicTorqueCurrentFOC.hpp:31
Requests Motion Magic® to target a final velocity using a motion profile.
Definition MotionMagicVelocityTorqueCurrentFOC.hpp:38
Requires Phoenix Pro; Request PID to target position with torque current feedforward.
Definition PositionTorqueCurrentFOC.hpp:27
Requires Phoenix Pro; Request a specified motor current (field oriented control).
Definition TorqueCurrentFOC.hpp:27
Requires Phoenix Pro; Request PID to target velocity with torque current feedforward.
Definition VelocityTorqueCurrentFOC.hpp:27
Contains everything common between Phoenix 6 devices.
Definition CommonDevice.hpp:23
Requires Phoenix Pro; Contains all FOC-exclusive control functions available for devices that support...
Definition SupportsFOC.hpp:51
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Velocity &request)=0
Differential control with Motion Magic® Expo average target and velocity difference target using torq...
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_TorqueCurrentFOC_Open &request)=0
Differential control with torque current average target and torque current difference target.
virtual ctre::phoenix::StatusCode SetControl(const controls::MotionMagicTorqueCurrentFOC &request)=0
Requests Motion Magic® to target a final position using a motion profile.
virtual ctre::phoenix::StatusCode SetControl(const controls::ControlRequest &request)=0
Control device with generic control request object.
virtual ctre::phoenix::StatusCode SetControl(const controls::VelocityTorqueCurrentFOC &request)=0
Request PID to target velocity with torque current feedforward.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_PositionTorqueCurrentFOC_Open &request)=0
Differential control with position average target and torque current difference target.
virtual ctre::phoenix::StatusCode SetControl(const controls::DynamicMotionMagicExpoTorqueCurrentFOC &request)=0
Requests Motion Magic® Expo to target a final position using an exponential motion profile.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_VelocityTorqueCurrentFOC_Velocity &request)=0
Differential control with velocity average target and velocity difference target using torque current...
virtual ctre::phoenix::StatusCode SetControl(const controls::DynamicMotionMagicTorqueCurrentFOC &request)=0
Requests Motion Magic® to target a final position using a motion profile.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_VelocityTorqueCurrentFOC_Position &request)=0
Differential control with velocity average target and position difference target using torque current...
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Open &request)=0
Differential control with Motion Magic® Velocity average target and torque current difference target.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicTorqueCurrentFOC_Open &request)=0
Differential control with Motion Magic® average target and torque current difference target.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Open &request)=0
Differential control with Motion Magic® Expo average target and torque current difference target.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Position &request)=0
Differential control with Motion Magic® Expo average target and position difference target using torq...
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_TorqueCurrentFOC_Velocity &request)=0
Differential control with torque current average target and velocity difference target.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Position &request)=0
Differential control with Motion Magic® Velocity average target and position difference target using ...
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicTorqueCurrentFOC_Position &request)=0
Differential control with Motion Magic® average target and position difference target using torque cu...
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_PositionTorqueCurrentFOC_Velocity &request)=0
Differential control with position average target and velocity difference target using torque current...
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_VelocityTorqueCurrentFOC_Open &request)=0
Differential control with velocity average target and torque current difference target.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_TorqueCurrentFOC_Position &request)=0
Differential control with torque current average target and position difference target.
virtual ctre::phoenix::StatusCode SetControl(const controls::MotionMagicVelocityTorqueCurrentFOC &request)=0
Requests Motion Magic® to target a final velocity using a motion profile.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicTorqueCurrentFOC_Velocity &request)=0
Differential control with Motion Magic® average target and velocity difference target using torque cu...
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_PositionTorqueCurrentFOC_Position &request)=0
Differential control with position average target and position difference target using torque current...
virtual ctre::phoenix::StatusCode SetControl(const controls::PositionTorqueCurrentFOC &request)=0
Request PID to target position with torque current feedforward.
virtual ctre::phoenix::StatusCode SetControl(const controls::MotionMagicExpoTorqueCurrentFOC &request)=0
Requests Motion Magic® to target a final position using an exponential motion profile.
virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity &request)=0
Differential control with Motion Magic® Velocity average target and velocity difference target using ...
virtual ctre::phoenix::StatusCode SetControl(const controls::TorqueCurrentFOC &request)=0
Request a specified motor current (field oriented control).
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition motor_constants.h:14