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