CTRE Phoenix 6 C++ 26.3.0
Loading...
Searching...
No Matches
CoreCANdi.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
13
19
21#include <units/angle.h>
22#include <units/angular_velocity.h>
23#include <units/current.h>
24#include <units/time.h>
25#include <units/voltage.h>
26
27namespace ctre {
28namespace phoenix6 {
29
30namespace hardware {
31namespace core {
32 class CoreCANdi;
33}
34}
35
36namespace configs {
37
38/**
39 * Class for CTR Electronics' CANdi™ branded device, a device that integrates
40 * digital signals into the existing CAN bus network.
41 *
42 * This defines all configurations for the hardware#CANdi.
43 */
45{
46public:
47 constexpr CANdiConfiguration() = default;
48
49 /**
50 * \brief True if we should factory default newer unsupported configs,
51 * false to leave newer unsupported configs alone.
52 *
53 * \details This flag addresses a corner case where the device may have
54 * firmware with newer configs that didn't exist when this
55 * version of the API was built. If this occurs and this
56 * flag is true, unsupported new configs will be factory
57 * defaulted to avoid unexpected behavior.
58 *
59 * This is also the behavior in Phoenix 5, so this flag
60 * is defaulted to true to match.
61 */
63
64
65 /**
66 * \brief Custom Params.
67 *
68 * \details Custom paramaters that have no real impact on controller.
69 *
70 * Parameter list:
71 *
72 * - CustomParamsConfigs#CustomParam0
73 * - CustomParamsConfigs#CustomParam1
74 *
75 */
77
78 /**
79 * \brief Configs related to the CANdi™ branded device's digital I/O
80 * settings
81 *
82 * \details Contains float-state settings and when to assert the S1/S2
83 * inputs.
84 *
85 * Parameter list:
86 *
87 * - DigitalInputsConfigs#S1FloatState
88 * - DigitalInputsConfigs#S2FloatState
89 * - DigitalInputsConfigs#S1CloseState
90 * - DigitalInputsConfigs#S2CloseState
91 *
92 */
94
95 /**
96 * \brief Configs related to the CANdi™ branded device's quadrature
97 * interface using both the S1IN and S2IN inputs
98 *
99 * \details All the configs related to the quadrature interface for
100 * the CANdi™ branded device , including encoder edges per
101 * revolution and sensor direction.
102 *
103 * Parameter list:
104 *
105 * - QuadratureConfigs#QuadratureEdgesPerRotation
106 * - QuadratureConfigs#SensorDirection
107 *
108 */
110
111 /**
112 * \brief Configs related to the CANdi™ branded device's PWM interface
113 * on the Signal 1 input (S1IN)
114 *
115 * \details All the configs related to the PWM interface for the
116 * CANdi™ branded device on S1, including absolute sensor
117 * offset, absolute sensor discontinuity point and sensor
118 * direction.
119 *
120 * Parameter list:
121 *
122 * - PWM1Configs#AbsoluteSensorOffset
123 * - PWM1Configs#AbsoluteSensorDiscontinuityPoint
124 * - PWM1Configs#SensorDirection
125 *
126 */
128
129 /**
130 * \brief Configs related to the CANdi™ branded device's PWM interface
131 * on the Signal 2 input (S2IN)
132 *
133 * \details All the configs related to the PWM interface for the
134 * CANdi™ branded device on S1, including absolute sensor
135 * offset, absolute sensor discontinuity point and sensor
136 * direction.
137 *
138 * Parameter list:
139 *
140 * - PWM2Configs#AbsoluteSensorOffset
141 * - PWM2Configs#AbsoluteSensorDiscontinuityPoint
142 * - PWM2Configs#SensorDirection
143 *
144 */
146
147 /**
148 * \brief Modifies this configuration's CustomParams parameter and returns itself for
149 * method-chaining and easier to use config API.
150 *
151 * Custom Params.
152 *
153 * \details Custom paramaters that have no real impact on controller.
154 *
155 * Parameter list:
156 *
157 * - CustomParamsConfigs#CustomParam0
158 * - CustomParamsConfigs#CustomParam1
159 *
160 *
161 * \param newCustomParams Parameter to modify
162 * \returns Itself
163 */
165 {
166 CustomParams = std::move(newCustomParams);
167 return *this;
168 }
169
170 /**
171 * \brief Modifies this configuration's DigitalInputs parameter and returns itself for
172 * method-chaining and easier to use config API.
173 *
174 * Configs related to the CANdi™ branded device's digital I/O settings
175 *
176 * \details Contains float-state settings and when to assert the S1/S2
177 * inputs.
178 *
179 * Parameter list:
180 *
181 * - DigitalInputsConfigs#S1FloatState
182 * - DigitalInputsConfigs#S2FloatState
183 * - DigitalInputsConfigs#S1CloseState
184 * - DigitalInputsConfigs#S2CloseState
185 *
186 *
187 * \param newDigitalInputs Parameter to modify
188 * \returns Itself
189 */
191 {
192 DigitalInputs = std::move(newDigitalInputs);
193 return *this;
194 }
195
196 /**
197 * \brief Modifies this configuration's Quadrature parameter and returns itself for
198 * method-chaining and easier to use config API.
199 *
200 * Configs related to the CANdi™ branded device's quadrature interface
201 * using both the S1IN and S2IN inputs
202 *
203 * \details All the configs related to the quadrature interface for
204 * the CANdi™ branded device , including encoder edges per
205 * revolution and sensor direction.
206 *
207 * Parameter list:
208 *
209 * - QuadratureConfigs#QuadratureEdgesPerRotation
210 * - QuadratureConfigs#SensorDirection
211 *
212 *
213 * \param newQuadrature Parameter to modify
214 * \returns Itself
215 */
217 {
218 Quadrature = std::move(newQuadrature);
219 return *this;
220 }
221
222 /**
223 * \brief Modifies this configuration's PWM1 parameter and returns itself for
224 * method-chaining and easier to use config API.
225 *
226 * Configs related to the CANdi™ branded device's PWM interface on the
227 * Signal 1 input (S1IN)
228 *
229 * \details All the configs related to the PWM interface for the
230 * CANdi™ branded device on S1, including absolute sensor
231 * offset, absolute sensor discontinuity point and sensor
232 * direction.
233 *
234 * Parameter list:
235 *
236 * - PWM1Configs#AbsoluteSensorOffset
237 * - PWM1Configs#AbsoluteSensorDiscontinuityPoint
238 * - PWM1Configs#SensorDirection
239 *
240 *
241 * \param newPWM1 Parameter to modify
242 * \returns Itself
243 */
245 {
246 PWM1 = std::move(newPWM1);
247 return *this;
248 }
249
250 /**
251 * \brief Modifies this configuration's PWM2 parameter and returns itself for
252 * method-chaining and easier to use config API.
253 *
254 * Configs related to the CANdi™ branded device's PWM interface on the
255 * Signal 2 input (S2IN)
256 *
257 * \details All the configs related to the PWM interface for the
258 * CANdi™ branded device on S1, including absolute sensor
259 * offset, absolute sensor discontinuity point and sensor
260 * direction.
261 *
262 * Parameter list:
263 *
264 * - PWM2Configs#AbsoluteSensorOffset
265 * - PWM2Configs#AbsoluteSensorDiscontinuityPoint
266 * - PWM2Configs#SensorDirection
267 *
268 *
269 * \param newPWM2 Parameter to modify
270 * \returns Itself
271 */
273 {
274 PWM2 = std::move(newPWM2);
275 return *this;
276 }
277
278 /**
279 * \brief Get the string representation of this configuration
280 */
281 std::string ToString() const override;
282
283 /**
284 * \brief Get the serialized form of this configuration
285 */
286 std::string Serialize() const final;
287 /**
288 * \brief Take a string and deserialize it to this configuration
289 */
290 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
291};
292
293/**
294 * Class for CTR Electronics' CANdi™ branded device, a device that integrates
295 * digital signals into the existing CAN bus network.
296 *
297 * This handles applying and refreshing configurations for the hardware#CANdi.
298 */
300{
301private:
303 ParentConfigurator{std::move(id)}
304 {}
305
307
308public:
309 /**
310 * \brief Applies the contents of the specified config to the device.
311 *
312 * This will wait up to #DefaultTimeoutSeconds.
313 *
314 * \details Call to apply the selected configs.
315 *
316 * \param configs Configs to apply against.
317 * \returns Status code of applying the configs
318 */
320 {
321 return Apply(configs, DefaultTimeoutSeconds);
322 }
323
324 /**
325 * \brief Applies the contents of the specified config to the device.
326 *
327 * \details Call to apply the selected configs.
328 *
329 * \param configs Configs to apply against.
330 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
331 * \returns Status code of applying the configs
332 */
333 ctre::phoenix::StatusCode Apply(const CANdiConfiguration &configs, units::time::second_t timeoutSeconds)
334 {
335 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, configs.FutureProofConfigs, false);
336 }
337
338 /**
339 * \brief Applies the contents of the specified config to the device.
340 *
341 * This will wait up to #DefaultTimeoutSeconds.
342 *
343 * \details Call to apply the selected configs.
344 *
345 * \param configs Configs to apply against.
346 * \returns Status code of applying the configs
347 */
349 {
350 return Apply(configs, DefaultTimeoutSeconds);
351 }
352
353 /**
354 * \brief Applies the contents of the specified config to the device.
355 *
356 * \details Call to apply the selected configs.
357 *
358 * \param configs Configs to apply against.
359 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
360 * \returns Status code of applying the configs
361 */
362 ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, units::time::second_t timeoutSeconds)
363 {
364 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
365 }
366
367 /**
368 * \brief Applies the contents of the specified config to the device.
369 *
370 * This will wait up to #DefaultTimeoutSeconds.
371 *
372 * \details Call to apply the selected configs.
373 *
374 * \param configs Configs to apply against.
375 * \returns Status code of applying the configs
376 */
378 {
379 return Apply(configs, DefaultTimeoutSeconds);
380 }
381
382 /**
383 * \brief Applies the contents of the specified config to the device.
384 *
385 * \details Call to apply the selected configs.
386 *
387 * \param configs Configs to apply against.
388 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
389 * \returns Status code of applying the configs
390 */
391 ctre::phoenix::StatusCode Apply(const DigitalInputsConfigs &configs, units::time::second_t timeoutSeconds)
392 {
393 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
394 }
395
396 /**
397 * \brief Applies the contents of the specified config to the device.
398 *
399 * This will wait up to #DefaultTimeoutSeconds.
400 *
401 * \details Call to apply the selected configs.
402 *
403 * \param configs Configs to apply against.
404 * \returns Status code of applying the configs
405 */
407 {
408 return Apply(configs, DefaultTimeoutSeconds);
409 }
410
411 /**
412 * \brief Applies the contents of the specified config to the device.
413 *
414 * \details Call to apply the selected configs.
415 *
416 * \param configs Configs to apply against.
417 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
418 * \returns Status code of applying the configs
419 */
420 ctre::phoenix::StatusCode Apply(const QuadratureConfigs &configs, units::time::second_t timeoutSeconds)
421 {
422 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
423 }
424
425 /**
426 * \brief Applies the contents of the specified config to the device.
427 *
428 * This will wait up to #DefaultTimeoutSeconds.
429 *
430 * \details Call to apply the selected configs.
431 *
432 * \param configs Configs to apply against.
433 * \returns Status code of applying the configs
434 */
436 {
437 return Apply(configs, DefaultTimeoutSeconds);
438 }
439
440 /**
441 * \brief Applies the contents of the specified config to the device.
442 *
443 * \details Call to apply the selected configs.
444 *
445 * \param configs Configs to apply against.
446 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
447 * \returns Status code of applying the configs
448 */
449 ctre::phoenix::StatusCode Apply(const PWM1Configs &configs, units::time::second_t timeoutSeconds)
450 {
451 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
452 }
453
454 /**
455 * \brief Applies the contents of the specified config to the device.
456 *
457 * This will wait up to #DefaultTimeoutSeconds.
458 *
459 * \details Call to apply the selected configs.
460 *
461 * \param configs Configs to apply against.
462 * \returns Status code of applying the configs
463 */
465 {
466 return Apply(configs, DefaultTimeoutSeconds);
467 }
468
469 /**
470 * \brief Applies the contents of the specified config to the device.
471 *
472 * \details Call to apply the selected configs.
473 *
474 * \param configs Configs to apply against.
475 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
476 * \returns Status code of applying the configs
477 */
478 ctre::phoenix::StatusCode Apply(const PWM2Configs &configs, units::time::second_t timeoutSeconds)
479 {
480 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
481 }
482
483 /**
484 * \brief Refreshes the values of the specified config group.
485 *
486 * This will wait up to #DefaultTimeoutSeconds.
487 *
488 * \details Call to refresh the selected configs from the device.
489 *
490 * \param configs The configs to refresh
491 * \returns Status code of refreshing the configs
492 */
494 {
495 return Refresh(configs, DefaultTimeoutSeconds);
496 }
497
498 /**
499 * \brief Refreshes the values of the specified config group.
500 *
501 * \details Call to refresh the selected configs from the device.
502 *
503 * \param configs The configs to refresh
504 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
505 * \returns Status code of refreshing the configs
506 */
507 ctre::phoenix::StatusCode Refresh(CANdiConfiguration &configs, units::time::second_t timeoutSeconds) const
508 {
509 std::string ref;
510 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
511 configs.Deserialize(ref);
512 return ret;
513 }
514
515 /**
516 * \brief Refreshes the values of the specified config group.
517 *
518 * This will wait up to #DefaultTimeoutSeconds.
519 *
520 * \details Call to refresh the selected configs from the device.
521 *
522 * \param configs The configs to refresh
523 * \returns Status code of refreshing the configs
524 */
526 {
527 return Refresh(configs, DefaultTimeoutSeconds);
528 }
529 /**
530 * \brief Refreshes the values of the specified config group.
531 *
532 * \details Call to refresh the selected configs from the device.
533 *
534 * \param configs The configs to refresh
535 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
536 * \returns Status code of refreshing the configs
537 */
538 ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
539 {
540 std::string ref;
541 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
542 configs.Deserialize(ref);
543 return ret;
544 }
545
546 /**
547 * \brief Refreshes the values of the specified config group.
548 *
549 * This will wait up to #DefaultTimeoutSeconds.
550 *
551 * \details Call to refresh the selected configs from the device.
552 *
553 * \param configs The configs to refresh
554 * \returns Status code of refreshing the configs
555 */
557 {
558 return Refresh(configs, DefaultTimeoutSeconds);
559 }
560 /**
561 * \brief Refreshes the values of the specified config group.
562 *
563 * \details Call to refresh the selected configs from the device.
564 *
565 * \param configs The configs to refresh
566 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
567 * \returns Status code of refreshing the configs
568 */
569 ctre::phoenix::StatusCode Refresh(DigitalInputsConfigs &configs, units::time::second_t timeoutSeconds) const
570 {
571 std::string ref;
572 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
573 configs.Deserialize(ref);
574 return ret;
575 }
576
577 /**
578 * \brief Refreshes the values of the specified config group.
579 *
580 * This will wait up to #DefaultTimeoutSeconds.
581 *
582 * \details Call to refresh the selected configs from the device.
583 *
584 * \param configs The configs to refresh
585 * \returns Status code of refreshing the configs
586 */
588 {
589 return Refresh(configs, DefaultTimeoutSeconds);
590 }
591 /**
592 * \brief Refreshes the values of the specified config group.
593 *
594 * \details Call to refresh the selected configs from the device.
595 *
596 * \param configs The configs to refresh
597 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
598 * \returns Status code of refreshing the configs
599 */
600 ctre::phoenix::StatusCode Refresh(QuadratureConfigs &configs, units::time::second_t timeoutSeconds) const
601 {
602 std::string ref;
603 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
604 configs.Deserialize(ref);
605 return ret;
606 }
607
608 /**
609 * \brief Refreshes the values of the specified config group.
610 *
611 * This will wait up to #DefaultTimeoutSeconds.
612 *
613 * \details Call to refresh the selected configs from the device.
614 *
615 * \param configs The configs to refresh
616 * \returns Status code of refreshing the configs
617 */
619 {
620 return Refresh(configs, DefaultTimeoutSeconds);
621 }
622 /**
623 * \brief Refreshes the values of the specified config group.
624 *
625 * \details Call to refresh the selected configs from the device.
626 *
627 * \param configs The configs to refresh
628 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
629 * \returns Status code of refreshing the configs
630 */
631 ctre::phoenix::StatusCode Refresh(PWM1Configs &configs, units::time::second_t timeoutSeconds) const
632 {
633 std::string ref;
634 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
635 configs.Deserialize(ref);
636 return ret;
637 }
638
639 /**
640 * \brief Refreshes the values of the specified config group.
641 *
642 * This will wait up to #DefaultTimeoutSeconds.
643 *
644 * \details Call to refresh the selected configs from the device.
645 *
646 * \param configs The configs to refresh
647 * \returns Status code of refreshing the configs
648 */
650 {
651 return Refresh(configs, DefaultTimeoutSeconds);
652 }
653 /**
654 * \brief Refreshes the values of the specified config group.
655 *
656 * \details Call to refresh the selected configs from the device.
657 *
658 * \param configs The configs to refresh
659 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
660 * \returns Status code of refreshing the configs
661 */
662 ctre::phoenix::StatusCode Refresh(PWM2Configs &configs, units::time::second_t timeoutSeconds) const
663 {
664 std::string ref;
665 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
666 configs.Deserialize(ref);
667 return ret;
668 }
669
670
671 /**
672 * \brief Sets the position of the quadrature input.
673 *
674 * This will wait up to #DefaultTimeoutSeconds.
675 *
676 * This is available in the configurator in case the user wants
677 * to initialize their device entirely without passing a device
678 * reference down to the code that performs the initialization.
679 * In this case, the user passes down the configurator object
680 * and performs all the initialization code on the object.
681 *
682 * \param newValue Value to set to. Units are in rotations.
683 * \returns StatusCode of the set command
684 */
686 {
687 return SetQuadraturePosition(newValue, DefaultTimeoutSeconds);
688 }
689 /**
690 * \brief Sets the position of the quadrature input.
691 *
692 * This is available in the configurator in case the user wants
693 * to initialize their device entirely without passing a device
694 * reference down to the code that performs the initialization.
695 * In this case, the user passes down the configurator object
696 * and performs all the initialization code on the object.
697 *
698 * \param newValue Value to set to. Units are in rotations.
699 * \param timeoutSeconds Maximum time to wait up to in seconds.
700 * \returns StatusCode of the set command
701 */
702 ctre::phoenix::StatusCode SetQuadraturePosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds);
703
704 /**
705 * \brief Clear the sticky faults in the device.
706 *
707 * \details This typically has no impact on the device functionality.
708 * Instead, it just clears telemetry faults that are accessible via
709 * API and Tuner Self-Test.
710 *
711 * This will wait up to #DefaultTimeoutSeconds.
712 *
713 * This is available in the configurator in case the user wants
714 * to initialize their device entirely without passing a device
715 * reference down to the code that performs the initialization.
716 * In this case, the user passes down the configurator object
717 * and performs all the initialization code on the object.
718 *
719 * \returns StatusCode of the set command
720 */
722 {
723 return ClearStickyFaults(DefaultTimeoutSeconds);
724 }
725 /**
726 * \brief Clear the sticky faults in the device.
727 *
728 * \details This typically has no impact on the device functionality.
729 * Instead, it just clears telemetry faults that are accessible via
730 * API and Tuner Self-Test.
731 *
732 * This is available in the configurator in case the user wants
733 * to initialize their device entirely without passing a device
734 * reference down to the code that performs the initialization.
735 * In this case, the user passes down the configurator object
736 * and performs all the initialization code on the object.
737 *
738 * \param timeoutSeconds Maximum time to wait up to in seconds.
739 * \returns StatusCode of the set command
740 */
741 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds);
742
743 /**
744 * \brief Clear sticky fault: Hardware fault occurred
745 *
746 * This will wait up to #DefaultTimeoutSeconds.
747 *
748 * This is available in the configurator in case the user wants
749 * to initialize their device entirely without passing a device
750 * reference down to the code that performs the initialization.
751 * In this case, the user passes down the configurator object
752 * and performs all the initialization code on the object.
753 *
754 * \returns StatusCode of the set command
755 */
757 {
758 return ClearStickyFault_Hardware(DefaultTimeoutSeconds);
759 }
760 /**
761 * \brief Clear sticky fault: Hardware fault occurred
762 *
763 * This is available in the configurator in case the user wants
764 * to initialize their device entirely without passing a device
765 * reference down to the code that performs the initialization.
766 * In this case, the user passes down the configurator object
767 * and performs all the initialization code on the object.
768 *
769 * \param timeoutSeconds Maximum time to wait up to in seconds.
770 * \returns StatusCode of the set command
771 */
772 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds);
773
774 /**
775 * \brief Clear sticky fault: Device supply voltage dropped to near
776 * brownout levels
777 *
778 * This will wait up to #DefaultTimeoutSeconds.
779 *
780 * This is available in the configurator in case the user wants
781 * to initialize their device entirely without passing a device
782 * reference down to the code that performs the initialization.
783 * In this case, the user passes down the configurator object
784 * and performs all the initialization code on the object.
785 *
786 * \returns StatusCode of the set command
787 */
789 {
790 return ClearStickyFault_Undervoltage(DefaultTimeoutSeconds);
791 }
792 /**
793 * \brief Clear sticky fault: Device supply voltage dropped to near
794 * brownout levels
795 *
796 * This is available in the configurator in case the user wants
797 * to initialize their device entirely without passing a device
798 * reference down to the code that performs the initialization.
799 * In this case, the user passes down the configurator object
800 * and performs all the initialization code on the object.
801 *
802 * \param timeoutSeconds Maximum time to wait up to in seconds.
803 * \returns StatusCode of the set command
804 */
805 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds);
806
807 /**
808 * \brief Clear sticky fault: Device boot while detecting the enable
809 * signal
810 *
811 * This will wait up to #DefaultTimeoutSeconds.
812 *
813 * This is available in the configurator in case the user wants
814 * to initialize their device entirely without passing a device
815 * reference down to the code that performs the initialization.
816 * In this case, the user passes down the configurator object
817 * and performs all the initialization code on the object.
818 *
819 * \returns StatusCode of the set command
820 */
822 {
823 return ClearStickyFault_BootDuringEnable(DefaultTimeoutSeconds);
824 }
825 /**
826 * \brief Clear sticky fault: Device boot while detecting the enable
827 * signal
828 *
829 * This is available in the configurator in case the user wants
830 * to initialize their device entirely without passing a device
831 * reference down to the code that performs the initialization.
832 * In this case, the user passes down the configurator object
833 * and performs all the initialization code on the object.
834 *
835 * \param timeoutSeconds Maximum time to wait up to in seconds.
836 * \returns StatusCode of the set command
837 */
839
840 /**
841 * \brief Clear sticky fault: An unlicensed feature is in use, device
842 * may not behave as expected.
843 *
844 * This will wait up to #DefaultTimeoutSeconds.
845 *
846 * This is available in the configurator in case the user wants
847 * to initialize their device entirely without passing a device
848 * reference down to the code that performs the initialization.
849 * In this case, the user passes down the configurator object
850 * and performs all the initialization code on the object.
851 *
852 * \returns StatusCode of the set command
853 */
855 {
856 return ClearStickyFault_UnlicensedFeatureInUse(DefaultTimeoutSeconds);
857 }
858 /**
859 * \brief Clear sticky fault: An unlicensed feature is in use, device
860 * may not behave as expected.
861 *
862 * This is available in the configurator in case the user wants
863 * to initialize their device entirely without passing a device
864 * reference down to the code that performs the initialization.
865 * In this case, the user passes down the configurator object
866 * and performs all the initialization code on the object.
867 *
868 * \param timeoutSeconds Maximum time to wait up to in seconds.
869 * \returns StatusCode of the set command
870 */
872
873 /**
874 * \brief Clear sticky fault: The CTR Electronics' CANdi™ branded
875 * device has detected a 5V fault. This may be due to overcurrent or a
876 * short-circuit.
877 *
878 * This will wait up to #DefaultTimeoutSeconds.
879 *
880 * This is available in the configurator in case the user wants
881 * to initialize their device entirely without passing a device
882 * reference down to the code that performs the initialization.
883 * In this case, the user passes down the configurator object
884 * and performs all the initialization code on the object.
885 *
886 * \returns StatusCode of the set command
887 */
889 {
890 return ClearStickyFault_5V(DefaultTimeoutSeconds);
891 }
892 /**
893 * \brief Clear sticky fault: The CTR Electronics' CANdi™ branded
894 * device has detected a 5V fault. This may be due to overcurrent or a
895 * short-circuit.
896 *
897 * This is available in the configurator in case the user wants
898 * to initialize their device entirely without passing a device
899 * reference down to the code that performs the initialization.
900 * In this case, the user passes down the configurator object
901 * and performs all the initialization code on the object.
902 *
903 * \param timeoutSeconds Maximum time to wait up to in seconds.
904 * \returns StatusCode of the set command
905 */
906 ctre::phoenix::StatusCode ClearStickyFault_5V(units::time::second_t timeoutSeconds);
907};
908
909}
910
911namespace hardware {
912namespace core {
913
914#if defined(_WIN32) || defined(_WIN64)
915#pragma warning(push)
916#pragma warning(disable : 4250)
917#endif
918
919/**
920 * Class for CTR Electronics' CANdi™ branded device, a device that integrates
921 * digital signals into the existing CAN bus network.
922 */
924{
925private:
927
928public:
929 /**
930 * \brief The configuration class for this device.
931 */
933
934 /**
935 * Constructs a new CANdi object.
936 *
937 * \param deviceId ID of the device, as configured in Phoenix Tuner
938 * \param canbus The CAN bus this device is on
939 */
940 CoreCANdi(int deviceId, CANBus canbus = {});
941
942 /**
943 * Constructs a new CANdi object.
944 *
945 * \param deviceId ID of the device, as configured in Phoenix Tuner
946 * \param canbus Name of the CAN bus this device is on. Possible CAN bus strings are:
947 * - "rio" for the native roboRIO CAN bus
948 * - CANivore name or serial number
949 * - SocketCAN interface (non-FRC Linux only)
950 * - "*" for any CANivore seen by the program
951 * - empty string (default) to select the default for the system:
952 * - "rio" on roboRIO
953 * - "can0" on Linux
954 * - "*" on Windows
955 *
956 * \deprecated Constructing devices with a CAN bus string is deprecated for removal
957 * in the 2027 season. Construct devices using a CANBus instance instead.
958 */
959 CoreCANdi(int deviceId, std::string canbus);
960
961 /**
962 * \brief Constructs a stubbed-out CoreCANdi, where all status signals, controls,
963 * configs, etc. perform no action and immediately return OK. This can be used to
964 * silence error messages for devices that have been completely removed from the robot.
965 *
966 * \returns Stubbed-out CoreCANdi
967 */
969 {
970 return CoreCANdi{-1, CANBus{}};
971 }
972
973 /**
974 * \brief Gets the configurator for this CANdi
975 *
976 * \details Gets the configurator for this CANdi
977 *
978 * \returns Configurator for this CANdi
979 */
981 {
982 return _configs;
983 }
984
985 /**
986 * \brief Gets the configurator for this CANdi
987 *
988 * \details Gets the configurator for this CANdi
989 *
990 * \returns Configurator for this CANdi
991 */
993 {
994 return _configs;
995 }
996
997
998private:
999 std::unique_ptr<sim::CANdiSimState> _simState{};
1000public:
1001 /**
1002 * \brief Get the simulation state for this device.
1003 *
1004 * \details This function reuses an allocated simulation
1005 * state object, so it is safe to call this function multiple
1006 * times in a robot loop.
1007 *
1008 * \returns Simulation state
1009 */
1011 {
1012 if (_simState == nullptr)
1013 _simState = std::make_unique<sim::CANdiSimState>(*this);
1014 return *_simState;
1015 }
1016
1017
1018
1019 /**
1020 * \brief App Major Version number.
1021 *
1022 * - Minimum Value: 0
1023 * - Maximum Value: 255
1024 * - Default Value: 0
1025 * - Units:
1026 *
1027 * Default Rates:
1028 * - CAN: 4.0 Hz
1029 *
1030 * This refreshes and returns a cached StatusSignal object.
1031 *
1032 * \param refresh Whether to refresh the StatusSignal before returning it;
1033 * defaults to true
1034 * \returns VersionMajor Status Signal Object
1035 */
1036 StatusSignal<int> &GetVersionMajor(bool refresh = true);
1037
1038 /**
1039 * \brief App Minor Version number.
1040 *
1041 * - Minimum Value: 0
1042 * - Maximum Value: 255
1043 * - Default Value: 0
1044 * - Units:
1045 *
1046 * Default Rates:
1047 * - CAN: 4.0 Hz
1048 *
1049 * This refreshes and returns a cached StatusSignal object.
1050 *
1051 * \param refresh Whether to refresh the StatusSignal before returning it;
1052 * defaults to true
1053 * \returns VersionMinor Status Signal Object
1054 */
1055 StatusSignal<int> &GetVersionMinor(bool refresh = true);
1056
1057 /**
1058 * \brief App Bugfix Version number.
1059 *
1060 * - Minimum Value: 0
1061 * - Maximum Value: 255
1062 * - Default Value: 0
1063 * - Units:
1064 *
1065 * Default Rates:
1066 * - CAN: 4.0 Hz
1067 *
1068 * This refreshes and returns a cached StatusSignal object.
1069 *
1070 * \param refresh Whether to refresh the StatusSignal before returning it;
1071 * defaults to true
1072 * \returns VersionBugfix Status Signal Object
1073 */
1075
1076 /**
1077 * \brief App Build Version number.
1078 *
1079 * - Minimum Value: 0
1080 * - Maximum Value: 255
1081 * - Default Value: 0
1082 * - Units:
1083 *
1084 * Default Rates:
1085 * - CAN: 4.0 Hz
1086 *
1087 * This refreshes and returns a cached StatusSignal object.
1088 *
1089 * \param refresh Whether to refresh the StatusSignal before returning it;
1090 * defaults to true
1091 * \returns VersionBuild Status Signal Object
1092 */
1093 StatusSignal<int> &GetVersionBuild(bool refresh = true);
1094
1095 /**
1096 * \brief Full Version of firmware in device. The format is a four
1097 * byte value.
1098 *
1099 * - Minimum Value: 0
1100 * - Maximum Value: 4294967295
1101 * - Default Value: 0
1102 * - Units:
1103 *
1104 * Default Rates:
1105 * - CAN: 4.0 Hz
1106 *
1107 * This refreshes and returns a cached StatusSignal object.
1108 *
1109 * \param refresh Whether to refresh the StatusSignal before returning it;
1110 * defaults to true
1111 * \returns Version Status Signal Object
1112 */
1113 StatusSignal<int> &GetVersion(bool refresh = true);
1114
1115 /**
1116 * \brief Integer representing all fault flags reported by the device.
1117 *
1118 * \details These are device specific and are not used directly in
1119 * typical applications. Use the signal specific GetFault_*() methods
1120 * instead.
1121 *
1122 * - Minimum Value: 0
1123 * - Maximum Value: 4294967295
1124 * - Default Value: 0
1125 * - Units:
1126 *
1127 * Default Rates:
1128 * - CAN: 4.0 Hz
1129 *
1130 * This refreshes and returns a cached StatusSignal object.
1131 *
1132 * \param refresh Whether to refresh the StatusSignal before returning it;
1133 * defaults to true
1134 * \returns FaultField Status Signal Object
1135 */
1136 StatusSignal<int> &GetFaultField(bool refresh = true);
1137
1138 /**
1139 * \brief Integer representing all (persistent) sticky fault flags
1140 * reported by the device.
1141 *
1142 * \details These are device specific and are not used directly in
1143 * typical applications. Use the signal specific GetStickyFault_*()
1144 * methods instead.
1145 *
1146 * - Minimum Value: 0
1147 * - Maximum Value: 4294967295
1148 * - Default Value: 0
1149 * - Units:
1150 *
1151 * Default Rates:
1152 * - CAN: 4.0 Hz
1153 *
1154 * This refreshes and returns a cached StatusSignal object.
1155 *
1156 * \param refresh Whether to refresh the StatusSignal before returning it;
1157 * defaults to true
1158 * \returns StickyFaultField Status Signal Object
1159 */
1161
1162 /**
1163 * \brief Whether the device is Phoenix Pro licensed.
1164 *
1165 * - Default Value: False
1166 *
1167 * Default Rates:
1168 * - CAN: 4.0 Hz
1169 *
1170 * This refreshes and returns a cached StatusSignal object.
1171 *
1172 * \param refresh Whether to refresh the StatusSignal before returning it;
1173 * defaults to true
1174 * \returns IsProLicensed Status Signal Object
1175 */
1177
1178 /**
1179 * \brief State of the Signal 1 input (S1IN).
1180 *
1181 *
1182 * Default Rates:
1183 * - CAN 2.0: 100.0 Hz
1184 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1185 *
1186 * This refreshes and returns a cached StatusSignal object.
1187 *
1188 * \param refresh Whether to refresh the StatusSignal before returning it;
1189 * defaults to true
1190 * \returns S1State Status Signal Object
1191 */
1193
1194 /**
1195 * \brief State of the Signal 2 input (S2IN).
1196 *
1197 *
1198 * Default Rates:
1199 * - CAN 2.0: 100.0 Hz
1200 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1201 *
1202 * This refreshes and returns a cached StatusSignal object.
1203 *
1204 * \param refresh Whether to refresh the StatusSignal before returning it;
1205 * defaults to true
1206 * \returns S2State Status Signal Object
1207 */
1209
1210 /**
1211 * \brief Position from a quadrature encoder sensor connected to both
1212 * the S1IN and S2IN inputs.
1213 *
1214 * - Minimum Value: -16384.0
1215 * - Maximum Value: 16383.999755859375
1216 * - Default Value: 0
1217 * - Units: rotations
1218 *
1219 * Default Rates:
1220 * - CAN 2.0: 20.0 Hz
1221 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1222 *
1223 * This refreshes and returns a cached StatusSignal object.
1224 *
1225 * \param refresh Whether to refresh the StatusSignal before returning it;
1226 * defaults to true
1227 * \returns QuadraturePosition Status Signal Object
1228 */
1230
1231 /**
1232 * \brief Measured rise to rise time of the PWM signal at the S1 input
1233 * of the CTR Electronics' CANdi™.
1234 *
1235 * - Minimum Value: 0
1236 * - Maximum Value: 131070
1237 * - Default Value: 0
1238 * - Units: us
1239 *
1240 * Default Rates:
1241 * - CAN 2.0: 20.0 Hz
1242 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1243 *
1244 * This refreshes and returns a cached StatusSignal object.
1245 *
1246 * \param refresh Whether to refresh the StatusSignal before returning it;
1247 * defaults to true
1248 * \returns PWM1RiseToRise Status Signal Object
1249 */
1251
1252 /**
1253 * \brief Measured position of the PWM sensor at the S1 input of the
1254 * CTR Electronics' CANdi™.
1255 *
1256 * - Minimum Value: -16384.0
1257 * - Maximum Value: 16383.999755859375
1258 * - Default Value: 0
1259 * - Units: rotations
1260 *
1261 * Default Rates:
1262 * - CAN 2.0: 20.0 Hz
1263 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1264 *
1265 * This refreshes and returns a cached StatusSignal object.
1266 *
1267 * \param refresh Whether to refresh the StatusSignal before returning it;
1268 * defaults to true
1269 * \returns PWM1Position Status Signal Object
1270 */
1272
1273 /**
1274 * \brief Measured velocity of the PWM sensor at the S1 input of the
1275 * CTR Electronics' CANdi™.
1276 *
1277 * - Minimum Value: -512.0
1278 * - Maximum Value: 511.998046875
1279 * - Default Value: 0
1280 * - Units: rotations per second
1281 *
1282 * Default Rates:
1283 * - CAN 2.0: 20.0 Hz
1284 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1285 *
1286 * This refreshes and returns a cached StatusSignal object.
1287 *
1288 * \param refresh Whether to refresh the StatusSignal before returning it;
1289 * defaults to true
1290 * \returns PWM1Velocity Status Signal Object
1291 */
1293
1294 /**
1295 * \brief Measured rise to rise time of the PWM signal at the S2 input
1296 * of the CTR Electronics' CANdi™.
1297 *
1298 * - Minimum Value: 0
1299 * - Maximum Value: 131070
1300 * - Default Value: 0
1301 * - Units: us
1302 *
1303 * Default Rates:
1304 * - CAN 2.0: 20.0 Hz
1305 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1306 *
1307 * This refreshes and returns a cached StatusSignal object.
1308 *
1309 * \param refresh Whether to refresh the StatusSignal before returning it;
1310 * defaults to true
1311 * \returns PWM2RiseToRise Status Signal Object
1312 */
1314
1315 /**
1316 * \brief Measured position of the PWM sensor at the S2 input of the
1317 * CTR Electronics' CANdi™.
1318 *
1319 * - Minimum Value: -16384.0
1320 * - Maximum Value: 16383.999755859375
1321 * - Default Value: 0
1322 * - Units: rotations
1323 *
1324 * Default Rates:
1325 * - CAN 2.0: 20.0 Hz
1326 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1327 *
1328 * This refreshes and returns a cached StatusSignal object.
1329 *
1330 * \param refresh Whether to refresh the StatusSignal before returning it;
1331 * defaults to true
1332 * \returns PWM2Position Status Signal Object
1333 */
1335
1336 /**
1337 * \brief True when the CANdi™ is in overcurrent protection mode. This
1338 * may be due to either overcurrent or a short-circuit.
1339 *
1340 * - Default Value: 0
1341 *
1342 * Default Rates:
1343 * - CAN 2.0: 100.0 Hz
1344 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1345 *
1346 * This refreshes and returns a cached StatusSignal object.
1347 *
1348 * \param refresh Whether to refresh the StatusSignal before returning it;
1349 * defaults to true
1350 * \returns Overcurrent Status Signal Object
1351 */
1352 StatusSignal<bool> &GetOvercurrent(bool refresh = true);
1353
1354 /**
1355 * \brief Measured supply voltage to the CANdi™.
1356 *
1357 * - Minimum Value: 4.0
1358 * - Maximum Value: 29.5
1359 * - Default Value: 0
1360 * - Units: V
1361 *
1362 * Default Rates:
1363 * - CAN 2.0: 100.0 Hz
1364 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1365 *
1366 * This refreshes and returns a cached StatusSignal object.
1367 *
1368 * \param refresh Whether to refresh the StatusSignal before returning it;
1369 * defaults to true
1370 * \returns SupplyVoltage Status Signal Object
1371 */
1373
1374 /**
1375 * \brief Measured output current. This includes both Vbat and 5V
1376 * output current.
1377 *
1378 * - Minimum Value: 0.0
1379 * - Maximum Value: 0.51
1380 * - Default Value: 0
1381 * - Units: A
1382 *
1383 * Default Rates:
1384 * - CAN 2.0: 100.0 Hz
1385 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1386 *
1387 * This refreshes and returns a cached StatusSignal object.
1388 *
1389 * \param refresh Whether to refresh the StatusSignal before returning it;
1390 * defaults to true
1391 * \returns OutputCurrent Status Signal Object
1392 */
1394
1395 /**
1396 * \brief Measured velocity of the PWM sensor at the S2 input of the
1397 * CTR Electronics' CANdi™.
1398 *
1399 * - Minimum Value: -512.0
1400 * - Maximum Value: 511.998046875
1401 * - Default Value: 0
1402 * - Units: rotations per second
1403 *
1404 * Default Rates:
1405 * - CAN 2.0: 20.0 Hz
1406 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1407 *
1408 * This refreshes and returns a cached StatusSignal object.
1409 *
1410 * \param refresh Whether to refresh the StatusSignal before returning it;
1411 * defaults to true
1412 * \returns PWM2Velocity Status Signal Object
1413 */
1415
1416 /**
1417 * \brief Velocity from a quadrature encoder sensor connected to both
1418 * the S1IN and S2IN inputs.
1419 *
1420 * - Minimum Value: -512.0
1421 * - Maximum Value: 511.998046875
1422 * - Default Value: 0
1423 * - Units: rotations per second
1424 *
1425 * Default Rates:
1426 * - CAN 2.0: 20.0 Hz
1427 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1428 *
1429 * This refreshes and returns a cached StatusSignal object.
1430 *
1431 * \param refresh Whether to refresh the StatusSignal before returning it;
1432 * defaults to true
1433 * \returns QuadratureVelocity Status Signal Object
1434 */
1436
1437 /**
1438 * \brief True if the Signal 1 input (S1IN) matches the configured S1
1439 * Closed State.
1440 *
1441 * \details Configure the S1 closed state in the Digitals
1442 * configuration object to change when this is asserted.
1443 *
1444 * - Default Value: False
1445 *
1446 * Default Rates:
1447 * - CAN 2.0: 100.0 Hz
1448 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1449 *
1450 * This refreshes and returns a cached StatusSignal object.
1451 *
1452 * \param refresh Whether to refresh the StatusSignal before returning it;
1453 * defaults to true
1454 * \returns S1Closed Status Signal Object
1455 */
1456 StatusSignal<bool> &GetS1Closed(bool refresh = true);
1457
1458 /**
1459 * \brief True if the Signal 2 input (S2IN) matches the configured S2
1460 * Closed State.
1461 *
1462 * \details Configure the S2 closed state in the Digitals
1463 * configuration object to change when this is asserted.
1464 *
1465 * - Default Value: False
1466 *
1467 * Default Rates:
1468 * - CAN 2.0: 100.0 Hz
1469 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1470 *
1471 * This refreshes and returns a cached StatusSignal object.
1472 *
1473 * \param refresh Whether to refresh the StatusSignal before returning it;
1474 * defaults to true
1475 * \returns S2Closed Status Signal Object
1476 */
1477 StatusSignal<bool> &GetS2Closed(bool refresh = true);
1478
1479 /**
1480 * \brief Hardware fault occurred
1481 *
1482 * - Default Value: False
1483 *
1484 * Default Rates:
1485 * - CAN: 4.0 Hz
1486 *
1487 * This refreshes and returns a cached StatusSignal object.
1488 *
1489 * \param refresh Whether to refresh the StatusSignal before returning it;
1490 * defaults to true
1491 * \returns Fault_Hardware Status Signal Object
1492 */
1494
1495 /**
1496 * \brief Hardware fault occurred
1497 *
1498 * - Default Value: False
1499 *
1500 * Default Rates:
1501 * - CAN: 4.0 Hz
1502 *
1503 * This refreshes and returns a cached StatusSignal object.
1504 *
1505 * \param refresh Whether to refresh the StatusSignal before returning it;
1506 * defaults to true
1507 * \returns StickyFault_Hardware Status Signal Object
1508 */
1510
1511 /**
1512 * \brief Device supply voltage dropped to near brownout levels
1513 *
1514 * - Default Value: False
1515 *
1516 * Default Rates:
1517 * - CAN: 4.0 Hz
1518 *
1519 * This refreshes and returns a cached StatusSignal object.
1520 *
1521 * \param refresh Whether to refresh the StatusSignal before returning it;
1522 * defaults to true
1523 * \returns Fault_Undervoltage Status Signal Object
1524 */
1526
1527 /**
1528 * \brief Device supply voltage dropped to near brownout levels
1529 *
1530 * - Default Value: False
1531 *
1532 * Default Rates:
1533 * - CAN: 4.0 Hz
1534 *
1535 * This refreshes and returns a cached StatusSignal object.
1536 *
1537 * \param refresh Whether to refresh the StatusSignal before returning it;
1538 * defaults to true
1539 * \returns StickyFault_Undervoltage Status Signal Object
1540 */
1542
1543 /**
1544 * \brief Device boot while detecting the enable signal
1545 *
1546 * - Default Value: False
1547 *
1548 * Default Rates:
1549 * - CAN: 4.0 Hz
1550 *
1551 * This refreshes and returns a cached StatusSignal object.
1552 *
1553 * \param refresh Whether to refresh the StatusSignal before returning it;
1554 * defaults to true
1555 * \returns Fault_BootDuringEnable Status Signal Object
1556 */
1558
1559 /**
1560 * \brief Device boot while detecting the enable signal
1561 *
1562 * - Default Value: False
1563 *
1564 * Default Rates:
1565 * - CAN: 4.0 Hz
1566 *
1567 * This refreshes and returns a cached StatusSignal object.
1568 *
1569 * \param refresh Whether to refresh the StatusSignal before returning it;
1570 * defaults to true
1571 * \returns StickyFault_BootDuringEnable Status Signal Object
1572 */
1574
1575 /**
1576 * \brief An unlicensed feature is in use, device may not behave as
1577 * expected.
1578 *
1579 * - Default Value: False
1580 *
1581 * Default Rates:
1582 * - CAN: 4.0 Hz
1583 *
1584 * This refreshes and returns a cached StatusSignal object.
1585 *
1586 * \param refresh Whether to refresh the StatusSignal before returning it;
1587 * defaults to true
1588 * \returns Fault_UnlicensedFeatureInUse Status Signal Object
1589 */
1591
1592 /**
1593 * \brief An unlicensed feature is in use, device may not behave as
1594 * expected.
1595 *
1596 * - Default Value: False
1597 *
1598 * Default Rates:
1599 * - CAN: 4.0 Hz
1600 *
1601 * This refreshes and returns a cached StatusSignal object.
1602 *
1603 * \param refresh Whether to refresh the StatusSignal before returning it;
1604 * defaults to true
1605 * \returns StickyFault_UnlicensedFeatureInUse Status Signal Object
1606 */
1608
1609 /**
1610 * \brief The CTR Electronics' CANdi™ branded device has detected a 5V
1611 * fault. This may be due to overcurrent or a short-circuit.
1612 *
1613 * - Default Value: False
1614 *
1615 * Default Rates:
1616 * - CAN: 4.0 Hz
1617 *
1618 * This refreshes and returns a cached StatusSignal object.
1619 *
1620 * \param refresh Whether to refresh the StatusSignal before returning it;
1621 * defaults to true
1622 * \returns Fault_5V Status Signal Object
1623 */
1624 StatusSignal<bool> &GetFault_5V(bool refresh = true);
1625
1626 /**
1627 * \brief The CTR Electronics' CANdi™ branded device has detected a 5V
1628 * fault. This may be due to overcurrent or a short-circuit.
1629 *
1630 * - Default Value: False
1631 *
1632 * Default Rates:
1633 * - CAN: 4.0 Hz
1634 *
1635 * This refreshes and returns a cached StatusSignal object.
1636 *
1637 * \param refresh Whether to refresh the StatusSignal before returning it;
1638 * defaults to true
1639 * \returns StickyFault_5V Status Signal Object
1640 */
1642
1643
1644
1645
1646 /**
1647 * \brief Sets the position of the quadrature input.
1648 *
1649 * \param newValue Value to set to. Units are in rotations.
1650 * \param timeoutSeconds Maximum time to wait up to in seconds.
1651 * \returns StatusCode of the set command
1652 */
1653 ctre::phoenix::StatusCode SetQuadraturePosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
1654 {
1655 return GetConfigurator().SetQuadraturePosition(newValue, timeoutSeconds);
1656 }
1657 /**
1658 * \brief Sets the position of the quadrature input.
1659 *
1660 * This will wait up to 0.100 seconds (100ms) by default.
1661 *
1662 * \param newValue Value to set to. Units are in rotations.
1663 * \returns StatusCode of the set command
1664 */
1666 {
1667 return SetQuadraturePosition(newValue, 0.100_s);
1668 }
1669
1670 /**
1671 * \brief Clear the sticky faults in the device.
1672 *
1673 * \details This typically has no impact on the device functionality.
1674 * Instead, it just clears telemetry faults that are accessible via
1675 * API and Tuner Self-Test.
1676 *
1677 * \param timeoutSeconds Maximum time to wait up to in seconds.
1678 * \returns StatusCode of the set command
1679 */
1680 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
1681 {
1682 return GetConfigurator().ClearStickyFaults(timeoutSeconds);
1683 }
1684 /**
1685 * \brief Clear the sticky faults in the device.
1686 *
1687 * \details This typically has no impact on the device functionality.
1688 * Instead, it just clears telemetry faults that are accessible via
1689 * API and Tuner Self-Test.
1690 *
1691 * This will wait up to 0.100 seconds (100ms) by default.
1692 *
1693 * \returns StatusCode of the set command
1694 */
1696 {
1697 return ClearStickyFaults(0.100_s);
1698 }
1699
1700 /**
1701 * \brief Clear sticky fault: Hardware fault occurred
1702 *
1703 * \param timeoutSeconds Maximum time to wait up to in seconds.
1704 * \returns StatusCode of the set command
1705 */
1706 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
1707 {
1708 return GetConfigurator().ClearStickyFault_Hardware(timeoutSeconds);
1709 }
1710 /**
1711 * \brief Clear sticky fault: Hardware fault occurred
1712 *
1713 * This will wait up to 0.100 seconds (100ms) by default.
1714 *
1715 * \returns StatusCode of the set command
1716 */
1718 {
1719 return ClearStickyFault_Hardware(0.100_s);
1720 }
1721
1722 /**
1723 * \brief Clear sticky fault: Device supply voltage dropped to near
1724 * brownout levels
1725 *
1726 * \param timeoutSeconds Maximum time to wait up to in seconds.
1727 * \returns StatusCode of the set command
1728 */
1729 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
1730 {
1731 return GetConfigurator().ClearStickyFault_Undervoltage(timeoutSeconds);
1732 }
1733 /**
1734 * \brief Clear sticky fault: Device supply voltage dropped to near
1735 * brownout levels
1736 *
1737 * This will wait up to 0.100 seconds (100ms) by default.
1738 *
1739 * \returns StatusCode of the set command
1740 */
1742 {
1743 return ClearStickyFault_Undervoltage(0.100_s);
1744 }
1745
1746 /**
1747 * \brief Clear sticky fault: Device boot while detecting the enable
1748 * signal
1749 *
1750 * \param timeoutSeconds Maximum time to wait up to in seconds.
1751 * \returns StatusCode of the set command
1752 */
1754 {
1755 return GetConfigurator().ClearStickyFault_BootDuringEnable(timeoutSeconds);
1756 }
1757 /**
1758 * \brief Clear sticky fault: Device boot while detecting the enable
1759 * signal
1760 *
1761 * This will wait up to 0.100 seconds (100ms) by default.
1762 *
1763 * \returns StatusCode of the set command
1764 */
1766 {
1767 return ClearStickyFault_BootDuringEnable(0.100_s);
1768 }
1769
1770 /**
1771 * \brief Clear sticky fault: An unlicensed feature is in use, device
1772 * may not behave as expected.
1773 *
1774 * \param timeoutSeconds Maximum time to wait up to in seconds.
1775 * \returns StatusCode of the set command
1776 */
1778 {
1779 return GetConfigurator().ClearStickyFault_UnlicensedFeatureInUse(timeoutSeconds);
1780 }
1781 /**
1782 * \brief Clear sticky fault: An unlicensed feature is in use, device
1783 * may not behave as expected.
1784 *
1785 * This will wait up to 0.100 seconds (100ms) by default.
1786 *
1787 * \returns StatusCode of the set command
1788 */
1790 {
1791 return ClearStickyFault_UnlicensedFeatureInUse(0.100_s);
1792 }
1793
1794 /**
1795 * \brief Clear sticky fault: The CTR Electronics' CANdi™ branded
1796 * device has detected a 5V fault. This may be due to overcurrent or a
1797 * short-circuit.
1798 *
1799 * \param timeoutSeconds Maximum time to wait up to in seconds.
1800 * \returns StatusCode of the set command
1801 */
1802 ctre::phoenix::StatusCode ClearStickyFault_5V(units::time::second_t timeoutSeconds)
1803 {
1804 return GetConfigurator().ClearStickyFault_5V(timeoutSeconds);
1805 }
1806 /**
1807 * \brief Clear sticky fault: The CTR Electronics' CANdi™ branded
1808 * device has detected a 5V fault. This may be due to overcurrent or a
1809 * short-circuit.
1810 *
1811 * This will wait up to 0.100 seconds (100ms) by default.
1812 *
1813 * \returns StatusCode of the set command
1814 */
1816 {
1817 return ClearStickyFault_5V(0.100_s);
1818 }
1819};
1820
1821#if defined(_WIN32) || defined(_WIN64)
1822#pragma warning(pop)
1823#endif
1824
1825}
1826}
1827
1828}
1829}
1830
Class for getting information about an available CAN bus.
Definition CANBus.hpp:19
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:567
Class for CTR Electronics' CANdi™ branded device, a device that integrates digital signals into the e...
Definition CoreCANdi.hpp:45
QuadratureConfigs Quadrature
Configs related to the CANdi™ branded device's quadrature interface using both the S1IN and S2IN inpu...
Definition CoreCANdi.hpp:109
std::string Serialize() const final
Get the serialized form of this configuration.
bool FutureProofConfigs
True if we should factory default newer unsupported configs, false to leave newer unsupported configs...
Definition CoreCANdi.hpp:62
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Take a string and deserialize it to this configuration.
constexpr CANdiConfiguration & WithPWM1(PWM1Configs newPWM1)
Modifies this configuration's PWM1 parameter and returns itself for method-chaining and easier to use...
Definition CoreCANdi.hpp:244
PWM2Configs PWM2
Configs related to the CANdi™ branded device's PWM interface on the Signal 2 input (S2IN)
Definition CoreCANdi.hpp:145
constexpr CANdiConfiguration & WithCustomParams(CustomParamsConfigs newCustomParams)
Modifies this configuration's CustomParams parameter and returns itself for method-chaining and easie...
Definition CoreCANdi.hpp:164
DigitalInputsConfigs DigitalInputs
Configs related to the CANdi™ branded device's digital I/O settings.
Definition CoreCANdi.hpp:93
std::string ToString() const override
Get the string representation of this configuration.
constexpr CANdiConfiguration & WithDigitalInputs(DigitalInputsConfigs newDigitalInputs)
Modifies this configuration's DigitalInputs parameter and returns itself for method-chaining and easi...
Definition CoreCANdi.hpp:190
CustomParamsConfigs CustomParams
Custom Params.
Definition CoreCANdi.hpp:76
constexpr CANdiConfiguration & WithPWM2(PWM2Configs newPWM2)
Modifies this configuration's PWM2 parameter and returns itself for method-chaining and easier to use...
Definition CoreCANdi.hpp:272
constexpr CANdiConfiguration & WithQuadrature(QuadratureConfigs newQuadrature)
Modifies this configuration's Quadrature parameter and returns itself for method-chaining and easier ...
Definition CoreCANdi.hpp:216
PWM1Configs PWM1
Configs related to the CANdi™ branded device's PWM interface on the Signal 1 input (S1IN)
Definition CoreCANdi.hpp:127
Class for CTR Electronics' CANdi™ branded device, a device that integrates digital signals into the e...
Definition CoreCANdi.hpp:300
ctre::phoenix::StatusCode Refresh(QuadratureConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:600
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:538
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(units::time::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdi.hpp:756
ctre::phoenix::StatusCode Refresh(PWM1Configs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:631
ctre::phoenix::StatusCode Apply(const QuadratureConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:406
ctre::phoenix::StatusCode SetQuadraturePosition(units::angle::turn_t newValue)
Sets the position of the quadrature input.
Definition CoreCANdi.hpp:685
ctre::phoenix::StatusCode Apply(const DigitalInputsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:391
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
ctre::phoenix::StatusCode Refresh(DigitalInputsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:556
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:362
ctre::phoenix::StatusCode Refresh(CANdiConfiguration &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:507
ctre::phoenix::StatusCode Apply(const PWM1Configs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:435
ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
ctre::phoenix::StatusCode SetQuadraturePosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
Sets the position of the quadrature input.
ctre::phoenix::StatusCode Apply(const PWM1Configs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:449
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdi.hpp:788
ctre::phoenix::StatusCode Refresh(QuadratureConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:587
ctre::phoenix::StatusCode Apply(const QuadratureConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:420
ctre::phoenix::StatusCode Apply(const CANdiConfiguration &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:319
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode Apply(const PWM2Configs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:478
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANdi.hpp:721
ctre::phoenix::StatusCode Refresh(PWM1Configs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:618
ctre::phoenix::StatusCode Refresh(CANdiConfiguration &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:493
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:525
ctre::phoenix::StatusCode Apply(const DigitalInputsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:377
ctre::phoenix::StatusCode Refresh(PWM2Configs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:649
ctre::phoenix::StatusCode Apply(const PWM2Configs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:464
ctre::phoenix::StatusCode ClearStickyFault_5V()
Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault.
Definition CoreCANdi.hpp:888
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:348
ctre::phoenix::StatusCode Refresh(PWM2Configs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:662
ctre::phoenix::StatusCode ClearStickyFault_5V(units::time::second_t timeoutSeconds)
Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault.
ctre::phoenix::StatusCode Refresh(DigitalInputsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:569
ctre::phoenix::StatusCode Apply(const CANdiConfiguration &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:333
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdi.hpp:821
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdi.hpp:854
Custom Params.
Definition CustomParamsConfigs.hpp:23
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Configs related to the CANdi™ branded device's digital I/O settings.
Definition DigitalInputsConfigs.hpp:25
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Configs related to the CANdi™ branded device's PWM interface on the Signal 1 input (S1IN)
Definition PWM1Configs.hpp:27
std::string Serialize() const final
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Configs related to the CANdi™ branded device's PWM interface on the Signal 2 input (S2IN)
Definition PWM2Configs.hpp:27
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
std::string Serialize() const final
Definition Configuration.hpp:17
The base class for all device configurators.
Definition Configurator.hpp:21
Configs related to the CANdi™ branded device's quadrature interface using both the S1IN and S2IN inpu...
Definition QuadratureConfigs.hpp:26
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
The unique identifier for a device.
Definition DeviceIdentifier.hpp:19
Parent class for all devices.
Definition ParentDevice.hpp:23
Class for CTR Electronics' CANdi™ branded device, a device that integrates digital signals into the e...
Definition CoreCANdi.hpp:924
ctre::phoenix::StatusCode SetQuadraturePosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
Sets the position of the quadrature input.
Definition CoreCANdi.hpp:1653
StatusSignal< bool > & GetFault_Hardware(bool refresh=true)
Hardware fault occurred.
configs::CANdiConfigurator const & GetConfigurator() const
Gets the configurator for this CANdi.
Definition CoreCANdi.hpp:992
StatusSignal< bool > & GetStickyFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdi.hpp:1753
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(units::time::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdi.hpp:1777
StatusSignal< units::time::microsecond_t > & GetPWM2RiseToRise(bool refresh=true)
Measured rise to rise time of the PWM signal at the S2 input of the CTR Electronics' CANdi™.
ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdi.hpp:1706
StatusSignal< bool > & GetFault_5V(bool refresh=true)
The CTR Electronics' CANdi™ branded device has detected a 5V fault.
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdi.hpp:1741
StatusSignal< int > & GetVersionBuild(bool refresh=true)
App Build Version number.
ctre::phoenix::StatusCode ClearStickyFault_5V(units::time::second_t timeoutSeconds)
Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault.
Definition CoreCANdi.hpp:1802
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdi.hpp:1729
StatusSignal< bool > & GetS2Closed(bool refresh=true)
True if the Signal 2 input (S2IN) matches the configured S2 Closed State.
StatusSignal< units::angular_velocity::turns_per_second_t > & GetPWM2Velocity(bool refresh=true)
Measured velocity of the PWM sensor at the S2 input of the CTR Electronics' CANdi™.
sim::CANdiSimState & GetSimState()
Get the simulation state for this device.
Definition CoreCANdi.hpp:1010
StatusSignal< int > & GetVersionBugfix(bool refresh=true)
App Bugfix Version number.
StatusSignal< bool > & GetStickyFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
StatusSignal< bool > & GetStickyFault_5V(bool refresh=true)
The CTR Electronics' CANdi™ branded device has detected a 5V fault.
StatusSignal< bool > & GetFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
StatusSignal< bool > & GetFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
configs::CANdiConfigurator & GetConfigurator()
Gets the configurator for this CANdi.
Definition CoreCANdi.hpp:980
StatusSignal< signals::S1StateValue > & GetS1State(bool refresh=true)
State of the Signal 1 input (S1IN).
StatusSignal< units::voltage::volt_t > & GetSupplyVoltage(bool refresh=true)
Measured supply voltage to the CANdi™.
StatusSignal< int > & GetVersion(bool refresh=true)
Full Version of firmware in device.
StatusSignal< bool > & GetStickyFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
StatusSignal< units::time::microsecond_t > & GetPWM1RiseToRise(bool refresh=true)
Measured rise to rise time of the PWM signal at the S1 input of the CTR Electronics' CANdi™.
StatusSignal< int > & GetStickyFaultField(bool refresh=true)
Integer representing all (persistent) sticky fault flags reported by the device.
StatusSignal< bool > & GetIsProLicensed(bool refresh=true)
Whether the device is Phoenix Pro licensed.
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition CoreCANdi.hpp:1680
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANdi.hpp:1695
StatusSignal< int > & GetVersionMajor(bool refresh=true)
App Major Version number.
StatusSignal< bool > & GetOvercurrent(bool refresh=true)
True when the CANdi™ is in overcurrent protection mode.
StatusSignal< int > & GetFaultField(bool refresh=true)
Integer representing all fault flags reported by the device.
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANdi.hpp:1717
CoreCANdi(int deviceId, std::string canbus)
Constructs a new CANdi object.
StatusSignal< units::angle::turn_t > & GetQuadraturePosition(bool refresh=true)
Position from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.
StatusSignal< units::angle::turn_t > & GetPWM1Position(bool refresh=true)
Measured position of the PWM sensor at the S1 input of the CTR Electronics' CANdi™.
ctre::phoenix::StatusCode SetQuadraturePosition(units::angle::turn_t newValue)
Sets the position of the quadrature input.
Definition CoreCANdi.hpp:1665
StatusSignal< bool > & GetS1Closed(bool refresh=true)
True if the Signal 1 input (S1IN) matches the configured S1 Closed State.
StatusSignal< int > & GetVersionMinor(bool refresh=true)
App Minor Version number.
StatusSignal< bool > & GetStickyFault_Hardware(bool refresh=true)
Hardware fault occurred.
StatusSignal< bool > & GetFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
StatusSignal< signals::S2StateValue > & GetS2State(bool refresh=true)
State of the Signal 2 input (S2IN).
static CoreCANdi None()
Constructs a stubbed-out CoreCANdi, where all status signals, controls, configs, etc.
Definition CoreCANdi.hpp:968
StatusSignal< units::current::ampere_t > & GetOutputCurrent(bool refresh=true)
Measured output current.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdi.hpp:1765
StatusSignal< units::angular_velocity::turns_per_second_t > & GetPWM1Velocity(bool refresh=true)
Measured velocity of the PWM sensor at the S1 input of the CTR Electronics' CANdi™.
ctre::phoenix::StatusCode ClearStickyFault_5V()
Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault.
Definition CoreCANdi.hpp:1815
StatusSignal< units::angle::turn_t > & GetPWM2Position(bool refresh=true)
Measured position of the PWM sensor at the S2 input of the CTR Electronics' CANdi™.
StatusSignal< units::angular_velocity::turns_per_second_t > & GetQuadratureVelocity(bool refresh=true)
Velocity from a quadrature encoder sensor connected to both the S1IN and S2IN inputs.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdi.hpp:1789
CoreCANdi(int deviceId, CANBus canbus={})
Constructs a new CANdi object.
Class to control the state of a simulated hardware::CANdi.
Definition CANdiSimState.hpp:33
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition motor_constants.h:14