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