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