CTRE Phoenix 6 C++ 26.0.0-beta-1
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 Refreshes the values of the specified config group.
311 *
312 * This will wait up to #DefaultTimeoutSeconds.
313 *
314 * \details Call to refresh the selected configs from the device.
315 *
316 * \param configs The configs to refresh
317 * \returns StatusCode of refreshing the configs
318 */
320 {
321 return Refresh(configs, DefaultTimeoutSeconds);
322 }
323
324 /**
325 * \brief Refreshes the values of the specified config group.
326 *
327 * \details Call to refresh the selected configs from the device.
328 *
329 * \param configs The configs to refresh
330 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
331 * \returns StatusCode of refreshing the configs
332 */
333 ctre::phoenix::StatusCode Refresh(CANdiConfiguration &configs, units::time::second_t timeoutSeconds) const
334 {
335 std::string ref;
336 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
337 configs.Deserialize(ref);
338 return ret;
339 }
340
341 /**
342 * \brief Applies the contents of the specified config to the device.
343 *
344 * This will wait up to #DefaultTimeoutSeconds.
345 *
346 * \details Call to apply the selected configs.
347 *
348 * \param configs Configs to apply against.
349 * \returns StatusCode of the set command
350 */
352 {
353 return Apply(configs, DefaultTimeoutSeconds);
354 }
355
356 /**
357 * \brief Applies the contents of the specified config to the device.
358 *
359 * \details Call to apply the selected configs.
360 *
361 * \param configs Configs to apply against.
362 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
363 * \returns StatusCode of the set command
364 */
365 ctre::phoenix::StatusCode Apply(const CANdiConfiguration &configs, units::time::second_t timeoutSeconds)
366 {
367 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, configs.FutureProofConfigs, false);
368 }
369
370
371 /**
372 * \brief Refreshes the values of the specified config group.
373 *
374 * This will wait up to #DefaultTimeoutSeconds.
375 *
376 * \details Call to refresh the selected configs from the device.
377 *
378 * \param configs The configs to refresh
379 * \returns StatusCode of refreshing the configs
380 */
382 {
383 return Refresh(configs, DefaultTimeoutSeconds);
384 }
385 /**
386 * \brief Refreshes the values of the specified config group.
387 *
388 * \details Call to refresh the selected configs from the device.
389 *
390 * \param configs The configs to refresh
391 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
392 * \returns StatusCode of refreshing the configs
393 */
394 ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
395 {
396 std::string ref;
397 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
398 configs.Deserialize(ref);
399 return ret;
400 }
401
402 /**
403 * \brief Applies the contents of the specified config to the device.
404 *
405 * This will wait up to #DefaultTimeoutSeconds.
406 *
407 * \details Call to apply the selected configs.
408 *
409 * \param configs Configs to apply against.
410 * \returns StatusCode of the set command
411 */
413 {
414 return Apply(configs, DefaultTimeoutSeconds);
415 }
416
417 /**
418 * \brief Applies the contents of the specified config to the device.
419 *
420 * \details Call to apply the selected configs.
421 *
422 * \param configs Configs to apply against.
423 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
424 * \returns StatusCode of the set command
425 */
426 ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, units::time::second_t timeoutSeconds)
427 {
428 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
429 }
430
431 /**
432 * \brief Refreshes the values of the specified config group.
433 *
434 * This will wait up to #DefaultTimeoutSeconds.
435 *
436 * \details Call to refresh the selected configs from the device.
437 *
438 * \param configs The configs to refresh
439 * \returns StatusCode of refreshing the configs
440 */
442 {
443 return Refresh(configs, DefaultTimeoutSeconds);
444 }
445 /**
446 * \brief Refreshes the values of the specified config group.
447 *
448 * \details Call to refresh the selected configs from the device.
449 *
450 * \param configs The configs to refresh
451 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
452 * \returns StatusCode of refreshing the configs
453 */
454 ctre::phoenix::StatusCode Refresh(DigitalInputsConfigs &configs, units::time::second_t timeoutSeconds) const
455 {
456 std::string ref;
457 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
458 configs.Deserialize(ref);
459 return ret;
460 }
461
462 /**
463 * \brief Applies the contents of the specified config to the device.
464 *
465 * This will wait up to #DefaultTimeoutSeconds.
466 *
467 * \details Call to apply the selected configs.
468 *
469 * \param configs Configs to apply against.
470 * \returns StatusCode of the set command
471 */
473 {
474 return Apply(configs, DefaultTimeoutSeconds);
475 }
476
477 /**
478 * \brief Applies the contents of the specified config to the device.
479 *
480 * \details Call to apply the selected configs.
481 *
482 * \param configs Configs to apply against.
483 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
484 * \returns StatusCode of the set command
485 */
486 ctre::phoenix::StatusCode Apply(const DigitalInputsConfigs &configs, units::time::second_t timeoutSeconds)
487 {
488 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
489 }
490
491 /**
492 * \brief Refreshes the values of the specified config group.
493 *
494 * This will wait up to #DefaultTimeoutSeconds.
495 *
496 * \details Call to refresh the selected configs from the device.
497 *
498 * \param configs The configs to refresh
499 * \returns StatusCode of refreshing the configs
500 */
502 {
503 return Refresh(configs, DefaultTimeoutSeconds);
504 }
505 /**
506 * \brief Refreshes the values of the specified config group.
507 *
508 * \details Call to refresh the selected configs from the device.
509 *
510 * \param configs The configs to refresh
511 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
512 * \returns StatusCode of refreshing the configs
513 */
514 ctre::phoenix::StatusCode Refresh(QuadratureConfigs &configs, units::time::second_t timeoutSeconds) const
515 {
516 std::string ref;
517 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
518 configs.Deserialize(ref);
519 return ret;
520 }
521
522 /**
523 * \brief Applies the contents of the specified config to the device.
524 *
525 * This will wait up to #DefaultTimeoutSeconds.
526 *
527 * \details Call to apply the selected configs.
528 *
529 * \param configs Configs to apply against.
530 * \returns StatusCode of the set command
531 */
533 {
534 return Apply(configs, DefaultTimeoutSeconds);
535 }
536
537 /**
538 * \brief Applies the contents of the specified config to the device.
539 *
540 * \details Call to apply the selected configs.
541 *
542 * \param configs Configs to apply against.
543 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
544 * \returns StatusCode of the set command
545 */
546 ctre::phoenix::StatusCode Apply(const QuadratureConfigs &configs, units::time::second_t timeoutSeconds)
547 {
548 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
549 }
550
551 /**
552 * \brief Refreshes the values of the specified config group.
553 *
554 * This will wait up to #DefaultTimeoutSeconds.
555 *
556 * \details Call to refresh the selected configs from the device.
557 *
558 * \param configs The configs to refresh
559 * \returns StatusCode of refreshing the configs
560 */
562 {
563 return Refresh(configs, DefaultTimeoutSeconds);
564 }
565 /**
566 * \brief Refreshes the values of the specified config group.
567 *
568 * \details Call to refresh the selected configs from the device.
569 *
570 * \param configs The configs to refresh
571 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
572 * \returns StatusCode of refreshing the configs
573 */
574 ctre::phoenix::StatusCode Refresh(PWM1Configs &configs, units::time::second_t timeoutSeconds) const
575 {
576 std::string ref;
577 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
578 configs.Deserialize(ref);
579 return ret;
580 }
581
582 /**
583 * \brief Applies the contents of the specified config to the device.
584 *
585 * This will wait up to #DefaultTimeoutSeconds.
586 *
587 * \details Call to apply the selected configs.
588 *
589 * \param configs Configs to apply against.
590 * \returns StatusCode of the set command
591 */
593 {
594 return Apply(configs, DefaultTimeoutSeconds);
595 }
596
597 /**
598 * \brief Applies the contents of the specified config to the device.
599 *
600 * \details Call to apply the selected configs.
601 *
602 * \param configs Configs to apply against.
603 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
604 * \returns StatusCode of the set command
605 */
606 ctre::phoenix::StatusCode Apply(const PWM1Configs &configs, units::time::second_t timeoutSeconds)
607 {
608 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
609 }
610
611 /**
612 * \brief Refreshes the values of the specified config group.
613 *
614 * This will wait up to #DefaultTimeoutSeconds.
615 *
616 * \details Call to refresh the selected configs from the device.
617 *
618 * \param configs The configs to refresh
619 * \returns StatusCode of refreshing the configs
620 */
622 {
623 return Refresh(configs, DefaultTimeoutSeconds);
624 }
625 /**
626 * \brief Refreshes the values of the specified config group.
627 *
628 * \details Call to refresh the selected configs from the device.
629 *
630 * \param configs The configs to refresh
631 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
632 * \returns StatusCode of refreshing the configs
633 */
634 ctre::phoenix::StatusCode Refresh(PWM2Configs &configs, units::time::second_t timeoutSeconds) const
635 {
636 std::string ref;
637 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
638 configs.Deserialize(ref);
639 return ret;
640 }
641
642 /**
643 * \brief Applies the contents of the specified config to the device.
644 *
645 * This will wait up to #DefaultTimeoutSeconds.
646 *
647 * \details Call to apply the selected configs.
648 *
649 * \param configs Configs to apply against.
650 * \returns StatusCode of the set command
651 */
653 {
654 return Apply(configs, DefaultTimeoutSeconds);
655 }
656
657 /**
658 * \brief Applies the contents of the specified config to the device.
659 *
660 * \details Call to apply the selected configs.
661 *
662 * \param configs Configs to apply against.
663 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
664 * \returns StatusCode of the set command
665 */
666 ctre::phoenix::StatusCode Apply(const PWM2Configs &configs, units::time::second_t timeoutSeconds)
667 {
668 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
669 }
670
671
672 /**
673 * \brief Sets the position of the quadrature input.
674 *
675 * This will wait up to #DefaultTimeoutSeconds.
676 *
677 * This is available in the configurator in case the user wants
678 * to initialize their device entirely without passing a device
679 * reference down to the code that performs the initialization.
680 * In this case, the user passes down the configurator object
681 * and performs all the initialization code on the object.
682 *
683 * \param newValue Value to set to. Units are in rotations.
684 * \returns StatusCode of the set command
685 */
687 {
688 return SetQuadraturePosition(newValue, DefaultTimeoutSeconds);
689 }
690 /**
691 * \brief Sets the position of the quadrature input.
692 *
693 * This is available in the configurator in case the user wants
694 * to initialize their device entirely without passing a device
695 * reference down to the code that performs the initialization.
696 * In this case, the user passes down the configurator object
697 * and performs all the initialization code on the object.
698 *
699 * \param newValue Value to set to. Units are in rotations.
700 * \param timeoutSeconds Maximum time to wait up to in seconds.
701 * \returns StatusCode of the set command
702 */
703 ctre::phoenix::StatusCode SetQuadraturePosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds);
704
705 /**
706 * \brief Clear the sticky faults in the device.
707 *
708 * \details This typically has no impact on the device functionality.
709 * Instead, it just clears telemetry faults that are accessible via
710 * API and Tuner Self-Test.
711 *
712 * This will wait up to #DefaultTimeoutSeconds.
713 *
714 * This is available in the configurator in case the user wants
715 * to initialize their device entirely without passing a device
716 * reference down to the code that performs the initialization.
717 * In this case, the user passes down the configurator object
718 * and performs all the initialization code on the object.
719 *
720 * \returns StatusCode of the set command
721 */
723 {
724 return ClearStickyFaults(DefaultTimeoutSeconds);
725 }
726 /**
727 * \brief Clear the sticky faults in the device.
728 *
729 * \details This typically has no impact on the device functionality.
730 * Instead, it just clears telemetry faults that are accessible via
731 * API and Tuner Self-Test.
732 *
733 * This is available in the configurator in case the user wants
734 * to initialize their device entirely without passing a device
735 * reference down to the code that performs the initialization.
736 * In this case, the user passes down the configurator object
737 * and performs all the initialization code on the object.
738 *
739 * \param timeoutSeconds Maximum time to wait up to in seconds.
740 * \returns StatusCode of the set command
741 */
742 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds);
743
744 /**
745 * \brief Clear sticky fault: Hardware fault occurred
746 *
747 * This will wait up to #DefaultTimeoutSeconds.
748 *
749 * This is available in the configurator in case the user wants
750 * to initialize their device entirely without passing a device
751 * reference down to the code that performs the initialization.
752 * In this case, the user passes down the configurator object
753 * and performs all the initialization code on the object.
754 *
755 * \returns StatusCode of the set command
756 */
758 {
759 return ClearStickyFault_Hardware(DefaultTimeoutSeconds);
760 }
761 /**
762 * \brief Clear sticky fault: Hardware fault occurred
763 *
764 * This is available in the configurator in case the user wants
765 * to initialize their device entirely without passing a device
766 * reference down to the code that performs the initialization.
767 * In this case, the user passes down the configurator object
768 * and performs all the initialization code on the object.
769 *
770 * \param timeoutSeconds Maximum time to wait up to in seconds.
771 * \returns StatusCode of the set command
772 */
773 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds);
774
775 /**
776 * \brief Clear sticky fault: Device supply voltage dropped to near
777 * brownout levels
778 *
779 * This will wait up to #DefaultTimeoutSeconds.
780 *
781 * This is available in the configurator in case the user wants
782 * to initialize their device entirely without passing a device
783 * reference down to the code that performs the initialization.
784 * In this case, the user passes down the configurator object
785 * and performs all the initialization code on the object.
786 *
787 * \returns StatusCode of the set command
788 */
790 {
791 return ClearStickyFault_Undervoltage(DefaultTimeoutSeconds);
792 }
793 /**
794 * \brief Clear sticky fault: Device supply voltage dropped to near
795 * brownout levels
796 *
797 * This is available in the configurator in case the user wants
798 * to initialize their device entirely without passing a device
799 * reference down to the code that performs the initialization.
800 * In this case, the user passes down the configurator object
801 * and performs all the initialization code on the object.
802 *
803 * \param timeoutSeconds Maximum time to wait up to in seconds.
804 * \returns StatusCode of the set command
805 */
806 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds);
807
808 /**
809 * \brief Clear sticky fault: Device boot while detecting the enable
810 * signal
811 *
812 * This will wait up to #DefaultTimeoutSeconds.
813 *
814 * This is available in the configurator in case the user wants
815 * to initialize their device entirely without passing a device
816 * reference down to the code that performs the initialization.
817 * In this case, the user passes down the configurator object
818 * and performs all the initialization code on the object.
819 *
820 * \returns StatusCode of the set command
821 */
823 {
824 return ClearStickyFault_BootDuringEnable(DefaultTimeoutSeconds);
825 }
826 /**
827 * \brief Clear sticky fault: Device boot while detecting the enable
828 * signal
829 *
830 * This is available in the configurator in case the user wants
831 * to initialize their device entirely without passing a device
832 * reference down to the code that performs the initialization.
833 * In this case, the user passes down the configurator object
834 * and performs all the initialization code on the object.
835 *
836 * \param timeoutSeconds Maximum time to wait up to in seconds.
837 * \returns StatusCode of the set command
838 */
840
841 /**
842 * \brief Clear sticky fault: An unlicensed feature is in use, device
843 * may not behave as expected.
844 *
845 * This will wait up to #DefaultTimeoutSeconds.
846 *
847 * This is available in the configurator in case the user wants
848 * to initialize their device entirely without passing a device
849 * reference down to the code that performs the initialization.
850 * In this case, the user passes down the configurator object
851 * and performs all the initialization code on the object.
852 *
853 * \returns StatusCode of the set command
854 */
856 {
857 return ClearStickyFault_UnlicensedFeatureInUse(DefaultTimeoutSeconds);
858 }
859 /**
860 * \brief Clear sticky fault: An unlicensed feature is in use, device
861 * may not behave as expected.
862 *
863 * This is available in the configurator in case the user wants
864 * to initialize their device entirely without passing a device
865 * reference down to the code that performs the initialization.
866 * In this case, the user passes down the configurator object
867 * and performs all the initialization code on the object.
868 *
869 * \param timeoutSeconds Maximum time to wait up to in seconds.
870 * \returns StatusCode of the set command
871 */
873
874 /**
875 * \brief Clear sticky fault: The CTR Electronics' CANdi™ branded
876 * device has detected a 5V fault. This may be due to overcurrent or a
877 * short-circuit.
878 *
879 * This will wait up to #DefaultTimeoutSeconds.
880 *
881 * This is available in the configurator in case the user wants
882 * to initialize their device entirely without passing a device
883 * reference down to the code that performs the initialization.
884 * In this case, the user passes down the configurator object
885 * and performs all the initialization code on the object.
886 *
887 * \returns StatusCode of the set command
888 */
890 {
891 return ClearStickyFault_5V(DefaultTimeoutSeconds);
892 }
893 /**
894 * \brief Clear sticky fault: The CTR Electronics' CANdi™ branded
895 * device has detected a 5V fault. This may be due to overcurrent or a
896 * short-circuit.
897 *
898 * This is available in the configurator in case the user wants
899 * to initialize their device entirely without passing a device
900 * reference down to the code that performs the initialization.
901 * In this case, the user passes down the configurator object
902 * and performs all the initialization code on the object.
903 *
904 * \param timeoutSeconds Maximum time to wait up to in seconds.
905 * \returns StatusCode of the set command
906 */
907 ctre::phoenix::StatusCode ClearStickyFault_5V(units::time::second_t timeoutSeconds);
908};
909
910}
911
912namespace hardware {
913namespace core {
914
915#if defined(_WIN32) || defined(_WIN64)
916#pragma warning(push)
917#pragma warning(disable : 4250)
918#endif
919
920/**
921 * Class for CTR Electronics' CANdi™ branded device, a device that integrates
922 * digital signals into the existing CAN bus network.
923 */
925{
926private:
928
929public:
930 /**
931 * \brief The configuration class for this device.
932 */
934
935 /**
936 * Constructs a new CANdi object.
937 *
938 * \param deviceId ID of the device, as configured in Phoenix Tuner
939 * \param canbus The CAN bus this device is on
940 */
941 CoreCANdi(int deviceId, CANBus canbus = {});
942
943 /**
944 * Constructs a new CANdi object.
945 *
946 * \param deviceId ID of the device, as configured in Phoenix Tuner
947 * \param canbus Name of the CAN bus this device is on. Possible CAN bus strings are:
948 * - "rio" for the native roboRIO CAN bus
949 * - CANivore name or serial number
950 * - SocketCAN interface (non-FRC Linux only)
951 * - "*" for any CANivore seen by the program
952 * - empty string (default) to select the default for the system:
953 * - "rio" on roboRIO
954 * - "can0" on Linux
955 * - "*" on Windows
956 *
957 * \deprecated Constructing devices with a CAN bus string is deprecated for removal
958 * in the 2027 season. Construct devices using a CANBus instance instead.
959 */
960 CoreCANdi(int deviceId, std::string canbus);
961
962 /**
963 * \brief Gets the configurator for this CANdi
964 *
965 * \details Gets the configurator for this CANdi
966 *
967 * \returns Configurator for this CANdi
968 */
970 {
971 return _configs;
972 }
973
974 /**
975 * \brief Gets the configurator for this CANdi
976 *
977 * \details Gets the configurator for this CANdi
978 *
979 * \returns Configurator for this CANdi
980 */
982 {
983 return _configs;
984 }
985
986
987private:
988 std::unique_ptr<sim::CANdiSimState> _simState{};
989public:
990 /**
991 * \brief Get the simulation state for this device.
992 *
993 * \details This function reuses an allocated simulation
994 * state object, so it is safe to call this function multiple
995 * times in a robot loop.
996 *
997 * \returns Simulation state
998 */
1000 {
1001 if (_simState == nullptr)
1002 _simState = std::make_unique<sim::CANdiSimState>(*this);
1003 return *_simState;
1004 }
1005
1006
1007
1008 /**
1009 * \brief App Major Version number.
1010 *
1011 * - Minimum Value: 0
1012 * - Maximum Value: 255
1013 * - Default Value: 0
1014 * - Units:
1015 *
1016 * Default Rates:
1017 * - CAN: 4.0 Hz
1018 *
1019 * This refreshes and returns a cached StatusSignal object.
1020 *
1021 * \param refresh Whether to refresh the StatusSignal before returning it;
1022 * defaults to true
1023 * \returns VersionMajor Status Signal Object
1024 */
1025 StatusSignal<int> &GetVersionMajor(bool refresh = true);
1026
1027 /**
1028 * \brief App Minor Version number.
1029 *
1030 * - Minimum Value: 0
1031 * - Maximum Value: 255
1032 * - Default Value: 0
1033 * - Units:
1034 *
1035 * Default Rates:
1036 * - CAN: 4.0 Hz
1037 *
1038 * This refreshes and returns a cached StatusSignal object.
1039 *
1040 * \param refresh Whether to refresh the StatusSignal before returning it;
1041 * defaults to true
1042 * \returns VersionMinor Status Signal Object
1043 */
1044 StatusSignal<int> &GetVersionMinor(bool refresh = true);
1045
1046 /**
1047 * \brief App Bugfix Version number.
1048 *
1049 * - Minimum Value: 0
1050 * - Maximum Value: 255
1051 * - Default Value: 0
1052 * - Units:
1053 *
1054 * Default Rates:
1055 * - CAN: 4.0 Hz
1056 *
1057 * This refreshes and returns a cached StatusSignal object.
1058 *
1059 * \param refresh Whether to refresh the StatusSignal before returning it;
1060 * defaults to true
1061 * \returns VersionBugfix Status Signal Object
1062 */
1064
1065 /**
1066 * \brief App Build Version number.
1067 *
1068 * - Minimum Value: 0
1069 * - Maximum Value: 255
1070 * - Default Value: 0
1071 * - Units:
1072 *
1073 * Default Rates:
1074 * - CAN: 4.0 Hz
1075 *
1076 * This refreshes and returns a cached StatusSignal object.
1077 *
1078 * \param refresh Whether to refresh the StatusSignal before returning it;
1079 * defaults to true
1080 * \returns VersionBuild Status Signal Object
1081 */
1082 StatusSignal<int> &GetVersionBuild(bool refresh = true);
1083
1084 /**
1085 * \brief Full Version of firmware in device. The format is a four
1086 * byte value.
1087 *
1088 * - Minimum Value: 0
1089 * - Maximum Value: 4294967295
1090 * - Default Value: 0
1091 * - Units:
1092 *
1093 * Default Rates:
1094 * - CAN: 4.0 Hz
1095 *
1096 * This refreshes and returns a cached StatusSignal object.
1097 *
1098 * \param refresh Whether to refresh the StatusSignal before returning it;
1099 * defaults to true
1100 * \returns Version Status Signal Object
1101 */
1102 StatusSignal<int> &GetVersion(bool refresh = true);
1103
1104 /**
1105 * \brief Integer representing all fault flags reported by the device.
1106 *
1107 * \details These are device specific and are not used directly in
1108 * typical applications. Use the signal specific GetFault_*() methods
1109 * instead.
1110 *
1111 * - Minimum Value: 0
1112 * - Maximum Value: 4294967295
1113 * - Default Value: 0
1114 * - Units:
1115 *
1116 * Default Rates:
1117 * - CAN: 4.0 Hz
1118 *
1119 * This refreshes and returns a cached StatusSignal object.
1120 *
1121 * \param refresh Whether to refresh the StatusSignal before returning it;
1122 * defaults to true
1123 * \returns FaultField Status Signal Object
1124 */
1125 StatusSignal<int> &GetFaultField(bool refresh = true);
1126
1127 /**
1128 * \brief Integer representing all (persistent) sticky fault flags
1129 * reported by the device.
1130 *
1131 * \details These are device specific and are not used directly in
1132 * typical applications. Use the signal specific GetStickyFault_*()
1133 * methods instead.
1134 *
1135 * - Minimum Value: 0
1136 * - Maximum Value: 4294967295
1137 * - Default Value: 0
1138 * - Units:
1139 *
1140 * Default Rates:
1141 * - CAN: 4.0 Hz
1142 *
1143 * This refreshes and returns a cached StatusSignal object.
1144 *
1145 * \param refresh Whether to refresh the StatusSignal before returning it;
1146 * defaults to true
1147 * \returns StickyFaultField Status Signal Object
1148 */
1150
1151 /**
1152 * \brief Whether the device is Phoenix Pro licensed.
1153 *
1154 * - Default Value: False
1155 *
1156 * Default Rates:
1157 * - CAN: 4.0 Hz
1158 *
1159 * This refreshes and returns a cached StatusSignal object.
1160 *
1161 * \param refresh Whether to refresh the StatusSignal before returning it;
1162 * defaults to true
1163 * \returns IsProLicensed Status Signal Object
1164 */
1166
1167 /**
1168 * \brief State of the Signal 1 input (S1IN).
1169 *
1170 *
1171 * Default Rates:
1172 * - CAN 2.0: 100.0 Hz
1173 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1174 *
1175 * This refreshes and returns a cached StatusSignal object.
1176 *
1177 * \param refresh Whether to refresh the StatusSignal before returning it;
1178 * defaults to true
1179 * \returns S1State Status Signal Object
1180 */
1182
1183 /**
1184 * \brief State of the Signal 2 input (S2IN).
1185 *
1186 *
1187 * Default Rates:
1188 * - CAN 2.0: 100.0 Hz
1189 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1190 *
1191 * This refreshes and returns a cached StatusSignal object.
1192 *
1193 * \param refresh Whether to refresh the StatusSignal before returning it;
1194 * defaults to true
1195 * \returns S2State Status Signal Object
1196 */
1198
1199 /**
1200 * \brief Position from a quadrature encoder sensor connected to both
1201 * the S1IN and S2IN inputs.
1202 *
1203 * - Minimum Value: -16384.0
1204 * - Maximum Value: 16383.999755859375
1205 * - Default Value: 0
1206 * - Units: rotations
1207 *
1208 * Default Rates:
1209 * - CAN 2.0: 20.0 Hz
1210 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1211 *
1212 * This refreshes and returns a cached StatusSignal object.
1213 *
1214 * \param refresh Whether to refresh the StatusSignal before returning it;
1215 * defaults to true
1216 * \returns QuadraturePosition Status Signal Object
1217 */
1219
1220 /**
1221 * \brief Measured rise to rise time of the PWM signal at the S1 input
1222 * of the CTR Electronics' CANdi™.
1223 *
1224 * - Minimum Value: 0
1225 * - Maximum Value: 131070
1226 * - Default Value: 0
1227 * - Units: us
1228 *
1229 * Default Rates:
1230 * - CAN 2.0: 20.0 Hz
1231 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1232 *
1233 * This refreshes and returns a cached StatusSignal object.
1234 *
1235 * \param refresh Whether to refresh the StatusSignal before returning it;
1236 * defaults to true
1237 * \returns PWM1RiseToRise Status Signal Object
1238 */
1240
1241 /**
1242 * \brief Measured position of the PWM sensor at the S1 input of the
1243 * CTR Electronics' CANdi™.
1244 *
1245 * - Minimum Value: -16384.0
1246 * - Maximum Value: 16383.999755859375
1247 * - Default Value: 0
1248 * - Units: rotations
1249 *
1250 * Default Rates:
1251 * - CAN 2.0: 20.0 Hz
1252 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1253 *
1254 * This refreshes and returns a cached StatusSignal object.
1255 *
1256 * \param refresh Whether to refresh the StatusSignal before returning it;
1257 * defaults to true
1258 * \returns PWM1Position Status Signal Object
1259 */
1261
1262 /**
1263 * \brief Measured velocity of the PWM sensor at the S1 input of the
1264 * CTR Electronics' CANdi™.
1265 *
1266 * - Minimum Value: -512.0
1267 * - Maximum Value: 511.998046875
1268 * - Default Value: 0
1269 * - Units: rotations per second
1270 *
1271 * Default Rates:
1272 * - CAN 2.0: 20.0 Hz
1273 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1274 *
1275 * This refreshes and returns a cached StatusSignal object.
1276 *
1277 * \param refresh Whether to refresh the StatusSignal before returning it;
1278 * defaults to true
1279 * \returns PWM1Velocity Status Signal Object
1280 */
1282
1283 /**
1284 * \brief Measured rise to rise time of the PWM signal at the S2 input
1285 * of the CTR Electronics' CANdi™.
1286 *
1287 * - Minimum Value: 0
1288 * - Maximum Value: 131070
1289 * - Default Value: 0
1290 * - Units: us
1291 *
1292 * Default Rates:
1293 * - CAN 2.0: 20.0 Hz
1294 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1295 *
1296 * This refreshes and returns a cached StatusSignal object.
1297 *
1298 * \param refresh Whether to refresh the StatusSignal before returning it;
1299 * defaults to true
1300 * \returns PWM2RiseToRise Status Signal Object
1301 */
1303
1304 /**
1305 * \brief Measured position of the PWM sensor at the S2 input of the
1306 * CTR Electronics' CANdi™.
1307 *
1308 * - Minimum Value: -16384.0
1309 * - Maximum Value: 16383.999755859375
1310 * - Default Value: 0
1311 * - Units: rotations
1312 *
1313 * Default Rates:
1314 * - CAN 2.0: 20.0 Hz
1315 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1316 *
1317 * This refreshes and returns a cached StatusSignal object.
1318 *
1319 * \param refresh Whether to refresh the StatusSignal before returning it;
1320 * defaults to true
1321 * \returns PWM2Position Status Signal Object
1322 */
1324
1325 /**
1326 * \brief True when the CANdi™ is in overcurrent protection mode. This
1327 * may be due to either overcurrent or a short-circuit.
1328 *
1329 * - Default Value: 0
1330 *
1331 * Default Rates:
1332 * - CAN 2.0: 100.0 Hz
1333 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1334 *
1335 * This refreshes and returns a cached StatusSignal object.
1336 *
1337 * \param refresh Whether to refresh the StatusSignal before returning it;
1338 * defaults to true
1339 * \returns Overcurrent Status Signal Object
1340 */
1341 StatusSignal<bool> &GetOvercurrent(bool refresh = true);
1342
1343 /**
1344 * \brief Measured supply voltage to the CANdi™.
1345 *
1346 * - Minimum Value: 4.0
1347 * - Maximum Value: 29.5
1348 * - Default Value: 0
1349 * - Units: V
1350 *
1351 * Default Rates:
1352 * - CAN 2.0: 100.0 Hz
1353 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1354 *
1355 * This refreshes and returns a cached StatusSignal object.
1356 *
1357 * \param refresh Whether to refresh the StatusSignal before returning it;
1358 * defaults to true
1359 * \returns SupplyVoltage Status Signal Object
1360 */
1362
1363 /**
1364 * \brief Measured output current. This includes both Vbat and 5V
1365 * output current.
1366 *
1367 * - Minimum Value: 0.0
1368 * - Maximum Value: 0.51
1369 * - Default Value: 0
1370 * - Units: A
1371 *
1372 * Default Rates:
1373 * - CAN 2.0: 100.0 Hz
1374 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1375 *
1376 * This refreshes and returns a cached StatusSignal object.
1377 *
1378 * \param refresh Whether to refresh the StatusSignal before returning it;
1379 * defaults to true
1380 * \returns OutputCurrent Status Signal Object
1381 */
1383
1384 /**
1385 * \brief Measured velocity of the PWM sensor at the S2 input of the
1386 * CTR Electronics' CANdi™.
1387 *
1388 * - Minimum Value: -512.0
1389 * - Maximum Value: 511.998046875
1390 * - Default Value: 0
1391 * - Units: rotations per second
1392 *
1393 * Default Rates:
1394 * - CAN 2.0: 20.0 Hz
1395 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1396 *
1397 * This refreshes and returns a cached StatusSignal object.
1398 *
1399 * \param refresh Whether to refresh the StatusSignal before returning it;
1400 * defaults to true
1401 * \returns PWM2Velocity Status Signal Object
1402 */
1404
1405 /**
1406 * \brief Velocity from a quadrature encoder sensor connected to both
1407 * the S1IN and S2IN inputs.
1408 *
1409 * - Minimum Value: -512.0
1410 * - Maximum Value: 511.998046875
1411 * - Default Value: 0
1412 * - Units: rotations per second
1413 *
1414 * Default Rates:
1415 * - CAN 2.0: 20.0 Hz
1416 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1417 *
1418 * This refreshes and returns a cached StatusSignal object.
1419 *
1420 * \param refresh Whether to refresh the StatusSignal before returning it;
1421 * defaults to true
1422 * \returns QuadratureVelocity Status Signal Object
1423 */
1425
1426 /**
1427 * \brief True if the Signal 1 input (S1IN) matches the configured S1
1428 * Closed State.
1429 *
1430 * \details Configure the S1 closed state in the Digitals
1431 * configuration object to change when this is asserted.
1432 *
1433 * - Default Value: False
1434 *
1435 * Default Rates:
1436 * - CAN 2.0: 100.0 Hz
1437 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1438 *
1439 * This refreshes and returns a cached StatusSignal object.
1440 *
1441 * \param refresh Whether to refresh the StatusSignal before returning it;
1442 * defaults to true
1443 * \returns S1Closed Status Signal Object
1444 */
1445 StatusSignal<bool> &GetS1Closed(bool refresh = true);
1446
1447 /**
1448 * \brief True if the Signal 2 input (S2IN) matches the configured S2
1449 * Closed State.
1450 *
1451 * \details Configure the S2 closed state in the Digitals
1452 * configuration object to change when this is asserted.
1453 *
1454 * - Default Value: False
1455 *
1456 * Default Rates:
1457 * - CAN 2.0: 100.0 Hz
1458 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1459 *
1460 * This refreshes and returns a cached StatusSignal object.
1461 *
1462 * \param refresh Whether to refresh the StatusSignal before returning it;
1463 * defaults to true
1464 * \returns S2Closed Status Signal Object
1465 */
1466 StatusSignal<bool> &GetS2Closed(bool refresh = true);
1467
1468 /**
1469 * \brief Hardware fault occurred
1470 *
1471 * - Default Value: False
1472 *
1473 * Default Rates:
1474 * - CAN: 4.0 Hz
1475 *
1476 * This refreshes and returns a cached StatusSignal object.
1477 *
1478 * \param refresh Whether to refresh the StatusSignal before returning it;
1479 * defaults to true
1480 * \returns Fault_Hardware Status Signal Object
1481 */
1483
1484 /**
1485 * \brief Hardware fault occurred
1486 *
1487 * - Default Value: False
1488 *
1489 * Default Rates:
1490 * - CAN: 4.0 Hz
1491 *
1492 * This refreshes and returns a cached StatusSignal object.
1493 *
1494 * \param refresh Whether to refresh the StatusSignal before returning it;
1495 * defaults to true
1496 * \returns StickyFault_Hardware Status Signal Object
1497 */
1499
1500 /**
1501 * \brief Device supply voltage dropped to near brownout levels
1502 *
1503 * - Default Value: False
1504 *
1505 * Default Rates:
1506 * - CAN: 4.0 Hz
1507 *
1508 * This refreshes and returns a cached StatusSignal object.
1509 *
1510 * \param refresh Whether to refresh the StatusSignal before returning it;
1511 * defaults to true
1512 * \returns Fault_Undervoltage Status Signal Object
1513 */
1515
1516 /**
1517 * \brief Device supply voltage dropped to near brownout levels
1518 *
1519 * - Default Value: False
1520 *
1521 * Default Rates:
1522 * - CAN: 4.0 Hz
1523 *
1524 * This refreshes and returns a cached StatusSignal object.
1525 *
1526 * \param refresh Whether to refresh the StatusSignal before returning it;
1527 * defaults to true
1528 * \returns StickyFault_Undervoltage Status Signal Object
1529 */
1531
1532 /**
1533 * \brief Device boot while detecting the enable signal
1534 *
1535 * - Default Value: False
1536 *
1537 * Default Rates:
1538 * - CAN: 4.0 Hz
1539 *
1540 * This refreshes and returns a cached StatusSignal object.
1541 *
1542 * \param refresh Whether to refresh the StatusSignal before returning it;
1543 * defaults to true
1544 * \returns Fault_BootDuringEnable Status Signal Object
1545 */
1547
1548 /**
1549 * \brief Device boot while detecting the enable signal
1550 *
1551 * - Default Value: False
1552 *
1553 * Default Rates:
1554 * - CAN: 4.0 Hz
1555 *
1556 * This refreshes and returns a cached StatusSignal object.
1557 *
1558 * \param refresh Whether to refresh the StatusSignal before returning it;
1559 * defaults to true
1560 * \returns StickyFault_BootDuringEnable Status Signal Object
1561 */
1563
1564 /**
1565 * \brief An unlicensed feature is in use, device may not behave as
1566 * expected.
1567 *
1568 * - Default Value: False
1569 *
1570 * Default Rates:
1571 * - CAN: 4.0 Hz
1572 *
1573 * This refreshes and returns a cached StatusSignal object.
1574 *
1575 * \param refresh Whether to refresh the StatusSignal before returning it;
1576 * defaults to true
1577 * \returns Fault_UnlicensedFeatureInUse Status Signal Object
1578 */
1580
1581 /**
1582 * \brief An unlicensed feature is in use, device may not behave as
1583 * expected.
1584 *
1585 * - Default Value: False
1586 *
1587 * Default Rates:
1588 * - CAN: 4.0 Hz
1589 *
1590 * This refreshes and returns a cached StatusSignal object.
1591 *
1592 * \param refresh Whether to refresh the StatusSignal before returning it;
1593 * defaults to true
1594 * \returns StickyFault_UnlicensedFeatureInUse Status Signal Object
1595 */
1597
1598 /**
1599 * \brief The CTR Electronics' CANdi™ branded device has detected a 5V
1600 * fault. This may be due to overcurrent or a short-circuit.
1601 *
1602 * - Default Value: False
1603 *
1604 * Default Rates:
1605 * - CAN: 4.0 Hz
1606 *
1607 * This refreshes and returns a cached StatusSignal object.
1608 *
1609 * \param refresh Whether to refresh the StatusSignal before returning it;
1610 * defaults to true
1611 * \returns Fault_5V Status Signal Object
1612 */
1613 StatusSignal<bool> &GetFault_5V(bool refresh = true);
1614
1615 /**
1616 * \brief The CTR Electronics' CANdi™ branded device has detected a 5V
1617 * fault. This may be due to overcurrent or a short-circuit.
1618 *
1619 * - Default Value: False
1620 *
1621 * Default Rates:
1622 * - CAN: 4.0 Hz
1623 *
1624 * This refreshes and returns a cached StatusSignal object.
1625 *
1626 * \param refresh Whether to refresh the StatusSignal before returning it;
1627 * defaults to true
1628 * \returns StickyFault_5V Status Signal Object
1629 */
1631
1632
1633
1634 /**
1635 * \brief Control device with generic control request object. User must make
1636 * sure the specified object is castable to a valid control request,
1637 * otherwise this function will fail at run-time and return the NotSupported
1638 * StatusCode
1639 *
1640 * \param request Control object to request of the device
1641 * \returns Status Code of the request, 0 is OK
1642 */
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:474
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:514
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:394
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:757
ctre::phoenix::StatusCode Refresh(PWM1Configs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:574
ctre::phoenix::StatusCode Apply(const QuadratureConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:532
ctre::phoenix::StatusCode SetQuadraturePosition(units::angle::turn_t newValue)
Sets the position of the quadrature input.
Definition CoreCANdi.hpp:686
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:486
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:441
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:426
ctre::phoenix::StatusCode Refresh(CANdiConfiguration &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:333
ctre::phoenix::StatusCode Apply(const PWM1Configs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:592
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:606
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANdi.hpp:789
ctre::phoenix::StatusCode Refresh(QuadratureConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:501
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:546
ctre::phoenix::StatusCode Apply(const CANdiConfiguration &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:351
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:666
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:722
ctre::phoenix::StatusCode Refresh(PWM1Configs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:561
ctre::phoenix::StatusCode Refresh(CANdiConfiguration &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:319
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:381
ctre::phoenix::StatusCode Apply(const DigitalInputsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:472
ctre::phoenix::StatusCode Refresh(PWM2Configs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:621
ctre::phoenix::StatusCode Apply(const PWM2Configs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:652
ctre::phoenix::StatusCode ClearStickyFault_5V()
Clear sticky fault: The CTR Electronics' CANdi™ branded device has detected a 5V fault.
Definition CoreCANdi.hpp:889
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANdi.hpp:412
ctre::phoenix::StatusCode Refresh(PWM2Configs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANdi.hpp:634
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:454
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:365
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANdi.hpp:822
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANdi.hpp:855
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
Definition Configurator.hpp:18
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
Common interface implemented by all control requests.
Definition ControlRequest.hpp:27
Definition DeviceIdentifier.hpp:16
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:925
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
ctre::phoenix::StatusCode SetControl(controls::ControlRequest const &request)
Control device with generic control request object.
StatusSignal< bool > & GetFault_Hardware(bool refresh=true)
Hardware fault occurred.
configs::CANdiConfigurator const & GetConfigurator() const
Gets the configurator for this CANdi.
Definition CoreCANdi.hpp:981
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:999
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:969
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).
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