CTRE Phoenix 6 C++ 26.3.0
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 <units/angle.h>
19#include <units/angular_velocity.h>
20#include <units/voltage.h>
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 */
159{
160private:
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 */
179 {
180 return Apply(configs, DefaultTimeoutSeconds);
181 }
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, units::time::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 */
208 {
209 return Apply(configs, DefaultTimeoutSeconds);
210 }
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, units::time::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 */
237 {
238 return Apply(configs, DefaultTimeoutSeconds);
239 }
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, units::time::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 */
266 {
267 return Refresh(configs, DefaultTimeoutSeconds);
268 }
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, units::time::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 */
298 {
299 return Refresh(configs, DefaultTimeoutSeconds);
300 }
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, units::time::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 */
329 {
330 return Refresh(configs, DefaultTimeoutSeconds);
331 }
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, units::time::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(units::angle::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(units::angle::turn_t newValue, units::time::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 */
401 {
402 return ClearStickyFaults(DefaultTimeoutSeconds);
403 }
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(units::time::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 */
436 {
437 return ClearStickyFault_Hardware(DefaultTimeoutSeconds);
438 }
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(units::time::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 */
468 {
469 return ClearStickyFault_Undervoltage(DefaultTimeoutSeconds);
470 }
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(units::time::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 */
501 {
502 return ClearStickyFault_BootDuringEnable(DefaultTimeoutSeconds);
503 }
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 */
534 {
535 return ClearStickyFault_UnlicensedFeatureInUse(DefaultTimeoutSeconds);
536 }
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 */
567 {
568 return ClearStickyFault_BadMagnet(DefaultTimeoutSeconds);
569 }
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(units::time::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 * Constructs a new CANcoder object.
621 *
622 * \param deviceId ID of the device, as configured in Phoenix Tuner
623 * \param canbus Name of the CAN bus this device is on. Possible CAN bus strings are:
624 * - "rio" for the native roboRIO CAN bus
625 * - CANivore name or serial number
626 * - SocketCAN interface (non-FRC Linux only)
627 * - "*" for any CANivore seen by the program
628 * - empty string (default) to select the default for the system:
629 * - "rio" on roboRIO
630 * - "can0" on Linux
631 * - "*" on Windows
632 *
633 * \deprecated Constructing devices with a CAN bus string is deprecated for removal
634 * in the 2027 season. Construct devices using a CANBus instance instead.
635 */
636 CoreCANcoder(int deviceId, std::string canbus);
637
638 /**
639 * \brief Constructs a stubbed-out CoreCANcoder, where all status signals, controls,
640 * configs, etc. perform no action and immediately return OK. This can be used to
641 * silence error messages for devices that have been completely removed from the robot.
642 *
643 * \returns Stubbed-out CoreCANcoder
644 */
646 {
647 return CoreCANcoder{-1, CANBus{}};
648 }
649
650 /**
651 * \brief Gets the configurator for this CANcoder
652 *
653 * \details Gets the configurator for this CANcoder
654 *
655 * \returns Configurator for this CANcoder
656 */
658 {
659 return _configs;
660 }
661
662 /**
663 * \brief Gets the configurator for this CANcoder
664 *
665 * \details Gets the configurator for this CANcoder
666 *
667 * \returns Configurator for this CANcoder
668 */
670 {
671 return _configs;
672 }
673
674
675private:
676 std::unique_ptr<sim::CANcoderSimState> _simState{};
677public:
678 /**
679 * \brief Get the simulation state for this device.
680 *
681 * \details This function reuses an allocated simulation
682 * state object, so it is safe to call this function multiple
683 * times in a robot loop.
684 *
685 * \returns Simulation state
686 */
688 {
689 if (_simState == nullptr)
690 _simState = std::make_unique<sim::CANcoderSimState>(*this);
691 return *_simState;
692 }
693
694
695
696 /**
697 * \brief App Major 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 VersionMajor Status Signal Object
712 */
713 StatusSignal<int> &GetVersionMajor(bool refresh = true);
714
715 /**
716 * \brief App Minor 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 VersionMinor Status Signal Object
731 */
732 StatusSignal<int> &GetVersionMinor(bool refresh = true);
733
734 /**
735 * \brief App Bugfix 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 VersionBugfix Status Signal Object
750 */
751 StatusSignal<int> &GetVersionBugfix(bool refresh = true);
752
753 /**
754 * \brief App Build Version number.
755 *
756 * - Minimum Value: 0
757 * - Maximum Value: 255
758 * - Default Value: 0
759 * - Units:
760 *
761 * Default Rates:
762 * - CAN: 4.0 Hz
763 *
764 * This refreshes and returns a cached StatusSignal object.
765 *
766 * \param refresh Whether to refresh the StatusSignal before returning it;
767 * defaults to true
768 * \returns VersionBuild Status Signal Object
769 */
770 StatusSignal<int> &GetVersionBuild(bool refresh = true);
771
772 /**
773 * \brief Full Version of firmware in device. The format is a four
774 * byte value.
775 *
776 * - Minimum Value: 0
777 * - Maximum Value: 4294967295
778 * - Default Value: 0
779 * - Units:
780 *
781 * Default Rates:
782 * - CAN: 4.0 Hz
783 *
784 * This refreshes and returns a cached StatusSignal object.
785 *
786 * \param refresh Whether to refresh the StatusSignal before returning it;
787 * defaults to true
788 * \returns Version Status Signal Object
789 */
790 StatusSignal<int> &GetVersion(bool refresh = true);
791
792 /**
793 * \brief Integer representing all fault flags reported by the device.
794 *
795 * \details These are device specific and are not used directly in
796 * typical applications. Use the signal specific GetFault_*() methods
797 * instead.
798 *
799 * - Minimum Value: 0
800 * - Maximum Value: 4294967295
801 * - Default Value: 0
802 * - Units:
803 *
804 * Default Rates:
805 * - CAN: 4.0 Hz
806 *
807 * This refreshes and returns a cached StatusSignal object.
808 *
809 * \param refresh Whether to refresh the StatusSignal before returning it;
810 * defaults to true
811 * \returns FaultField Status Signal Object
812 */
813 StatusSignal<int> &GetFaultField(bool refresh = true);
814
815 /**
816 * \brief Integer representing all (persistent) sticky fault flags
817 * reported by the device.
818 *
819 * \details These are device specific and are not used directly in
820 * typical applications. Use the signal specific GetStickyFault_*()
821 * methods instead.
822 *
823 * - Minimum Value: 0
824 * - Maximum Value: 4294967295
825 * - Default Value: 0
826 * - Units:
827 *
828 * Default Rates:
829 * - CAN: 4.0 Hz
830 *
831 * This refreshes and returns a cached StatusSignal object.
832 *
833 * \param refresh Whether to refresh the StatusSignal before returning it;
834 * defaults to true
835 * \returns StickyFaultField Status Signal Object
836 */
838
839 /**
840 * \brief Velocity of the device.
841 *
842 * - Minimum Value: -512.0
843 * - Maximum Value: 511.998046875
844 * - Default Value: 0
845 * - Units: rotations per second
846 *
847 * Default Rates:
848 * - CAN 2.0: 100.0 Hz
849 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
850 *
851 * This refreshes and returns a cached StatusSignal object.
852 *
853 * \param refresh Whether to refresh the StatusSignal before returning it;
854 * defaults to true
855 * \returns Velocity Status Signal Object
856 */
858
859 /**
860 * \brief Position of the device. This is initialized to the absolute
861 * position on boot.
862 *
863 * - Minimum Value: -16384.0
864 * - Maximum Value: 16383.999755859375
865 * - Default Value: 0
866 * - Units: rotations
867 *
868 * Default Rates:
869 * - CAN 2.0: 100.0 Hz
870 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
871 *
872 * This refreshes and returns a cached StatusSignal object.
873 *
874 * \param refresh Whether to refresh the StatusSignal before returning it;
875 * defaults to true
876 * \returns Position Status Signal Object
877 */
879
880 /**
881 * \brief Absolute Position of the device. The possible range is
882 * documented below; however, the exact expected range is determined
883 * by the AbsoluteSensorDiscontinuityPoint. This position is affected
884 * by the MagnetSensor configs and the user-set position via
885 * setPosition().
886 *
887 * - Minimum Value: -1.0
888 * - Maximum Value: 0.999755859375
889 * - Default Value: 0
890 * - Units: rotations
891 *
892 * Default Rates:
893 * - CAN 2.0: 100.0 Hz
894 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
895 *
896 * This refreshes and returns a cached StatusSignal object.
897 *
898 * \param refresh Whether to refresh the StatusSignal before returning it;
899 * defaults to true
900 * \returns AbsolutePosition Status Signal Object
901 */
903
904 /**
905 * \brief The unfiltered velocity reported by CANcoder.
906 *
907 * \details This is the unfiltered velocity reported by CANcoder. This
908 * signal does not use the fusing algorithm.
909 *
910 * - Minimum Value: -8000.0
911 * - Maximum Value: 7999.755859375
912 * - Default Value: 0
913 * - Units: rotations per second
914 *
915 * Default Rates:
916 * - CAN 2.0: 4.0 Hz
917 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
918 *
919 * This refreshes and returns a cached StatusSignal object.
920 *
921 * \param refresh Whether to refresh the StatusSignal before returning it;
922 * defaults to true
923 * \returns UnfilteredVelocity Status Signal Object
924 */
926
927 /**
928 * \brief The relative position reported by the CANcoder since boot.
929 *
930 * \details This is the total displacement reported by CANcoder since
931 * power up. This signal is relative and is not influenced by the
932 * fusing algorithm.
933 *
934 * - Minimum Value: -16384.0
935 * - Maximum Value: 16383.999755859375
936 * - Default Value: 0
937 * - Units: rotations
938 *
939 * Default Rates:
940 * - CAN 2.0: 4.0 Hz
941 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
942 *
943 * This refreshes and returns a cached StatusSignal object.
944 *
945 * \param refresh Whether to refresh the StatusSignal before returning it;
946 * defaults to true
947 * \returns PositionSinceBoot Status Signal Object
948 */
950
951 /**
952 * \brief Measured supply voltage to the CANcoder.
953 *
954 * - Minimum Value: 4
955 * - Maximum Value: 16.75
956 * - Default Value: 4
957 * - Units: V
958 *
959 * Default Rates:
960 * - CAN 2.0: 4.0 Hz
961 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
962 *
963 * This refreshes and returns a cached StatusSignal object.
964 *
965 * \param refresh Whether to refresh the StatusSignal before returning it;
966 * defaults to true
967 * \returns SupplyVoltage Status Signal Object
968 */
970
971 /**
972 * \brief Magnet health as measured by CANcoder.
973 *
974 * Red indicates too close or too far, Orange is adequate but with
975 * reduced accuracy, green is ideal. Invalid means the accuracy cannot
976 * be determined.
977 *
978 *
979 * Default Rates:
980 * - CAN 2.0: 4.0 Hz
981 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
982 *
983 * This refreshes and returns a cached StatusSignal object.
984 *
985 * \param refresh Whether to refresh the StatusSignal before returning it;
986 * defaults to true
987 * \returns MagnetHealth Status Signal Object
988 */
990
991 /**
992 * \brief Whether the device is Phoenix Pro licensed.
993 *
994 * - Default Value: False
995 *
996 * Default Rates:
997 * - CAN: 4.0 Hz
998 *
999 * This refreshes and returns a cached StatusSignal object.
1000 *
1001 * \param refresh Whether to refresh the StatusSignal before returning it;
1002 * defaults to true
1003 * \returns IsProLicensed Status Signal Object
1004 */
1006
1007 /**
1008 * \brief Hardware fault occurred
1009 *
1010 * - Default Value: False
1011 *
1012 * Default Rates:
1013 * - CAN: 4.0 Hz
1014 *
1015 * This refreshes and returns a cached StatusSignal object.
1016 *
1017 * \param refresh Whether to refresh the StatusSignal before returning it;
1018 * defaults to true
1019 * \returns Fault_Hardware Status Signal Object
1020 */
1022
1023 /**
1024 * \brief Hardware fault occurred
1025 *
1026 * - Default Value: False
1027 *
1028 * Default Rates:
1029 * - CAN: 4.0 Hz
1030 *
1031 * This refreshes and returns a cached StatusSignal object.
1032 *
1033 * \param refresh Whether to refresh the StatusSignal before returning it;
1034 * defaults to true
1035 * \returns StickyFault_Hardware Status Signal Object
1036 */
1038
1039 /**
1040 * \brief Device supply voltage dropped to near brownout levels
1041 *
1042 * - Default Value: False
1043 *
1044 * Default Rates:
1045 * - CAN: 4.0 Hz
1046 *
1047 * This refreshes and returns a cached StatusSignal object.
1048 *
1049 * \param refresh Whether to refresh the StatusSignal before returning it;
1050 * defaults to true
1051 * \returns Fault_Undervoltage Status Signal Object
1052 */
1054
1055 /**
1056 * \brief Device supply voltage dropped to near brownout levels
1057 *
1058 * - Default Value: False
1059 *
1060 * Default Rates:
1061 * - CAN: 4.0 Hz
1062 *
1063 * This refreshes and returns a cached StatusSignal object.
1064 *
1065 * \param refresh Whether to refresh the StatusSignal before returning it;
1066 * defaults to true
1067 * \returns StickyFault_Undervoltage Status Signal Object
1068 */
1070
1071 /**
1072 * \brief Device boot while detecting the enable signal
1073 *
1074 * - Default Value: False
1075 *
1076 * Default Rates:
1077 * - CAN: 4.0 Hz
1078 *
1079 * This refreshes and returns a cached StatusSignal object.
1080 *
1081 * \param refresh Whether to refresh the StatusSignal before returning it;
1082 * defaults to true
1083 * \returns Fault_BootDuringEnable Status Signal Object
1084 */
1086
1087 /**
1088 * \brief Device boot while detecting the enable signal
1089 *
1090 * - Default Value: False
1091 *
1092 * Default Rates:
1093 * - CAN: 4.0 Hz
1094 *
1095 * This refreshes and returns a cached StatusSignal object.
1096 *
1097 * \param refresh Whether to refresh the StatusSignal before returning it;
1098 * defaults to true
1099 * \returns StickyFault_BootDuringEnable Status Signal Object
1100 */
1102
1103 /**
1104 * \brief An unlicensed feature is in use, device may not behave as
1105 * expected.
1106 *
1107 * - Default Value: False
1108 *
1109 * Default Rates:
1110 * - CAN: 4.0 Hz
1111 *
1112 * This refreshes and returns a cached StatusSignal object.
1113 *
1114 * \param refresh Whether to refresh the StatusSignal before returning it;
1115 * defaults to true
1116 * \returns Fault_UnlicensedFeatureInUse Status Signal Object
1117 */
1119
1120 /**
1121 * \brief An unlicensed feature is in use, device may not behave as
1122 * expected.
1123 *
1124 * - Default Value: False
1125 *
1126 * Default Rates:
1127 * - CAN: 4.0 Hz
1128 *
1129 * This refreshes and returns a cached StatusSignal object.
1130 *
1131 * \param refresh Whether to refresh the StatusSignal before returning it;
1132 * defaults to true
1133 * \returns StickyFault_UnlicensedFeatureInUse Status Signal Object
1134 */
1136
1137 /**
1138 * \brief The magnet distance is not correct or magnet is missing
1139 *
1140 * - Default Value: False
1141 *
1142 * Default Rates:
1143 * - CAN: 4.0 Hz
1144 *
1145 * This refreshes and returns a cached StatusSignal object.
1146 *
1147 * \param refresh Whether to refresh the StatusSignal before returning it;
1148 * defaults to true
1149 * \returns Fault_BadMagnet Status Signal Object
1150 */
1152
1153 /**
1154 * \brief The magnet distance is not correct or magnet is missing
1155 *
1156 * - Default Value: False
1157 *
1158 * Default Rates:
1159 * - CAN: 4.0 Hz
1160 *
1161 * This refreshes and returns a cached StatusSignal object.
1162 *
1163 * \param refresh Whether to refresh the StatusSignal before returning it;
1164 * defaults to true
1165 * \returns StickyFault_BadMagnet Status Signal Object
1166 */
1168
1169
1170
1171
1172 /**
1173 * \brief Sets the current position of the device.
1174 *
1175 * \param newValue Value to set to. Units are in rotations.
1176 * \param timeoutSeconds Maximum time to wait up to in seconds.
1177 * \returns StatusCode of the set command
1178 */
1179 ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
1180 {
1181 return GetConfigurator().SetPosition(newValue, timeoutSeconds);
1182 }
1183 /**
1184 * \brief Sets the current position of the device.
1185 *
1186 * This will wait up to 0.100 seconds (100ms) by default.
1187 *
1188 * \param newValue Value to set to. Units are in rotations.
1189 * \returns StatusCode of the set command
1190 */
1191 ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue)
1192 {
1193 return SetPosition(newValue, 0.100_s);
1194 }
1195
1196 /**
1197 * \brief Clear the sticky faults in the device.
1198 *
1199 * \details This typically has no impact on the device functionality.
1200 * Instead, it just clears telemetry faults that are accessible via
1201 * API and Tuner Self-Test.
1202 *
1203 * \param timeoutSeconds Maximum time to wait up to in seconds.
1204 * \returns StatusCode of the set command
1205 */
1206 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
1207 {
1208 return GetConfigurator().ClearStickyFaults(timeoutSeconds);
1209 }
1210 /**
1211 * \brief Clear the sticky faults in the device.
1212 *
1213 * \details This typically has no impact on the device functionality.
1214 * Instead, it just clears telemetry faults that are accessible via
1215 * API and Tuner Self-Test.
1216 *
1217 * This will wait up to 0.100 seconds (100ms) by default.
1218 *
1219 * \returns StatusCode of the set command
1220 */
1222 {
1223 return ClearStickyFaults(0.100_s);
1224 }
1225
1226 /**
1227 * \brief Clear sticky fault: Hardware fault occurred
1228 *
1229 * \param timeoutSeconds Maximum time to wait up to in seconds.
1230 * \returns StatusCode of the set command
1231 */
1232 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
1233 {
1234 return GetConfigurator().ClearStickyFault_Hardware(timeoutSeconds);
1235 }
1236 /**
1237 * \brief Clear sticky fault: Hardware fault occurred
1238 *
1239 * This will wait up to 0.100 seconds (100ms) by default.
1240 *
1241 * \returns StatusCode of the set command
1242 */
1244 {
1245 return ClearStickyFault_Hardware(0.100_s);
1246 }
1247
1248 /**
1249 * \brief Clear sticky fault: Device supply voltage dropped to near
1250 * brownout levels
1251 *
1252 * \param timeoutSeconds Maximum time to wait up to in seconds.
1253 * \returns StatusCode of the set command
1254 */
1255 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
1256 {
1257 return GetConfigurator().ClearStickyFault_Undervoltage(timeoutSeconds);
1258 }
1259 /**
1260 * \brief Clear sticky fault: Device supply voltage dropped to near
1261 * brownout levels
1262 *
1263 * This will wait up to 0.100 seconds (100ms) by default.
1264 *
1265 * \returns StatusCode of the set command
1266 */
1268 {
1269 return ClearStickyFault_Undervoltage(0.100_s);
1270 }
1271
1272 /**
1273 * \brief Clear sticky fault: Device boot while detecting the enable
1274 * signal
1275 *
1276 * \param timeoutSeconds Maximum time to wait up to in seconds.
1277 * \returns StatusCode of the set command
1278 */
1280 {
1281 return GetConfigurator().ClearStickyFault_BootDuringEnable(timeoutSeconds);
1282 }
1283 /**
1284 * \brief Clear sticky fault: Device boot while detecting the enable
1285 * signal
1286 *
1287 * This will wait up to 0.100 seconds (100ms) by default.
1288 *
1289 * \returns StatusCode of the set command
1290 */
1292 {
1293 return ClearStickyFault_BootDuringEnable(0.100_s);
1294 }
1295
1296 /**
1297 * \brief Clear sticky fault: An unlicensed feature is in use, device
1298 * may not behave as expected.
1299 *
1300 * \param timeoutSeconds Maximum time to wait up to in seconds.
1301 * \returns StatusCode of the set command
1302 */
1304 {
1305 return GetConfigurator().ClearStickyFault_UnlicensedFeatureInUse(timeoutSeconds);
1306 }
1307 /**
1308 * \brief Clear sticky fault: An unlicensed feature is in use, device
1309 * may not behave as expected.
1310 *
1311 * This will wait up to 0.100 seconds (100ms) by default.
1312 *
1313 * \returns StatusCode of the set command
1314 */
1316 {
1317 return ClearStickyFault_UnlicensedFeatureInUse(0.100_s);
1318 }
1319
1320 /**
1321 * \brief Clear sticky fault: The magnet distance is not correct or
1322 * magnet is missing
1323 *
1324 * \param timeoutSeconds Maximum time to wait up to in seconds.
1325 * \returns StatusCode of the set command
1326 */
1327 ctre::phoenix::StatusCode ClearStickyFault_BadMagnet(units::time::second_t timeoutSeconds)
1328 {
1329 return GetConfigurator().ClearStickyFault_BadMagnet(timeoutSeconds);
1330 }
1331 /**
1332 * \brief Clear sticky fault: The magnet distance is not correct or
1333 * magnet is missing
1334 *
1335 * This will wait up to 0.100 seconds (100ms) by default.
1336 *
1337 * \returns StatusCode of the set command
1338 */
1340 {
1341 return ClearStickyFault_BadMagnet(0.100_s);
1342 }
1343};
1344
1345#if defined(_WIN32) || defined(_WIN64)
1346#pragma warning(pop)
1347#endif
1348
1349}
1350}
1351
1352}
1353}
1354
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:567
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_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 ClearStickyFault_BadMagnet(units::time::second_t timeoutSeconds)
Clear sticky fault: The magnet distance is not correct or magnet is missing.
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 ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue)
Sets the current position of the device.
Definition CoreCANcoder.hpp:364
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 Apply(const CANcoderConfiguration &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:192
ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:279
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:250
ctre::phoenix::StatusCode Apply(const MagnetSensorConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:221
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANcoder.hpp:435
ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:265
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:341
ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(units::time::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:328
ctre::phoenix::StatusCode Refresh(MagnetSensorConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:310
ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
Sets the current position of the device.
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
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Configs that affect the magnet sensor and how to interpret it.
Definition MagnetSensorConfigs.hpp:26
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Definition Configuration.hpp:17
The base class for all device configurators.
Definition Configurator.hpp:21
The unique identifier for a device.
Definition DeviceIdentifier.hpp:19
Parent class for all devices.
Definition ParentDevice.hpp:23
Class for CANcoder, a CAN based magnetic encoder that provides absolute and relative position along w...
Definition CoreCANcoder.hpp:601
StatusSignal< int > & GetVersionMinor(bool refresh=true)
App Minor Version number.
CoreCANcoder(int deviceId, std::string canbus)
Constructs a new CANcoder object.
StatusSignal< int > & GetVersionBugfix(bool refresh=true)
App Bugfix Version number.
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition CoreCANcoder.hpp:1206
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANcoder.hpp:1267
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 ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANcoder.hpp:1221
configs::CANcoderConfigurator & GetConfigurator()
Gets the configurator for this CANcoder.
Definition CoreCANcoder.hpp:657
StatusSignal< int > & GetVersionBuild(bool refresh=true)
App Build Version number.
StatusSignal< units::angular_velocity::turns_per_second_t > & GetUnfilteredVelocity(bool refresh=true)
The unfiltered velocity reported by CANcoder.
ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
Definition CoreCANcoder.hpp:1232
StatusSignal< units::angle::turn_t > & GetPosition(bool refresh=true)
Position 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:1315
StatusSignal< int > & GetStickyFaultField(bool refresh=true)
Integer representing all (persistent) sticky fault flags reported by the device.
StatusSignal< units::angular_velocity::turns_per_second_t > & GetVelocity(bool refresh=true)
Velocity of the device.
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANcoder.hpp:1255
StatusSignal< int > & GetVersionMajor(bool refresh=true)
App Major Version number.
ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue)
Sets the current position of the device.
Definition CoreCANcoder.hpp:1191
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:687
ctre::phoenix::StatusCode ClearStickyFault_BadMagnet()
Clear sticky fault: The magnet distance is not correct or magnet is missing.
Definition CoreCANcoder.hpp:1339
StatusSignal< units::angle::turn_t > & GetAbsolutePosition(bool refresh=true)
Absolute Position of the device.
StatusSignal< units::voltage::volt_t > & GetSupplyVoltage(bool refresh=true)
Measured supply voltage to the CANcoder.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANcoder.hpp:1279
static CoreCANcoder None()
Constructs a stubbed-out CoreCANcoder, where all status signals, controls, configs,...
Definition CoreCANcoder.hpp:645
StatusSignal< int > & GetVersion(bool refresh=true)
Full Version of firmware in device.
CoreCANcoder(int deviceId, CANBus canbus={})
Constructs a new CANcoder object.
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(units::time::second_t timeoutSeconds)
Clear sticky fault: The magnet distance is not correct or magnet is missing.
Definition CoreCANcoder.hpp:1327
StatusSignal< units::angle::turn_t > & GetPositionSinceBoot(bool refresh=true)
The relative position reported by the CANcoder since boot.
StatusSignal< int > & GetFaultField(bool refresh=true)
Integer representing all fault flags reported by the device.
ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
Sets the current position of the device.
Definition CoreCANcoder.hpp:1179
StatusSignal< bool > & GetFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(units::time::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANcoder.hpp:1303
StatusSignal< bool > & GetIsProLicensed(bool refresh=true)
Whether the device is Phoenix Pro licensed.
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANcoder.hpp:1243
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:669
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANcoder.hpp:1291
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 motor_constants.h:14