CTRE Phoenix Pro C++ 23.0.12
CoreTalonFX.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
30#include <units/angle.h>
31#include <units/angular_acceleration.h>
32#include <units/angular_velocity.h>
33#include <units/current.h>
34#include <units/dimensionless.h>
35#include <units/temperature.h>
36#include <units/voltage.h>
37
38namespace ctre {
39namespace phoenixpro {
40
41namespace hardware {
42namespace core {
43 class CoreTalonFX;
44}
45}
46
47namespace configs {
48
49/**
50 * Class description for the Talon FX integrated motor controller that runs on
51 * associated Falcon motors.
52 *
53 * This handles the configurations for the hardware#TalonFX
54 */
56{
57public:
58 /**
59 * \brief True if we should factory default newer unsupported configs,
60 * false to leave newer unsupported configs alone.
61 *
62 * \details This flag addresses a corner case where the device may have
63 * firmware with newer configs that didn't exist when this
64 * version of the API was built. If this occurs and this
65 * flag is true, unsupported new configs will be factory
66 * defaulted to avoid unexpected behavior.
67 *
68 * This is also the behavior in Phoenix 5, so this flag
69 * is defaulted to true to match.
70 */
72
73
74 /**
75 * \brief What the gains for slot 0 are
76 *
77 * \details If this slot is selected, these gains are used in closed
78 * loop control requests.
79 */
81
82 /**
83 * \brief What the gains for slot 1 are
84 *
85 * \details If this slot is selected, these gains are used in closed
86 * loop control requests.
87 */
89
90 /**
91 * \brief What the gains for slot 2 are
92 *
93 * \details If this slot is selected, these gains are used in closed
94 * loop control requests.
95 */
97
98 /**
99 * \brief Configs that directly affect motor-output.
100 *
101 * \details Includes Motor Invert and various limit features.
102 */
104
105 /**
106 * \brief Configs that directly affect current limiting features.
107 *
108 * \details Includes Motor Invert and various limit features.
109 */
111
112 /**
113 * \brief Voltage-specific configs
114 *
115 * \details Voltage-specific configs
116 */
118
119 /**
120 * \brief Configs that directly affect motor-output.
121 *
122 * \details Includes Motor Invert and various limit features.
123 */
125
126 /**
127 * \brief Configs that directly affect motor-output.
128 *
129 * \details Includes Motor Invert and various limit features.
130 */
132
133 /**
134 * \brief Configs that directly affect motor-output.
135 *
136 * \details Includes Motor Invert and various limit features.
137 */
139
140 /**
141 * \brief Configs that directly affect motor-output.
142 *
143 * \details Includes Motor Invert and various limit features.
144 */
146
147 /**
148 * \brief Configs that directly affect motor-output.
149 *
150 * \details Includes Motor Invert and various limit features.
151 */
153
154 /**
155 * \brief Configs that directly affect motor-output.
156 *
157 * \details Includes Motor Invert and various limit features.
158 */
160
161 /**
162 * \brief Configs that directly affect motor-output.
163 *
164 * \details Includes Motor Invert and various limit features.
165 */
167
168 /**
169 * \brief Configs that directly affect motor-output.
170 *
171 * \details Includes Motor Invert and various limit features.
172 */
174
175 /**
176 * \brief Configs that directly affect motor-output.
177 *
178 * \details Includes Motor Invert and various limit features.
179 */
181
182 /**
183 * \brief Configs that affect general behavior during closed-looping.
184 *
185 * \details Includes Continuous Wrap features.
186 */
188
189 /**
190 * \brief Get the string representation of this configuration
191 */
192 std::string ToString() const
193 {
194 std::stringstream ss;
195 ss << Slot0.ToString();
196 ss << Slot1.ToString();
197 ss << Slot2.ToString();
198 ss << MotorOutput.ToString();
199 ss << CurrentLimits.ToString();
200 ss << Voltage.ToString();
201 ss << TorqueCurrent.ToString();
202 ss << Feedback.ToString();
203 ss << OpenLoopRamps.ToString();
206 ss << Audio.ToString();
208 ss << MotionMagic.ToString();
209 ss << CustomParams.ToString();
211 return ss.str();
212 }
213
214 /**
215 * \brief Get the serialized form of this configuration
216 */
217 std::string Serialize() const
218 {
219 std::stringstream ss;
220 ss << Slot0.Serialize();
221 ss << Slot1.Serialize();
222 ss << Slot2.Serialize();
223 ss << MotorOutput.Serialize();
224 ss << CurrentLimits.Serialize();
225 ss << Voltage.Serialize();
226 ss << TorqueCurrent.Serialize();
227 ss << Feedback.Serialize();
228 ss << OpenLoopRamps.Serialize();
231 ss << Audio.Serialize();
233 ss << MotionMagic.Serialize();
234 ss << CustomParams.Serialize();
236 return ss.str();
237 }
238
239 /**
240 * \brief Take a string and deserialize it to this configuration
241 */
242 ctre::phoenix::StatusCode Deserialize(const std::string& string)
243 {
244 ctre::phoenix::StatusCode err = ctre::phoenix::StatusCode::OK;
245 err = Slot0.Deserialize(string);
246 err = Slot1.Deserialize(string);
247 err = Slot2.Deserialize(string);
248 err = MotorOutput.Deserialize(string);
249 err = CurrentLimits.Deserialize(string);
250 err = Voltage.Deserialize(string);
251 err = TorqueCurrent.Deserialize(string);
252 err = Feedback.Deserialize(string);
253 err = OpenLoopRamps.Deserialize(string);
254 err = ClosedLoopRamps.Deserialize(string);
255 err = HardwareLimitSwitch.Deserialize(string);
256 err = Audio.Deserialize(string);
257 err = SoftwareLimitSwitch.Deserialize(string);
258 err = MotionMagic.Deserialize(string);
259 err = CustomParams.Deserialize(string);
260 err = ClosedLoopGeneral.Deserialize(string);
261 return err;
262 }
263};
264
265/**
266 * Class description for the Talon FX integrated motor controller that runs on
267 * associated Falcon motors.
268 *
269 * This handles the configurations for the hardware#TalonFX
270 */
272{
274 ParentConfigurator{std::move(id)}
275 {}
276
278public:
279
280 /**
281 * Delete the copy constructor, we can only pass by reference
282 */
284
285 /**
286 * \brief Refreshes the values of the specified config group.
287 *
288 * This will wait up to #defaultTimeoutSeconds.
289 *
290 * \details Call to refresh the selected configs from the device.
291 *
292 * \param configs The configs to refresh
293 * \returns StatusCode of refreshing the configs
294 */
295 ctre::phoenix::StatusCode Refresh(TalonFXConfiguration& configs) const
296 {
297 return Refresh(configs, defaultTimeoutSeconds);
298 }
299
300 /**
301 * \brief Refreshes the values of the specified config group.
302 *
303 * \details Call to refresh the selected configs from the device.
304 *
305 * \param configs The configs to refresh
306 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
307 * \returns StatusCode of refreshing the configs
308 */
309 ctre::phoenix::StatusCode Refresh(TalonFXConfiguration& configs, units::time::second_t timeoutSeconds) const
310 {
311 std::string ref;
312 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
313 configs.Deserialize(ref);
314 return ret;
315 }
316
317 /**
318 * \brief Applies the contents of the specified config to the device.
319 *
320 * This will wait up to #defaultTimeoutSeconds.
321 *
322 * \details Call to apply the selected configs.
323 *
324 * \param configs Configs to apply against.
325 * \returns StatusCode of the set command
326 */
327 ctre::phoenix::StatusCode Apply(const TalonFXConfiguration& configs)
328 {
329 return Apply(configs, defaultTimeoutSeconds);
330 }
331
332 /**
333 * \brief Applies the contents of the specified config to the device.
334 *
335 * \details Call to apply the selected configs.
336 *
337 * \param configs Configs to apply against.
338 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
339 * \returns StatusCode of the set command
340 */
341 ctre::phoenix::StatusCode Apply(const TalonFXConfiguration& configs, units::time::second_t timeoutSeconds)
342 {
343 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, configs.FutureProofConfigs, false);
344 }
345
346
347 /**
348 * \brief Refreshes the values of the specified config group.
349 *
350 * This will wait up to #defaultTimeoutSeconds.
351 *
352 * \details Call to refresh the selected configs from the device.
353 *
354 * \param configs The configs to refresh
355 * \returns StatusCode of refreshing the configs
356 */
357 ctre::phoenix::StatusCode Refresh(Slot0Configs& configs) const
358 {
359 return Refresh(configs, defaultTimeoutSeconds);
360 }
361 /**
362 * \brief Refreshes the values of the specified config group.
363 *
364 * \details Call to refresh the selected configs from the device.
365 *
366 * \param configs The configs to refresh
367 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
368 * \returns StatusCode of refreshing the configs
369 */
370 ctre::phoenix::StatusCode Refresh(Slot0Configs& configs, units::time::second_t timeoutSeconds) const
371 {
372 std::string ref;
373 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
374 configs.Deserialize(ref);
375 return ret;
376 }
377
378 /**
379 * \brief Applies the contents of the specified config to the device.
380 *
381 * This will wait up to #defaultTimeoutSeconds.
382 *
383 * \details Call to apply the selected configs.
384 *
385 * \param configs Configs to apply against.
386 * \returns StatusCode of the set command
387 */
388 ctre::phoenix::StatusCode Apply(const Slot0Configs& configs)
389 {
390 return Apply(configs, defaultTimeoutSeconds);
391 }
392
393 /**
394 * \brief Applies the contents of the specified config to the device.
395 *
396 * \details Call to apply the selected configs.
397 *
398 * \param configs Configs to apply against.
399 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
400 * \returns StatusCode of the set command
401 */
402 ctre::phoenix::StatusCode Apply(const Slot0Configs& configs, units::time::second_t timeoutSeconds)
403 {
404 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
405 }
406
407 /**
408 * \brief Refreshes the values of the specified config group.
409 *
410 * This will wait up to #defaultTimeoutSeconds.
411 *
412 * \details Call to refresh the selected configs from the device.
413 *
414 * \param configs The configs to refresh
415 * \returns StatusCode of refreshing the configs
416 */
417 ctre::phoenix::StatusCode Refresh(Slot1Configs& configs) const
418 {
419 return Refresh(configs, defaultTimeoutSeconds);
420 }
421 /**
422 * \brief Refreshes the values of the specified config group.
423 *
424 * \details Call to refresh the selected configs from the device.
425 *
426 * \param configs The configs to refresh
427 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
428 * \returns StatusCode of refreshing the configs
429 */
430 ctre::phoenix::StatusCode Refresh(Slot1Configs& configs, units::time::second_t timeoutSeconds) const
431 {
432 std::string ref;
433 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
434 configs.Deserialize(ref);
435 return ret;
436 }
437
438 /**
439 * \brief Applies the contents of the specified config to the device.
440 *
441 * This will wait up to #defaultTimeoutSeconds.
442 *
443 * \details Call to apply the selected configs.
444 *
445 * \param configs Configs to apply against.
446 * \returns StatusCode of the set command
447 */
448 ctre::phoenix::StatusCode Apply(const Slot1Configs& configs)
449 {
450 return Apply(configs, defaultTimeoutSeconds);
451 }
452
453 /**
454 * \brief Applies the contents of the specified config to the device.
455 *
456 * \details Call to apply the selected configs.
457 *
458 * \param configs Configs to apply against.
459 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
460 * \returns StatusCode of the set command
461 */
462 ctre::phoenix::StatusCode Apply(const Slot1Configs& configs, units::time::second_t timeoutSeconds)
463 {
464 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
465 }
466
467 /**
468 * \brief Refreshes the values of the specified config group.
469 *
470 * This will wait up to #defaultTimeoutSeconds.
471 *
472 * \details Call to refresh the selected configs from the device.
473 *
474 * \param configs The configs to refresh
475 * \returns StatusCode of refreshing the configs
476 */
477 ctre::phoenix::StatusCode Refresh(Slot2Configs& configs) const
478 {
479 return Refresh(configs, defaultTimeoutSeconds);
480 }
481 /**
482 * \brief Refreshes the values of the specified config group.
483 *
484 * \details Call to refresh the selected configs from the device.
485 *
486 * \param configs The configs to refresh
487 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
488 * \returns StatusCode of refreshing the configs
489 */
490 ctre::phoenix::StatusCode Refresh(Slot2Configs& configs, units::time::second_t timeoutSeconds) const
491 {
492 std::string ref;
493 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
494 configs.Deserialize(ref);
495 return ret;
496 }
497
498 /**
499 * \brief Applies the contents of the specified config to the device.
500 *
501 * This will wait up to #defaultTimeoutSeconds.
502 *
503 * \details Call to apply the selected configs.
504 *
505 * \param configs Configs to apply against.
506 * \returns StatusCode of the set command
507 */
508 ctre::phoenix::StatusCode Apply(const Slot2Configs& configs)
509 {
510 return Apply(configs, defaultTimeoutSeconds);
511 }
512
513 /**
514 * \brief Applies the contents of the specified config to the device.
515 *
516 * \details Call to apply the selected configs.
517 *
518 * \param configs Configs to apply against.
519 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
520 * \returns StatusCode of the set command
521 */
522 ctre::phoenix::StatusCode Apply(const Slot2Configs& configs, units::time::second_t timeoutSeconds)
523 {
524 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
525 }
526
527 /**
528 * \brief Refreshes the values of the specified config group.
529 *
530 * This will wait up to #defaultTimeoutSeconds.
531 *
532 * \details Call to refresh the selected configs from the device.
533 *
534 * \param configs The configs to refresh
535 * \returns StatusCode of refreshing the configs
536 */
537 ctre::phoenix::StatusCode Refresh(MotorOutputConfigs& configs) const
538 {
539 return Refresh(configs, defaultTimeoutSeconds);
540 }
541 /**
542 * \brief Refreshes the values of the specified config group.
543 *
544 * \details Call to refresh the selected configs from the device.
545 *
546 * \param configs The configs to refresh
547 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
548 * \returns StatusCode of refreshing the configs
549 */
550 ctre::phoenix::StatusCode Refresh(MotorOutputConfigs& configs, units::time::second_t timeoutSeconds) const
551 {
552 std::string ref;
553 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
554 configs.Deserialize(ref);
555 return ret;
556 }
557
558 /**
559 * \brief Applies the contents of the specified config to the device.
560 *
561 * This will wait up to #defaultTimeoutSeconds.
562 *
563 * \details Call to apply the selected configs.
564 *
565 * \param configs Configs to apply against.
566 * \returns StatusCode of the set command
567 */
568 ctre::phoenix::StatusCode Apply(const MotorOutputConfigs& configs)
569 {
570 return Apply(configs, defaultTimeoutSeconds);
571 }
572
573 /**
574 * \brief Applies the contents of the specified config to the device.
575 *
576 * \details Call to apply the selected configs.
577 *
578 * \param configs Configs to apply against.
579 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
580 * \returns StatusCode of the set command
581 */
582 ctre::phoenix::StatusCode Apply(const MotorOutputConfigs& configs, units::time::second_t timeoutSeconds)
583 {
584 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
585 }
586
587 /**
588 * \brief Refreshes the values of the specified config group.
589 *
590 * This will wait up to #defaultTimeoutSeconds.
591 *
592 * \details Call to refresh the selected configs from the device.
593 *
594 * \param configs The configs to refresh
595 * \returns StatusCode of refreshing the configs
596 */
597 ctre::phoenix::StatusCode Refresh(CurrentLimitsConfigs& configs) const
598 {
599 return Refresh(configs, defaultTimeoutSeconds);
600 }
601 /**
602 * \brief Refreshes the values of the specified config group.
603 *
604 * \details Call to refresh the selected configs from the device.
605 *
606 * \param configs The configs to refresh
607 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
608 * \returns StatusCode of refreshing the configs
609 */
610 ctre::phoenix::StatusCode Refresh(CurrentLimitsConfigs& configs, units::time::second_t timeoutSeconds) const
611 {
612 std::string ref;
613 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
614 configs.Deserialize(ref);
615 return ret;
616 }
617
618 /**
619 * \brief Applies the contents of the specified config to the device.
620 *
621 * This will wait up to #defaultTimeoutSeconds.
622 *
623 * \details Call to apply the selected configs.
624 *
625 * \param configs Configs to apply against.
626 * \returns StatusCode of the set command
627 */
628 ctre::phoenix::StatusCode Apply(const CurrentLimitsConfigs& configs)
629 {
630 return Apply(configs, defaultTimeoutSeconds);
631 }
632
633 /**
634 * \brief Applies the contents of the specified config to the device.
635 *
636 * \details Call to apply the selected configs.
637 *
638 * \param configs Configs to apply against.
639 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
640 * \returns StatusCode of the set command
641 */
642 ctre::phoenix::StatusCode Apply(const CurrentLimitsConfigs& configs, units::time::second_t timeoutSeconds)
643 {
644 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
645 }
646
647 /**
648 * \brief Refreshes the values of the specified config group.
649 *
650 * This will wait up to #defaultTimeoutSeconds.
651 *
652 * \details Call to refresh the selected configs from the device.
653 *
654 * \param configs The configs to refresh
655 * \returns StatusCode of refreshing the configs
656 */
657 ctre::phoenix::StatusCode Refresh(VoltageConfigs& configs) const
658 {
659 return Refresh(configs, defaultTimeoutSeconds);
660 }
661 /**
662 * \brief Refreshes the values of the specified config group.
663 *
664 * \details Call to refresh the selected configs from the device.
665 *
666 * \param configs The configs to refresh
667 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
668 * \returns StatusCode of refreshing the configs
669 */
670 ctre::phoenix::StatusCode Refresh(VoltageConfigs& configs, units::time::second_t timeoutSeconds) const
671 {
672 std::string ref;
673 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
674 configs.Deserialize(ref);
675 return ret;
676 }
677
678 /**
679 * \brief Applies the contents of the specified config to the device.
680 *
681 * This will wait up to #defaultTimeoutSeconds.
682 *
683 * \details Call to apply the selected configs.
684 *
685 * \param configs Configs to apply against.
686 * \returns StatusCode of the set command
687 */
688 ctre::phoenix::StatusCode Apply(const VoltageConfigs& configs)
689 {
690 return Apply(configs, defaultTimeoutSeconds);
691 }
692
693 /**
694 * \brief Applies the contents of the specified config to the device.
695 *
696 * \details Call to apply the selected configs.
697 *
698 * \param configs Configs to apply against.
699 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
700 * \returns StatusCode of the set command
701 */
702 ctre::phoenix::StatusCode Apply(const VoltageConfigs& configs, units::time::second_t timeoutSeconds)
703 {
704 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
705 }
706
707 /**
708 * \brief Refreshes the values of the specified config group.
709 *
710 * This will wait up to #defaultTimeoutSeconds.
711 *
712 * \details Call to refresh the selected configs from the device.
713 *
714 * \param configs The configs to refresh
715 * \returns StatusCode of refreshing the configs
716 */
717 ctre::phoenix::StatusCode Refresh(TorqueCurrentConfigs& configs) const
718 {
719 return Refresh(configs, defaultTimeoutSeconds);
720 }
721 /**
722 * \brief Refreshes the values of the specified config group.
723 *
724 * \details Call to refresh the selected configs from the device.
725 *
726 * \param configs The configs to refresh
727 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
728 * \returns StatusCode of refreshing the configs
729 */
730 ctre::phoenix::StatusCode Refresh(TorqueCurrentConfigs& configs, units::time::second_t timeoutSeconds) const
731 {
732 std::string ref;
733 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
734 configs.Deserialize(ref);
735 return ret;
736 }
737
738 /**
739 * \brief Applies the contents of the specified config to the device.
740 *
741 * This will wait up to #defaultTimeoutSeconds.
742 *
743 * \details Call to apply the selected configs.
744 *
745 * \param configs Configs to apply against.
746 * \returns StatusCode of the set command
747 */
748 ctre::phoenix::StatusCode Apply(const TorqueCurrentConfigs& configs)
749 {
750 return Apply(configs, defaultTimeoutSeconds);
751 }
752
753 /**
754 * \brief Applies the contents of the specified config to the device.
755 *
756 * \details Call to apply the selected configs.
757 *
758 * \param configs Configs to apply against.
759 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
760 * \returns StatusCode of the set command
761 */
762 ctre::phoenix::StatusCode Apply(const TorqueCurrentConfigs& configs, units::time::second_t timeoutSeconds)
763 {
764 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
765 }
766
767 /**
768 * \brief Refreshes the values of the specified config group.
769 *
770 * This will wait up to #defaultTimeoutSeconds.
771 *
772 * \details Call to refresh the selected configs from the device.
773 *
774 * \param configs The configs to refresh
775 * \returns StatusCode of refreshing the configs
776 */
777 ctre::phoenix::StatusCode Refresh(FeedbackConfigs& configs) const
778 {
779 return Refresh(configs, defaultTimeoutSeconds);
780 }
781 /**
782 * \brief Refreshes the values of the specified config group.
783 *
784 * \details Call to refresh the selected configs from the device.
785 *
786 * \param configs The configs to refresh
787 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
788 * \returns StatusCode of refreshing the configs
789 */
790 ctre::phoenix::StatusCode Refresh(FeedbackConfigs& configs, units::time::second_t timeoutSeconds) const
791 {
792 std::string ref;
793 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
794 configs.Deserialize(ref);
795 return ret;
796 }
797
798 /**
799 * \brief Applies the contents of the specified config to the device.
800 *
801 * This will wait up to #defaultTimeoutSeconds.
802 *
803 * \details Call to apply the selected configs.
804 *
805 * \param configs Configs to apply against.
806 * \returns StatusCode of the set command
807 */
808 ctre::phoenix::StatusCode Apply(const FeedbackConfigs& configs)
809 {
810 return Apply(configs, defaultTimeoutSeconds);
811 }
812
813 /**
814 * \brief Applies the contents of the specified config to the device.
815 *
816 * \details Call to apply the selected configs.
817 *
818 * \param configs Configs to apply against.
819 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
820 * \returns StatusCode of the set command
821 */
822 ctre::phoenix::StatusCode Apply(const FeedbackConfigs& configs, units::time::second_t timeoutSeconds)
823 {
824 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
825 }
826
827 /**
828 * \brief Refreshes the values of the specified config group.
829 *
830 * This will wait up to #defaultTimeoutSeconds.
831 *
832 * \details Call to refresh the selected configs from the device.
833 *
834 * \param configs The configs to refresh
835 * \returns StatusCode of refreshing the configs
836 */
837 ctre::phoenix::StatusCode Refresh(OpenLoopRampsConfigs& configs) const
838 {
839 return Refresh(configs, defaultTimeoutSeconds);
840 }
841 /**
842 * \brief Refreshes the values of the specified config group.
843 *
844 * \details Call to refresh the selected configs from the device.
845 *
846 * \param configs The configs to refresh
847 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
848 * \returns StatusCode of refreshing the configs
849 */
850 ctre::phoenix::StatusCode Refresh(OpenLoopRampsConfigs& configs, units::time::second_t timeoutSeconds) const
851 {
852 std::string ref;
853 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
854 configs.Deserialize(ref);
855 return ret;
856 }
857
858 /**
859 * \brief Applies the contents of the specified config to the device.
860 *
861 * This will wait up to #defaultTimeoutSeconds.
862 *
863 * \details Call to apply the selected configs.
864 *
865 * \param configs Configs to apply against.
866 * \returns StatusCode of the set command
867 */
868 ctre::phoenix::StatusCode Apply(const OpenLoopRampsConfigs& configs)
869 {
870 return Apply(configs, defaultTimeoutSeconds);
871 }
872
873 /**
874 * \brief Applies the contents of the specified config to the device.
875 *
876 * \details Call to apply the selected configs.
877 *
878 * \param configs Configs to apply against.
879 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
880 * \returns StatusCode of the set command
881 */
882 ctre::phoenix::StatusCode Apply(const OpenLoopRampsConfigs& configs, units::time::second_t timeoutSeconds)
883 {
884 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
885 }
886
887 /**
888 * \brief Refreshes the values of the specified config group.
889 *
890 * This will wait up to #defaultTimeoutSeconds.
891 *
892 * \details Call to refresh the selected configs from the device.
893 *
894 * \param configs The configs to refresh
895 * \returns StatusCode of refreshing the configs
896 */
897 ctre::phoenix::StatusCode Refresh(ClosedLoopRampsConfigs& configs) const
898 {
899 return Refresh(configs, defaultTimeoutSeconds);
900 }
901 /**
902 * \brief Refreshes the values of the specified config group.
903 *
904 * \details Call to refresh the selected configs from the device.
905 *
906 * \param configs The configs to refresh
907 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
908 * \returns StatusCode of refreshing the configs
909 */
910 ctre::phoenix::StatusCode Refresh(ClosedLoopRampsConfigs& configs, units::time::second_t timeoutSeconds) const
911 {
912 std::string ref;
913 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
914 configs.Deserialize(ref);
915 return ret;
916 }
917
918 /**
919 * \brief Applies the contents of the specified config to the device.
920 *
921 * This will wait up to #defaultTimeoutSeconds.
922 *
923 * \details Call to apply the selected configs.
924 *
925 * \param configs Configs to apply against.
926 * \returns StatusCode of the set command
927 */
928 ctre::phoenix::StatusCode Apply(const ClosedLoopRampsConfigs& configs)
929 {
930 return Apply(configs, defaultTimeoutSeconds);
931 }
932
933 /**
934 * \brief Applies the contents of the specified config to the device.
935 *
936 * \details Call to apply the selected configs.
937 *
938 * \param configs Configs to apply against.
939 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
940 * \returns StatusCode of the set command
941 */
942 ctre::phoenix::StatusCode Apply(const ClosedLoopRampsConfigs& configs, units::time::second_t timeoutSeconds)
943 {
944 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
945 }
946
947 /**
948 * \brief Refreshes the values of the specified config group.
949 *
950 * This will wait up to #defaultTimeoutSeconds.
951 *
952 * \details Call to refresh the selected configs from the device.
953 *
954 * \param configs The configs to refresh
955 * \returns StatusCode of refreshing the configs
956 */
957 ctre::phoenix::StatusCode Refresh(HardwareLimitSwitchConfigs& configs) const
958 {
959 return Refresh(configs, defaultTimeoutSeconds);
960 }
961 /**
962 * \brief Refreshes the values of the specified config group.
963 *
964 * \details Call to refresh the selected configs from the device.
965 *
966 * \param configs The configs to refresh
967 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
968 * \returns StatusCode of refreshing the configs
969 */
970 ctre::phoenix::StatusCode Refresh(HardwareLimitSwitchConfigs& configs, units::time::second_t timeoutSeconds) const
971 {
972 std::string ref;
973 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
974 configs.Deserialize(ref);
975 return ret;
976 }
977
978 /**
979 * \brief Applies the contents of the specified config to the device.
980 *
981 * This will wait up to #defaultTimeoutSeconds.
982 *
983 * \details Call to apply the selected configs.
984 *
985 * \param configs Configs to apply against.
986 * \returns StatusCode of the set command
987 */
988 ctre::phoenix::StatusCode Apply(const HardwareLimitSwitchConfigs& configs)
989 {
990 return Apply(configs, defaultTimeoutSeconds);
991 }
992
993 /**
994 * \brief Applies the contents of the specified config to the device.
995 *
996 * \details Call to apply the selected configs.
997 *
998 * \param configs Configs to apply against.
999 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1000 * \returns StatusCode of the set command
1001 */
1002 ctre::phoenix::StatusCode Apply(const HardwareLimitSwitchConfigs& configs, units::time::second_t timeoutSeconds)
1003 {
1004 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
1005 }
1006
1007 /**
1008 * \brief Refreshes the values of the specified config group.
1009 *
1010 * This will wait up to #defaultTimeoutSeconds.
1011 *
1012 * \details Call to refresh the selected configs from the device.
1013 *
1014 * \param configs The configs to refresh
1015 * \returns StatusCode of refreshing the configs
1016 */
1017 ctre::phoenix::StatusCode Refresh(AudioConfigs& configs) const
1018 {
1019 return Refresh(configs, defaultTimeoutSeconds);
1020 }
1021 /**
1022 * \brief Refreshes the values of the specified config group.
1023 *
1024 * \details Call to refresh the selected configs from the device.
1025 *
1026 * \param configs The configs to refresh
1027 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1028 * \returns StatusCode of refreshing the configs
1029 */
1030 ctre::phoenix::StatusCode Refresh(AudioConfigs& configs, units::time::second_t timeoutSeconds) const
1031 {
1032 std::string ref;
1033 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
1034 configs.Deserialize(ref);
1035 return ret;
1036 }
1037
1038 /**
1039 * \brief Applies the contents of the specified config to the device.
1040 *
1041 * This will wait up to #defaultTimeoutSeconds.
1042 *
1043 * \details Call to apply the selected configs.
1044 *
1045 * \param configs Configs to apply against.
1046 * \returns StatusCode of the set command
1047 */
1048 ctre::phoenix::StatusCode Apply(const AudioConfigs& configs)
1049 {
1050 return Apply(configs, defaultTimeoutSeconds);
1051 }
1052
1053 /**
1054 * \brief Applies the contents of the specified config to the device.
1055 *
1056 * \details Call to apply the selected configs.
1057 *
1058 * \param configs Configs to apply against.
1059 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1060 * \returns StatusCode of the set command
1061 */
1062 ctre::phoenix::StatusCode Apply(const AudioConfigs& configs, units::time::second_t timeoutSeconds)
1063 {
1064 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
1065 }
1066
1067 /**
1068 * \brief Refreshes the values of the specified config group.
1069 *
1070 * This will wait up to #defaultTimeoutSeconds.
1071 *
1072 * \details Call to refresh the selected configs from the device.
1073 *
1074 * \param configs The configs to refresh
1075 * \returns StatusCode of refreshing the configs
1076 */
1077 ctre::phoenix::StatusCode Refresh(SoftwareLimitSwitchConfigs& configs) const
1078 {
1079 return Refresh(configs, defaultTimeoutSeconds);
1080 }
1081 /**
1082 * \brief Refreshes the values of the specified config group.
1083 *
1084 * \details Call to refresh the selected configs from the device.
1085 *
1086 * \param configs The configs to refresh
1087 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1088 * \returns StatusCode of refreshing the configs
1089 */
1090 ctre::phoenix::StatusCode Refresh(SoftwareLimitSwitchConfigs& configs, units::time::second_t timeoutSeconds) const
1091 {
1092 std::string ref;
1093 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
1094 configs.Deserialize(ref);
1095 return ret;
1096 }
1097
1098 /**
1099 * \brief Applies the contents of the specified config to the device.
1100 *
1101 * This will wait up to #defaultTimeoutSeconds.
1102 *
1103 * \details Call to apply the selected configs.
1104 *
1105 * \param configs Configs to apply against.
1106 * \returns StatusCode of the set command
1107 */
1108 ctre::phoenix::StatusCode Apply(const SoftwareLimitSwitchConfigs& configs)
1109 {
1110 return Apply(configs, defaultTimeoutSeconds);
1111 }
1112
1113 /**
1114 * \brief Applies the contents of the specified config to the device.
1115 *
1116 * \details Call to apply the selected configs.
1117 *
1118 * \param configs Configs to apply against.
1119 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1120 * \returns StatusCode of the set command
1121 */
1122 ctre::phoenix::StatusCode Apply(const SoftwareLimitSwitchConfigs& configs, units::time::second_t timeoutSeconds)
1123 {
1124 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
1125 }
1126
1127 /**
1128 * \brief Refreshes the values of the specified config group.
1129 *
1130 * This will wait up to #defaultTimeoutSeconds.
1131 *
1132 * \details Call to refresh the selected configs from the device.
1133 *
1134 * \param configs The configs to refresh
1135 * \returns StatusCode of refreshing the configs
1136 */
1137 ctre::phoenix::StatusCode Refresh(MotionMagicConfigs& configs) const
1138 {
1139 return Refresh(configs, defaultTimeoutSeconds);
1140 }
1141 /**
1142 * \brief Refreshes the values of the specified config group.
1143 *
1144 * \details Call to refresh the selected configs from the device.
1145 *
1146 * \param configs The configs to refresh
1147 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1148 * \returns StatusCode of refreshing the configs
1149 */
1150 ctre::phoenix::StatusCode Refresh(MotionMagicConfigs& configs, units::time::second_t timeoutSeconds) const
1151 {
1152 std::string ref;
1153 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
1154 configs.Deserialize(ref);
1155 return ret;
1156 }
1157
1158 /**
1159 * \brief Applies the contents of the specified config to the device.
1160 *
1161 * This will wait up to #defaultTimeoutSeconds.
1162 *
1163 * \details Call to apply the selected configs.
1164 *
1165 * \param configs Configs to apply against.
1166 * \returns StatusCode of the set command
1167 */
1168 ctre::phoenix::StatusCode Apply(const MotionMagicConfigs& configs)
1169 {
1170 return Apply(configs, defaultTimeoutSeconds);
1171 }
1172
1173 /**
1174 * \brief Applies the contents of the specified config to the device.
1175 *
1176 * \details Call to apply the selected configs.
1177 *
1178 * \param configs Configs to apply against.
1179 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1180 * \returns StatusCode of the set command
1181 */
1182 ctre::phoenix::StatusCode Apply(const MotionMagicConfigs& configs, units::time::second_t timeoutSeconds)
1183 {
1184 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
1185 }
1186
1187 /**
1188 * \brief Refreshes the values of the specified config group.
1189 *
1190 * This will wait up to #defaultTimeoutSeconds.
1191 *
1192 * \details Call to refresh the selected configs from the device.
1193 *
1194 * \param configs The configs to refresh
1195 * \returns StatusCode of refreshing the configs
1196 */
1197 ctre::phoenix::StatusCode Refresh(CustomParamsConfigs& configs) const
1198 {
1199 return Refresh(configs, defaultTimeoutSeconds);
1200 }
1201 /**
1202 * \brief Refreshes the values of the specified config group.
1203 *
1204 * \details Call to refresh the selected configs from the device.
1205 *
1206 * \param configs The configs to refresh
1207 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1208 * \returns StatusCode of refreshing the configs
1209 */
1210 ctre::phoenix::StatusCode Refresh(CustomParamsConfigs& configs, units::time::second_t timeoutSeconds) const
1211 {
1212 std::string ref;
1213 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
1214 configs.Deserialize(ref);
1215 return ret;
1216 }
1217
1218 /**
1219 * \brief Applies the contents of the specified config to the device.
1220 *
1221 * This will wait up to #defaultTimeoutSeconds.
1222 *
1223 * \details Call to apply the selected configs.
1224 *
1225 * \param configs Configs to apply against.
1226 * \returns StatusCode of the set command
1227 */
1228 ctre::phoenix::StatusCode Apply(const CustomParamsConfigs& configs)
1229 {
1230 return Apply(configs, defaultTimeoutSeconds);
1231 }
1232
1233 /**
1234 * \brief Applies the contents of the specified config to the device.
1235 *
1236 * \details Call to apply the selected configs.
1237 *
1238 * \param configs Configs to apply against.
1239 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1240 * \returns StatusCode of the set command
1241 */
1242 ctre::phoenix::StatusCode Apply(const CustomParamsConfigs& configs, units::time::second_t timeoutSeconds)
1243 {
1244 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
1245 }
1246
1247 /**
1248 * \brief Refreshes the values of the specified config group.
1249 *
1250 * This will wait up to #defaultTimeoutSeconds.
1251 *
1252 * \details Call to refresh the selected configs from the device.
1253 *
1254 * \param configs The configs to refresh
1255 * \returns StatusCode of refreshing the configs
1256 */
1257 ctre::phoenix::StatusCode Refresh(ClosedLoopGeneralConfigs& configs) const
1258 {
1259 return Refresh(configs, defaultTimeoutSeconds);
1260 }
1261 /**
1262 * \brief Refreshes the values of the specified config group.
1263 *
1264 * \details Call to refresh the selected configs from the device.
1265 *
1266 * \param configs The configs to refresh
1267 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1268 * \returns StatusCode of refreshing the configs
1269 */
1270 ctre::phoenix::StatusCode Refresh(ClosedLoopGeneralConfigs& configs, units::time::second_t timeoutSeconds) const
1271 {
1272 std::string ref;
1273 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
1274 configs.Deserialize(ref);
1275 return ret;
1276 }
1277
1278 /**
1279 * \brief Applies the contents of the specified config to the device.
1280 *
1281 * This will wait up to #defaultTimeoutSeconds.
1282 *
1283 * \details Call to apply the selected configs.
1284 *
1285 * \param configs Configs to apply against.
1286 * \returns StatusCode of the set command
1287 */
1288 ctre::phoenix::StatusCode Apply(const ClosedLoopGeneralConfigs& configs)
1289 {
1290 return Apply(configs, defaultTimeoutSeconds);
1291 }
1292
1293 /**
1294 * \brief Applies the contents of the specified config to the device.
1295 *
1296 * \details Call to apply the selected configs.
1297 *
1298 * \param configs Configs to apply against.
1299 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
1300 * \returns StatusCode of the set command
1301 */
1302 ctre::phoenix::StatusCode Apply(const ClosedLoopGeneralConfigs& configs, units::time::second_t timeoutSeconds)
1303 {
1304 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
1305 }
1306
1307
1308 /**
1309 * \brief The position to set the rotor position to right now.
1310 *
1311 * This will wait up to #defaultTimeoutSeconds.
1312 *
1313 * This is available in the configurator in case the user wants
1314 * to initialize their device entirely without passing a device
1315 * reference down to the code that performs the initialization.
1316 * In this case, the user passes down the configurator object
1317 * and performs all the initialization code on the object.
1318 *
1319 * \param newValue Value to set to.
1320 * \returns StatusCode of the set command
1321 */
1322 ctre::phoenix::StatusCode SetRotorPosition(units::angle::turn_t newValue)
1323 {
1324 return SetRotorPosition(newValue, defaultTimeoutSeconds);
1325 }
1326 /**
1327 * \brief The position to set the rotor position to right now.
1328 *
1329 * This is available in the configurator in case the user wants
1330 * to initialize their device entirely without passing a device
1331 * reference down to the code that performs the initialization.
1332 * In this case, the user passes down the configurator object
1333 * and performs all the initialization code on the object.
1334 *
1335 * \param newValue Value to set to.
1336 * \param timeoutSeconds Maximum time to wait up to in seconds.
1337 * \returns StatusCode of the set command
1338 */
1339 ctre::phoenix::StatusCode SetRotorPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
1340 {
1341 std::stringstream ss;
1342 char *ref;
1343 c_ctre_phoenixpro_serialize_double(1008, newValue.to<double>(), &ref); if(ref != nullptr) { ss << ref; free(ref); }
1344 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
1345 }
1346
1347 /**
1348 * \brief Clear the sticky faults in the device.
1349 *
1350 * \details This typically has no impact on the device functionality.
1351 * Instead, it just clears telemetry faults that are accessible via
1352 * API and Tuner Self-Test.
1353 *
1354 * This will wait up to #defaultTimeoutSeconds.
1355 *
1356 * This is available in the configurator in case the user wants
1357 * to initialize their device entirely without passing a device
1358 * reference down to the code that performs the initialization.
1359 * In this case, the user passes down the configurator object
1360 * and performs all the initialization code on the object.
1361 * \returns StatusCode of the set command
1362 */
1363 ctre::phoenix::StatusCode ClearStickyFaults()
1364 {
1366 }
1367 /**
1368 * \brief Clear the sticky faults in the device.
1369 *
1370 * \details This typically has no impact on the device functionality.
1371 * Instead, it just clears telemetry faults that are accessible via
1372 * API and Tuner Self-Test.
1373 *
1374 * This is available in the configurator in case the user wants
1375 * to initialize their device entirely without passing a device
1376 * reference down to the code that performs the initialization.
1377 * In this case, the user passes down the configurator object
1378 * and performs all the initialization code on the object.
1379 * \param timeoutSeconds Maximum time to wait up to in seconds.
1380 * \returns StatusCode of the set command
1381 */
1382 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
1383 {
1384 std::stringstream ss;
1385 char *ref;
1386 c_ctre_phoenixpro_serialize_double(1476, 0, &ref); if(ref != nullptr) { ss << ref; free(ref); }
1387 return SetConfigsPrivate(ss.str(), timeoutSeconds, false, true);
1388 }
1389};
1390
1391}
1392
1393namespace hardware {
1394namespace core {
1395
1396/**
1397 * Class description for the Talon FX integrated motor controller that runs on
1398 * associated Falcon motors.
1399 */
1401{
1402private:
1404
1405 bool _isInitialized = false;
1406 bool _isVersionOk = false;
1407 StatusSignalValue<int> &_version = GetVersion();
1408 double _timeToRefreshVersion = GetCurrentTimeSeconds();
1409
1410 StatusSignalValue<int> &_resetFlags = LookupStatusSignalValue<int>(ctre::phoenixpro::spns::SpnValue::Startup_ResetFlags, "ResetFlags", false);
1411 units::time::second_t _resetTimestamp{0_s};
1412
1413 double _creationTime = GetCurrentTimeSeconds();
1414
1415 void ReportIfTooOld();
1416
1417
1418 /**
1419 * \brief Proportional output of PID controller when PID'ing under a
1420 * DutyCycle Request
1421 *
1422 * Minimum Value: -128.0
1423 * Maximum Value: 127.9990234375
1424 * Default Value: 0
1425 * Units: fractional
1426 *
1427 * Default Rates:
1428 * CAN: 4.0 Hz
1429 *
1430 * \returns PIDDutyCycle_ProportionalOutput Status Signal Value object
1431 */
1432 StatusSignalValue<units::dimensionless::scalar_t> &GetPIDDutyCycle_ProportionalOutput();
1433
1434 /**
1435 * \brief Proportional output of PID controller when PID'ing under a
1436 * Voltage Request
1437 *
1438 * Minimum Value: -1310.72
1439 * Maximum Value: 1310.71
1440 * Default Value: 0
1441 * Units: V
1442 *
1443 * Default Rates:
1444 * CAN: 4.0 Hz
1445 *
1446 * \returns PIDMotorVoltage_ProportionalOutput Status Signal Value object
1447 */
1448 StatusSignalValue<units::voltage::volt_t> &GetPIDMotorVoltage_ProportionalOutput();
1449
1450 /**
1451 * \brief Proportional output of PID controller when PID'ing under a
1452 * TorqueCurrent Request
1453 *
1454 * Minimum Value: -13107.2
1455 * Maximum Value: 13107.1
1456 * Default Value: 0
1457 * Units: A
1458 *
1459 * Default Rates:
1460 * CAN: 4.0 Hz
1461 *
1462 * \returns PIDTorqueCurrent_ProportionalOutput Status Signal Value object
1463 */
1464 StatusSignalValue<units::current::ampere_t> &GetPIDTorqueCurrent_ProportionalOutput();
1465
1466 /**
1467 * \brief Integrated Accumulator of PID controller when PID'ing under
1468 * a DutyCycle Request
1469 *
1470 * Minimum Value: -128.0
1471 * Maximum Value: 127.9990234375
1472 * Default Value: 0
1473 * Units: fractional
1474 *
1475 * Default Rates:
1476 * CAN: 4.0 Hz
1477 *
1478 * \returns PIDDutyCycle_IntegratedAccum Status Signal Value object
1479 */
1480 StatusSignalValue<units::dimensionless::scalar_t> &GetPIDDutyCycle_IntegratedAccum();
1481
1482 /**
1483 * \brief Integrated Accumulator of PID controller when PID'ing under
1484 * a Voltage Request
1485 *
1486 * Minimum Value: -1310.72
1487 * Maximum Value: 1310.71
1488 * Default Value: 0
1489 * Units: V
1490 *
1491 * Default Rates:
1492 * CAN: 4.0 Hz
1493 *
1494 * \returns PIDMotorVoltage_IntegratedAccum Status Signal Value object
1495 */
1496 StatusSignalValue<units::voltage::volt_t> &GetPIDMotorVoltage_IntegratedAccum();
1497
1498 /**
1499 * \brief Integrated Accumulator of PID controller when PID'ing under
1500 * a TorqueCurrent Request
1501 *
1502 * Minimum Value: -13107.2
1503 * Maximum Value: 13107.1
1504 * Default Value: 0
1505 * Units: A
1506 *
1507 * Default Rates:
1508 * CAN: 4.0 Hz
1509 *
1510 * \returns PIDTorqueCurrent_IntegratedAccum Status Signal Value object
1511 */
1512 StatusSignalValue<units::current::ampere_t> &GetPIDTorqueCurrent_IntegratedAccum();
1513
1514 /**
1515 * \brief Feedforward passed to PID controller
1516 *
1517 * Minimum Value: -2.0
1518 * Maximum Value: 1.9990234375
1519 * Default Value: 0
1520 * Units: fractional
1521 *
1522 * Default Rates:
1523 * CAN: 4.0 Hz
1524 *
1525 * \returns PIDDutyCycle_FeedForward Status Signal Value object
1526 */
1527 StatusSignalValue<units::dimensionless::scalar_t> &GetPIDDutyCycle_FeedForward();
1528
1529 /**
1530 * \brief Feedforward passed to PID controller
1531 *
1532 * Minimum Value: -20.48
1533 * Maximum Value: 20.47
1534 * Default Value: 0
1535 * Units: V
1536 *
1537 * Default Rates:
1538 * CAN: 4.0 Hz
1539 *
1540 * \returns PIDMotorVoltage_FeedForward Status Signal Value object
1541 */
1542 StatusSignalValue<units::voltage::volt_t> &GetPIDMotorVoltage_FeedForward();
1543
1544 /**
1545 * \brief Feedforward passed to PID controller
1546 *
1547 * Minimum Value: -409.6
1548 * Maximum Value: 409.40000000000003
1549 * Default Value: 0
1550 * Units: A
1551 *
1552 * Default Rates:
1553 * CAN: 4.0 Hz
1554 *
1555 * \returns PIDTorqueCurrent_FeedForward Status Signal Value object
1556 */
1557 StatusSignalValue<units::current::ampere_t> &GetPIDTorqueCurrent_FeedForward();
1558
1559 /**
1560 * \brief Derivative Output of PID controller when PID'ing under a
1561 * DutyCycle Request
1562 *
1563 * Minimum Value: -128.0
1564 * Maximum Value: 127.9990234375
1565 * Default Value: 0
1566 * Units: fractional
1567 *
1568 * Default Rates:
1569 * CAN: 4.0 Hz
1570 *
1571 * \returns PIDDutyCycle_DerivativeOutput Status Signal Value object
1572 */
1573 StatusSignalValue<units::dimensionless::scalar_t> &GetPIDDutyCycle_DerivativeOutput();
1574
1575 /**
1576 * \brief Derivative Output of PID controller when PID'ing under a
1577 * Voltage Request
1578 *
1579 * Minimum Value: -1310.72
1580 * Maximum Value: 1310.71
1581 * Default Value: 0
1582 * Units: V
1583 *
1584 * Default Rates:
1585 * CAN: 4.0 Hz
1586 *
1587 * \returns PIDMotorVoltage_DerivativeOutput Status Signal Value object
1588 */
1589 StatusSignalValue<units::voltage::volt_t> &GetPIDMotorVoltage_DerivativeOutput();
1590
1591 /**
1592 * \brief Derivative Output of PID controller when PID'ing under a
1593 * TorqueCurrent Request
1594 *
1595 * Minimum Value: -13107.2
1596 * Maximum Value: 13107.1
1597 * Default Value: 0
1598 * Units: A
1599 *
1600 * Default Rates:
1601 * CAN: 4.0 Hz
1602 *
1603 * \returns PIDTorqueCurrent_DerivativeOutput Status Signal Value object
1604 */
1605 StatusSignalValue<units::current::ampere_t> &GetPIDTorqueCurrent_DerivativeOutput();
1606
1607 /**
1608 * \brief Output of PID controller when PID'ing under a DutyCycle
1609 * Request
1610 *
1611 * Minimum Value: -128.0
1612 * Maximum Value: 127.9990234375
1613 * Default Value: 0
1614 * Units: fractional
1615 *
1616 * Default Rates:
1617 * CAN: 4.0 Hz
1618 *
1619 * \returns PIDDutyCycle_Output Status Signal Value object
1620 */
1621 StatusSignalValue<units::dimensionless::scalar_t> &GetPIDDutyCycle_Output();
1622
1623 /**
1624 * \brief Output of PID controller when PID'ing under a Voltage
1625 * Request
1626 *
1627 * Minimum Value: -1310.72
1628 * Maximum Value: 1310.71
1629 * Default Value: 0
1630 * Units: V
1631 *
1632 * Default Rates:
1633 * CAN: 4.0 Hz
1634 *
1635 * \returns PIDMotorVoltage_Output Status Signal Value object
1636 */
1637 StatusSignalValue<units::voltage::volt_t> &GetPIDMotorVoltage_Output();
1638
1639 /**
1640 * \brief Output of PID controller when PID'ing under a TorqueCurrent
1641 * Request
1642 *
1643 * Minimum Value: -13107.2
1644 * Maximum Value: 13107.1
1645 * Default Value: 0
1646 * Units: A
1647 *
1648 * Default Rates:
1649 * CAN: 4.0 Hz
1650 *
1651 * \returns PIDTorqueCurrent_Output Status Signal Value object
1652 */
1653 StatusSignalValue<units::current::ampere_t> &GetPIDTorqueCurrent_Output();
1654
1655 /**
1656 * \brief Input position of PID controller when PID'ing to a position
1657 *
1658 * Minimum Value: -10000
1659 * Maximum Value: 10000
1660 * Default Value: 0
1661 * Units: rotations
1662 *
1663 * Default Rates:
1664 * CAN: 4.0 Hz
1665 *
1666 * \returns PIDPosition_Reference Status Signal Value object
1667 */
1668 StatusSignalValue<units::angle::turn_t> &GetPIDPosition_Reference();
1669
1670 /**
1671 * \brief Input velocity of PID controller when PID'ing to a velocity
1672 *
1673 * Minimum Value: -10000
1674 * Maximum Value: 10000
1675 * Default Value: 0
1676 * Units: rotations per second
1677 *
1678 * Default Rates:
1679 * CAN: 4.0 Hz
1680 *
1681 * \returns PIDVelocity_Reference Status Signal Value object
1682 */
1684
1685 /**
1686 * \brief Change in input (velocity) of PID controller when PID'ing to
1687 * a position
1688 *
1689 * Minimum Value: -512.0
1690 * Maximum Value: 511.984375
1691 * Default Value: 0
1692 * Units: rotations per second
1693 *
1694 * Default Rates:
1695 * CAN: 4.0 Hz
1696 *
1697 * \returns PIDPosition_ReferenceSlope Status Signal Value object
1698 */
1700
1701 /**
1702 * \brief Change in input (acceleration) of PID controller when
1703 * PID'ing to a velocity
1704 *
1705 * Minimum Value: -512.0
1706 * Maximum Value: 511.984375
1707 * Default Value: 0
1708 * Units: rotations per second²
1709 *
1710 * Default Rates:
1711 * CAN: 4.0 Hz
1712 *
1713 * \returns PIDVelocity_ReferenceSlope Status Signal Value object
1714 */
1716
1717 /**
1718 * \brief The difference between target position and current position
1719 *
1720 * Minimum Value: -10000
1721 * Maximum Value: 10000
1722 * Default Value: 0
1723 * Units: rotations
1724 *
1725 * Default Rates:
1726 * CAN: 4.0 Hz
1727 *
1728 * \returns PIDPosition_ClosedLoopError Status Signal Value object
1729 */
1730 StatusSignalValue<units::angle::turn_t> &GetPIDPosition_ClosedLoopError();
1731
1732 /**
1733 * \brief The difference between target velocity and current velocity
1734 *
1735 * Minimum Value: -10000
1736 * Maximum Value: 10000
1737 * Default Value: 0
1738 * Units: rotations per second
1739 *
1740 * Default Rates:
1741 * CAN: 4.0 Hz
1742 *
1743 * \returns PIDVelocity_ClosedLoopError Status Signal Value object
1744 */
1746public:
1747 /**
1748 * Constructs a new Talon FX motor controller object.
1749 *
1750 * \param deviceId ID of the device, as configured in Phoenix Tuner.
1751 * \param canbus Name of the CAN bus this device is on. Possible CAN bus strings are:
1752 * - "rio" for the native roboRIO CAN bus
1753 * - CANivore name or serial number
1754 * - SocketCAN interface (non-FRC Linux only)
1755 * - "*" for any CANivore seen by the program
1756 * - empty string (default) to select the default for the system:
1757 * - "rio" on roboRIO
1758 * - "can0" on Linux
1759 * - "*" on Windows
1760 */
1761 CoreTalonFX(int deviceId, std::string canbus = "");
1762
1763 CoreTalonFX(CoreTalonFX const &) = delete;
1765
1766 /**
1767 * \returns true if device has reset since the previous call of this routine.
1768 */
1770
1771 /**
1772 * \brief Gets the configurator for this TalonFX
1773 *
1774 * \details Gets the configurator for this TalonFX
1775 *
1776 * \returns Configurator for this TalonFX
1777 */
1779 {
1780 return _configs;
1781 }
1782
1783 /**
1784 * \brief Gets the configurator for this TalonFX
1785 *
1786 * \details Gets the configurator for this TalonFX
1787 *
1788 * \returns Configurator for this TalonFX
1789 */
1791 {
1792 return _configs;
1793 }
1794
1795
1796private:
1797 std::unique_ptr<sim::TalonFXSimState> _simState{};
1798public:
1799 /**
1800 * \brief Get the simulation state for this device.
1801 *
1802 * \details This function reuses an allocated simulation
1803 * state object, so it is safe to call this function multiple
1804 * times in a robot loop.
1805 *
1806 * \returns Simulation state
1807 */
1809 {
1810 if (_simState == nullptr)
1811 _simState = std::make_unique<sim::TalonFXSimState>(*this);
1812 return *_simState;
1813 }
1814
1815
1816
1817 /**
1818 * \brief App Major Version number.
1819 *
1820 * Minimum Value: 0
1821 * Maximum Value: 255
1822 * Default Value: 0
1823 * Units:
1824 *
1825 * Default Rates:
1826 * CAN: 4.0 Hz
1827 *
1828 * \returns VersionMajor Status Signal Value object
1829 */
1831
1832 /**
1833 * \brief App Minor Version number.
1834 *
1835 * Minimum Value: 0
1836 * Maximum Value: 255
1837 * Default Value: 0
1838 * Units:
1839 *
1840 * Default Rates:
1841 * CAN: 4.0 Hz
1842 *
1843 * \returns VersionMinor Status Signal Value object
1844 */
1846
1847 /**
1848 * \brief App Bugfix Version number.
1849 *
1850 * Minimum Value: 0
1851 * Maximum Value: 255
1852 * Default Value: 0
1853 * Units:
1854 *
1855 * Default Rates:
1856 * CAN: 4.0 Hz
1857 *
1858 * \returns VersionBugfix Status Signal Value object
1859 */
1861
1862 /**
1863 * \brief App Build Version number.
1864 *
1865 * Minimum Value: 0
1866 * Maximum Value: 255
1867 * Default Value: 0
1868 * Units:
1869 *
1870 * Default Rates:
1871 * CAN: 4.0 Hz
1872 *
1873 * \returns VersionBuild Status Signal Value object
1874 */
1876
1877 /**
1878 * \brief Full Version. The format is a four byte value.
1879 *
1880 * \details Full Version of firmware in device. The format is a four
1881 * byte value.
1882 *
1883 * Minimum Value: 0
1884 * Maximum Value: 4294967295
1885 * Default Value: 0
1886 * Units:
1887 *
1888 * Default Rates:
1889 * CAN: 4.0 Hz
1890 *
1891 * \returns Version Status Signal Value object
1892 */
1894
1895 /**
1896 * \brief Integer representing all faults
1897 *
1898 * \details This returns the fault flags reported by the device. These
1899 * are device specific and are not used directly in typical
1900 * applications. Use the signal specific GetFault_*() methods instead.
1901 *
1902 *
1903 * Minimum Value: 0
1904 * Maximum Value: 1048575
1905 * Default Value: 0
1906 * Units:
1907 *
1908 * Default Rates:
1909 * CAN: 4.0 Hz
1910 *
1911 * \returns FaultField Status Signal Value object
1912 */
1914
1915 /**
1916 * \brief Integer representing all sticky faults
1917 *
1918 * \details This returns the persistent "sticky" fault flags reported
1919 * by the device. These are device specific and are not used directly
1920 * in typical applications. Use the signal specific GetStickyFault_*()
1921 * methods instead.
1922 *
1923 * Minimum Value: 0
1924 * Maximum Value: 1048575
1925 * Default Value: 0
1926 * Units:
1927 *
1928 * Default Rates:
1929 * CAN: 4.0 Hz
1930 *
1931 * \returns StickyFaultField Status Signal Value object
1932 */
1934
1935 /**
1936 * \brief Forward Limit Pin.
1937 *
1938 *
1939 * Default Rates:
1940 * CAN: 100.0 Hz
1941 *
1942 * \returns ForwardLimit Status Signal Value object
1943 */
1945
1946 /**
1947 * \brief Reverse Limit Pin.
1948 *
1949 *
1950 * Default Rates:
1951 * CAN: 100.0 Hz
1952 *
1953 * \returns ReverseLimit Status Signal Value object
1954 */
1956
1957 /**
1958 * \brief The applied rotor polarity. This typically is determined by
1959 * the Inverted config, but can be overridden if using Follower
1960 * features.
1961 *
1962 *
1963 * Default Rates:
1964 * CAN: 100.0 Hz
1965 *
1966 * \returns AppliedRotorPolarity Status Signal Value object
1967 */
1969
1970 /**
1971 * \brief The applied motor duty cycle.
1972 *
1973 * Minimum Value: -2.0
1974 * Maximum Value: 1.9990234375
1975 * Default Value: 0
1976 * Units: fractional
1977 *
1978 * Default Rates:
1979 * CAN: 100.0 Hz
1980 *
1981 * \returns DutyCycle Status Signal Value object
1982 */
1984
1985 /**
1986 * \brief Current corresponding to the torque output by the motor.
1987 * Similar to StatorCurrent. Users will likely prefer this current to
1988 * calculate the applied torque to the rotor.
1989 *
1990 * \details Stator current where positive current means torque is
1991 * applied in the forward direction as determined by the Inverted
1992 * setting
1993 *
1994 * Minimum Value: -327.68
1995 * Maximum Value: 327.67
1996 * Default Value: 0
1997 * Units: A
1998 *
1999 * Default Rates:
2000 * CAN: 100.0 Hz
2001 *
2002 * \returns TorqueCurrent Status Signal Value object
2003 */
2005
2006 /**
2007 * \brief Current corresponding to the stator windings. Similar to
2008 * TorqueCurrent. Users will likely prefer TorqueCurrent over
2009 * StatorCurrent.
2010 *
2011 * \details Stator current where Positive current indicates motoring
2012 * regardless of direction. Negative current indicates regenerative
2013 * braking regardless of direction.
2014 *
2015 * Minimum Value: -327.68
2016 * Maximum Value: 327.67
2017 * Default Value: 0
2018 * Units: A
2019 *
2020 * Default Rates:
2021 * CAN 2.0: 5.0 Hz
2022 * CAN FD: 100.0 Hz
2023 *
2024 * \returns StatorCurrent Status Signal Value object
2025 */
2027
2028 /**
2029 * \brief Measured supply side current
2030 *
2031 * Minimum Value: -327.68
2032 * Maximum Value: 327.67
2033 * Default Value: 0
2034 * Units: A
2035 *
2036 * Default Rates:
2037 * CAN 2.0: 5.0 Hz
2038 * CAN FD: 100.0 Hz
2039 *
2040 * \returns SupplyCurrent Status Signal Value object
2041 */
2043
2044 /**
2045 * \brief Measured supply voltage to the TalonFX.
2046 *
2047 * Minimum Value: 4.0
2048 * Maximum Value: 16.75
2049 * Default Value: 4
2050 * Units: V
2051 *
2052 * Default Rates:
2053 * CAN 2.0: 5.0 Hz
2054 * CAN FD: 100.0 Hz
2055 *
2056 * \returns SupplyVoltage Status Signal Value object
2057 */
2059
2060 /**
2061 * \brief Temperature of device
2062 *
2063 * \details This is the temperature that the device measures itself to
2064 * be at. Similar to Processor Temperature.
2065 *
2066 * Minimum Value: 0.0
2067 * Maximum Value: 255.0
2068 * Default Value: 0
2069 * Units: ℃
2070 *
2071 * Default Rates:
2072 * CAN 2.0: 5.0 Hz
2073 * CAN FD: 100.0 Hz
2074 *
2075 * \returns DeviceTemp Status Signal Value object
2076 */
2078
2079 /**
2080 * \brief Temperature of the processor
2081 *
2082 * \details This is the temperature that the processor measures itself
2083 * to be at. Similar to Device Temperature.
2084 *
2085 * Minimum Value: 0.0
2086 * Maximum Value: 255.0
2087 * Default Value: 0
2088 * Units: ℃
2089 *
2090 * Default Rates:
2091 * CAN 2.0: 5.0 Hz
2092 * CAN FD: 100.0 Hz
2093 *
2094 * \returns ProcessorTemp Status Signal Value object
2095 */
2097
2098 /**
2099 * \brief Velocity of motor rotor.
2100 *
2101 * Minimum Value: -512.0
2102 * Maximum Value: 511.998046875
2103 * Default Value: 0
2104 * Units: rotations per second
2105 *
2106 * Default Rates:
2107 * CAN 2.0: 5.0 Hz
2108 * CAN FD: 100.0 Hz
2109 *
2110 * \returns RotorVelocity Status Signal Value object
2111 */
2113
2114 /**
2115 * \brief Position of motor rotor.
2116 *
2117 * Minimum Value: -16384.0
2118 * Maximum Value: 16383.999755859375
2119 * Default Value: 0
2120 * Units: rotations
2121 *
2122 * Default Rates:
2123 * CAN 2.0: 5.0 Hz
2124 * CAN FD: 100.0 Hz
2125 *
2126 * \returns RotorPosition Status Signal Value object
2127 */
2129
2130 /**
2131 * \brief Velocity of device.
2132 *
2133 * Minimum Value: -512.0
2134 * Maximum Value: 511.998046875
2135 * Default Value: 0
2136 * Units: rotations per second
2137 *
2138 * Default Rates:
2139 * CAN 2.0: 50.0 Hz
2140 * CAN FD: 100.0 Hz
2141 *
2142 * \returns Velocity Status Signal Value object
2143 */
2145
2146 /**
2147 * \brief Position of device.
2148 *
2149 * Minimum Value: -16384.0
2150 * Maximum Value: 16383.999755859375
2151 * Default Value: 0
2152 * Units: rotations
2153 *
2154 * Default Rates:
2155 * CAN 2.0: 50.0 Hz
2156 * CAN FD: 100.0 Hz
2157 *
2158 * \returns Position Status Signal Value object
2159 */
2161
2162 /**
2163 * \brief The active control mode of the motor controller
2164 *
2165 *
2166 * Default Rates:
2167 * CAN 2.0: 5.0 Hz
2168 * CAN FD: 100.0 Hz
2169 *
2170 * \returns ControlMode Status Signal Value object
2171 */
2173
2174 /**
2175 * \brief Check if Motion Magic® is running. This is equivalent to
2176 * checking that the reported control mode is a Motion Magic® based
2177 * mode.
2178 *
2179 *
2180 * Default Rates:
2181 * CAN 2.0: 5.0 Hz
2182 * CAN FD: 100.0 Hz
2183 *
2184 * \returns MotionMagicIsRunning Status Signal Value object
2185 */
2187
2188 /**
2189 * \brief Indicates if device is actuator enabled.
2190 *
2191 *
2192 * Default Rates:
2193 * CAN 2.0: 5.0 Hz
2194 * CAN FD: 100.0 Hz
2195 *
2196 * \returns DeviceEnable Status Signal Value object
2197 */
2199
2200 /**
2201 * \brief Closed loop slot in use
2202 *
2203 * \details This is the slot that the closed loop PID is using.
2204 *
2205 * Minimum Value: 0
2206 * Maximum Value: 2
2207 * Default Value: 0
2208 * Units:
2209 *
2210 * Default Rates:
2211 * CAN 2.0: 5.0 Hz
2212 * CAN FD: 100.0 Hz
2213 *
2214 * \returns ClosedLoopSlot Status Signal Value object
2215 */
2217
2218 /**
2219 * \brief The applied output of the bridge.
2220 *
2221 *
2222 * Default Rates:
2223 * CAN: 100.0 Hz
2224 *
2225 * \returns BridgeOuput Status Signal Value object
2226 */
2228
2229 /**
2230 * \brief Hardware fault occurred
2231 *
2232 * Default Value: False
2233 *
2234 * Default Rates:
2235 * CAN: 4.0 Hz
2236 *
2237 * \returns Fault_Hardware Status Signal Value object
2238 */
2240
2241 /**
2242 * \brief Hardware fault occurred
2243 *
2244 * Default Value: False
2245 *
2246 * Default Rates:
2247 * CAN: 4.0 Hz
2248 *
2249 * \returns StickyFault_Hardware Status Signal Value object
2250 */
2252
2253 /**
2254 * \brief Processor temperature exceeded limit
2255 *
2256 * Default Value: False
2257 *
2258 * Default Rates:
2259 * CAN: 4.0 Hz
2260 *
2261 * \returns Fault_ProcTemp Status Signal Value object
2262 */
2264
2265 /**
2266 * \brief Processor temperature exceeded limit
2267 *
2268 * Default Value: False
2269 *
2270 * Default Rates:
2271 * CAN: 4.0 Hz
2272 *
2273 * \returns StickyFault_ProcTemp Status Signal Value object
2274 */
2276
2277 /**
2278 * \brief Device temperature exceeded limit
2279 *
2280 * Default Value: False
2281 *
2282 * Default Rates:
2283 * CAN: 4.0 Hz
2284 *
2285 * \returns Fault_DeviceTemp Status Signal Value object
2286 */
2288
2289 /**
2290 * \brief Device temperature exceeded limit
2291 *
2292 * Default Value: False
2293 *
2294 * Default Rates:
2295 * CAN: 4.0 Hz
2296 *
2297 * \returns StickyFault_DeviceTemp Status Signal Value object
2298 */
2300
2301 /**
2302 * \brief Device supply voltage dropped to near brownout levels
2303 *
2304 * Default Value: False
2305 *
2306 * Default Rates:
2307 * CAN: 4.0 Hz
2308 *
2309 * \returns Fault_Undervoltage Status Signal Value object
2310 */
2312
2313 /**
2314 * \brief Device supply voltage dropped to near brownout levels
2315 *
2316 * Default Value: False
2317 *
2318 * Default Rates:
2319 * CAN: 4.0 Hz
2320 *
2321 * \returns StickyFault_Undervoltage Status Signal Value object
2322 */
2324
2325 /**
2326 * \brief Device boot while detecting the enable signal
2327 *
2328 * Default Value: False
2329 *
2330 * Default Rates:
2331 * CAN: 4.0 Hz
2332 *
2333 * \returns Fault_BootDuringEnable Status Signal Value object
2334 */
2336
2337 /**
2338 * \brief Device boot while detecting the enable signal
2339 *
2340 * Default Value: False
2341 *
2342 * Default Rates:
2343 * CAN: 4.0 Hz
2344 *
2345 * \returns StickyFault_BootDuringEnable Status Signal Value object
2346 */
2348
2349 /**
2350 * \brief Supply Voltage has exceeded the maximum voltage rating of
2351 * device.
2352 *
2353 * Default Value: False
2354 *
2355 * Default Rates:
2356 * CAN: 4.0 Hz
2357 *
2358 * \returns Fault_OverSupplyV Status Signal Value object
2359 */
2361
2362 /**
2363 * \brief Supply Voltage has exceeded the maximum voltage rating of
2364 * device.
2365 *
2366 * Default Value: False
2367 *
2368 * Default Rates:
2369 * CAN: 4.0 Hz
2370 *
2371 * \returns StickyFault_OverSupplyV Status Signal Value object
2372 */
2374
2375 /**
2376 * \brief Supply Voltage is unstable. Ensure you are using a battery
2377 * and current limited power supply.
2378 *
2379 * Default Value: False
2380 *
2381 * Default Rates:
2382 * CAN: 4.0 Hz
2383 *
2384 * \returns Fault_UnstableSupplyV Status Signal Value object
2385 */
2387
2388 /**
2389 * \brief Supply Voltage is unstable. Ensure you are using a battery
2390 * and current limited power supply.
2391 *
2392 * Default Value: False
2393 *
2394 * Default Rates:
2395 * CAN: 4.0 Hz
2396 *
2397 * \returns StickyFault_UnstableSupplyV Status Signal Value object
2398 */
2400
2401 /**
2402 * \brief Reverse limit switch has been asserted. Output is set to
2403 * neutral.
2404 *
2405 * Default Value: False
2406 *
2407 * Default Rates:
2408 * CAN: 4.0 Hz
2409 *
2410 * \returns Fault_ReverseHardLimit Status Signal Value object
2411 */
2413
2414 /**
2415 * \brief Reverse limit switch has been asserted. Output is set to
2416 * neutral.
2417 *
2418 * Default Value: False
2419 *
2420 * Default Rates:
2421 * CAN: 4.0 Hz
2422 *
2423 * \returns StickyFault_ReverseHardLimit Status Signal Value object
2424 */
2426
2427 /**
2428 * \brief Forward limit switch has been asserted. Output is set to
2429 * neutral.
2430 *
2431 * Default Value: False
2432 *
2433 * Default Rates:
2434 * CAN: 4.0 Hz
2435 *
2436 * \returns Fault_ForwardHardLimit Status Signal Value object
2437 */
2439
2440 /**
2441 * \brief Forward limit switch has been asserted. Output is set to
2442 * neutral.
2443 *
2444 * Default Value: False
2445 *
2446 * Default Rates:
2447 * CAN: 4.0 Hz
2448 *
2449 * \returns StickyFault_ForwardHardLimit Status Signal Value object
2450 */
2452
2453 /**
2454 * \brief Reverse soft limit has been asserted. Output is set to
2455 * neutral.
2456 *
2457 * Default Value: False
2458 *
2459 * Default Rates:
2460 * CAN: 4.0 Hz
2461 *
2462 * \returns Fault_ReverseSoftLimit Status Signal Value object
2463 */
2465
2466 /**
2467 * \brief Reverse soft limit has been asserted. Output is set to
2468 * neutral.
2469 *
2470 * Default Value: False
2471 *
2472 * Default Rates:
2473 * CAN: 4.0 Hz
2474 *
2475 * \returns StickyFault_ReverseSoftLimit Status Signal Value object
2476 */
2478
2479 /**
2480 * \brief Forward soft limit has been asserted. Output is set to
2481 * neutral.
2482 *
2483 * Default Value: False
2484 *
2485 * Default Rates:
2486 * CAN: 4.0 Hz
2487 *
2488 * \returns Fault_ForwardSoftLimit Status Signal Value object
2489 */
2491
2492 /**
2493 * \brief Forward soft limit has been asserted. Output is set to
2494 * neutral.
2495 *
2496 * Default Value: False
2497 *
2498 * Default Rates:
2499 * CAN: 4.0 Hz
2500 *
2501 * \returns StickyFault_ForwardSoftLimit Status Signal Value object
2502 */
2504
2505 /**
2506 * \brief The remote sensor is not present on CAN Bus.
2507 *
2508 * Default Value: False
2509 *
2510 * Default Rates:
2511 * CAN: 4.0 Hz
2512 *
2513 * \returns Fault_MissingRemoteSensor Status Signal Value object
2514 */
2516
2517 /**
2518 * \brief The remote sensor is not present on CAN Bus.
2519 *
2520 * Default Value: False
2521 *
2522 * Default Rates:
2523 * CAN: 4.0 Hz
2524 *
2525 * \returns StickyFault_MissingRemoteSensor Status Signal Value object
2526 */
2528
2529 /**
2530 * \brief The remote sensor used for fusion has fallen out of sync to
2531 * the local sensor. A re-synchronization has occurred, which may
2532 * cause a discontinuity. This typically happens if there is
2533 * significant slop in the mechanism, or if the RotorToSensorRatio
2534 * configuration parameter is incorrect.
2535 *
2536 * Default Value: False
2537 *
2538 * Default Rates:
2539 * CAN: 4.0 Hz
2540 *
2541 * \returns Fault_FusedSensorOutOfSync Status Signal Value object
2542 */
2544
2545 /**
2546 * \brief The remote sensor used for fusion has fallen out of sync to
2547 * the local sensor. A re-synchronization has occurred, which may
2548 * cause a discontinuity. This typically happens if there is
2549 * significant slop in the mechanism, or if the RotorToSensorRatio
2550 * configuration parameter is incorrect.
2551 *
2552 * Default Value: False
2553 *
2554 * Default Rates:
2555 * CAN: 4.0 Hz
2556 *
2557 * \returns StickyFault_FusedSensorOutOfSync Status Signal Value object
2558 */
2560
2561 /**
2562 * \brief Stator current limit occured.
2563 *
2564 * Default Value: False
2565 *
2566 * Default Rates:
2567 * CAN: 4.0 Hz
2568 *
2569 * \returns Fault_StatorCurrLimit Status Signal Value object
2570 */
2572
2573 /**
2574 * \brief Stator current limit occured.
2575 *
2576 * Default Value: False
2577 *
2578 * Default Rates:
2579 * CAN: 4.0 Hz
2580 *
2581 * \returns StickyFault_StatorCurrLimit Status Signal Value object
2582 */
2584
2585 /**
2586 * \brief Supply current limit occured.
2587 *
2588 * Default Value: False
2589 *
2590 * Default Rates:
2591 * CAN: 4.0 Hz
2592 *
2593 * \returns Fault_SupplyCurrLimit Status Signal Value object
2594 */
2596
2597 /**
2598 * \brief Supply current limit occured.
2599 *
2600 * Default Value: False
2601 *
2602 * Default Rates:
2603 * CAN: 4.0 Hz
2604 *
2605 * \returns StickyFault_SupplyCurrLimit Status Signal Value object
2606 */
2608
2609 /**
2610 * \brief Closed loop proportional component
2611 *
2612 * \details The portion of the closed loop output that is the
2613 * proportional to the error. Alternatively, the p-Contribution of the
2614 * closed loop output.
2615 *
2616 * Default Rates:
2617 * CAN 2.0: 5.0 Hz
2618 * CAN FD: 100.0 Hz
2619 *
2620 * \returns ClosedLoopProportionalOutput Status Signal Value object
2621 */
2623
2624 /**
2625 * \brief Closed loop integrated component
2626 *
2627 * \details The portion of the closed loop output that is proportional
2628 * to the integrated error. Alternatively, the i-Contribution of the
2629 * closed loop output.
2630 *
2631 * Default Rates:
2632 * CAN 2.0: 5.0 Hz
2633 * CAN FD: 100.0 Hz
2634 *
2635 * \returns ClosedLoopIntegratedOutput Status Signal Value object
2636 */
2638
2639 /**
2640 * \brief Feed Forward passed by the user
2641 *
2642 * \details This is the general feed forward that the user provides
2643 * for the closed loop.
2644 *
2645 * Default Rates:
2646 * CAN 2.0: 5.0 Hz
2647 * CAN FD: 100.0 Hz
2648 *
2649 * \returns ClosedLoopFeedForward Status Signal Value object
2650 */
2652
2653 /**
2654 * \brief Closed loop derivative component
2655 *
2656 * \details The portion of the closed loop output that is the
2657 * proportional to the deriviative the error. Alternatively, the
2658 * d-Contribution of the closed loop output.
2659 *
2660 * Default Rates:
2661 * CAN 2.0: 5.0 Hz
2662 * CAN FD: 100.0 Hz
2663 *
2664 * \returns ClosedLoopDerivativeOutput Status Signal Value object
2665 */
2667
2668 /**
2669 * \brief Closed loop total output
2670 *
2671 * \details The total output of the closed loop output.
2672 *
2673 * Default Rates:
2674 * CAN 2.0: 5.0 Hz
2675 * CAN FD: 100.0 Hz
2676 *
2677 * \returns ClosedLoopOutput Status Signal Value object
2678 */
2680
2681 /**
2682 * \brief Value that the closed loop is targeting
2683 *
2684 * \details This is the value that the closed loop PID controller
2685 * targets.
2686 *
2687 * Default Rates:
2688 * CAN 2.0: 5.0 Hz
2689 * CAN FD: 100.0 Hz
2690 *
2691 * \returns ClosedLoopReference Status Signal Value object
2692 */
2694
2695 /**
2696 * \brief Derivative of the target that the closed loop is targeting
2697 *
2698 * \details This is the change in the closed loop reference. This may
2699 * be used in the feed-forward calculation, the derivative-error, or
2700 * in application of the signage for kS. Typically, this represents
2701 * the target velocity during Motion Magic®.
2702 *
2703 * Default Rates:
2704 * CAN 2.0: 5.0 Hz
2705 * CAN FD: 100.0 Hz
2706 *
2707 * \returns ClosedLoopReferenceSlope Status Signal Value object
2708 */
2710
2711 /**
2712 * \brief The difference between target reference and current
2713 * measurement
2714 *
2715 * \details This is the value that is treated as the error in the PID
2716 * loop.
2717 *
2718 * Default Rates:
2719 * CAN 2.0: 5.0 Hz
2720 * CAN FD: 100.0 Hz
2721 *
2722 * \returns ClosedLoopError Status Signal Value object
2723 */
2725
2726
2727 /**
2728 * \brief Request a specified motor duty cycle.
2729 *
2730 * \details This control mode will output a proportion of the supplied
2731 * voltage which is supplied by the user.
2732 *
2733 * DutyCycleOut Parameters:
2734 * Output: Proportion of supply voltage to apply in fractional units between -1
2735 * and +1
2736 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
2737 * ~15%. Set to false to use trapezoidal commutation. FOC improves
2738 * motor performance by leveraging torque (current) control. However,
2739 * this may be inconvenient for applications that require specifying
2740 * duty cycle or voltage. CTR-Electronics has developed a hybrid
2741 * method that combines the performances gains of FOC while still
2742 * allowing applications to provide duty cycle or voltage demand.
2743 * This not to be confused with simple sinusoidal control or phase
2744 * voltage control which lacks the performance gains.
2745 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
2746 * zero (or within deadband). Set to false to use the
2747 * NeutralMode configuration setting (default). This
2748 * flag exists to provide the fundamental behavior of
2749 * this control when output is zero, which is to provide
2750 * 0V to the motor.
2751 *
2752 * \param request Control object to request of the device
2753 * \returns Status Code of the request, 0 is OK
2754 */
2755 ctre::phoenix::StatusCode SetControl(controls::DutyCycleOut& request);
2756 /**
2757 * \brief Request a specified motor duty cycle.
2758 *
2759 * \details This control mode will output a proportion of the supplied
2760 * voltage which is supplied by the user.
2761 *
2762 * DutyCycleOut Parameters:
2763 * Output: Proportion of supply voltage to apply in fractional units between -1
2764 * and +1
2765 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
2766 * ~15%. Set to false to use trapezoidal commutation. FOC improves
2767 * motor performance by leveraging torque (current) control. However,
2768 * this may be inconvenient for applications that require specifying
2769 * duty cycle or voltage. CTR-Electronics has developed a hybrid
2770 * method that combines the performances gains of FOC while still
2771 * allowing applications to provide duty cycle or voltage demand.
2772 * This not to be confused with simple sinusoidal control or phase
2773 * voltage control which lacks the performance gains.
2774 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
2775 * zero (or within deadband). Set to false to use the
2776 * NeutralMode configuration setting (default). This
2777 * flag exists to provide the fundamental behavior of
2778 * this control when output is zero, which is to provide
2779 * 0V to the motor.
2780 *
2781 * \param request Control object to request of the device
2782 * \returns Status Code of the request, 0 is OK
2783 */
2784 ctre::phoenix::StatusCode SetControl(controls::DutyCycleOut&& request)
2785 {
2786 return SetControl(request);
2787 }
2788
2789 /**
2790 * \brief Request a specified motor current (field oriented control).
2791 *
2792 * \details This control request will drive the motor to the requested
2793 * motor (stator) current value. This leverages field oriented
2794 * control (FOC), which means greater peak power than what is
2795 * documented. This scales to torque based on Motor's kT constant.
2796 *
2797 * TorqueCurrentFOC Parameters:
2798 * Output: Amount of motor current in Amperes
2799 * MaxAbsDutyCycle: The maximum absolute motor output that can be applied, which
2800 * effectively limits the velocity. For example, 0.50 means no
2801 * more than 50% output in either direction. This is useful for
2802 * preventing the motor from spinning to its terminal velocity
2803 * when there is no external torque applied unto the rotor.
2804 * Note this is absolute maximum, so the value should be between
2805 * zero and one.
2806 * Deadband: Deadband in Amperes. If torque request is within deadband, the
2807 * bridge output is neutral. If deadband is set to zero then there is
2808 * effectively no deadband. Note if deadband is zero, a free spinning
2809 * motor will spin for quite a while as the firmware attempts to hold
2810 * the motor's bemf. If user expects motor to cease spinning quickly
2811 * with a demand of zero, we recommend a deadband of one Ampere. This
2812 * value will be converted to an integral value of amps.
2813 * OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero
2814 * (or within deadband). Set to false to use the
2815 * NeutralMode configuration setting (default). This
2816 * flag exists to provide the fundamental behavior of
2817 * this control when output is zero, which is to provide
2818 * 0A (zero torque).
2819 *
2820 * \param request Control object to request of the device
2821 * \returns Status Code of the request, 0 is OK
2822 */
2823 ctre::phoenix::StatusCode SetControl(controls::TorqueCurrentFOC& request);
2824 /**
2825 * \brief Request a specified motor current (field oriented control).
2826 *
2827 * \details This control request will drive the motor to the requested
2828 * motor (stator) current value. This leverages field oriented
2829 * control (FOC), which means greater peak power than what is
2830 * documented. This scales to torque based on Motor's kT constant.
2831 *
2832 * TorqueCurrentFOC Parameters:
2833 * Output: Amount of motor current in Amperes
2834 * MaxAbsDutyCycle: The maximum absolute motor output that can be applied, which
2835 * effectively limits the velocity. For example, 0.50 means no
2836 * more than 50% output in either direction. This is useful for
2837 * preventing the motor from spinning to its terminal velocity
2838 * when there is no external torque applied unto the rotor.
2839 * Note this is absolute maximum, so the value should be between
2840 * zero and one.
2841 * Deadband: Deadband in Amperes. If torque request is within deadband, the
2842 * bridge output is neutral. If deadband is set to zero then there is
2843 * effectively no deadband. Note if deadband is zero, a free spinning
2844 * motor will spin for quite a while as the firmware attempts to hold
2845 * the motor's bemf. If user expects motor to cease spinning quickly
2846 * with a demand of zero, we recommend a deadband of one Ampere. This
2847 * value will be converted to an integral value of amps.
2848 * OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero
2849 * (or within deadband). Set to false to use the
2850 * NeutralMode configuration setting (default). This
2851 * flag exists to provide the fundamental behavior of
2852 * this control when output is zero, which is to provide
2853 * 0A (zero torque).
2854 *
2855 * \param request Control object to request of the device
2856 * \returns Status Code of the request, 0 is OK
2857 */
2858 ctre::phoenix::StatusCode SetControl(controls::TorqueCurrentFOC&& request)
2859 {
2860 return SetControl(request);
2861 }
2862
2863 /**
2864 * \brief Request a specified voltage.
2865 *
2866 * \details This control mode will attempt to apply the specified
2867 * voltage to the motor. If the supply voltage is below the requested
2868 * voltage, the motor controller will output the supply voltage.
2869 *
2870 * VoltageOut Parameters:
2871 * Output: Voltage to attempt to drive at
2872 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
2873 * ~15%. Set to false to use trapezoidal commutation. FOC improves
2874 * motor performance by leveraging torque (current) control. However,
2875 * this may be inconvenient for applications that require specifying
2876 * duty cycle or voltage. CTR-Electronics has developed a hybrid
2877 * method that combines the performances gains of FOC while still
2878 * allowing applications to provide duty cycle or voltage demand.
2879 * This not to be confused with simple sinusoidal control or phase
2880 * voltage control which lacks the performance gains.
2881 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
2882 * zero (or within deadband). Set to false to use the
2883 * NeutralMode configuration setting (default). This
2884 * flag exists to provide the fundamental behavior of
2885 * this control when output is zero, which is to provide
2886 * 0V to the motor.
2887 *
2888 * \param request Control object to request of the device
2889 * \returns Status Code of the request, 0 is OK
2890 */
2891 ctre::phoenix::StatusCode SetControl(controls::VoltageOut& request);
2892 /**
2893 * \brief Request a specified voltage.
2894 *
2895 * \details This control mode will attempt to apply the specified
2896 * voltage to the motor. If the supply voltage is below the requested
2897 * voltage, the motor controller will output the supply voltage.
2898 *
2899 * VoltageOut Parameters:
2900 * Output: Voltage to attempt to drive at
2901 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
2902 * ~15%. Set to false to use trapezoidal commutation. FOC improves
2903 * motor performance by leveraging torque (current) control. However,
2904 * this may be inconvenient for applications that require specifying
2905 * duty cycle or voltage. CTR-Electronics has developed a hybrid
2906 * method that combines the performances gains of FOC while still
2907 * allowing applications to provide duty cycle or voltage demand.
2908 * This not to be confused with simple sinusoidal control or phase
2909 * voltage control which lacks the performance gains.
2910 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
2911 * zero (or within deadband). Set to false to use the
2912 * NeutralMode configuration setting (default). This
2913 * flag exists to provide the fundamental behavior of
2914 * this control when output is zero, which is to provide
2915 * 0V to the motor.
2916 *
2917 * \param request Control object to request of the device
2918 * \returns Status Code of the request, 0 is OK
2919 */
2920 ctre::phoenix::StatusCode SetControl(controls::VoltageOut&& request)
2921 {
2922 return SetControl(request);
2923 }
2924
2925 /**
2926 * \brief Request PID to target position with duty cycle feedforward.
2927 *
2928 * \details This control mode will set the motor's position setpoint
2929 * to the position specified by the user. In addition, it will apply
2930 * an additional duty cycle as an arbitrary feedforward value.
2931 *
2932 * PositionDutyCycle Parameters:
2933 * Position: Position to drive toward in rotations.
2934 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
2935 * ~15%. Set to false to use trapezoidal commutation. FOC improves
2936 * motor performance by leveraging torque (current) control. However,
2937 * this may be inconvenient for applications that require specifying
2938 * duty cycle or voltage. CTR-Electronics has developed a hybrid
2939 * method that combines the performances gains of FOC while still
2940 * allowing applications to provide duty cycle or voltage demand.
2941 * This not to be confused with simple sinusoidal control or phase
2942 * voltage control which lacks the performance gains.
2943 * FeedForward: Feedforward to apply in fractional units between -1 and +1.
2944 * Slot: Select which gains are applied by selecting the slot. Use the
2945 * configuration api to set the gain values for the selected slot before
2946 * enabling this feature. Slot must be within [0,2].
2947 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
2948 * zero (or within deadband). Set to false to use the
2949 * NeutralMode configuration setting (default). This
2950 * flag exists to provide the fundamental behavior of
2951 * this control when output is zero, which is to provide
2952 * 0V to the motor.
2953 *
2954 * \param request Control object to request of the device
2955 * \returns Status Code of the request, 0 is OK
2956 */
2957 ctre::phoenix::StatusCode SetControl(controls::PositionDutyCycle& request);
2958 /**
2959 * \brief Request PID to target position with duty cycle feedforward.
2960 *
2961 * \details This control mode will set the motor's position setpoint
2962 * to the position specified by the user. In addition, it will apply
2963 * an additional duty cycle as an arbitrary feedforward value.
2964 *
2965 * PositionDutyCycle Parameters:
2966 * Position: Position to drive toward in rotations.
2967 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
2968 * ~15%. Set to false to use trapezoidal commutation. FOC improves
2969 * motor performance by leveraging torque (current) control. However,
2970 * this may be inconvenient for applications that require specifying
2971 * duty cycle or voltage. CTR-Electronics has developed a hybrid
2972 * method that combines the performances gains of FOC while still
2973 * allowing applications to provide duty cycle or voltage demand.
2974 * This not to be confused with simple sinusoidal control or phase
2975 * voltage control which lacks the performance gains.
2976 * FeedForward: Feedforward to apply in fractional units between -1 and +1.
2977 * Slot: Select which gains are applied by selecting the slot. Use the
2978 * configuration api to set the gain values for the selected slot before
2979 * enabling this feature. Slot must be within [0,2].
2980 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
2981 * zero (or within deadband). Set to false to use the
2982 * NeutralMode configuration setting (default). This
2983 * flag exists to provide the fundamental behavior of
2984 * this control when output is zero, which is to provide
2985 * 0V to the motor.
2986 *
2987 * \param request Control object to request of the device
2988 * \returns Status Code of the request, 0 is OK
2989 */
2990 ctre::phoenix::StatusCode SetControl(controls::PositionDutyCycle&& request)
2991 {
2992 return SetControl(request);
2993 }
2994
2995 /**
2996 * \brief Request PID to target position with voltage feedforward
2997 *
2998 * \details This control mode will set the motor's position setpoint
2999 * to the position specified by the user. In addition, it will apply
3000 * an additional voltage as an arbitrary feedforward value.
3001 *
3002 * PositionVoltage Parameters:
3003 * Position: Position to drive toward in rotations.
3004 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3005 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3006 * motor performance by leveraging torque (current) control. However,
3007 * this may be inconvenient for applications that require specifying
3008 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3009 * method that combines the performances gains of FOC while still
3010 * allowing applications to provide duty cycle or voltage demand.
3011 * This not to be confused with simple sinusoidal control or phase
3012 * voltage control which lacks the performance gains.
3013 * FeedForward: Feedforward to apply in volts
3014 * Slot: Select which gains are applied by selecting the slot. Use the
3015 * configuration api to set the gain values for the selected slot before
3016 * enabling this feature. Slot must be within [0,2].
3017 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3018 * zero (or within deadband). Set to false to use the
3019 * NeutralMode configuration setting (default). This
3020 * flag exists to provide the fundamental behavior of
3021 * this control when output is zero, which is to provide
3022 * 0V to the motor.
3023 *
3024 * \param request Control object to request of the device
3025 * \returns Status Code of the request, 0 is OK
3026 */
3027 ctre::phoenix::StatusCode SetControl(controls::PositionVoltage& request);
3028 /**
3029 * \brief Request PID to target position with voltage feedforward
3030 *
3031 * \details This control mode will set the motor's position setpoint
3032 * to the position specified by the user. In addition, it will apply
3033 * an additional voltage as an arbitrary feedforward value.
3034 *
3035 * PositionVoltage Parameters:
3036 * Position: Position to drive toward in rotations.
3037 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3038 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3039 * motor performance by leveraging torque (current) control. However,
3040 * this may be inconvenient for applications that require specifying
3041 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3042 * method that combines the performances gains of FOC while still
3043 * allowing applications to provide duty cycle or voltage demand.
3044 * This not to be confused with simple sinusoidal control or phase
3045 * voltage control which lacks the performance gains.
3046 * FeedForward: Feedforward to apply in volts
3047 * Slot: Select which gains are applied by selecting the slot. Use the
3048 * configuration api to set the gain values for the selected slot before
3049 * enabling this feature. Slot must be within [0,2].
3050 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3051 * zero (or within deadband). Set to false to use the
3052 * NeutralMode configuration setting (default). This
3053 * flag exists to provide the fundamental behavior of
3054 * this control when output is zero, which is to provide
3055 * 0V to the motor.
3056 *
3057 * \param request Control object to request of the device
3058 * \returns Status Code of the request, 0 is OK
3059 */
3060 ctre::phoenix::StatusCode SetControl(controls::PositionVoltage&& request)
3061 {
3062 return SetControl(request);
3063 }
3064
3065 /**
3066 * \brief Request PID to target position with torque current
3067 * feedforward.
3068 *
3069 * \details This control mode will set the motor's position setpoint
3070 * to the position specified by the user. In addition, it will apply
3071 * an additional torque current as an arbitrary feedforward value.
3072 *
3073 * PositionTorqueCurrentFOC Parameters:
3074 * Position: Position to drive toward in rotations.
3075 * FeedForward: Feedforward to apply in torque current in Amperes. User can use
3076 * motor's kT to scale Newton-meter to Amperes.
3077 * Slot: Select which gains are applied by selecting the slot. Use the
3078 * configuration api to set the gain values for the selected slot before
3079 * enabling this feature. Slot must be within [0,2].
3080 * OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero
3081 * (or within deadband). Set to false to use the
3082 * NeutralMode configuration setting (default). This
3083 * flag exists to provide the fundamental behavior of
3084 * this control when output is zero, which is to provide
3085 * 0A (zero torque).
3086 *
3087 * \param request Control object to request of the device
3088 * \returns Status Code of the request, 0 is OK
3089 */
3090 ctre::phoenix::StatusCode SetControl(controls::PositionTorqueCurrentFOC& request);
3091 /**
3092 * \brief Request PID to target position with torque current
3093 * feedforward.
3094 *
3095 * \details This control mode will set the motor's position setpoint
3096 * to the position specified by the user. In addition, it will apply
3097 * an additional torque current as an arbitrary feedforward value.
3098 *
3099 * PositionTorqueCurrentFOC Parameters:
3100 * Position: Position to drive toward in rotations.
3101 * FeedForward: Feedforward to apply in torque current in Amperes. User can use
3102 * motor's kT to scale Newton-meter to Amperes.
3103 * Slot: Select which gains are applied by selecting the slot. Use the
3104 * configuration api to set the gain values for the selected slot before
3105 * enabling this feature. Slot must be within [0,2].
3106 * OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero
3107 * (or within deadband). Set to false to use the
3108 * NeutralMode configuration setting (default). This
3109 * flag exists to provide the fundamental behavior of
3110 * this control when output is zero, which is to provide
3111 * 0A (zero torque).
3112 *
3113 * \param request Control object to request of the device
3114 * \returns Status Code of the request, 0 is OK
3115 */
3116 ctre::phoenix::StatusCode SetControl(controls::PositionTorqueCurrentFOC&& request)
3117 {
3118 return SetControl(request);
3119 }
3120
3121 /**
3122 * \brief Request PID to target velocity with duty cycle feedforward.
3123 *
3124 * \details This control mode will set the motor's velocity setpoint
3125 * to the velocity specified by the user. In addition, it will apply
3126 * an additional voltage as an arbitrary feedforward value.
3127 *
3128 * VelocityDutyCycle Parameters:
3129 * Velocity: Velocity to drive toward in rotations per second.
3130 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3131 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3132 * motor performance by leveraging torque (current) control. However,
3133 * this may be inconvenient for applications that require specifying
3134 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3135 * method that combines the performances gains of FOC while still
3136 * allowing applications to provide duty cycle or voltage demand.
3137 * This not to be confused with simple sinusoidal control or phase
3138 * voltage control which lacks the performance gains.
3139 * FeedForward: Feedforward to apply in fractional units between -1 and +1.
3140 * Slot: Select which gains are applied by selecting the slot. Use the
3141 * configuration api to set the gain values for the selected slot before
3142 * enabling this feature. Slot must be within [0,2].
3143 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3144 * zero (or within deadband). Set to false to use the
3145 * NeutralMode configuration setting (default). This
3146 * flag exists to provide the fundamental behavior of
3147 * this control when output is zero, which is to provide
3148 * 0V to the motor.
3149 *
3150 * \param request Control object to request of the device
3151 * \returns Status Code of the request, 0 is OK
3152 */
3153 ctre::phoenix::StatusCode SetControl(controls::VelocityDutyCycle& request);
3154 /**
3155 * \brief Request PID to target velocity with duty cycle feedforward.
3156 *
3157 * \details This control mode will set the motor's velocity setpoint
3158 * to the velocity specified by the user. In addition, it will apply
3159 * an additional voltage as an arbitrary feedforward value.
3160 *
3161 * VelocityDutyCycle Parameters:
3162 * Velocity: Velocity to drive toward in rotations per second.
3163 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3164 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3165 * motor performance by leveraging torque (current) control. However,
3166 * this may be inconvenient for applications that require specifying
3167 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3168 * method that combines the performances gains of FOC while still
3169 * allowing applications to provide duty cycle or voltage demand.
3170 * This not to be confused with simple sinusoidal control or phase
3171 * voltage control which lacks the performance gains.
3172 * FeedForward: Feedforward to apply in fractional units between -1 and +1.
3173 * Slot: Select which gains are applied by selecting the slot. Use the
3174 * configuration api to set the gain values for the selected slot before
3175 * enabling this feature. Slot must be within [0,2].
3176 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3177 * zero (or within deadband). Set to false to use the
3178 * NeutralMode configuration setting (default). This
3179 * flag exists to provide the fundamental behavior of
3180 * this control when output is zero, which is to provide
3181 * 0V to the motor.
3182 *
3183 * \param request Control object to request of the device
3184 * \returns Status Code of the request, 0 is OK
3185 */
3186 ctre::phoenix::StatusCode SetControl(controls::VelocityDutyCycle&& request)
3187 {
3188 return SetControl(request);
3189 }
3190
3191 /**
3192 * \brief Request PID to target velocity with voltage feedforward.
3193 *
3194 * \details This control mode will set the motor's velocity setpoint
3195 * to the velocity specified by the user. In addition, it will apply
3196 * an additional voltage as an arbitrary feedforward value.
3197 *
3198 * VelocityVoltage Parameters:
3199 * Velocity: Velocity to drive toward in rotations per second.
3200 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3201 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3202 * motor performance by leveraging torque (current) control. However,
3203 * this may be inconvenient for applications that require specifying
3204 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3205 * method that combines the performances gains of FOC while still
3206 * allowing applications to provide duty cycle or voltage demand.
3207 * This not to be confused with simple sinusoidal control or phase
3208 * voltage control which lacks the performance gains.
3209 * FeedForward: Feedforward to apply in volts
3210 * Slot: Select which gains are applied by selecting the slot. Use the
3211 * configuration api to set the gain values for the selected slot before
3212 * enabling this feature. Slot must be within [0,2].
3213 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3214 * zero (or within deadband). Set to false to use the
3215 * NeutralMode configuration setting (default). This
3216 * flag exists to provide the fundamental behavior of
3217 * this control when output is zero, which is to provide
3218 * 0V to the motor.
3219 *
3220 * \param request Control object to request of the device
3221 * \returns Status Code of the request, 0 is OK
3222 */
3223 ctre::phoenix::StatusCode SetControl(controls::VelocityVoltage& request);
3224 /**
3225 * \brief Request PID to target velocity with voltage feedforward.
3226 *
3227 * \details This control mode will set the motor's velocity setpoint
3228 * to the velocity specified by the user. In addition, it will apply
3229 * an additional voltage as an arbitrary feedforward value.
3230 *
3231 * VelocityVoltage Parameters:
3232 * Velocity: Velocity to drive toward in rotations per second.
3233 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3234 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3235 * motor performance by leveraging torque (current) control. However,
3236 * this may be inconvenient for applications that require specifying
3237 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3238 * method that combines the performances gains of FOC while still
3239 * allowing applications to provide duty cycle or voltage demand.
3240 * This not to be confused with simple sinusoidal control or phase
3241 * voltage control which lacks the performance gains.
3242 * FeedForward: Feedforward to apply in volts
3243 * Slot: Select which gains are applied by selecting the slot. Use the
3244 * configuration api to set the gain values for the selected slot before
3245 * enabling this feature. Slot must be within [0,2].
3246 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3247 * zero (or within deadband). Set to false to use the
3248 * NeutralMode configuration setting (default). This
3249 * flag exists to provide the fundamental behavior of
3250 * this control when output is zero, which is to provide
3251 * 0V to the motor.
3252 *
3253 * \param request Control object to request of the device
3254 * \returns Status Code of the request, 0 is OK
3255 */
3256 ctre::phoenix::StatusCode SetControl(controls::VelocityVoltage&& request)
3257 {
3258 return SetControl(request);
3259 }
3260
3261 /**
3262 * \brief Request PID to target velocity with torque current
3263 * feedforward.
3264 *
3265 * \details This control mode will set the motor's velocity setpoint
3266 * to the velocity specified by the user. In addition, it will apply
3267 * an additional torque current as an arbitrary feedforward value.
3268 *
3269 * VelocityTorqueCurrentFOC Parameters:
3270 * Velocity: Velocity to drive toward in rotations per second.
3271 * FeedForward: Feedforward to apply in torque current in Amperes. User can use
3272 * motor's kT to scale Newton-meter to Amperes.
3273 * Slot: Select which gains are applied by selecting the slot. Use the
3274 * configuration api to set the gain values for the selected slot before
3275 * enabling this feature. Slot must be within [0,2].
3276 * OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero
3277 * (or within deadband). Set to false to use the
3278 * NeutralMode configuration setting (default). This
3279 * flag exists to provide the fundamental behavior of
3280 * this control when output is zero, which is to provide
3281 * 0A (zero torque).
3282 *
3283 * \param request Control object to request of the device
3284 * \returns Status Code of the request, 0 is OK
3285 */
3286 ctre::phoenix::StatusCode SetControl(controls::VelocityTorqueCurrentFOC& request);
3287 /**
3288 * \brief Request PID to target velocity with torque current
3289 * feedforward.
3290 *
3291 * \details This control mode will set the motor's velocity setpoint
3292 * to the velocity specified by the user. In addition, it will apply
3293 * an additional torque current as an arbitrary feedforward value.
3294 *
3295 * VelocityTorqueCurrentFOC Parameters:
3296 * Velocity: Velocity to drive toward in rotations per second.
3297 * FeedForward: Feedforward to apply in torque current in Amperes. User can use
3298 * motor's kT to scale Newton-meter to Amperes.
3299 * Slot: Select which gains are applied by selecting the slot. Use the
3300 * configuration api to set the gain values for the selected slot before
3301 * enabling this feature. Slot must be within [0,2].
3302 * OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero
3303 * (or within deadband). Set to false to use the
3304 * NeutralMode configuration setting (default). This
3305 * flag exists to provide the fundamental behavior of
3306 * this control when output is zero, which is to provide
3307 * 0A (zero torque).
3308 *
3309 * \param request Control object to request of the device
3310 * \returns Status Code of the request, 0 is OK
3311 */
3312 ctre::phoenix::StatusCode SetControl(controls::VelocityTorqueCurrentFOC&& request)
3313 {
3314 return SetControl(request);
3315 }
3316
3317 /**
3318 * \brief Requests Motion Magic® to target a final position using a
3319 * motion profile. Users can optionally provide a duty cycle
3320 * feedforward.
3321 *
3322 * \details Motion Magic® produces a motion profile in real-time while
3323 * attempting to honor the Cruise Velocity, Acceleration, and Jerk
3324 * value specified via the Motion Magic® configuration values. Target
3325 * position can be changed on-the-fly and Motion Magic® will do its
3326 * best to adjust the profile. This control mode is duty cycled
3327 * based, so relevant closed-loop gains will use fractional duty cycle
3328 * for the numerator: +1.0 represents full forward output.
3329 *
3330 * MotionMagicDutyCycle Parameters:
3331 * Position: Position to drive toward in rotations.
3332 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3333 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3334 * motor performance by leveraging torque (current) control. However,
3335 * this may be inconvenient for applications that require specifying
3336 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3337 * method that combines the performances gains of FOC while still
3338 * allowing applications to provide duty cycle or voltage demand.
3339 * This not to be confused with simple sinusoidal control or phase
3340 * voltage control which lacks the performance gains.
3341 * FeedForward: Feedforward to apply in fractional units between -1 and +1.
3342 * Slot: Select which gains are applied by selecting the slot. Use the
3343 * configuration api to set the gain values for the selected slot before
3344 * enabling this feature. Slot must be within [0,2].
3345 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3346 * zero (or within deadband). Set to false to use the
3347 * NeutralMode configuration setting (default). This
3348 * flag exists to provide the fundamental behavior of
3349 * this control when output is zero, which is to provide
3350 * 0V to the motor.
3351 *
3352 * \param request Control object to request of the device
3353 * \returns Status Code of the request, 0 is OK
3354 */
3355 ctre::phoenix::StatusCode SetControl(controls::MotionMagicDutyCycle& request);
3356 /**
3357 * \brief Requests Motion Magic® to target a final position using a
3358 * motion profile. Users can optionally provide a duty cycle
3359 * feedforward.
3360 *
3361 * \details Motion Magic® produces a motion profile in real-time while
3362 * attempting to honor the Cruise Velocity, Acceleration, and Jerk
3363 * value specified via the Motion Magic® configuration values. Target
3364 * position can be changed on-the-fly and Motion Magic® will do its
3365 * best to adjust the profile. This control mode is duty cycled
3366 * based, so relevant closed-loop gains will use fractional duty cycle
3367 * for the numerator: +1.0 represents full forward output.
3368 *
3369 * MotionMagicDutyCycle Parameters:
3370 * Position: Position to drive toward in rotations.
3371 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3372 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3373 * motor performance by leveraging torque (current) control. However,
3374 * this may be inconvenient for applications that require specifying
3375 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3376 * method that combines the performances gains of FOC while still
3377 * allowing applications to provide duty cycle or voltage demand.
3378 * This not to be confused with simple sinusoidal control or phase
3379 * voltage control which lacks the performance gains.
3380 * FeedForward: Feedforward to apply in fractional units between -1 and +1.
3381 * Slot: Select which gains are applied by selecting the slot. Use the
3382 * configuration api to set the gain values for the selected slot before
3383 * enabling this feature. Slot must be within [0,2].
3384 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3385 * zero (or within deadband). Set to false to use the
3386 * NeutralMode configuration setting (default). This
3387 * flag exists to provide the fundamental behavior of
3388 * this control when output is zero, which is to provide
3389 * 0V to the motor.
3390 *
3391 * \param request Control object to request of the device
3392 * \returns Status Code of the request, 0 is OK
3393 */
3394 ctre::phoenix::StatusCode SetControl(controls::MotionMagicDutyCycle&& request)
3395 {
3396 return SetControl(request);
3397 }
3398
3399 /**
3400 * \brief Requests Motion Magic® to target a final position using a
3401 * motion profile. Users can optionally provide a voltage
3402 * feedforward.
3403 *
3404 * \details Motion Magic® produces a motion profile in real-time while
3405 * attempting to honor the Cruise Velocity, Acceleration, and Jerk
3406 * value specified via the Motion Magic® configuration values. Target
3407 * position can be changed on-the-fly and Motion Magic® will do its
3408 * best to adjust the profile. This control mode is voltage-based, so
3409 * relevant closed-loop gains will use Volts for the numerator.
3410 *
3411 * MotionMagicVoltage Parameters:
3412 * Position: Position to drive toward in rotations.
3413 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3414 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3415 * motor performance by leveraging torque (current) control. However,
3416 * this may be inconvenient for applications that require specifying
3417 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3418 * method that combines the performances gains of FOC while still
3419 * allowing applications to provide duty cycle or voltage demand.
3420 * This not to be confused with simple sinusoidal control or phase
3421 * voltage control which lacks the performance gains.
3422 * FeedForward: Feedforward to apply in volts
3423 * Slot: Select which gains are applied by selecting the slot. Use the
3424 * configuration api to set the gain values for the selected slot before
3425 * enabling this feature. Slot must be within [0,2].
3426 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3427 * zero (or within deadband). Set to false to use the
3428 * NeutralMode configuration setting (default). This
3429 * flag exists to provide the fundamental behavior of
3430 * this control when output is zero, which is to provide
3431 * 0V to the motor.
3432 *
3433 * \param request Control object to request of the device
3434 * \returns Status Code of the request, 0 is OK
3435 */
3436 ctre::phoenix::StatusCode SetControl(controls::MotionMagicVoltage& request);
3437 /**
3438 * \brief Requests Motion Magic® to target a final position using a
3439 * motion profile. Users can optionally provide a voltage
3440 * feedforward.
3441 *
3442 * \details Motion Magic® produces a motion profile in real-time while
3443 * attempting to honor the Cruise Velocity, Acceleration, and Jerk
3444 * value specified via the Motion Magic® configuration values. Target
3445 * position can be changed on-the-fly and Motion Magic® will do its
3446 * best to adjust the profile. This control mode is voltage-based, so
3447 * relevant closed-loop gains will use Volts for the numerator.
3448 *
3449 * MotionMagicVoltage Parameters:
3450 * Position: Position to drive toward in rotations.
3451 * EnableFOC: Set to true to use FOC commutation, which increases peak power by
3452 * ~15%. Set to false to use trapezoidal commutation. FOC improves
3453 * motor performance by leveraging torque (current) control. However,
3454 * this may be inconvenient for applications that require specifying
3455 * duty cycle or voltage. CTR-Electronics has developed a hybrid
3456 * method that combines the performances gains of FOC while still
3457 * allowing applications to provide duty cycle or voltage demand.
3458 * This not to be confused with simple sinusoidal control or phase
3459 * voltage control which lacks the performance gains.
3460 * FeedForward: Feedforward to apply in volts
3461 * Slot: Select which gains are applied by selecting the slot. Use the
3462 * configuration api to set the gain values for the selected slot before
3463 * enabling this feature. Slot must be within [0,2].
3464 * OverrideBrakeDurNeutral: Set to true to static-brake the rotor when output is
3465 * zero (or within deadband). Set to false to use the
3466 * NeutralMode configuration setting (default). This
3467 * flag exists to provide the fundamental behavior of
3468 * this control when output is zero, which is to provide
3469 * 0V to the motor.
3470 *
3471 * \param request Control object to request of the device
3472 * \returns Status Code of the request, 0 is OK
3473 */
3474 ctre::phoenix::StatusCode SetControl(controls::MotionMagicVoltage&& request)
3475 {
3476 return SetControl(request);
3477 }
3478
3479 /**
3480 * \brief Requests Motion Magic® to target a final position using a
3481 * motion profile. Users can optionally provide a torque current
3482 * feedforward.
3483 *
3484 * \details Motion Magic® produces a motion profile in real-time while
3485 * attempting to honor the Cruise Velocity, Acceleration, and Jerk
3486 * value specified via the Motion Magic® configuration values. Target
3487 * position can be changed on-the-fly and Motion Magic® will do its
3488 * best to adjust the profile. This control mode is based on torque
3489 * current, so relevant closed-loop gains will use Amperes for the
3490 * numerator.
3491 *
3492 * MotionMagicTorqueCurrentFOC Parameters:
3493 * Position: Position to drive toward in rotations.
3494 * FeedForward: Feedforward to apply in torque current in Amperes. User can use
3495 * motor's kT to scale Newton-meter to Amperes.
3496 * Slot: Select which gains are applied by selecting the slot. Use the
3497 * configuration api to set the gain values for the selected slot before
3498 * enabling this feature. Slot must be within [0,2].
3499 * OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero
3500 * (or within deadband). Set to false to use the
3501 * NeutralMode configuration setting (default). This
3502 * flag exists to provide the fundamental behavior of
3503 * this control when output is zero, which is to provide
3504 * 0A (zero torque).
3505 *
3506 * \param request Control object to request of the device
3507 * \returns Status Code of the request, 0 is OK
3508 */
3509 ctre::phoenix::StatusCode SetControl(controls::MotionMagicTorqueCurrentFOC& request);
3510 /**
3511 * \brief Requests Motion Magic® to target a final position using a
3512 * motion profile. Users can optionally provide a torque current
3513 * feedforward.
3514 *
3515 * \details Motion Magic® produces a motion profile in real-time while
3516 * attempting to honor the Cruise Velocity, Acceleration, and Jerk
3517 * value specified via the Motion Magic® configuration values. Target
3518 * position can be changed on-the-fly and Motion Magic® will do its
3519 * best to adjust the profile. This control mode is based on torque
3520 * current, so relevant closed-loop gains will use Amperes for the
3521 * numerator.
3522 *
3523 * MotionMagicTorqueCurrentFOC Parameters:
3524 * Position: Position to drive toward in rotations.
3525 * FeedForward: Feedforward to apply in torque current in Amperes. User can use
3526 * motor's kT to scale Newton-meter to Amperes.
3527 * Slot: Select which gains are applied by selecting the slot. Use the
3528 * configuration api to set the gain values for the selected slot before
3529 * enabling this feature. Slot must be within [0,2].
3530 * OverrideCoastDurNeutral: Set to true to coast the rotor when output is zero
3531 * (or within deadband). Set to false to use the
3532 * NeutralMode configuration setting (default). This
3533 * flag exists to provide the fundamental behavior of
3534 * this control when output is zero, which is to provide
3535 * 0A (zero torque).
3536 *
3537 * \param request Control object to request of the device
3538 * \returns Status Code of the request, 0 is OK
3539 */
3540 ctre::phoenix::StatusCode SetControl(controls::MotionMagicTorqueCurrentFOC&& request)
3541 {
3542 return SetControl(request);
3543 }
3544
3545 /**
3546 * \brief Follow the motor output of another Talon.
3547 *
3548 * \details If Talon is in torque control, the torque is copied -
3549 * which will increase the total torque applied. If Talon is in
3550 * percent supply output control, the duty cycle is matched. Motor
3551 * direction either matches master's configured direction or opposes
3552 * it based on OpposeMasterDirection.
3553 *
3554 * Follower Parameters:
3555 * MasterID: Device ID of the master to follow.
3556 * OpposeMasterDirection: Set to false for motor invert to match the master's
3557 * configured Invert - which is typical when master and
3558 * follower are mechanically linked and spin in the same
3559 * direction. Set to true for motor invert to oppose the
3560 * master's configured Invert - this is typical where the
3561 * the master and follower mechanically spin in opposite
3562 * directions.
3563 *
3564 * \param request Control object to request of the device
3565 * \returns Status Code of the request, 0 is OK
3566 */
3567 ctre::phoenix::StatusCode SetControl(controls::Follower& request);
3568 /**
3569 * \brief Follow the motor output of another Talon.
3570 *
3571 * \details If Talon is in torque control, the torque is copied -
3572 * which will increase the total torque applied. If Talon is in
3573 * percent supply output control, the duty cycle is matched. Motor
3574 * direction either matches master's configured direction or opposes
3575 * it based on OpposeMasterDirection.
3576 *
3577 * Follower Parameters:
3578 * MasterID: Device ID of the master to follow.
3579 * OpposeMasterDirection: Set to false for motor invert to match the master's
3580 * configured Invert - which is typical when master and
3581 * follower are mechanically linked and spin in the same
3582 * direction. Set to true for motor invert to oppose the
3583 * master's configured Invert - this is typical where the
3584 * the master and follower mechanically spin in opposite
3585 * directions.
3586 *
3587 * \param request Control object to request of the device
3588 * \returns Status Code of the request, 0 is OK
3589 */
3590 ctre::phoenix::StatusCode SetControl(controls::Follower&& request)
3591 {
3592 return SetControl(request);
3593 }
3594
3595 /**
3596 * \brief Follow the motor output of another Talon while ignoring the
3597 * master's invert setting.
3598 *
3599 * \details If Talon is in torque control, the torque is copied -
3600 * which will increase the total torque applied. If Talon is in
3601 * percent supply output control, the duty cycle is matched. Motor
3602 * direction is strictly determined by the configured invert and not
3603 * the master. If you want motor direction to match or oppose the
3604 * master, use FollowerRequest instead.
3605 *
3606 * StrictFollower Parameters:
3607 * MasterID: Device ID of the master to follow.
3608 *
3609 * \param request Control object to request of the device
3610 * \returns Status Code of the request, 0 is OK
3611 */
3612 ctre::phoenix::StatusCode SetControl(controls::StrictFollower& request);
3613 /**
3614 * \brief Follow the motor output of another Talon while ignoring the
3615 * master's invert setting.
3616 *
3617 * \details If Talon is in torque control, the torque is copied -
3618 * which will increase the total torque applied. If Talon is in
3619 * percent supply output control, the duty cycle is matched. Motor
3620 * direction is strictly determined by the configured invert and not
3621 * the master. If you want motor direction to match or oppose the
3622 * master, use FollowerRequest instead.
3623 *
3624 * StrictFollower Parameters:
3625 * MasterID: Device ID of the master to follow.
3626 *
3627 * \param request Control object to request of the device
3628 * \returns Status Code of the request, 0 is OK
3629 */
3630 ctre::phoenix::StatusCode SetControl(controls::StrictFollower&& request)
3631 {
3632 return SetControl(request);
3633 }
3634
3635 /**
3636 * \brief Request neutral output of actuator. The applied brake type
3637 * is determined by the NeutralMode configuration.
3638 *
3639 * NeutralOut Parameters:
3640 *
3641 * \param request Control object to request of the device
3642 * \returns Status Code of the request, 0 is OK
3643 */
3644 ctre::phoenix::StatusCode SetControl(controls::NeutralOut& request);
3645 /**
3646 * \brief Request neutral output of actuator. The applied brake type
3647 * is determined by the NeutralMode configuration.
3648 *
3649 * NeutralOut Parameters:
3650 *
3651 * \param request Control object to request of the device
3652 * \returns Status Code of the request, 0 is OK
3653 */
3654 ctre::phoenix::StatusCode SetControl(controls::NeutralOut&& request)
3655 {
3656 return SetControl(request);
3657 }
3658
3659 /**
3660 * \brief Request coast neutral output of actuator. The bridge is
3661 * disabled and the rotor is allowed to coast.
3662 *
3663 * CoastOut Parameters:
3664 *
3665 * \param request Control object to request of the device
3666 * \returns Status Code of the request, 0 is OK
3667 */
3668 ctre::phoenix::StatusCode SetControl(controls::CoastOut& request);
3669 /**
3670 * \brief Request coast neutral output of actuator. The bridge is
3671 * disabled and the rotor is allowed to coast.
3672 *
3673 * CoastOut Parameters:
3674 *
3675 * \param request Control object to request of the device
3676 * \returns Status Code of the request, 0 is OK
3677 */
3678 ctre::phoenix::StatusCode SetControl(controls::CoastOut&& request)
3679 {
3680 return SetControl(request);
3681 }
3682
3683 /**
3684 * \brief Applies full neutral-brake by shorting motor leads together.
3685 *
3686 * StaticBrake Parameters:
3687 *
3688 * \param request Control object to request of the device
3689 * \returns Status Code of the request, 0 is OK
3690 */
3691 ctre::phoenix::StatusCode SetControl(controls::StaticBrake& request);
3692 /**
3693 * \brief Applies full neutral-brake by shorting motor leads together.
3694 *
3695 * StaticBrake Parameters:
3696 *
3697 * \param request Control object to request of the device
3698 * \returns Status Code of the request, 0 is OK
3699 */
3700 ctre::phoenix::StatusCode SetControl(controls::StaticBrake&& request)
3701 {
3702 return SetControl(request);
3703 }
3704
3705 /**
3706 * \brief Control motor with generic control request object. User must make
3707 * sure the specified object is castable to a valid control request,
3708 * otherwise this function will fail at run-time and return the NotSupported
3709 * StatusCode
3710 *
3711 * \param request Control object to request of the device
3712 * \returns Status Code of the request, 0 is OK
3713 */
3714 ctre::phoenix::StatusCode SetControl(controls::ControlRequest& request)
3715 {
3716 controls::ControlRequest *ptr = &request;
3717 (void)ptr;
3718 auto *DutyCycleOutValue = dynamic_cast<controls::DutyCycleOut *>(ptr);
3719 if (DutyCycleOutValue != nullptr)
3720 return SetControl(*DutyCycleOutValue);
3721 auto *TorqueCurrentFOCValue = dynamic_cast<controls::TorqueCurrentFOC *>(ptr);
3722 if (TorqueCurrentFOCValue != nullptr)
3723 return SetControl(*TorqueCurrentFOCValue);
3724 auto *VoltageOutValue = dynamic_cast<controls::VoltageOut *>(ptr);
3725 if (VoltageOutValue != nullptr)
3726 return SetControl(*VoltageOutValue);
3727 auto *PositionDutyCycleValue = dynamic_cast<controls::PositionDutyCycle *>(ptr);
3728 if (PositionDutyCycleValue != nullptr)
3729 return SetControl(*PositionDutyCycleValue);
3730 auto *PositionVoltageValue = dynamic_cast<controls::PositionVoltage *>(ptr);
3731 if (PositionVoltageValue != nullptr)
3732 return SetControl(*PositionVoltageValue);
3733 auto *PositionTorqueCurrentFOCValue = dynamic_cast<controls::PositionTorqueCurrentFOC *>(ptr);
3734 if (PositionTorqueCurrentFOCValue != nullptr)
3735 return SetControl(*PositionTorqueCurrentFOCValue);
3736 auto *VelocityDutyCycleValue = dynamic_cast<controls::VelocityDutyCycle *>(ptr);
3737 if (VelocityDutyCycleValue != nullptr)
3738 return SetControl(*VelocityDutyCycleValue);
3739 auto *VelocityVoltageValue = dynamic_cast<controls::VelocityVoltage *>(ptr);
3740 if (VelocityVoltageValue != nullptr)
3741 return SetControl(*VelocityVoltageValue);
3742 auto *VelocityTorqueCurrentFOCValue = dynamic_cast<controls::VelocityTorqueCurrentFOC *>(ptr);
3743 if (VelocityTorqueCurrentFOCValue != nullptr)
3744 return SetControl(*VelocityTorqueCurrentFOCValue);
3745 auto *MotionMagicDutyCycleValue = dynamic_cast<controls::MotionMagicDutyCycle *>(ptr);
3746 if (MotionMagicDutyCycleValue != nullptr)
3747 return SetControl(*MotionMagicDutyCycleValue);
3748 auto *MotionMagicVoltageValue = dynamic_cast<controls::MotionMagicVoltage *>(ptr);
3749 if (MotionMagicVoltageValue != nullptr)
3750 return SetControl(*MotionMagicVoltageValue);
3751 auto *MotionMagicTorqueCurrentFOCValue = dynamic_cast<controls::MotionMagicTorqueCurrentFOC *>(ptr);
3752 if (MotionMagicTorqueCurrentFOCValue != nullptr)
3753 return SetControl(*MotionMagicTorqueCurrentFOCValue);
3754 auto *FollowerValue = dynamic_cast<controls::Follower *>(ptr);
3755 if (FollowerValue != nullptr)
3756 return SetControl(*FollowerValue);
3757 auto *StrictFollowerValue = dynamic_cast<controls::StrictFollower *>(ptr);
3758 if (StrictFollowerValue != nullptr)
3759 return SetControl(*StrictFollowerValue);
3760 auto *NeutralOutValue = dynamic_cast<controls::NeutralOut *>(ptr);
3761 if (NeutralOutValue != nullptr)
3762 return SetControl(*NeutralOutValue);
3763 auto *CoastOutValue = dynamic_cast<controls::CoastOut *>(ptr);
3764 if (CoastOutValue != nullptr)
3765 return SetControl(*CoastOutValue);
3766 auto *StaticBrakeValue = dynamic_cast<controls::StaticBrake *>(ptr);
3767 if (StaticBrakeValue != nullptr)
3768 return SetControl(*StaticBrakeValue);
3770 }
3771 /**
3772 * \brief Control motor with generic control request object. User must make
3773 * sure the specified object is castable to a valid control request,
3774 * otherwise this function will fail at run-time and return the corresponding
3775 * StatusCode
3776 *
3777 * \param request Control object to request of the device
3778 * \returns Status Code of the request, 0 is OK
3779 */
3780 ctre::phoenix::StatusCode SetControl(controls::ControlRequest&& request)
3781 {
3782 return SetControl(request);
3783 }
3784
3785
3786 /**
3787 * \brief The position to set the rotor position to right now.
3788 *
3789 * \param newValue Value to set to.
3790 * \param timeoutSeconds Maximum time to wait up to in seconds.
3791 * \returns StatusCode of the set command
3792 */
3793 ctre::phoenix::StatusCode SetRotorPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
3794 {
3795 return GetConfigurator().SetRotorPosition(newValue, timeoutSeconds);
3796 }
3797 /**
3798 * \brief The position to set the rotor position to right now.
3799 *
3800 * This will wait up to 0.050 seconds (50ms) by default.
3801 *
3802 * \param newValue Value to set to.
3803 * \returns StatusCode of the set command
3804 */
3805 ctre::phoenix::StatusCode SetRotorPosition(units::angle::turn_t newValue)
3806 {
3807 return SetRotorPosition(newValue, 0.050_s);
3808 }
3809
3810 /**
3811 * \brief Clear the sticky faults in the device.
3812 *
3813 * \details This typically has no impact on the device functionality.
3814 * Instead, it just clears telemetry faults that are accessible via
3815 * API and Tuner Self-Test.
3816 * \param timeoutSeconds Maximum time to wait up to in seconds.
3817 * \returns StatusCode of the set command
3818 */
3819 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
3820 {
3821 return GetConfigurator().ClearStickyFaults(timeoutSeconds);
3822 }
3823 /**
3824 * \brief Clear the sticky faults in the device.
3825 *
3826 * \details This typically has no impact on the device functionality.
3827 * Instead, it just clears telemetry faults that are accessible via
3828 * API and Tuner Self-Test.
3829 *
3830 * This will wait up to 0.050 seconds (50ms) by default.
3831 * \returns StatusCode of the set command
3832 */
3833 ctre::phoenix::StatusCode ClearStickyFaults()
3834 {
3835 return ClearStickyFaults(0.050_s);
3836 }
3837};
3838
3839}
3840}
3841
3842}
3843}
3844
ii that the Software will be uninterrupted or error free
Definition: CTRE_LICENSE.txt:191
CTREXPORT int c_ctre_phoenixpro_serialize_double(int spn, double value, char **str)
@ OK
No Error.
Definition: StatusCodes.h:1101
@ NotSupported
This is not supported.
Definition: StatusCodes.h:1704
Configs that directly affect motor-output.
Definition: Configs.hpp:1494
std::string ToString() const
Definition: Configs.hpp:1506
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1524
std::string Serialize() const
Definition: Configs.hpp:1516
Configs that affect general behavior during closed-looping.
Definition: Configs.hpp:1755
std::string Serialize() const
Definition: Configs.hpp:1781
std::string ToString() const
Definition: Configs.hpp:1771
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1789
Configs that directly affect motor-output.
Definition: Configs.hpp:1259
std::string ToString() const
Definition: Configs.hpp:1292
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1314
std::string Serialize() const
Definition: Configs.hpp:1304
Configs that directly affect current limiting features.
Definition: Configs.hpp:808
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:899
std::string Serialize() const
Definition: Configs.hpp:886
std::string ToString() const
Definition: Configs.hpp:871
Configs that directly affect motor-output.
Definition: Configs.hpp:1695
std::string ToString() const
Definition: Configs.hpp:1718
std::string Serialize() const
Definition: Configs.hpp:1729
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1738
Configs that directly affect motor-output.
Definition: Configs.hpp:1068
std::string ToString() const
Definition: Configs.hpp:1140
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1166
std::string Serialize() const
Definition: Configs.hpp:1154
Configs that directly affect motor-output.
Definition: Configs.hpp:1332
std::string ToString() const
Definition: Configs.hpp:1427
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1467
std::string Serialize() const
Definition: Configs.hpp:1448
Configs that directly affect motor-output.
Definition: Configs.hpp:1620
std::string ToString() const
Definition: Configs.hpp:1655
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1677
std::string Serialize() const
Definition: Configs.hpp:1667
Configs that directly affect motor-output.
Definition: Configs.hpp:719
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:788
std::string ToString() const
Definition: Configs.hpp:762
std::string Serialize() const
Definition: Configs.hpp:776
Configs that directly affect motor-output.
Definition: Configs.hpp:1186
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1241
std::string ToString() const
Definition: Configs.hpp:1219
std::string Serialize() const
Definition: Configs.hpp:1231
Definition: Configurator.hpp:21
ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, units::time::second_t timeoutSeconds) const
Definition: Configurator.hpp:61
units::time::second_t defaultTimeoutSeconds
The default amount of time to wait for a config.
Definition: Configurator.hpp:26
ctre::phoenix::StatusCode SetConfigsPrivate(const std::string &serializedString, units::time::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate)
Definition: Configurator.hpp:37
What the gains for slot 0 are.
Definition: Configs.hpp:321
std::string Serialize() const
Definition: Configs.hpp:421
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:433
std::string ToString() const
Definition: Configs.hpp:407
What the gains for slot 1 are.
Definition: Configs.hpp:454
std::string ToString() const
Definition: Configs.hpp:540
std::string Serialize() const
Definition: Configs.hpp:554
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:566
What the gains for slot 2 are.
Definition: Configs.hpp:587
std::string ToString() const
Definition: Configs.hpp:673
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:699
std::string Serialize() const
Definition: Configs.hpp:687
Configs that directly affect motor-output.
Definition: Configs.hpp:1540
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1601
std::string Serialize() const
Definition: Configs.hpp:1590
std::string ToString() const
Definition: Configs.hpp:1577
Class description for the Talon FX integrated motor controller that runs on associated Falcon motors.
Definition: CoreTalonFX.hpp:56
OpenLoopRampsConfigs OpenLoopRamps
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:138
TorqueCurrentConfigs TorqueCurrent
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:124
FeedbackConfigs Feedback
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:131
ClosedLoopGeneralConfigs ClosedLoopGeneral
Configs that affect general behavior during closed-looping.
Definition: CoreTalonFX.hpp:187
SoftwareLimitSwitchConfigs SoftwareLimitSwitch
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:166
CustomParamsConfigs CustomParams
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:180
VoltageConfigs Voltage
Voltage-specific configs.
Definition: CoreTalonFX.hpp:117
AudioConfigs Audio
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:159
ClosedLoopRampsConfigs ClosedLoopRamps
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:145
HardwareLimitSwitchConfigs HardwareLimitSwitch
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:152
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Take a string and deserialize it to this configuration.
Definition: CoreTalonFX.hpp:242
std::string ToString() const
Get the string representation of this configuration.
Definition: CoreTalonFX.hpp:192
CurrentLimitsConfigs CurrentLimits
Configs that directly affect current limiting features.
Definition: CoreTalonFX.hpp:110
Slot0Configs Slot0
What the gains for slot 0 are.
Definition: CoreTalonFX.hpp:80
Slot1Configs Slot1
What the gains for slot 1 are.
Definition: CoreTalonFX.hpp:88
MotorOutputConfigs MotorOutput
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:103
MotionMagicConfigs MotionMagic
Configs that directly affect motor-output.
Definition: CoreTalonFX.hpp:173
std::string Serialize() const
Get the serialized form of this configuration.
Definition: CoreTalonFX.hpp:217
Slot2Configs Slot2
What the gains for slot 2 are.
Definition: CoreTalonFX.hpp:96
bool FutureProofConfigs
True if we should factory default newer unsupported configs, false to leave newer unsupported configs...
Definition: CoreTalonFX.hpp:71
Class description for the Talon FX integrated motor controller that runs on associated Falcon motors.
Definition: CoreTalonFX.hpp:272
ctre::phoenix::StatusCode Apply(const Slot0Configs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:388
ctre::phoenix::StatusCode Refresh(TalonFXConfiguration &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:295
ctre::phoenix::StatusCode Apply(const CurrentLimitsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:642
ctre::phoenix::StatusCode Apply(const OpenLoopRampsConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:868
ctre::phoenix::StatusCode Apply(const SoftwareLimitSwitchConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1108
ctre::phoenix::StatusCode Apply(const Slot2Configs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:522
ctre::phoenix::StatusCode Refresh(Slot1Configs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:430
ctre::phoenix::StatusCode Apply(const ClosedLoopRampsConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:928
ctre::phoenix::StatusCode Refresh(CurrentLimitsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:610
ctre::phoenix::StatusCode Refresh(SoftwareLimitSwitchConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1090
ctre::phoenix::StatusCode Refresh(Slot2Configs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:490
ctre::phoenix::StatusCode Apply(const ClosedLoopRampsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:942
ctre::phoenix::StatusCode Refresh(FeedbackConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:790
ctre::phoenix::StatusCode Refresh(TalonFXConfiguration &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:309
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1210
TalonFXConfigurator(const TalonFXConfigurator &)=delete
Delete the copy constructor, we can only pass by reference.
ctre::phoenix::StatusCode Apply(const MotionMagicConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1168
ctre::phoenix::StatusCode SetRotorPosition(units::angle::turn_t newValue)
The position to set the rotor position to right now.
Definition: CoreTalonFX.hpp:1322
ctre::phoenix::StatusCode Apply(const TalonFXConfiguration &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:341
ctre::phoenix::StatusCode Apply(const Slot1Configs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:462
ctre::phoenix::StatusCode Refresh(SoftwareLimitSwitchConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1077
ctre::phoenix::StatusCode Refresh(AudioConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1017
ctre::phoenix::StatusCode Apply(const TorqueCurrentConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:762
ctre::phoenix::StatusCode Refresh(FeedbackConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:777
ctre::phoenix::StatusCode Apply(const CurrentLimitsConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:628
ctre::phoenix::StatusCode Apply(const AudioConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1048
ctre::phoenix::StatusCode Apply(const Slot0Configs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:402
ctre::phoenix::StatusCode Refresh(AudioConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1030
ctre::phoenix::StatusCode Refresh(Slot1Configs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:417
ctre::phoenix::StatusCode Refresh(Slot2Configs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:477
ctre::phoenix::StatusCode Refresh(ClosedLoopRampsConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:897
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1197
ctre::phoenix::StatusCode Refresh(CurrentLimitsConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:597
ctre::phoenix::StatusCode Apply(const VoltageConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:702
ctre::phoenix::StatusCode Refresh(TorqueCurrentConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:717
ctre::phoenix::StatusCode Refresh(OpenLoopRampsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:850
ctre::phoenix::StatusCode Refresh(OpenLoopRampsConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:837
ctre::phoenix::StatusCode Refresh(MotorOutputConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:550
ctre::phoenix::StatusCode Apply(const ClosedLoopGeneralConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1302
ctre::phoenix::StatusCode Apply(const MotorOutputConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:568
ctre::phoenix::StatusCode Apply(const MotionMagicConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1182
ctre::phoenix::StatusCode Apply(const VoltageConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:688
ctre::phoenix::StatusCode Apply(const FeedbackConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:808
ctre::phoenix::StatusCode Apply(const OpenLoopRampsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:882
ctre::phoenix::StatusCode Refresh(MotionMagicConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1137
ctre::phoenix::StatusCode Apply(const FeedbackConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:822
ctre::phoenix::StatusCode Apply(const Slot1Configs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:448
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition: CoreTalonFX.hpp:1363
ctre::phoenix::StatusCode Apply(const ClosedLoopGeneralConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1288
ctre::phoenix::StatusCode Apply(const HardwareLimitSwitchConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:988
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1242
ctre::phoenix::StatusCode SetRotorPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
The position to set the rotor position to right now.
Definition: CoreTalonFX.hpp:1339
ctre::phoenix::StatusCode Refresh(ClosedLoopGeneralConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1270
ctre::phoenix::StatusCode Refresh(ClosedLoopGeneralConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1257
ctre::phoenix::StatusCode Refresh(ClosedLoopRampsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:910
ctre::phoenix::StatusCode Apply(const Slot2Configs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:508
ctre::phoenix::StatusCode Refresh(VoltageConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:670
ctre::phoenix::StatusCode Apply(const TalonFXConfiguration &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:327
ctre::phoenix::StatusCode Refresh(Slot0Configs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:357
ctre::phoenix::StatusCode Apply(const AudioConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1062
ctre::phoenix::StatusCode Refresh(MotorOutputConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:537
ctre::phoenix::StatusCode Refresh(VoltageConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:657
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition: CoreTalonFX.hpp:1382
ctre::phoenix::StatusCode Refresh(TorqueCurrentConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:730
ctre::phoenix::StatusCode Apply(const MotorOutputConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:582
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1228
ctre::phoenix::StatusCode Apply(const SoftwareLimitSwitchConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1122
ctre::phoenix::StatusCode Apply(const TorqueCurrentConfigs &configs)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:748
ctre::phoenix::StatusCode Apply(const HardwareLimitSwitchConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition: CoreTalonFX.hpp:1002
ctre::phoenix::StatusCode Refresh(HardwareLimitSwitchConfigs &configs) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:957
ctre::phoenix::StatusCode Refresh(Slot0Configs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:370
ctre::phoenix::StatusCode Refresh(HardwareLimitSwitchConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:970
ctre::phoenix::StatusCode Refresh(MotionMagicConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition: CoreTalonFX.hpp:1150
Configs that directly affect motor-output.
Definition: Configs.hpp:995
std::string Serialize() const
Definition: Configs.hpp:1040
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:1050
std::string ToString() const
Definition: Configs.hpp:1028
Voltage-specific configs.
Definition: Configs.hpp:920
ctre::phoenix::StatusCode Deserialize(const std::string &string)
Definition: Configs.hpp:977
std::string Serialize() const
Definition: Configs.hpp:967
std::string ToString() const
Definition: Configs.hpp:955
Request coast neutral output of actuator.
Definition: CoastOut.hpp:27
Abstract Control Request class that other control requests extend for use.
Definition: ControlRequest.hpp:65
Request a specified motor duty cycle.
Definition: DutyCycleOut.hpp:28
Follow the motor output of another Talon.
Definition: Follower.hpp:30
Requests Motion Magic® to target a final position using a motion profile.
Definition: MotionMagicDutyCycle.hpp:34
Requests Motion Magic® to target a final position using a motion profile.
Definition: MotionMagicTorqueCurrentFOC.hpp:33
Requests Motion Magic® to target a final position using a motion profile.
Definition: MotionMagicVoltage.hpp:33
Request neutral output of actuator.
Definition: NeutralOut.hpp:27
Request PID to target position with duty cycle feedforward.
Definition: PositionDutyCycle.hpp:30
Request PID to target position with torque current feedforward.
Definition: PositionTorqueCurrentFOC.hpp:30
Request PID to target position with voltage feedforward.
Definition: PositionVoltage.hpp:30
Applies full neutral-brake by shorting motor leads together.
Definition: StaticBrake.hpp:26
Follow the motor output of another Talon while ignoring the master's invert setting.
Definition: StrictFollower.hpp:32
Request a specified motor current (field oriented control).
Definition: TorqueCurrentFOC.hpp:31
Request PID to target velocity with duty cycle feedforward.
Definition: VelocityDutyCycle.hpp:30
Request PID to target velocity with torque current feedforward.
Definition: VelocityTorqueCurrentFOC.hpp:30
Request PID to target velocity with voltage feedforward.
Definition: VelocityVoltage.hpp:30
Request a specified voltage.
Definition: VoltageOut.hpp:29
Definition: DeviceIdentifier.hpp:19
Parent class for all devices.
Definition: ParentDevice.hpp:30
Class description for the Talon FX integrated motor controller that runs on associated Falcon motors.
Definition: CoreTalonFX.hpp:1401
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition: CoreTalonFX.hpp:3819
StatusSignalValue< units::angular_velocity::turns_per_second_t > & GetVelocity()
Velocity of device.
StatusSignalValue< units::temperature::celsius_t > & GetDeviceTemp()
Temperature of device.
StatusSignalValue< bool > & GetStickyFault_MissingRemoteSensor()
The remote sensor is not present on CAN Bus.
StatusSignalValue< bool > & GetFault_FusedSensorOutOfSync()
The remote sensor used for fusion has fallen out of sync to the local sensor.
StatusSignalValue< double > & GetClosedLoopFeedForward()
Feed Forward passed by the user.
ctre::phoenix::StatusCode SetControl(controls::NeutralOut &request)
Request neutral output of actuator.
StatusSignalValue< double > & GetClosedLoopReference()
Value that the closed loop is targeting.
ctre::phoenix::StatusCode SetControl(controls::VelocityTorqueCurrentFOC &request)
Request PID to target velocity with torque current feedforward.
StatusSignalValue< bool > & GetFault_DeviceTemp()
Device temperature exceeded limit.
StatusSignalValue< bool > & GetStickyFault_FusedSensorOutOfSync()
The remote sensor used for fusion has fallen out of sync to the local sensor.
StatusSignalValue< bool > & GetFault_ReverseHardLimit()
Reverse limit switch has been asserted.
StatusSignalValue< bool > & GetFault_ForwardSoftLimit()
Forward soft limit has been asserted.
configs::TalonFXConfigurator const & GetConfigurator() const
Gets the configurator for this TalonFX.
Definition: CoreTalonFX.hpp:1790
CoreTalonFX(int deviceId, std::string canbus="")
Constructs a new Talon FX motor controller object.
ctre::phoenix::StatusCode SetControl(controls::VelocityDutyCycle &&request)
Request PID to target velocity with duty cycle feedforward.
Definition: CoreTalonFX.hpp:3186
ctre::phoenix::StatusCode SetControl(controls::PositionDutyCycle &request)
Request PID to target position with duty cycle feedforward.
ctre::phoenix::StatusCode SetControl(controls::StaticBrake &request)
Applies full neutral-brake by shorting motor leads together.
ctre::phoenix::StatusCode SetControl(controls::PositionVoltage &&request)
Request PID to target position with voltage feedforward.
Definition: CoreTalonFX.hpp:3060
ctre::phoenix::StatusCode SetControl(controls::VelocityVoltage &&request)
Request PID to target velocity with voltage feedforward.
Definition: CoreTalonFX.hpp:3256
ctre::phoenix::StatusCode SetControl(controls::CoastOut &&request)
Request coast neutral output of actuator.
Definition: CoreTalonFX.hpp:3678
StatusSignalValue< int > & GetVersionBugfix()
App Bugfix Version number.
ctre::phoenix::StatusCode SetControl(controls::Follower &&request)
Follow the motor output of another Talon.
Definition: CoreTalonFX.hpp:3590
ctre::phoenix::StatusCode SetControl(controls::ControlRequest &request)
Control motor with generic control request object.
Definition: CoreTalonFX.hpp:3714
ctre::phoenix::StatusCode SetControl(controls::PositionTorqueCurrentFOC &&request)
Request PID to target position with torque current feedforward.
Definition: CoreTalonFX.hpp:3116
StatusSignalValue< bool > & GetFault_ProcTemp()
Processor temperature exceeded limit.
StatusSignalValue< int > & GetStickyFaultField()
Integer representing all sticky faults.
ctre::phoenix::StatusCode SetControl(controls::VelocityDutyCycle &request)
Request PID to target velocity with duty cycle feedforward.
StatusSignalValue< units::current::ampere_t > & GetStatorCurrent()
Current corresponding to the stator windings.
ctre::phoenix::StatusCode SetControl(controls::VoltageOut &&request)
Request a specified voltage.
Definition: CoreTalonFX.hpp:2920
ctre::phoenix::StatusCode SetControl(controls::PositionDutyCycle &&request)
Request PID to target position with duty cycle feedforward.
Definition: CoreTalonFX.hpp:2990
ctre::phoenix::StatusCode SetControl(controls::VelocityTorqueCurrentFOC &&request)
Request PID to target velocity with torque current feedforward.
Definition: CoreTalonFX.hpp:3312
StatusSignalValue< units::current::ampere_t > & GetTorqueCurrent()
Current corresponding to the torque output by the motor.
StatusSignalValue< double > & GetClosedLoopIntegratedOutput()
Closed loop integrated component.
ctre::phoenix::StatusCode SetControl(controls::VelocityVoltage &request)
Request PID to target velocity with voltage feedforward.
StatusSignalValue< signals::AppliedRotorPolarityValue > & GetAppliedRotorPolarity()
The applied rotor polarity.
StatusSignalValue< bool > & GetStickyFault_Hardware()
Hardware fault occurred.
StatusSignalValue< bool > & GetStickyFault_OverSupplyV()
Supply Voltage has exceeded the maximum voltage rating of device.
ctre::phoenix::StatusCode SetControl(controls::StrictFollower &request)
Follow the motor output of another Talon while ignoring the master's invert setting.
StatusSignalValue< bool > & GetFault_StatorCurrLimit()
Stator current limit occured.
StatusSignalValue< bool > & GetFault_MissingRemoteSensor()
The remote sensor is not present on CAN Bus.
StatusSignalValue< double > & GetClosedLoopError()
The difference between target reference and current measurement.
StatusSignalValue< signals::ControlModeValue > & GetControlMode()
The active control mode of the motor controller.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicDutyCycle &&request)
Requests Motion Magic® to target a final position using a motion profile.
Definition: CoreTalonFX.hpp:3394
StatusSignalValue< double > & GetClosedLoopReferenceSlope()
Derivative of the target that the closed loop is targeting.
StatusSignalValue< bool > & GetFault_UnstableSupplyV()
Supply Voltage is unstable.
StatusSignalValue< bool > & GetStickyFault_ReverseHardLimit()
Reverse limit switch has been asserted.
CoreTalonFX & operator=(CoreTalonFX const &)=delete
StatusSignalValue< int > & GetVersionMajor()
App Major Version number.
StatusSignalValue< units::angle::turn_t > & GetPosition()
Position of device.
StatusSignalValue< double > & GetClosedLoopProportionalOutput()
Closed loop proportional component.
ctre::phoenix::StatusCode SetControl(controls::DutyCycleOut &&request)
Request a specified motor duty cycle.
Definition: CoreTalonFX.hpp:2784
ctre::phoenix::StatusCode SetRotorPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
The position to set the rotor position to right now.
Definition: CoreTalonFX.hpp:3793
StatusSignalValue< bool > & GetFault_ReverseSoftLimit()
Reverse soft limit has been asserted.
StatusSignalValue< bool > & GetFault_ForwardHardLimit()
Forward limit switch has been asserted.
CoreTalonFX(CoreTalonFX const &)=delete
ctre::phoenix::StatusCode SetControl(controls::StaticBrake &&request)
Applies full neutral-brake by shorting motor leads together.
Definition: CoreTalonFX.hpp:3700
ctre::phoenix::StatusCode SetRotorPosition(units::angle::turn_t newValue)
The position to set the rotor position to right now.
Definition: CoreTalonFX.hpp:3805
StatusSignalValue< units::angle::turn_t > & GetRotorPosition()
Position of motor rotor.
StatusSignalValue< int > & GetVersionBuild()
App Build Version number.
StatusSignalValue< bool > & GetStickyFault_SupplyCurrLimit()
Supply current limit occured.
StatusSignalValue< units::temperature::celsius_t > & GetProcessorTemp()
Temperature of the processor.
ctre::phoenix::StatusCode SetControl(controls::StrictFollower &&request)
Follow the motor output of another Talon while ignoring the master's invert setting.
Definition: CoreTalonFX.hpp:3630
ctre::phoenix::StatusCode SetControl(controls::TorqueCurrentFOC &request)
Request a specified motor current (field oriented control).
StatusSignalValue< int > & GetVersionMinor()
App Minor Version number.
StatusSignalValue< units::voltage::volt_t > & GetSupplyVoltage()
Measured supply voltage to the TalonFX.
ctre::phoenix::StatusCode SetControl(controls::TorqueCurrentFOC &&request)
Request a specified motor current (field oriented control).
Definition: CoreTalonFX.hpp:2858
ctre::phoenix::StatusCode SetControl(controls::NeutralOut &&request)
Request neutral output of actuator.
Definition: CoreTalonFX.hpp:3654
ctre::phoenix::StatusCode SetControl(controls::MotionMagicTorqueCurrentFOC &request)
Requests Motion Magic® to target a final position using a motion profile.
StatusSignalValue< units::current::ampere_t > & GetSupplyCurrent()
Measured supply side current.
configs::TalonFXConfigurator & GetConfigurator()
Gets the configurator for this TalonFX.
Definition: CoreTalonFX.hpp:1778
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVoltage &request)
Requests Motion Magic® to target a final position using a motion profile.
sim::TalonFXSimState & GetSimState()
Get the simulation state for this device.
Definition: CoreTalonFX.hpp:1808
StatusSignalValue< units::dimensionless::scalar_t > & GetDutyCycle()
The applied motor duty cycle.
ctre::phoenix::StatusCode SetControl(controls::CoastOut &request)
Request coast neutral output of actuator.
StatusSignalValue< int > & GetFaultField()
Integer representing all faults.
StatusSignalValue< bool > & GetStickyFault_DeviceTemp()
Device temperature exceeded limit.
StatusSignalValue< bool > & GetStickyFault_Undervoltage()
Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode SetControl(controls::PositionTorqueCurrentFOC &request)
Request PID to target position with torque current feedforward.
StatusSignalValue< double > & GetClosedLoopDerivativeOutput()
Closed loop derivative component.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicDutyCycle &request)
Requests Motion Magic® to target a final position using a motion profile.
StatusSignalValue< bool > & GetStickyFault_ForwardHardLimit()
Forward limit switch has been asserted.
StatusSignalValue< bool > & GetStickyFault_BootDuringEnable()
Device boot while detecting the enable signal.
StatusSignalValue< bool > & GetFault_Undervoltage()
Device supply voltage dropped to near brownout levels.
StatusSignalValue< bool > & GetStickyFault_ReverseSoftLimit()
Reverse soft limit has been asserted.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicTorqueCurrentFOC &&request)
Requests Motion Magic® to target a final position using a motion profile.
Definition: CoreTalonFX.hpp:3540
StatusSignalValue< bool > & GetFault_Hardware()
Hardware fault occurred.
StatusSignalValue< signals::ForwardLimitValue > & GetForwardLimit()
Forward Limit Pin.
StatusSignalValue< signals::DeviceEnableValue > & GetDeviceEnable()
Indicates if device is actuator enabled.
StatusSignalValue< signals::MotionMagicIsRunningValue > & GetMotionMagicIsRunning()
Check if Motion Magic® is running.
StatusSignalValue< bool > & GetFault_BootDuringEnable()
Device boot while detecting the enable signal.
StatusSignalValue< bool > & GetStickyFault_ProcTemp()
Processor temperature exceeded limit.
StatusSignalValue< bool > & GetStickyFault_StatorCurrLimit()
Stator current limit occured.
StatusSignalValue< int > & GetVersion()
Full Version.
StatusSignalValue< units::angular_velocity::turns_per_second_t > & GetRotorVelocity()
Velocity of motor rotor.
ctre::phoenix::StatusCode SetControl(controls::MotionMagicVoltage &&request)
Requests Motion Magic® to target a final position using a motion profile.
Definition: CoreTalonFX.hpp:3474
ctre::phoenix::StatusCode SetControl(controls::Follower &request)
Follow the motor output of another Talon.
ctre::phoenix::StatusCode SetControl(controls::ControlRequest &&request)
Control motor with generic control request object.
Definition: CoreTalonFX.hpp:3780
StatusSignalValue< bool > & GetStickyFault_ForwardSoftLimit()
Forward soft limit has been asserted.
StatusSignalValue< bool > & GetFault_OverSupplyV()
Supply Voltage has exceeded the maximum voltage rating of device.
StatusSignalValue< double > & GetClosedLoopOutput()
Closed loop total output.
StatusSignalValue< signals::ReverseLimitValue > & GetReverseLimit()
Reverse Limit Pin.
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition: CoreTalonFX.hpp:3833
StatusSignalValue< signals::BridgeOuputValue > & GetBridgeOuput()
The applied output of the bridge.
ctre::phoenix::StatusCode SetControl(controls::DutyCycleOut &request)
Request a specified motor duty cycle.
StatusSignalValue< bool > & GetStickyFault_UnstableSupplyV()
Supply Voltage is unstable.
StatusSignalValue< int > & GetClosedLoopSlot()
Closed loop slot in use.
ctre::phoenix::StatusCode SetControl(controls::VoltageOut &request)
Request a specified voltage.
StatusSignalValue< bool > & GetFault_SupplyCurrLimit()
Supply current limit occured.
ctre::phoenix::StatusCode SetControl(controls::PositionVoltage &request)
Request PID to target position with voltage feedforward.
Class to control the state of a simulated hardware::TalonFX.
Definition: TalonFXSimState.hpp:32
static constexpr int Startup_ResetFlags
Definition: SpnValue.hpp:26
CTREXPORT double GetCurrentTimeSeconds()
Get the current timestamp in seconds.
Definition: string_util.hpp:14