CTRE Phoenix 6 C++ 26.70.0-alpha-2
Loading...
Searching...
No Matches
CoreCANcoder.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
16
18#include <wpi/units/angle.hpp>
19#include <wpi/units/angular_velocity.hpp>
20#include <wpi/units/voltage.hpp>
21
22namespace ctre {
23namespace phoenix6 {
24
25namespace hardware {
26namespace core {
27 class CoreCANcoder;
28}
29}
30
31namespace configs {
32
33/**
34 * All configurations for the hardware#CANcoder.
35 */
37{
38public:
39 constexpr CANcoderConfiguration() = default;
40
41 /**
42 * \brief True if we should factory default newer unsupported configs,
43 * false to leave newer unsupported configs alone.
44 *
45 * \details This flag addresses a corner case where the device may have
46 * firmware with newer configs that didn't exist when this
47 * version of the API was built. If this occurs and this
48 * flag is true, unsupported new configs will be factory
49 * defaulted to avoid unexpected behavior.
50 *
51 * This is also the behavior in Phoenix 5, so this flag
52 * is defaulted to true to match.
53 */
55
56
57 /**
58 * \brief Configs that affect the magnet sensor and how to interpret
59 * it.
60 *
61 * \details Includes sensor direction, the sensor discontinuity point,
62 * and the magnet offset.
63 *
64 * Parameter list:
65 *
66 * - MagnetSensorConfigs#SensorDirection
67 * - MagnetSensorConfigs#MagnetOffset
68 * - MagnetSensorConfigs#AbsoluteSensorDiscontinuityPoint
69 *
70 */
72
73 /**
74 * \brief Custom Params.
75 *
76 * \details Custom paramaters that have no real impact on controller.
77 *
78 * Parameter list:
79 *
80 * - CustomParamsConfigs#CustomParam0
81 * - CustomParamsConfigs#CustomParam1
82 *
83 */
85
86 /**
87 * \brief Modifies this configuration's MagnetSensor parameter and returns itself for
88 * method-chaining and easier to use config API.
89 *
90 * Configs that affect the magnet sensor and how to interpret it.
91 *
92 * \details Includes sensor direction, the sensor discontinuity point,
93 * and the magnet offset.
94 *
95 * Parameter list:
96 *
97 * - MagnetSensorConfigs#SensorDirection
98 * - MagnetSensorConfigs#MagnetOffset
99 * - MagnetSensorConfigs#AbsoluteSensorDiscontinuityPoint
100 *
101 *
102 * \param newMagnetSensor Parameter to modify
103 * \returns Itself
104 */
106 {
107 MagnetSensor = std::move(newMagnetSensor);
108 return *this;
109 }
110
111 /**
112 * \brief Modifies this configuration's CustomParams parameter and returns itself for
113 * method-chaining and easier to use config API.
114 *
115 * Custom Params.
116 *
117 * \details Custom paramaters that have no real impact on controller.
118 *
119 * Parameter list:
120 *
121 * - CustomParamsConfigs#CustomParam0
122 * - CustomParamsConfigs#CustomParam1
123 *
124 *
125 * \param newCustomParams Parameter to modify
126 * \returns Itself
127 */
129 {
130 CustomParams = std::move(newCustomParams);
131 return *this;
132 }
133
134 /**
135 * \brief Get the string representation of this configuration
136 */
137 std::string ToString() const override;
138
139 /**
140 * \brief Get the serialized form of this configuration
141 */
142 std::string Serialize() const final;
143 /**
144 * \brief Take a string and deserialize it to this configuration
145 */
146 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
147};
148
149/**
150 * Handles applying and refreshing configurations for the hardware#CANcoder.
151 */
152class CANcoderConfigurator : public ParentConfigurator
153{
154private:
155 CANcoderConfigurator(hardware::DeviceIdentifier id) :
156 ParentConfigurator{std::move(id)}
157 {}
158
160
161public:
162 /**
163 * \brief Applies the contents of the specified config to the device.
164 *
165 * This will wait up to #DefaultTimeoutSeconds.
166 *
167 * \details Call to apply the selected configs.
168 *
169 * \param configs Configs to apply against.
170 * \returns Status code of applying the configs
171 */
176
177 /**
178 * \brief Applies the contents of the specified config to the device.
179 *
180 * \details Call to apply the selected configs.
181 *
182 * \param configs Configs to apply against.
183 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
184 * \returns Status code of applying the configs
185 */
186 ctre::phoenix::StatusCode Apply(const CANcoderConfiguration &configs, wpi::units::second_t timeoutSeconds)
187 {
188 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, configs.FutureProofConfigs, false);
189 }
190
191 /**
192 * \brief Applies the contents of the specified config to the device.
193 *
194 * This will wait up to #DefaultTimeoutSeconds.
195 *
196 * \details Call to apply the selected configs.
197 *
198 * \param configs Configs to apply against.
199 * \returns Status code of applying the configs
200 */
205
206 /**
207 * \brief Applies the contents of the specified config to the device.
208 *
209 * \details Call to apply the selected configs.
210 *
211 * \param configs Configs to apply against.
212 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
213 * \returns Status code of applying the configs
214 */
215 ctre::phoenix::StatusCode Apply(const MagnetSensorConfigs &configs, wpi::units::second_t timeoutSeconds)
216 {
217 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
218 }
219
220 /**
221 * \brief Applies the contents of the specified config to the device.
222 *
223 * This will wait up to #DefaultTimeoutSeconds.
224 *
225 * \details Call to apply the selected configs.
226 *
227 * \param configs Configs to apply against.
228 * \returns Status code of applying the configs
229 */
234
235 /**
236 * \brief Applies the contents of the specified config to the device.
237 *
238 * \details Call to apply the selected configs.
239 *
240 * \param configs Configs to apply against.
241 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
242 * \returns Status code of applying the configs
243 */
244 ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
245 {
246 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
247 }
248
249 /**
250 * \brief Refreshes the values of the specified config group.
251 *
252 * This will wait up to #DefaultTimeoutSeconds.
253 *
254 * \details Call to refresh the selected configs from the device.
255 *
256 * \param configs The configs to refresh
257 * \returns Status code of refreshing the configs
258 */
263
264 /**
265 * \brief Refreshes the values of the specified config group.
266 *
267 * \details Call to refresh the selected configs from the device.
268 *
269 * \param configs The configs to refresh
270 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
271 * \returns Status code of refreshing the configs
272 */
273 ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs, wpi::units::second_t timeoutSeconds) const
274 {
275 std::string ref;
276 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
277 configs.Deserialize(ref);
278 return ret;
279 }
280
281 /**
282 * \brief Refreshes the values of the specified config group.
283 *
284 * This will wait up to #DefaultTimeoutSeconds.
285 *
286 * \details Call to refresh the selected configs from the device.
287 *
288 * \param configs The configs to refresh
289 * \returns Status code of refreshing the configs
290 */
295 /**
296 * \brief Refreshes the values of the specified config group.
297 *
298 * \details Call to refresh the selected configs from the device.
299 *
300 * \param configs The configs to refresh
301 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
302 * \returns Status code of refreshing the configs
303 */
304 ctre::phoenix::StatusCode Refresh(MagnetSensorConfigs &configs, wpi::units::second_t timeoutSeconds) const
305 {
306 std::string ref;
307 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
308 configs.Deserialize(ref);
309 return ret;
310 }
311
312 /**
313 * \brief Refreshes the values of the specified config group.
314 *
315 * This will wait up to #DefaultTimeoutSeconds.
316 *
317 * \details Call to refresh the selected configs from the device.
318 *
319 * \param configs The configs to refresh
320 * \returns Status code of refreshing the configs
321 */
326 /**
327 * \brief Refreshes the values of the specified config group.
328 *
329 * \details Call to refresh the selected configs from the device.
330 *
331 * \param configs The configs to refresh
332 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
333 * \returns Status code of refreshing the configs
334 */
335 ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
336 {
337 std::string ref;
338 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
339 configs.Deserialize(ref);
340 return ret;
341 }
342
343
344 /**
345 * \brief Sets the current position of the device.
346 *
347 * This will wait up to #DefaultTimeoutSeconds.
348 *
349 * This is available in the configurator in case the user wants
350 * to initialize their device entirely without passing a device
351 * reference down to the code that performs the initialization.
352 * In this case, the user passes down the configurator object
353 * and performs all the initialization code on the object.
354 *
355 * \param newValue Value to set to. Units are in rotations.
356 * \returns StatusCode of the set command
357 */
358 ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t newValue)
359 {
360 return SetPosition(newValue, DefaultTimeoutSeconds);
361 }
362 /**
363 * \brief Sets the current position of the device.
364 *
365 * This is available in the configurator in case the user wants
366 * to initialize their device entirely without passing a device
367 * reference down to the code that performs the initialization.
368 * In this case, the user passes down the configurator object
369 * and performs all the initialization code on the object.
370 *
371 * \param newValue Value to set to. Units are in rotations.
372 * \param timeoutSeconds Maximum time to wait up to in seconds.
373 * \returns StatusCode of the set command
374 */
375 ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t newValue, wpi::units::second_t timeoutSeconds);
376
377 /**
378 * \brief Clear the sticky faults in the device.
379 *
380 * \details This typically has no impact on the device functionality.
381 * Instead, it just clears telemetry faults that are accessible via
382 * API and Tuner Self-Test.
383 *
384 * This will wait up to #DefaultTimeoutSeconds.
385 *
386 * This is available in the configurator in case the user wants
387 * to initialize their device entirely without passing a device
388 * reference down to the code that performs the initialization.
389 * In this case, the user passes down the configurator object
390 * and performs all the initialization code on the object.
391 *
392 * \returns StatusCode of the set command
393 */
398 /**
399 * \brief Clear the sticky faults in the device.
400 *
401 * \details This typically has no impact on the device functionality.
402 * Instead, it just clears telemetry faults that are accessible via
403 * API and Tuner Self-Test.
404 *
405 * This is available in the configurator in case the user wants
406 * to initialize their device entirely without passing a device
407 * reference down to the code that performs the initialization.
408 * In this case, the user passes down the configurator object
409 * and performs all the initialization code on the object.
410 *
411 * \param timeoutSeconds Maximum time to wait up to in seconds.
412 * \returns StatusCode of the set command
413 */
414 ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds);
415
416 /**
417 * \brief Clear sticky fault: Hardware fault occurred
418 *
419 * This will wait up to #DefaultTimeoutSeconds.
420 *
421 * This is available in the configurator in case the user wants
422 * to initialize their device entirely without passing a device
423 * reference down to the code that performs the initialization.
424 * In this case, the user passes down the configurator object
425 * and performs all the initialization code on the object.
426 *
427 * \returns StatusCode of the set command
428 */
433 /**
434 * \brief Clear sticky fault: Hardware fault occurred
435 *
436 * This is available in the configurator in case the user wants
437 * to initialize their device entirely without passing a device
438 * reference down to the code that performs the initialization.
439 * In this case, the user passes down the configurator object
440 * and performs all the initialization code on the object.
441 *
442 * \param timeoutSeconds Maximum time to wait up to in seconds.
443 * \returns StatusCode of the set command
444 */
445 ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds);
446
447 /**
448 * \brief Clear sticky fault: Device supply voltage dropped to near
449 * brownout levels
450 *
451 * This will wait up to #DefaultTimeoutSeconds.
452 *
453 * This is available in the configurator in case the user wants
454 * to initialize their device entirely without passing a device
455 * reference down to the code that performs the initialization.
456 * In this case, the user passes down the configurator object
457 * and performs all the initialization code on the object.
458 *
459 * \returns StatusCode of the set command
460 */
465 /**
466 * \brief Clear sticky fault: Device supply voltage dropped to near
467 * brownout levels
468 *
469 * This is available in the configurator in case the user wants
470 * to initialize their device entirely without passing a device
471 * reference down to the code that performs the initialization.
472 * In this case, the user passes down the configurator object
473 * and performs all the initialization code on the object.
474 *
475 * \param timeoutSeconds Maximum time to wait up to in seconds.
476 * \returns StatusCode of the set command
477 */
478 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(wpi::units::second_t timeoutSeconds);
479
480 /**
481 * \brief Clear sticky fault: Device boot while detecting the enable
482 * signal
483 *
484 * This will wait up to #DefaultTimeoutSeconds.
485 *
486 * This is available in the configurator in case the user wants
487 * to initialize their device entirely without passing a device
488 * reference down to the code that performs the initialization.
489 * In this case, the user passes down the configurator object
490 * and performs all the initialization code on the object.
491 *
492 * \returns StatusCode of the set command
493 */
498 /**
499 * \brief Clear sticky fault: Device boot while detecting the enable
500 * signal
501 *
502 * This is available in the configurator in case the user wants
503 * to initialize their device entirely without passing a device
504 * reference down to the code that performs the initialization.
505 * In this case, the user passes down the configurator object
506 * and performs all the initialization code on the object.
507 *
508 * \param timeoutSeconds Maximum time to wait up to in seconds.
509 * \returns StatusCode of the set command
510 */
512
513 /**
514 * \brief Clear sticky fault: An unlicensed feature is in use, device
515 * may not behave as expected.
516 *
517 * This will wait up to #DefaultTimeoutSeconds.
518 *
519 * This is available in the configurator in case the user wants
520 * to initialize their device entirely without passing a device
521 * reference down to the code that performs the initialization.
522 * In this case, the user passes down the configurator object
523 * and performs all the initialization code on the object.
524 *
525 * \returns StatusCode of the set command
526 */
531 /**
532 * \brief Clear sticky fault: An unlicensed feature is in use, device
533 * may not behave as expected.
534 *
535 * This is available in the configurator in case the user wants
536 * to initialize their device entirely without passing a device
537 * reference down to the code that performs the initialization.
538 * In this case, the user passes down the configurator object
539 * and performs all the initialization code on the object.
540 *
541 * \param timeoutSeconds Maximum time to wait up to in seconds.
542 * \returns StatusCode of the set command
543 */
545
546 /**
547 * \brief Clear sticky fault: The magnet distance is not correct or
548 * magnet is missing
549 *
550 * This will wait up to #DefaultTimeoutSeconds.
551 *
552 * This is available in the configurator in case the user wants
553 * to initialize their device entirely without passing a device
554 * reference down to the code that performs the initialization.
555 * In this case, the user passes down the configurator object
556 * and performs all the initialization code on the object.
557 *
558 * \returns StatusCode of the set command
559 */
564 /**
565 * \brief Clear sticky fault: The magnet distance is not correct or
566 * magnet is missing
567 *
568 * This is available in the configurator in case the user wants
569 * to initialize their device entirely without passing a device
570 * reference down to the code that performs the initialization.
571 * In this case, the user passes down the configurator object
572 * and performs all the initialization code on the object.
573 *
574 * \param timeoutSeconds Maximum time to wait up to in seconds.
575 * \returns StatusCode of the set command
576 */
577 ctre::phoenix::StatusCode ClearStickyFault_BadMagnet(wpi::units::second_t timeoutSeconds);
578};
579
580}
581
582namespace hardware {
583namespace core {
584
585#if defined(_WIN32) || defined(_WIN64)
586#pragma warning(push)
587#pragma warning(disable : 4250)
588#endif
589
590/**
591 * Class for CANcoder, a CAN based magnetic encoder that provides absolute and
592 * relative position along with filtered velocity.
593 */
595{
596private:
598
599public:
600 /**
601 * \brief The configuration class for this device.
602 */
604
605 /**
606 * Constructs a new CANcoder object.
607 *
608 * \param deviceId ID of the device, as configured in Phoenix Tuner
609 * \param canbus The CAN bus this device is on
610 */
611 CoreCANcoder(int deviceId, CANBus canbus);
612
613 /**
614 * \brief Constructs a stubbed-out CoreCANcoder, where all status signals, controls,
615 * configs, etc. perform no action and immediately return OK. This can be used to
616 * silence error messages for devices that have been completely removed from the robot.
617 *
618 * \returns Stubbed-out CoreCANcoder
619 */
621 {
622 return CoreCANcoder{-1, CANBus{}};
623 }
624
625 /**
626 * \brief Gets the configurator for this CANcoder. Users may use this to refresh
627 * and apply configs.
628 *
629 * \returns Configurator for this CANcoder
630 */
632 {
633 return _configs;
634 }
635
636 /**
637 * \brief Gets the configurator for this CANcoder
638 *
639 * \details Gets the configurator for this CANcoder
640 *
641 * \returns Configurator for this CANcoder
642 */
644 {
645 return _configs;
646 }
647
648
649private:
650 std::unique_ptr<sim::CANcoderSimState> _simState{};
651public:
652 /**
653 * \brief Get the simulation state for this device.
654 *
655 * \details This function reuses an allocated simulation
656 * state object, so it is safe to call this function multiple
657 * times in a robot loop.
658 *
659 * \returns Simulation state
660 */
662 {
663 if (_simState == nullptr)
664 _simState = std::make_unique<sim::CANcoderSimState>(*this);
665 return *_simState;
666 }
667
668
669
670 /**
671 * \brief App Major Version number.
672 *
673 * - Minimum Value: 0
674 * - Maximum Value: 255
675 * - Default Value: 0
676 * - Units:
677 *
678 * Default Rates:
679 * - CAN: 4.0 Hz
680 *
681 * This refreshes and returns a cached StatusSignal object.
682 *
683 * \param refresh Whether to refresh the StatusSignal before returning it;
684 * defaults to true
685 * \returns VersionMajor Status Signal Object
686 */
687 StatusSignal<int> &GetVersionMajor(bool refresh = true);
688
689 /**
690 * \brief App Minor Version number.
691 *
692 * - Minimum Value: 0
693 * - Maximum Value: 255
694 * - Default Value: 0
695 * - Units:
696 *
697 * Default Rates:
698 * - CAN: 4.0 Hz
699 *
700 * This refreshes and returns a cached StatusSignal object.
701 *
702 * \param refresh Whether to refresh the StatusSignal before returning it;
703 * defaults to true
704 * \returns VersionMinor Status Signal Object
705 */
706 StatusSignal<int> &GetVersionMinor(bool refresh = true);
707
708 /**
709 * \brief App Bugfix Version number.
710 *
711 * - Minimum Value: 0
712 * - Maximum Value: 255
713 * - Default Value: 0
714 * - Units:
715 *
716 * Default Rates:
717 * - CAN: 4.0 Hz
718 *
719 * This refreshes and returns a cached StatusSignal object.
720 *
721 * \param refresh Whether to refresh the StatusSignal before returning it;
722 * defaults to true
723 * \returns VersionBugfix Status Signal Object
724 */
725 StatusSignal<int> &GetVersionBugfix(bool refresh = true);
726
727 /**
728 * \brief App Build Version number.
729 *
730 * - Minimum Value: 0
731 * - Maximum Value: 255
732 * - Default Value: 0
733 * - Units:
734 *
735 * Default Rates:
736 * - CAN: 4.0 Hz
737 *
738 * This refreshes and returns a cached StatusSignal object.
739 *
740 * \param refresh Whether to refresh the StatusSignal before returning it;
741 * defaults to true
742 * \returns VersionBuild Status Signal Object
743 */
744 StatusSignal<int> &GetVersionBuild(bool refresh = true);
745
746 /**
747 * \brief Full Version of firmware in device. The format is a four
748 * byte value.
749 *
750 * - Minimum Value: 0
751 * - Maximum Value: 4294967295
752 * - Default Value: 0
753 * - Units:
754 *
755 * Default Rates:
756 * - CAN: 4.0 Hz
757 *
758 * This refreshes and returns a cached StatusSignal object.
759 *
760 * \param refresh Whether to refresh the StatusSignal before returning it;
761 * defaults to true
762 * \returns Version Status Signal Object
763 */
764 StatusSignal<int> &GetVersion(bool refresh = true);
765
766 /**
767 * \brief Integer representing all fault flags reported by the device.
768 *
769 * \details These are device specific and are not used directly in
770 * typical applications. Use the signal specific GetFault_*() methods
771 * instead.
772 *
773 * - Minimum Value: 0
774 * - Maximum Value: 4294967295
775 * - Default Value: 0
776 * - Units:
777 *
778 * Default Rates:
779 * - CAN: 4.0 Hz
780 *
781 * This refreshes and returns a cached StatusSignal object.
782 *
783 * \param refresh Whether to refresh the StatusSignal before returning it;
784 * defaults to true
785 * \returns FaultField Status Signal Object
786 */
787 StatusSignal<int> &GetFaultField(bool refresh = true);
788
789 /**
790 * \brief Integer representing all (persistent) sticky fault flags
791 * reported by the device.
792 *
793 * \details These are device specific and are not used directly in
794 * typical applications. Use the signal specific GetStickyFault_*()
795 * methods instead.
796 *
797 * - Minimum Value: 0
798 * - Maximum Value: 4294967295
799 * - Default Value: 0
800 * - Units:
801 *
802 * Default Rates:
803 * - CAN: 4.0 Hz
804 *
805 * This refreshes and returns a cached StatusSignal object.
806 *
807 * \param refresh Whether to refresh the StatusSignal before returning it;
808 * defaults to true
809 * \returns StickyFaultField Status Signal Object
810 */
812
813 /**
814 * \brief Velocity of the device.
815 *
816 * - Minimum Value: -512.0
817 * - Maximum Value: 511.998046875
818 * - Default Value: 0
819 * - Units: rotations per second
820 *
821 * Default Rates:
822 * - CAN 2.0: 100.0 Hz
823 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
824 *
825 * This refreshes and returns a cached StatusSignal object.
826 *
827 * \param refresh Whether to refresh the StatusSignal before returning it;
828 * defaults to true
829 * \returns Velocity Status Signal Object
830 */
832
833 /**
834 * \brief Position of the device. This is initialized to the absolute
835 * position on boot.
836 *
837 * - Minimum Value: -16384.0
838 * - Maximum Value: 16383.999755859375
839 * - Default Value: 0
840 * - Units: rotations
841 *
842 * Default Rates:
843 * - CAN 2.0: 100.0 Hz
844 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
845 *
846 * This refreshes and returns a cached StatusSignal object.
847 *
848 * \param refresh Whether to refresh the StatusSignal before returning it;
849 * defaults to true
850 * \returns Position Status Signal Object
851 */
853
854 /**
855 * \brief Absolute Position of the device. The possible range is
856 * documented below; however, the exact expected range is determined
857 * by the AbsoluteSensorDiscontinuityPoint. This position is affected
858 * by the MagnetSensor configs and the user-set position via
859 * setPosition().
860 *
861 * - Minimum Value: -1.0
862 * - Maximum Value: 0.999755859375
863 * - Default Value: 0
864 * - Units: rotations
865 *
866 * Default Rates:
867 * - CAN 2.0: 100.0 Hz
868 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
869 *
870 * This refreshes and returns a cached StatusSignal object.
871 *
872 * \param refresh Whether to refresh the StatusSignal before returning it;
873 * defaults to true
874 * \returns AbsolutePosition Status Signal Object
875 */
877
878 /**
879 * \brief The unfiltered velocity reported by CANcoder.
880 *
881 * \details This is the unfiltered velocity reported by CANcoder. This
882 * signal does not use the fusing algorithm.
883 *
884 * - Minimum Value: -8000.0
885 * - Maximum Value: 7999.755859375
886 * - Default Value: 0
887 * - Units: rotations per second
888 *
889 * Default Rates:
890 * - CAN 2.0: 4.0 Hz
891 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
892 *
893 * This refreshes and returns a cached StatusSignal object.
894 *
895 * \param refresh Whether to refresh the StatusSignal before returning it;
896 * defaults to true
897 * \returns UnfilteredVelocity Status Signal Object
898 */
900
901 /**
902 * \brief The relative position reported by the CANcoder since boot.
903 *
904 * \details This is the total displacement reported by CANcoder since
905 * power up. This signal is relative and is not influenced by the
906 * fusing algorithm.
907 *
908 * - Minimum Value: -16384.0
909 * - Maximum Value: 16383.999755859375
910 * - Default Value: 0
911 * - Units: rotations
912 *
913 * Default Rates:
914 * - CAN 2.0: 4.0 Hz
915 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
916 *
917 * This refreshes and returns a cached StatusSignal object.
918 *
919 * \param refresh Whether to refresh the StatusSignal before returning it;
920 * defaults to true
921 * \returns PositionSinceBoot Status Signal Object
922 */
924
925 /**
926 * \brief Measured supply voltage to the CANcoder.
927 *
928 * - Minimum Value: 4
929 * - Maximum Value: 16.75
930 * - Default Value: 4
931 * - Units: V
932 *
933 * Default Rates:
934 * - CAN 2.0: 4.0 Hz
935 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
936 *
937 * This refreshes and returns a cached StatusSignal object.
938 *
939 * \param refresh Whether to refresh the StatusSignal before returning it;
940 * defaults to true
941 * \returns SupplyVoltage Status Signal Object
942 */
944
945 /**
946 * \brief Magnet health as measured by CANcoder.
947 *
948 * Red indicates too close or too far, Orange is adequate but with
949 * reduced accuracy, green is ideal. Invalid means the accuracy cannot
950 * be determined.
951 *
952 * - Default Value: signals#MagnetHealthValue#Magnet_Invalid
953 *
954 * Default Rates:
955 * - CAN 2.0: 4.0 Hz
956 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
957 *
958 * This refreshes and returns a cached StatusSignal object.
959 *
960 * \param refresh Whether to refresh the StatusSignal before returning it;
961 * defaults to true
962 * \returns MagnetHealth Status Signal Object
963 */
965
966 /**
967 * \brief Whether the device is Phoenix Pro licensed.
968 *
969 * - Default Value: False
970 *
971 * Default Rates:
972 * - CAN: 4.0 Hz
973 *
974 * This refreshes and returns a cached StatusSignal object.
975 *
976 * \param refresh Whether to refresh the StatusSignal before returning it;
977 * defaults to true
978 * \returns IsProLicensed Status Signal Object
979 */
981
982 /**
983 * \brief Hardware fault occurred
984 *
985 * - Default Value: False
986 *
987 * Default Rates:
988 * - CAN: 4.0 Hz
989 *
990 * This refreshes and returns a cached StatusSignal object.
991 *
992 * \param refresh Whether to refresh the StatusSignal before returning it;
993 * defaults to true
994 * \returns Fault_Hardware Status Signal Object
995 */
997
998 /**
999 * \brief Hardware fault occurred
1000 *
1001 * - Default Value: False
1002 *
1003 * Default Rates:
1004 * - CAN: 4.0 Hz
1005 *
1006 * This refreshes and returns a cached StatusSignal object.
1007 *
1008 * \param refresh Whether to refresh the StatusSignal before returning it;
1009 * defaults to true
1010 * \returns StickyFault_Hardware Status Signal Object
1011 */
1013
1014 /**
1015 * \brief Device supply voltage dropped to near brownout levels
1016 *
1017 * - Default Value: False
1018 *
1019 * Default Rates:
1020 * - CAN: 4.0 Hz
1021 *
1022 * This refreshes and returns a cached StatusSignal object.
1023 *
1024 * \param refresh Whether to refresh the StatusSignal before returning it;
1025 * defaults to true
1026 * \returns Fault_Undervoltage Status Signal Object
1027 */
1029
1030 /**
1031 * \brief Device supply voltage dropped to near brownout levels
1032 *
1033 * - Default Value: False
1034 *
1035 * Default Rates:
1036 * - CAN: 4.0 Hz
1037 *
1038 * This refreshes and returns a cached StatusSignal object.
1039 *
1040 * \param refresh Whether to refresh the StatusSignal before returning it;
1041 * defaults to true
1042 * \returns StickyFault_Undervoltage Status Signal Object
1043 */
1045
1046 /**
1047 * \brief Device boot while detecting the enable signal
1048 *
1049 * - Default Value: False
1050 *
1051 * Default Rates:
1052 * - CAN: 4.0 Hz
1053 *
1054 * This refreshes and returns a cached StatusSignal object.
1055 *
1056 * \param refresh Whether to refresh the StatusSignal before returning it;
1057 * defaults to true
1058 * \returns Fault_BootDuringEnable Status Signal Object
1059 */
1061
1062 /**
1063 * \brief Device boot while detecting the enable signal
1064 *
1065 * - Default Value: False
1066 *
1067 * Default Rates:
1068 * - CAN: 4.0 Hz
1069 *
1070 * This refreshes and returns a cached StatusSignal object.
1071 *
1072 * \param refresh Whether to refresh the StatusSignal before returning it;
1073 * defaults to true
1074 * \returns StickyFault_BootDuringEnable Status Signal Object
1075 */
1077
1078 /**
1079 * \brief An unlicensed feature is in use, device may not behave as
1080 * expected.
1081 *
1082 * - Default Value: False
1083 *
1084 * Default Rates:
1085 * - CAN: 4.0 Hz
1086 *
1087 * This refreshes and returns a cached StatusSignal object.
1088 *
1089 * \param refresh Whether to refresh the StatusSignal before returning it;
1090 * defaults to true
1091 * \returns Fault_UnlicensedFeatureInUse Status Signal Object
1092 */
1094
1095 /**
1096 * \brief An unlicensed feature is in use, device may not behave as
1097 * expected.
1098 *
1099 * - Default Value: False
1100 *
1101 * Default Rates:
1102 * - CAN: 4.0 Hz
1103 *
1104 * This refreshes and returns a cached StatusSignal object.
1105 *
1106 * \param refresh Whether to refresh the StatusSignal before returning it;
1107 * defaults to true
1108 * \returns StickyFault_UnlicensedFeatureInUse Status Signal Object
1109 */
1111
1112 /**
1113 * \brief The magnet distance is not correct or magnet is missing
1114 *
1115 * - Default Value: False
1116 *
1117 * Default Rates:
1118 * - CAN: 4.0 Hz
1119 *
1120 * This refreshes and returns a cached StatusSignal object.
1121 *
1122 * \param refresh Whether to refresh the StatusSignal before returning it;
1123 * defaults to true
1124 * \returns Fault_BadMagnet Status Signal Object
1125 */
1127
1128 /**
1129 * \brief The magnet distance is not correct or magnet is missing
1130 *
1131 * - Default Value: False
1132 *
1133 * Default Rates:
1134 * - CAN: 4.0 Hz
1135 *
1136 * This refreshes and returns a cached StatusSignal object.
1137 *
1138 * \param refresh Whether to refresh the StatusSignal before returning it;
1139 * defaults to true
1140 * \returns StickyFault_BadMagnet Status Signal Object
1141 */
1143
1144
1145
1146
1147 /**
1148 * \brief Sets the current position of the device.
1149 *
1150 * \param newValue Value to set to. Units are in rotations.
1151 * \param timeoutSeconds Maximum time to wait up to in seconds.
1152 * \returns StatusCode of the set command
1153 */
1154 ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t newValue, wpi::units::second_t timeoutSeconds)
1155 {
1156 return GetConfigurator().SetPosition(newValue, timeoutSeconds);
1157 }
1158 /**
1159 * \brief Sets the current position of the device.
1160 *
1161 * This will wait up to 0.100 seconds (100ms) by default.
1162 *
1163 * \param newValue Value to set to. Units are in rotations.
1164 * \returns StatusCode of the set command
1165 */
1166 ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t newValue)
1167 {
1168 return SetPosition(newValue, 0.100_s);
1169 }
1170
1171 /**
1172 * \brief Clear the sticky faults in the device.
1173 *
1174 * \details This typically has no impact on the device functionality.
1175 * Instead, it just clears telemetry faults that are accessible via
1176 * API and Tuner Self-Test.
1177 *
1178 * \param timeoutSeconds Maximum time to wait up to in seconds.
1179 * \returns StatusCode of the set command
1180 */
1181 ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds)
1182 {
1183 return GetConfigurator().ClearStickyFaults(timeoutSeconds);
1184 }
1185 /**
1186 * \brief Clear the sticky faults in the device.
1187 *
1188 * \details This typically has no impact on the device functionality.
1189 * Instead, it just clears telemetry faults that are accessible via
1190 * API and Tuner Self-Test.
1191 *
1192 * This will wait up to 0.100 seconds (100ms) by default.
1193 *
1194 * \returns StatusCode of the set command
1195 */
1200
1201 /**
1202 * \brief Clear sticky fault: Hardware fault occurred
1203 *
1204 * \param timeoutSeconds Maximum time to wait up to in seconds.
1205 * \returns StatusCode of the set command
1206 */
1207 ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds)
1208 {
1209 return GetConfigurator().ClearStickyFault_Hardware(timeoutSeconds);
1210 }
1211 /**
1212 * \brief Clear sticky fault: Hardware fault occurred
1213 *
1214 * This will wait up to 0.100 seconds (100ms) by default.
1215 *
1216 * \returns StatusCode of the set command
1217 */
1222
1223 /**
1224 * \brief Clear sticky fault: Device supply voltage dropped to near
1225 * brownout levels
1226 *
1227 * \param timeoutSeconds Maximum time to wait up to in seconds.
1228 * \returns StatusCode of the set command
1229 */
1231 {
1232 return GetConfigurator().ClearStickyFault_Undervoltage(timeoutSeconds);
1233 }
1234 /**
1235 * \brief Clear sticky fault: Device supply voltage dropped to near
1236 * brownout levels
1237 *
1238 * This will wait up to 0.100 seconds (100ms) by default.
1239 *
1240 * \returns StatusCode of the set command
1241 */
1246
1247 /**
1248 * \brief Clear sticky fault: Device boot while detecting the enable
1249 * signal
1250 *
1251 * \param timeoutSeconds Maximum time to wait up to in seconds.
1252 * \returns StatusCode of the set command
1253 */
1255 {
1256 return GetConfigurator().ClearStickyFault_BootDuringEnable(timeoutSeconds);
1257 }
1258 /**
1259 * \brief Clear sticky fault: Device boot while detecting the enable
1260 * signal
1261 *
1262 * This will wait up to 0.100 seconds (100ms) by default.
1263 *
1264 * \returns StatusCode of the set command
1265 */
1270
1271 /**
1272 * \brief Clear sticky fault: An unlicensed feature is in use, device
1273 * may not behave as expected.
1274 *
1275 * \param timeoutSeconds Maximum time to wait up to in seconds.
1276 * \returns StatusCode of the set command
1277 */
1279 {
1280 return GetConfigurator().ClearStickyFault_UnlicensedFeatureInUse(timeoutSeconds);
1281 }
1282 /**
1283 * \brief Clear sticky fault: An unlicensed feature is in use, device
1284 * may not behave as expected.
1285 *
1286 * This will wait up to 0.100 seconds (100ms) by default.
1287 *
1288 * \returns StatusCode of the set command
1289 */
1294
1295 /**
1296 * \brief Clear sticky fault: The magnet distance is not correct or
1297 * magnet is missing
1298 *
1299 * \param timeoutSeconds Maximum time to wait up to in seconds.
1300 * \returns StatusCode of the set command
1301 */
1302 ctre::phoenix::StatusCode ClearStickyFault_BadMagnet(wpi::units::second_t timeoutSeconds)
1303 {
1304 return GetConfigurator().ClearStickyFault_BadMagnet(timeoutSeconds);
1305 }
1306 /**
1307 * \brief Clear sticky fault: The magnet distance is not correct or
1308 * magnet is missing
1309 *
1310 * This will wait up to 0.100 seconds (100ms) by default.
1311 *
1312 * \returns StatusCode of the set command
1313 */
1318
1319 void RegisterAlerts(AlertableCollection &collection) override;
1320};
1321
1322#if defined(_WIN32) || defined(_WIN64)
1323#pragma warning(pop)
1324#endif
1325
1326}
1327}
1328
1329}
1330}
1331
Collection of objects that can report alerts.
Definition Alertable.hpp:109
Class for getting information about an available CAN bus.
Definition CANBus.hpp:142
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:523
All configurations for the hardware::CANcoder.
Definition CoreCANcoder.hpp:37
MagnetSensorConfigs MagnetSensor
Configs that affect the magnet sensor and how to interpret it.
Definition CoreCANcoder.hpp:71
constexpr CANcoderConfiguration & WithMagnetSensor(MagnetSensorConfigs newMagnetSensor)
Modifies this configuration's MagnetSensor parameter and returns itself for method-chaining and easie...
Definition CoreCANcoder.hpp:105
bool FutureProofConfigs
True if we should factory default newer unsupported configs, false to leave newer unsupported configs...
Definition CoreCANcoder.hpp:54
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Take a string and deserialize it to this configuration.
CustomParamsConfigs CustomParams
Custom Params.
Definition CoreCANcoder.hpp:84
std::string ToString() const override
Get the string representation of this configuration.
constexpr CANcoderConfiguration & WithCustomParams(CustomParamsConfigs newCustomParams)
Modifies this configuration's CustomParams parameter and returns itself for method-chaining and easie...
Definition CoreCANcoder.hpp:128
std::string Serialize() const final
Get the serialized form of this configuration.
Handles applying and refreshing configurations for the hardware::CANcoder.
Definition CoreCANcoder.hpp:153
ctre::phoenix::StatusCode Refresh(MagnetSensorConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:291
ctre::phoenix::StatusCode ClearStickyFault_BadMagnet()
Clear sticky fault: The magnet distance is not correct or magnet is missing.
Definition CoreCANcoder.hpp:560
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:335
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANcoder.hpp:527
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:230
ctre::phoenix::StatusCode Refresh(MagnetSensorConfigs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:304
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANcoder.hpp:461
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANcoder.hpp:494
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANcoder.hpp:394
ctre::phoenix::StatusCode Apply(const CANcoderConfiguration &configs)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:172
ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t newValue)
Sets the current position of the device.
Definition CoreCANcoder.hpp:358
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANcoder.hpp:429
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:273
ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:259
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:244
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:322
ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(wpi::units::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
ctre::phoenix::StatusCode ClearStickyFault_BadMagnet(wpi::units::second_t timeoutSeconds)
Clear sticky fault: The magnet distance is not correct or magnet is missing.
ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds)
Clear the sticky faults in the device.
ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t newValue, wpi::units::second_t timeoutSeconds)
Sets the current position of the device.
ctre::phoenix::StatusCode Apply(const CANcoderConfiguration &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:186
ctre::phoenix::StatusCode Apply(const MagnetSensorConfigs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:215
ctre::phoenix::StatusCode Apply(const MagnetSensorConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:201
Custom Params.
Definition CustomParamsConfigs.hpp:23
Configs that affect the magnet sensor and how to interpret it.
Definition MagnetSensorConfigs.hpp:26
Common interface for all configuration objects.
Definition Configuration.hpp:20
ctre::phoenix::StatusCode SetConfigsPrivate(std::string_view serializedString, wpi::units::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate)
wpi::units::second_t DefaultTimeoutSeconds
The default maximum amount of time to wait for a config.
Definition Configurator.hpp:27
ParentConfigurator(hardware::DeviceIdentifier deviceIdentifier)
ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, wpi::units::second_t timeoutSeconds) const
The unique identifier for a device.
Definition DeviceIdentifier.hpp:19
ParentDevice(int deviceID, std::string model, CANBus canbus)
Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along w...
Definition CoreCANcoder.hpp:595
StatusSignal< wpi::units::turn_t > & GetPositionSinceBoot(bool refresh=true)
The relative position reported by the CANcoder since boot.
ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t newValue)
Sets the current position of the device.
Definition CoreCANcoder.hpp:1166
StatusSignal< int > & GetVersionMinor(bool refresh=true)
App Minor Version number.
StatusSignal< int > & GetVersionBugfix(bool refresh=true)
App Bugfix Version number.
ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition CoreCANcoder.hpp:1181
CoreCANcoder(int deviceId, CANBus canbus)
Constructs a new CANcoder object.
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANcoder.hpp:1242
StatusSignal< bool > & GetStickyFault_Hardware(bool refresh=true)
Hardware fault occurred.
StatusSignal< bool > & GetFault_Hardware(bool refresh=true)
Hardware fault occurred.
StatusSignal< bool > & GetStickyFault_BadMagnet(bool refresh=true)
The magnet distance is not correct or magnet is missing.
StatusSignal< bool > & GetStickyFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(wpi::units::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANcoder.hpp:1278
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANcoder.hpp:1196
configs::CANcoderConfigurator & GetConfigurator()
Gets the configurator for this CANcoder.
Definition CoreCANcoder.hpp:631
StatusSignal< int > & GetVersionBuild(bool refresh=true)
App Build Version number.
StatusSignal< wpi::units::turn_t > & GetAbsolutePosition(bool refresh=true)
Absolute Position of the device.
StatusSignal< wpi::units::turns_per_second_t > & GetVelocity(bool refresh=true)
Velocity of the device.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANcoder.hpp:1290
StatusSignal< int > & GetStickyFaultField(bool refresh=true)
Integer representing all (persistent) sticky fault flags reported by the device.
ctre::phoenix::StatusCode SetPosition(wpi::units::turn_t newValue, wpi::units::second_t timeoutSeconds)
Sets the current position of the device.
Definition CoreCANcoder.hpp:1154
StatusSignal< int > & GetVersionMajor(bool refresh=true)
App Major Version number.
StatusSignal< signals::MagnetHealthValue > & GetMagnetHealth(bool refresh=true)
Magnet health as measured by CANcoder.
sim::CANcoderSimState & GetSimState()
Get the simulation state for this device.
Definition CoreCANcoder.hpp:661
ctre::phoenix::StatusCode ClearStickyFault_BadMagnet()
Clear sticky fault: The magnet distance is not correct or magnet is missing.
Definition CoreCANcoder.hpp:1314
configs::CANcoderConfiguration Configuration
The configuration class for this device.
Definition CoreCANcoder.hpp:603
StatusSignal< wpi::units::turns_per_second_t > & GetUnfilteredVelocity(bool refresh=true)
The unfiltered velocity reported by CANcoder.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANcoder.hpp:1254
StatusSignal< wpi::units::volt_t > & GetSupplyVoltage(bool refresh=true)
Measured supply voltage to the CANcoder.
static CoreCANcoder None()
Constructs a stubbed-out CoreCANcoder, where all status signals, controls, configs,...
Definition CoreCANcoder.hpp:620
StatusSignal< int > & GetVersion(bool refresh=true)
Full Version of firmware in device.
StatusSignal< bool > & GetStickyFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
StatusSignal< bool > & GetFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
ctre::phoenix::StatusCode ClearStickyFault_BadMagnet(wpi::units::second_t timeoutSeconds)
Clear sticky fault: The magnet distance is not correct or magnet is missing.
Definition CoreCANcoder.hpp:1302
StatusSignal< int > & GetFaultField(bool refresh=true)
Integer representing all fault flags reported by the device.
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANcoder.hpp:1230
StatusSignal< bool > & GetFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
StatusSignal< bool > & GetIsProLicensed(bool refresh=true)
Whether the device is Phoenix Pro licensed.
ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
Definition CoreCANcoder.hpp:1207
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANcoder.hpp:1218
StatusSignal< bool > & GetFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
StatusSignal< bool > & GetStickyFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
StatusSignal< bool > & GetFault_BadMagnet(bool refresh=true)
The magnet distance is not correct or magnet is missing.
configs::CANcoderConfigurator const & GetConfigurator() const
Gets the configurator for this CANcoder.
Definition CoreCANcoder.hpp:643
StatusSignal< wpi::units::turn_t > & GetPosition(bool refresh=true)
Position of the device.
void RegisterAlerts(AlertableCollection &collection) override
Registers all alerts for this type to the provided collection.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANcoder.hpp:1266
Class to control the state of a simulated hardware::CANcoder.
Definition CANcoderSimState.hpp:32
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition ExternalFeedbackConfigs.hpp:21
Definition ExternalFeedbackConfigs.hpp:17
Definition ExternalFeedbackConfigs.hpp:17
Definition ExternalFeedbackConfigs.hpp:16
Definition StatusCodes.h:22
Definition motor_constants.h:14