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