CTRE Phoenix 6 C++ 26.0.0-beta-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 * - EnableFOC: Set to true to use FOC commutation (requires Phoenix Pro),
374 * which increases peak power by ~15% on supported devices (see
375 * hardware#traits#SupportsFOC). Set to false to use trapezoidal
376 * commutation.
377 *
378 * FOC improves motor performance by leveraging torque (current)
379 * control. However, this may be inconvenient for applications
380 * that require specifying duty cycle or voltage.
381 * CTR-Electronics has developed a hybrid method that combines
382 * the performances gains of FOC while still allowing
383 * applications to provide duty cycle or voltage demand. This
384 * not to be confused with simple sinusoidal control or phase
385 * voltage control which lacks the performance gains.
386 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
387 * added to the output of the onboard feedforward terms.
388 *
389 * User can use motor's kT to scale Newton-meter to Amperes.
390 * - Slot: Select which gains are applied by selecting the slot. Use the
391 * configuration api to set the gain values for the selected slot
392 * before enabling this feature. Slot must be within [0,2].
393 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
394 * zero (or within deadband). Set to false to use
395 * the NeutralMode configuration setting (default).
396 * This flag exists to provide the fundamental
397 * behavior of this control when output is zero,
398 * which is to provide 0A (zero torque).
399 * - LimitForwardMotion: Set to true to force forward limiting. This allows
400 * users to use other limit switch sensors connected to
401 * robot controller. This also allows use of active
402 * sensors that require external power.
403 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
404 * users to use other limit switch sensors connected to
405 * robot controller. This also allows use of active
406 * sensors that require external power.
407 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
408 * the LimitForwardMotion and LimitReverseMotion
409 * parameters, instead allowing motion.
410 *
411 * This can be useful on mechanisms such as an
412 * intake/feeder, where a limit switch stops motion
413 * while intaking but should be ignored when feeding
414 * to a shooter.
415 *
416 * The hardware limit faults and Forward/ReverseLimit
417 * signals will still report the values of the limit
418 * switches regardless of this parameter.
419 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
420 * allowing motion.
421 *
422 * This can be useful when calibrating the zero point
423 * of a mechanism such as an elevator.
424 *
425 * The software limit faults will still report the
426 * values of the software limits regardless of this
427 * parameter.
428 * - UseTimesync: Set to true to delay applying this control request until a
429 * timesync boundary (requires Phoenix Pro and CANivore). This
430 * eliminates the impact of nondeterministic network delays in
431 * exchange for a larger but deterministic control latency.
432 *
433 * This requires setting the ControlTimesyncFreqHz config in
434 * MotorOutputConfigs. Additionally, when this is enabled, the
435 * UpdateFreqHz of this request should be set to 0 Hz.
436 *
437 * \param request Control object to request of the device
438 * \returns Status Code of the request, 0 is OK
439 */
441
442 /**
443 * \brief Requests Motion Magic® to target a final position using an
444 * exponential motion profile. Users can optionally provide a torque
445 * current feedforward.
446 *
447 * \details Motion Magic® Expo produces a motion profile in real-time
448 * while attempting to honor the Cruise Velocity (optional) and the
449 * mechanism kV and kA, specified via the Motion Magic® configuration
450 * values. Note that unlike the slot gains, the Expo_kV and Expo_kA
451 * configs are always in output units of Volts.
452 *
453 * Setting Cruise Velocity to 0 will allow the profile to run to the
454 * max possible velocity based on Expo_kV. This control mode does not
455 * use the Acceleration or Jerk configs.
456 *
457 * Target position can be changed on-the-fly and Motion Magic® will do
458 * its best to adjust the profile. This control mode is based on
459 * torque current, so relevant closed-loop gains will use Amperes for
460 * the numerator.
461 *
462 * - MotionMagicExpoTorqueCurrentFOC Parameters:
463 * - Position: Position to drive toward in rotations.
464 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
465 * added to the output of the onboard feedforward terms.
466 *
467 * User can use motor's kT to scale Newton-meter to Amperes.
468 * - Slot: Select which gains are applied by selecting the slot. Use the
469 * configuration api to set the gain values for the selected slot
470 * before enabling this feature. Slot must be within [0,2].
471 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
472 * zero (or within deadband). Set to false to use
473 * the NeutralMode configuration setting (default).
474 * This flag exists to provide the fundamental
475 * behavior of this control when output is zero,
476 * which is to provide 0A (zero torque).
477 * - LimitForwardMotion: Set to true to force forward limiting. This allows
478 * users to use other limit switch sensors connected to
479 * robot controller. This also allows use of active
480 * sensors that require external power.
481 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
482 * users to use other limit switch sensors connected to
483 * robot controller. This also allows use of active
484 * sensors that require external power.
485 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
486 * the LimitForwardMotion and LimitReverseMotion
487 * parameters, instead allowing motion.
488 *
489 * This can be useful on mechanisms such as an
490 * intake/feeder, where a limit switch stops motion
491 * while intaking but should be ignored when feeding
492 * to a shooter.
493 *
494 * The hardware limit faults and Forward/ReverseLimit
495 * signals will still report the values of the limit
496 * switches regardless of this parameter.
497 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
498 * allowing motion.
499 *
500 * This can be useful when calibrating the zero point
501 * of a mechanism such as an elevator.
502 *
503 * The software limit faults will still report the
504 * values of the software limits regardless of this
505 * parameter.
506 * - UseTimesync: Set to true to delay applying this control request until a
507 * timesync boundary (requires Phoenix Pro and CANivore). This
508 * eliminates the impact of nondeterministic network delays in
509 * exchange for a larger but deterministic control latency.
510 *
511 * This requires setting the ControlTimesyncFreqHz config in
512 * MotorOutputConfigs. Additionally, when this is enabled, the
513 * UpdateFreqHz of this request should be set to 0 Hz.
514 *
515 * \param request Control object to request of the device
516 * \returns Status Code of the request, 0 is OK
517 */
519
520 /**
521 * \brief Requests Motion Magic® to target a final position using a
522 * motion profile. This dynamic request allows runtime changes to
523 * Cruise Velocity, Acceleration, and (optional) Jerk. Users can
524 * optionally provide a torque current feedforward.
525 *
526 * \details Motion Magic® produces a motion profile in real-time while
527 * attempting to honor the specified Cruise Velocity, Acceleration,
528 * and (optional) Jerk. This control mode does not use the Expo_kV or
529 * Expo_kA configs.
530 *
531 * Target position can be changed on-the-fly and Motion Magic® will do
532 * its best to adjust the profile. This control mode is based on
533 * torque current, so relevant closed-loop gains will use Amperes for
534 * the numerator.
535 *
536 * - DynamicMotionMagicTorqueCurrentFOC Parameters:
537 * - Position: Position to drive toward in rotations.
538 * - Velocity: Cruise velocity for profiling. The signage does not matter as
539 * the device will use the absolute value for profile generation.
540 * - Acceleration: Acceleration for profiling. The signage does not matter as
541 * the device will use the absolute value for profile
542 * generation.
543 * - Jerk: Jerk for profiling. The signage does not matter as the device will
544 * use the absolute value for profile generation.
545 *
546 * Jerk is optional; if this is set to zero, then Motion Magic® will
547 * not apply a Jerk limit.
548 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
549 * added to the output of the onboard feedforward terms.
550 *
551 * User can use motor's kT to scale Newton-meter to Amperes.
552 * - Slot: Select which gains are applied by selecting the slot. Use the
553 * configuration api to set the gain values for the selected slot
554 * before enabling this feature. Slot must be within [0,2].
555 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
556 * zero (or within deadband). Set to false to use
557 * the NeutralMode configuration setting (default).
558 * This flag exists to provide the fundamental
559 * behavior of this control when output is zero,
560 * which is to provide 0A (zero torque).
561 * - LimitForwardMotion: Set to true to force forward limiting. This allows
562 * users to use other limit switch sensors connected to
563 * robot controller. This also allows use of active
564 * sensors that require external power.
565 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
566 * users to use other limit switch sensors connected to
567 * robot controller. This also allows use of active
568 * sensors that require external power.
569 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
570 * the LimitForwardMotion and LimitReverseMotion
571 * parameters, instead allowing motion.
572 *
573 * This can be useful on mechanisms such as an
574 * intake/feeder, where a limit switch stops motion
575 * while intaking but should be ignored when feeding
576 * to a shooter.
577 *
578 * The hardware limit faults and Forward/ReverseLimit
579 * signals will still report the values of the limit
580 * switches regardless of this parameter.
581 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
582 * allowing motion.
583 *
584 * This can be useful when calibrating the zero point
585 * of a mechanism such as an elevator.
586 *
587 * The software limit faults will still report the
588 * values of the software limits regardless of this
589 * parameter.
590 * - UseTimesync: Set to true to delay applying this control request until a
591 * timesync boundary (requires Phoenix Pro and CANivore). This
592 * eliminates the impact of nondeterministic network delays in
593 * exchange for a larger but deterministic control latency.
594 *
595 * This requires setting the ControlTimesyncFreqHz config in
596 * MotorOutputConfigs. Additionally, when this is enabled, the
597 * UpdateFreqHz of this request should be set to 0 Hz.
598 *
599 * \param request Control object to request of the device
600 * \returns Status Code of the request, 0 is OK
601 */
603
604 /**
605 * \brief Requests Motion Magic® Expo to target a final position using
606 * an exponential motion profile. This dynamic request allows runtime
607 * changes to the profile kV, kA, and (optional) Cruise Velocity.
608 * Users can optionally provide a torque current feedforward.
609 *
610 * \details Motion Magic® Expo produces a motion profile in real-time
611 * while attempting to honor the specified Cruise Velocity (optional)
612 * and the mechanism kV and kA. Note that unlike the slot gains, the
613 * Expo_kV and Expo_kA parameters are always in output units of Volts.
614 *
615 * Setting the Cruise Velocity to 0 will allow the profile to run to
616 * the max possible velocity based on Expo_kV. This control mode does
617 * not use the Acceleration or Jerk configs.
618 *
619 * Target position can be changed on-the-fly and Motion Magic® will do
620 * its best to adjust the profile. This control mode is based on
621 * torque current, so relevant closed-loop gains will use Amperes for
622 * the numerator.
623 *
624 * - DynamicMotionMagicExpoTorqueCurrentFOC Parameters:
625 * - Position: Position to drive toward in rotations.
626 * - kV: Mechanism kV for profiling. Unlike the kV slot gain, this is always
627 * in units of V/rps.
628 *
629 * This represents the amount of voltage necessary to hold a velocity.
630 * In terms of the Motion Magic® Expo profile, a higher kV results in a
631 * slower maximum velocity.
632 * - kA: Mechanism kA for profiling. Unlike the kA slot gain, this is always
633 * in units of V/rps².
634 *
635 * This represents the amount of voltage necessary to achieve an
636 * acceleration. In terms of the Motion Magic® Expo profile, a higher
637 * kA results in a slower acceleration.
638 * - Velocity: Cruise velocity for profiling. The signage does not matter as
639 * the device will use the absolute value for profile generation.
640 * Setting this to 0 will allow the profile to run to the max
641 * possible velocity based on Expo_kV.
642 * - FeedForward: Feedforward to apply in torque current in Amperes. This is
643 * added to the output of the onboard feedforward terms.
644 *
645 * User can use motor's kT to scale Newton-meter to Amperes.
646 * - Slot: Select which gains are applied by selecting the slot. Use the
647 * configuration api to set the gain values for the selected slot
648 * before enabling this feature. Slot must be within [0,2].
649 * - OverrideCoastDurNeutral: Set to true to coast the rotor when output is
650 * zero (or within deadband). Set to false to use
651 * the NeutralMode configuration setting (default).
652 * This flag exists to provide the fundamental
653 * behavior of this control when output is zero,
654 * which is to provide 0A (zero torque).
655 * - LimitForwardMotion: Set to true to force forward limiting. This allows
656 * users to use other limit switch sensors connected to
657 * robot controller. This also allows use of active
658 * sensors that require external power.
659 * - LimitReverseMotion: Set to true to force reverse limiting. This allows
660 * users to use other limit switch sensors connected to
661 * robot controller. This also allows use of active
662 * sensors that require external power.
663 * - IgnoreHardwareLimits: Set to true to ignore hardware limit switches and
664 * the LimitForwardMotion and LimitReverseMotion
665 * parameters, instead allowing motion.
666 *
667 * This can be useful on mechanisms such as an
668 * intake/feeder, where a limit switch stops motion
669 * while intaking but should be ignored when feeding
670 * to a shooter.
671 *
672 * The hardware limit faults and Forward/ReverseLimit
673 * signals will still report the values of the limit
674 * switches regardless of this parameter.
675 * - IgnoreSoftwareLimits: Set to true to ignore software limits, instead
676 * allowing motion.
677 *
678 * This can be useful when calibrating the zero point
679 * of a mechanism such as an elevator.
680 *
681 * The software limit faults will still report the
682 * values of the software limits regardless of this
683 * parameter.
684 * - UseTimesync: Set to true to delay applying this control request until a
685 * timesync boundary (requires Phoenix Pro and CANivore). This
686 * eliminates the impact of nondeterministic network delays in
687 * exchange for a larger but deterministic control latency.
688 *
689 * This requires setting the ControlTimesyncFreqHz config in
690 * MotorOutputConfigs. Additionally, when this is enabled, the
691 * UpdateFreqHz of this request should be set to 0 Hz.
692 *
693 * \param request Control object to request of the device
694 * \returns Status Code of the request, 0 is OK
695 */
697
698 /**
699 * \brief Differential control with torque current average target and
700 * position difference target.
701 *
702 * - Diff_TorqueCurrentFOC_Position Parameters:
703 * - AverageRequest: Average TorqueCurrentFOC request of the mechanism.
704 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
705 * mechanism.
706 *
707 * \param request Control object to request of the device
708 * \returns Status Code of the request, 0 is OK
709 */
710 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_TorqueCurrentFOC_Position &request) = 0;
711
712 /**
713 * \brief Differential control with position average target and
714 * position difference target using torque current control.
715 *
716 * - Diff_PositionTorqueCurrentFOC_Position Parameters:
717 * - AverageRequest: Average PositionTorqueCurrentFOC request of the
718 * mechanism.
719 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
720 * mechanism.
721 *
722 * \param request Control object to request of the device
723 * \returns Status Code of the request, 0 is OK
724 */
725 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_PositionTorqueCurrentFOC_Position &request) = 0;
726
727 /**
728 * \brief Differential control with velocity average target and
729 * position difference target using torque current control.
730 *
731 * - Diff_VelocityTorqueCurrentFOC_Position Parameters:
732 * - AverageRequest: Average VelocityTorqueCurrentFOC request of the
733 * mechanism.
734 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
735 * mechanism.
736 *
737 * \param request Control object to request of the device
738 * \returns Status Code of the request, 0 is OK
739 */
740 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_VelocityTorqueCurrentFOC_Position &request) = 0;
741
742 /**
743 * \brief Differential control with Motion Magic® average target and
744 * position difference target using torque current control.
745 *
746 * - Diff_MotionMagicTorqueCurrentFOC_Position Parameters:
747 * - AverageRequest: Average MotionMagicTorqueCurrentFOC request of the
748 * mechanism.
749 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
750 * mechanism.
751 *
752 * \param request Control object to request of the device
753 * \returns Status Code of the request, 0 is OK
754 */
755 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicTorqueCurrentFOC_Position &request) = 0;
756
757 /**
758 * \brief Differential control with Motion Magic® Expo average target
759 * and position difference target using torque current control.
760 *
761 * - Diff_MotionMagicExpoTorqueCurrentFOC_Position Parameters:
762 * - AverageRequest: Average MotionMagicExpoTorqueCurrentFOC request of the
763 * mechanism.
764 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
765 * mechanism.
766 *
767 * \param request Control object to request of the device
768 * \returns Status Code of the request, 0 is OK
769 */
770 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Position &request) = 0;
771
772 /**
773 * \brief Differential control with Motion Magic® Velocity average
774 * target and position difference target using torque current control.
775 *
776 * - Diff_MotionMagicVelocityTorqueCurrentFOC_Position Parameters:
777 * - AverageRequest: Average MotionMagicVelocityTorqueCurrentFOC request of
778 * the mechanism.
779 * - DifferentialRequest: Differential PositionTorqueCurrentFOC request of the
780 * mechanism.
781 *
782 * \param request Control object to request of the device
783 * \returns Status Code of the request, 0 is OK
784 */
785 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Position &request) = 0;
786
787 /**
788 * \brief Differential control with torque current average target and
789 * velocity difference target.
790 *
791 * - Diff_TorqueCurrentFOC_Velocity Parameters:
792 * - AverageRequest: Average TorqueCurrentFOC request of the mechanism.
793 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
794 * mechanism.
795 *
796 * \param request Control object to request of the device
797 * \returns Status Code of the request, 0 is OK
798 */
799 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_TorqueCurrentFOC_Velocity &request) = 0;
800
801 /**
802 * \brief Differential control with position average target and
803 * velocity difference target using torque current control.
804 *
805 * - Diff_PositionTorqueCurrentFOC_Velocity Parameters:
806 * - AverageRequest: Average PositionTorqueCurrentFOC request of the
807 * mechanism.
808 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
809 * mechanism.
810 *
811 * \param request Control object to request of the device
812 * \returns Status Code of the request, 0 is OK
813 */
814 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_PositionTorqueCurrentFOC_Velocity &request) = 0;
815
816 /**
817 * \brief Differential control with velocity average target and
818 * velocity difference target using torque current control.
819 *
820 * - Diff_VelocityTorqueCurrentFOC_Velocity Parameters:
821 * - AverageRequest: Average VelocityTorqueCurrentFOC request of the
822 * mechanism.
823 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
824 * mechanism.
825 *
826 * \param request Control object to request of the device
827 * \returns Status Code of the request, 0 is OK
828 */
829 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_VelocityTorqueCurrentFOC_Velocity &request) = 0;
830
831 /**
832 * \brief Differential control with Motion Magic® average target and
833 * velocity difference target using torque current control.
834 *
835 * - Diff_MotionMagicTorqueCurrentFOC_Velocity Parameters:
836 * - AverageRequest: Average MotionMagicTorqueCurrentFOC request of the
837 * mechanism.
838 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
839 * mechanism.
840 *
841 * \param request Control object to request of the device
842 * \returns Status Code of the request, 0 is OK
843 */
844 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicTorqueCurrentFOC_Velocity &request) = 0;
845
846 /**
847 * \brief Differential control with Motion Magic® Expo average target
848 * and velocity difference target using torque current control.
849 *
850 * - Diff_MotionMagicExpoTorqueCurrentFOC_Velocity Parameters:
851 * - AverageRequest: Average MotionMagicExpoTorqueCurrentFOC request of the
852 * mechanism.
853 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
854 * mechanism.
855 *
856 * \param request Control object to request of the device
857 * \returns Status Code of the request, 0 is OK
858 */
859 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Velocity &request) = 0;
860
861 /**
862 * \brief Differential control with Motion Magic® Velocity average
863 * target and velocity difference target using torque current control.
864 *
865 * - Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity Parameters:
866 * - AverageRequest: Average MotionMagicVelocityTorqueCurrentFOC request of
867 * the mechanism.
868 * - DifferentialRequest: Differential VelocityTorqueCurrentFOC request of the
869 * mechanism.
870 *
871 * \param request Control object to request of the device
872 * \returns Status Code of the request, 0 is OK
873 */
874 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity &request) = 0;
875
876 /**
877 * \brief Differential control with torque current average target and
878 * torque current difference target.
879 *
880 * - Diff_TorqueCurrentFOC_Open Parameters:
881 * - AverageRequest: Average TorqueCurrentFOC request of the mechanism.
882 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
883 * mechanism.
884 *
885 * \param request Control object to request of the device
886 * \returns Status Code of the request, 0 is OK
887 */
888 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_TorqueCurrentFOC_Open &request) = 0;
889
890 /**
891 * \brief Differential control with position average target and torque
892 * current difference target.
893 *
894 * - Diff_PositionTorqueCurrentFOC_Open Parameters:
895 * - AverageRequest: Average PositionTorqueCurrentFOC request of the
896 * mechanism.
897 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
898 * mechanism.
899 *
900 * \param request Control object to request of the device
901 * \returns Status Code of the request, 0 is OK
902 */
903 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_PositionTorqueCurrentFOC_Open &request) = 0;
904
905 /**
906 * \brief Differential control with velocity average target and torque
907 * current difference target.
908 *
909 * - Diff_VelocityTorqueCurrentFOC_Open Parameters:
910 * - AverageRequest: Average VelocityTorqueCurrentFOC request of the
911 * mechanism.
912 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
913 * mechanism.
914 *
915 * \param request Control object to request of the device
916 * \returns Status Code of the request, 0 is OK
917 */
918 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_VelocityTorqueCurrentFOC_Open &request) = 0;
919
920 /**
921 * \brief Differential control with Motion Magic® average target and
922 * torque current difference target.
923 *
924 * - Diff_MotionMagicTorqueCurrentFOC_Open Parameters:
925 * - AverageRequest: Average MotionMagicTorqueCurrentFOC request of the
926 * mechanism.
927 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
928 * mechanism.
929 *
930 * \param request Control object to request of the device
931 * \returns Status Code of the request, 0 is OK
932 */
933 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicTorqueCurrentFOC_Open &request) = 0;
934
935 /**
936 * \brief Differential control with Motion Magic® Expo average target
937 * and torque current difference target.
938 *
939 * - Diff_MotionMagicExpoTorqueCurrentFOC_Open Parameters:
940 * - AverageRequest: Average MotionMagicExpoTorqueCurrentFOC request of the
941 * mechanism.
942 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
943 * mechanism.
944 *
945 * \param request Control object to request of the device
946 * \returns Status Code of the request, 0 is OK
947 */
948 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicExpoTorqueCurrentFOC_Open &request) = 0;
949
950 /**
951 * \brief Differential control with Motion Magic® Velocity average
952 * target and torque current difference target.
953 *
954 * - Diff_MotionMagicVelocityTorqueCurrentFOC_Open Parameters:
955 * - AverageRequest: Average MotionMagicVelocityTorqueCurrentFOC request of
956 * the mechanism.
957 * - DifferentialRequest: Differential TorqueCurrentFOC request of the
958 * mechanism.
959 *
960 * \param request Control object to request of the device
961 * \returns Status Code of the request, 0 is OK
962 */
963 virtual ctre::phoenix::StatusCode SetControl(const controls::compound::Diff_MotionMagicVelocityTorqueCurrentFOC_Open &request) = 0;
964
965 /**
966 * \brief Control device with generic control request object. User must make
967 * sure the specified object is castable to a valid control request,
968 * otherwise this function will fail at run-time and return the NotSupported
969 * StatusCode
970 *
971 * \param request Control object to request of the device
972 * \returns Status Code of the request, 0 is OK
973 */
975
976};
977
978}
979}
980}
981}
982
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