CTRE Phoenix 6 C++ 26.0.0-beta-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 <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 Refreshes the values of the specified config group.
170 *
171 * This will wait up to #DefaultTimeoutSeconds.
172 *
173 * \details Call to refresh the selected configs from the device.
174 *
175 * \param configs The configs to refresh
176 * \returns StatusCode of refreshing the configs
177 */
179 {
180 return Refresh(configs, DefaultTimeoutSeconds);
181 }
182
183 /**
184 * \brief Refreshes the values of the specified config group.
185 *
186 * \details Call to refresh the selected configs from the device.
187 *
188 * \param configs The configs to refresh
189 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
190 * \returns StatusCode of refreshing the configs
191 */
192 ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs, units::time::second_t timeoutSeconds) const
193 {
194 std::string ref;
195 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
196 configs.Deserialize(ref);
197 return ret;
198 }
199
200 /**
201 * \brief Applies the contents of the specified config to the device.
202 *
203 * This will wait up to #DefaultTimeoutSeconds.
204 *
205 * \details Call to apply the selected configs.
206 *
207 * \param configs Configs to apply against.
208 * \returns StatusCode of the set command
209 */
211 {
212 return Apply(configs, DefaultTimeoutSeconds);
213 }
214
215 /**
216 * \brief Applies the contents of the specified config to the device.
217 *
218 * \details Call to apply the selected configs.
219 *
220 * \param configs Configs to apply against.
221 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
222 * \returns StatusCode of the set command
223 */
224 ctre::phoenix::StatusCode Apply(const CANcoderConfiguration &configs, units::time::second_t timeoutSeconds)
225 {
226 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, configs.FutureProofConfigs, false);
227 }
228
229
230 /**
231 * \brief Refreshes the values of the specified config group.
232 *
233 * This will wait up to #DefaultTimeoutSeconds.
234 *
235 * \details Call to refresh the selected configs from the device.
236 *
237 * \param configs The configs to refresh
238 * \returns StatusCode of refreshing the configs
239 */
241 {
242 return Refresh(configs, DefaultTimeoutSeconds);
243 }
244 /**
245 * \brief Refreshes the values of the specified config group.
246 *
247 * \details Call to refresh the selected configs from the device.
248 *
249 * \param configs The configs to refresh
250 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
251 * \returns StatusCode of refreshing the configs
252 */
253 ctre::phoenix::StatusCode Refresh(MagnetSensorConfigs &configs, units::time::second_t timeoutSeconds) const
254 {
255 std::string ref;
256 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
257 configs.Deserialize(ref);
258 return ret;
259 }
260
261 /**
262 * \brief Applies the contents of the specified config to the device.
263 *
264 * This will wait up to #DefaultTimeoutSeconds.
265 *
266 * \details Call to apply the selected configs.
267 *
268 * \param configs Configs to apply against.
269 * \returns StatusCode of the set command
270 */
272 {
273 return Apply(configs, DefaultTimeoutSeconds);
274 }
275
276 /**
277 * \brief Applies the contents of the specified config to the device.
278 *
279 * \details Call to apply the selected configs.
280 *
281 * \param configs Configs to apply against.
282 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
283 * \returns StatusCode of the set command
284 */
285 ctre::phoenix::StatusCode Apply(const MagnetSensorConfigs &configs, units::time::second_t timeoutSeconds)
286 {
287 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
288 }
289
290 /**
291 * \brief Refreshes the values of the specified config group.
292 *
293 * This will wait up to #DefaultTimeoutSeconds.
294 *
295 * \details Call to refresh the selected configs from the device.
296 *
297 * \param configs The configs to refresh
298 * \returns StatusCode of refreshing the configs
299 */
301 {
302 return Refresh(configs, DefaultTimeoutSeconds);
303 }
304 /**
305 * \brief Refreshes the values of the specified config group.
306 *
307 * \details Call to refresh the selected configs from the device.
308 *
309 * \param configs The configs to refresh
310 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
311 * \returns StatusCode of refreshing the configs
312 */
313 ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
314 {
315 std::string ref;
316 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
317 configs.Deserialize(ref);
318 return ret;
319 }
320
321 /**
322 * \brief Applies the contents of the specified config to the device.
323 *
324 * This will wait up to #DefaultTimeoutSeconds.
325 *
326 * \details Call to apply the selected configs.
327 *
328 * \param configs Configs to apply against.
329 * \returns StatusCode of the set command
330 */
332 {
333 return Apply(configs, DefaultTimeoutSeconds);
334 }
335
336 /**
337 * \brief Applies the contents of the specified config to the device.
338 *
339 * \details Call to apply the selected configs.
340 *
341 * \param configs Configs to apply against.
342 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
343 * \returns StatusCode of the set command
344 */
345 ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, units::time::second_t timeoutSeconds)
346 {
347 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
348 }
349
350
351 /**
352 * \brief Sets the current position of the device.
353 *
354 * This will wait up to #DefaultTimeoutSeconds.
355 *
356 * This is available in the configurator in case the user wants
357 * to initialize their device entirely without passing a device
358 * reference down to the code that performs the initialization.
359 * In this case, the user passes down the configurator object
360 * and performs all the initialization code on the object.
361 *
362 * \param newValue Value to set to. Units are in rotations.
363 * \returns StatusCode of the set command
364 */
365 ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue)
366 {
367 return SetPosition(newValue, DefaultTimeoutSeconds);
368 }
369 /**
370 * \brief Sets the current position of the device.
371 *
372 * This is available in the configurator in case the user wants
373 * to initialize their device entirely without passing a device
374 * reference down to the code that performs the initialization.
375 * In this case, the user passes down the configurator object
376 * and performs all the initialization code on the object.
377 *
378 * \param newValue Value to set to. Units are in rotations.
379 * \param timeoutSeconds Maximum time to wait up to in seconds.
380 * \returns StatusCode of the set command
381 */
382 ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds);
383
384 /**
385 * \brief Clear the sticky faults in the device.
386 *
387 * \details This typically has no impact on the device functionality.
388 * Instead, it just clears telemetry faults that are accessible via
389 * API and Tuner Self-Test.
390 *
391 * This will wait up to #DefaultTimeoutSeconds.
392 *
393 * This is available in the configurator in case the user wants
394 * to initialize their device entirely without passing a device
395 * reference down to the code that performs the initialization.
396 * In this case, the user passes down the configurator object
397 * and performs all the initialization code on the object.
398 *
399 * \returns StatusCode of the set command
400 */
402 {
403 return ClearStickyFaults(DefaultTimeoutSeconds);
404 }
405 /**
406 * \brief Clear the sticky faults in the device.
407 *
408 * \details This typically has no impact on the device functionality.
409 * Instead, it just clears telemetry faults that are accessible via
410 * API and Tuner Self-Test.
411 *
412 * This is available in the configurator in case the user wants
413 * to initialize their device entirely without passing a device
414 * reference down to the code that performs the initialization.
415 * In this case, the user passes down the configurator object
416 * and performs all the initialization code on the object.
417 *
418 * \param timeoutSeconds Maximum time to wait up to in seconds.
419 * \returns StatusCode of the set command
420 */
421 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds);
422
423 /**
424 * \brief Clear sticky fault: Hardware fault occurred
425 *
426 * This will wait up to #DefaultTimeoutSeconds.
427 *
428 * This is available in the configurator in case the user wants
429 * to initialize their device entirely without passing a device
430 * reference down to the code that performs the initialization.
431 * In this case, the user passes down the configurator object
432 * and performs all the initialization code on the object.
433 *
434 * \returns StatusCode of the set command
435 */
437 {
438 return ClearStickyFault_Hardware(DefaultTimeoutSeconds);
439 }
440 /**
441 * \brief Clear sticky fault: Hardware fault occurred
442 *
443 * This is available in the configurator in case the user wants
444 * to initialize their device entirely without passing a device
445 * reference down to the code that performs the initialization.
446 * In this case, the user passes down the configurator object
447 * and performs all the initialization code on the object.
448 *
449 * \param timeoutSeconds Maximum time to wait up to in seconds.
450 * \returns StatusCode of the set command
451 */
452 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds);
453
454 /**
455 * \brief Clear sticky fault: Device supply voltage dropped to near
456 * brownout levels
457 *
458 * This will wait up to #DefaultTimeoutSeconds.
459 *
460 * This is available in the configurator in case the user wants
461 * to initialize their device entirely without passing a device
462 * reference down to the code that performs the initialization.
463 * In this case, the user passes down the configurator object
464 * and performs all the initialization code on the object.
465 *
466 * \returns StatusCode of the set command
467 */
469 {
470 return ClearStickyFault_Undervoltage(DefaultTimeoutSeconds);
471 }
472 /**
473 * \brief Clear sticky fault: Device supply voltage dropped to near
474 * brownout levels
475 *
476 * This is available in the configurator in case the user wants
477 * to initialize their device entirely without passing a device
478 * reference down to the code that performs the initialization.
479 * In this case, the user passes down the configurator object
480 * and performs all the initialization code on the object.
481 *
482 * \param timeoutSeconds Maximum time to wait up to in seconds.
483 * \returns StatusCode of the set command
484 */
485 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds);
486
487 /**
488 * \brief Clear sticky fault: Device boot while detecting the enable
489 * signal
490 *
491 * This will wait up to #DefaultTimeoutSeconds.
492 *
493 * This is available in the configurator in case the user wants
494 * to initialize their device entirely without passing a device
495 * reference down to the code that performs the initialization.
496 * In this case, the user passes down the configurator object
497 * and performs all the initialization code on the object.
498 *
499 * \returns StatusCode of the set command
500 */
502 {
503 return ClearStickyFault_BootDuringEnable(DefaultTimeoutSeconds);
504 }
505 /**
506 * \brief Clear sticky fault: Device boot while detecting the enable
507 * signal
508 *
509 * This is available in the configurator in case the user wants
510 * to initialize their device entirely without passing a device
511 * reference down to the code that performs the initialization.
512 * In this case, the user passes down the configurator object
513 * and performs all the initialization code on the object.
514 *
515 * \param timeoutSeconds Maximum time to wait up to in seconds.
516 * \returns StatusCode of the set command
517 */
519
520 /**
521 * \brief Clear sticky fault: An unlicensed feature is in use, device
522 * may not behave as expected.
523 *
524 * This will wait up to #DefaultTimeoutSeconds.
525 *
526 * This is available in the configurator in case the user wants
527 * to initialize their device entirely without passing a device
528 * reference down to the code that performs the initialization.
529 * In this case, the user passes down the configurator object
530 * and performs all the initialization code on the object.
531 *
532 * \returns StatusCode of the set command
533 */
535 {
536 return ClearStickyFault_UnlicensedFeatureInUse(DefaultTimeoutSeconds);
537 }
538 /**
539 * \brief Clear sticky fault: An unlicensed feature is in use, device
540 * may not behave as expected.
541 *
542 * This is available in the configurator in case the user wants
543 * to initialize their device entirely without passing a device
544 * reference down to the code that performs the initialization.
545 * In this case, the user passes down the configurator object
546 * and performs all the initialization code on the object.
547 *
548 * \param timeoutSeconds Maximum time to wait up to in seconds.
549 * \returns StatusCode of the set command
550 */
552
553 /**
554 * \brief Clear sticky fault: The magnet distance is not correct or
555 * magnet is missing
556 *
557 * This will wait up to #DefaultTimeoutSeconds.
558 *
559 * This is available in the configurator in case the user wants
560 * to initialize their device entirely without passing a device
561 * reference down to the code that performs the initialization.
562 * In this case, the user passes down the configurator object
563 * and performs all the initialization code on the object.
564 *
565 * \returns StatusCode of the set command
566 */
568 {
569 return ClearStickyFault_BadMagnet(DefaultTimeoutSeconds);
570 }
571 /**
572 * \brief Clear sticky fault: The magnet distance is not correct or
573 * magnet is missing
574 *
575 * This is available in the configurator in case the user wants
576 * to initialize their device entirely without passing a device
577 * reference down to the code that performs the initialization.
578 * In this case, the user passes down the configurator object
579 * and performs all the initialization code on the object.
580 *
581 * \param timeoutSeconds Maximum time to wait up to in seconds.
582 * \returns StatusCode of the set command
583 */
584 ctre::phoenix::StatusCode ClearStickyFault_BadMagnet(units::time::second_t timeoutSeconds);
585};
586
587}
588
589namespace hardware {
590namespace core {
591
592#if defined(_WIN32) || defined(_WIN64)
593#pragma warning(push)
594#pragma warning(disable : 4250)
595#endif
596
597/**
598 * Class for CANcoder, a CAN based magnetic encoder that provides absolute and
599 * relative position along with filtered velocity.
600 */
602{
603private:
605
606public:
607 /**
608 * \brief The configuration class for this device.
609 */
611
612 /**
613 * Constructs a new CANcoder object.
614 *
615 * \param deviceId ID of the device, as configured in Phoenix Tuner
616 * \param canbus The CAN bus this device is on
617 */
618 CoreCANcoder(int deviceId, CANBus canbus = {});
619
620 /**
621 * Constructs a new CANcoder object.
622 *
623 * \param deviceId ID of the device, as configured in Phoenix Tuner
624 * \param canbus Name of the CAN bus this device is on. Possible CAN bus strings are:
625 * - "rio" for the native roboRIO CAN bus
626 * - CANivore name or serial number
627 * - SocketCAN interface (non-FRC Linux only)
628 * - "*" for any CANivore seen by the program
629 * - empty string (default) to select the default for the system:
630 * - "rio" on roboRIO
631 * - "can0" on Linux
632 * - "*" on Windows
633 *
634 * \deprecated Constructing devices with a CAN bus string is deprecated for removal
635 * in the 2027 season. Construct devices using a CANBus instance instead.
636 */
637 CoreCANcoder(int deviceId, std::string canbus);
638
639 /**
640 * \brief Gets the configurator for this CANcoder
641 *
642 * \details Gets the configurator for this CANcoder
643 *
644 * \returns Configurator for this CANcoder
645 */
647 {
648 return _configs;
649 }
650
651 /**
652 * \brief Gets the configurator for this CANcoder
653 *
654 * \details Gets the configurator for this CANcoder
655 *
656 * \returns Configurator for this CANcoder
657 */
659 {
660 return _configs;
661 }
662
663
664private:
665 std::unique_ptr<sim::CANcoderSimState> _simState{};
666public:
667 /**
668 * \brief Get the simulation state for this device.
669 *
670 * \details This function reuses an allocated simulation
671 * state object, so it is safe to call this function multiple
672 * times in a robot loop.
673 *
674 * \returns Simulation state
675 */
677 {
678 if (_simState == nullptr)
679 _simState = std::make_unique<sim::CANcoderSimState>(*this);
680 return *_simState;
681 }
682
683
684
685 /**
686 * \brief App Major Version number.
687 *
688 * - Minimum Value: 0
689 * - Maximum Value: 255
690 * - Default Value: 0
691 * - Units:
692 *
693 * Default Rates:
694 * - CAN: 4.0 Hz
695 *
696 * This refreshes and returns a cached StatusSignal object.
697 *
698 * \param refresh Whether to refresh the StatusSignal before returning it;
699 * defaults to true
700 * \returns VersionMajor Status Signal Object
701 */
702 StatusSignal<int> &GetVersionMajor(bool refresh = true);
703
704 /**
705 * \brief App Minor Version number.
706 *
707 * - Minimum Value: 0
708 * - Maximum Value: 255
709 * - Default Value: 0
710 * - Units:
711 *
712 * Default Rates:
713 * - CAN: 4.0 Hz
714 *
715 * This refreshes and returns a cached StatusSignal object.
716 *
717 * \param refresh Whether to refresh the StatusSignal before returning it;
718 * defaults to true
719 * \returns VersionMinor Status Signal Object
720 */
721 StatusSignal<int> &GetVersionMinor(bool refresh = true);
722
723 /**
724 * \brief App Bugfix Version number.
725 *
726 * - Minimum Value: 0
727 * - Maximum Value: 255
728 * - Default Value: 0
729 * - Units:
730 *
731 * Default Rates:
732 * - CAN: 4.0 Hz
733 *
734 * This refreshes and returns a cached StatusSignal object.
735 *
736 * \param refresh Whether to refresh the StatusSignal before returning it;
737 * defaults to true
738 * \returns VersionBugfix Status Signal Object
739 */
740 StatusSignal<int> &GetVersionBugfix(bool refresh = true);
741
742 /**
743 * \brief App Build Version number.
744 *
745 * - Minimum Value: 0
746 * - Maximum Value: 255
747 * - Default Value: 0
748 * - Units:
749 *
750 * Default Rates:
751 * - CAN: 4.0 Hz
752 *
753 * This refreshes and returns a cached StatusSignal object.
754 *
755 * \param refresh Whether to refresh the StatusSignal before returning it;
756 * defaults to true
757 * \returns VersionBuild Status Signal Object
758 */
759 StatusSignal<int> &GetVersionBuild(bool refresh = true);
760
761 /**
762 * \brief Full Version of firmware in device. The format is a four
763 * byte value.
764 *
765 * - Minimum Value: 0
766 * - Maximum Value: 4294967295
767 * - Default Value: 0
768 * - Units:
769 *
770 * Default Rates:
771 * - CAN: 4.0 Hz
772 *
773 * This refreshes and returns a cached StatusSignal object.
774 *
775 * \param refresh Whether to refresh the StatusSignal before returning it;
776 * defaults to true
777 * \returns Version Status Signal Object
778 */
779 StatusSignal<int> &GetVersion(bool refresh = true);
780
781 /**
782 * \brief Integer representing all fault flags reported by the device.
783 *
784 * \details These are device specific and are not used directly in
785 * typical applications. Use the signal specific GetFault_*() methods
786 * instead.
787 *
788 * - Minimum Value: 0
789 * - Maximum Value: 4294967295
790 * - Default Value: 0
791 * - Units:
792 *
793 * Default Rates:
794 * - CAN: 4.0 Hz
795 *
796 * This refreshes and returns a cached StatusSignal object.
797 *
798 * \param refresh Whether to refresh the StatusSignal before returning it;
799 * defaults to true
800 * \returns FaultField Status Signal Object
801 */
802 StatusSignal<int> &GetFaultField(bool refresh = true);
803
804 /**
805 * \brief Integer representing all (persistent) sticky fault flags
806 * reported by the device.
807 *
808 * \details These are device specific and are not used directly in
809 * typical applications. Use the signal specific GetStickyFault_*()
810 * methods instead.
811 *
812 * - Minimum Value: 0
813 * - Maximum Value: 4294967295
814 * - Default Value: 0
815 * - Units:
816 *
817 * Default Rates:
818 * - CAN: 4.0 Hz
819 *
820 * This refreshes and returns a cached StatusSignal object.
821 *
822 * \param refresh Whether to refresh the StatusSignal before returning it;
823 * defaults to true
824 * \returns StickyFaultField Status Signal Object
825 */
827
828 /**
829 * \brief Velocity of the device.
830 *
831 * - Minimum Value: -512.0
832 * - Maximum Value: 511.998046875
833 * - Default Value: 0
834 * - Units: rotations per second
835 *
836 * Default Rates:
837 * - CAN 2.0: 100.0 Hz
838 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
839 *
840 * This refreshes and returns a cached StatusSignal object.
841 *
842 * \param refresh Whether to refresh the StatusSignal before returning it;
843 * defaults to true
844 * \returns Velocity Status Signal Object
845 */
847
848 /**
849 * \brief Position of the device. This is initialized to the absolute
850 * position on boot.
851 *
852 * - Minimum Value: -16384.0
853 * - Maximum Value: 16383.999755859375
854 * - Default Value: 0
855 * - Units: rotations
856 *
857 * Default Rates:
858 * - CAN 2.0: 100.0 Hz
859 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
860 *
861 * This refreshes and returns a cached StatusSignal object.
862 *
863 * \param refresh Whether to refresh the StatusSignal before returning it;
864 * defaults to true
865 * \returns Position Status Signal Object
866 */
868
869 /**
870 * \brief Absolute Position of the device. The possible range is
871 * documented below; however, the exact expected range is determined
872 * by the AbsoluteSensorDiscontinuityPoint. This position is only
873 * affected by the MagnetSensor configs.
874 *
875 * - Minimum Value: -1.0
876 * - Maximum Value: 0.999755859375
877 * - Default Value: 0
878 * - Units: rotations
879 *
880 * Default Rates:
881 * - CAN 2.0: 100.0 Hz
882 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
883 *
884 * This refreshes and returns a cached StatusSignal object.
885 *
886 * \param refresh Whether to refresh the StatusSignal before returning it;
887 * defaults to true
888 * \returns AbsolutePosition Status Signal Object
889 */
891
892 /**
893 * \brief The unfiltered velocity reported by CANcoder.
894 *
895 * \details This is the unfiltered velocity reported by CANcoder. This
896 * signal does not use the fusing algorithm.
897 *
898 * - Minimum Value: -8000.0
899 * - Maximum Value: 7999.755859375
900 * - Default Value: 0
901 * - Units: rotations per second
902 *
903 * Default Rates:
904 * - CAN 2.0: 4.0 Hz
905 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
906 *
907 * This refreshes and returns a cached StatusSignal object.
908 *
909 * \param refresh Whether to refresh the StatusSignal before returning it;
910 * defaults to true
911 * \returns UnfilteredVelocity Status Signal Object
912 */
914
915 /**
916 * \brief The relative position reported by the CANcoder since boot.
917 *
918 * \details This is the total displacement reported by CANcoder since
919 * power up. This signal is relative and is not influenced by the
920 * fusing algorithm.
921 *
922 * - Minimum Value: -16384.0
923 * - Maximum Value: 16383.999755859375
924 * - Default Value: 0
925 * - Units: rotations
926 *
927 * Default Rates:
928 * - CAN 2.0: 4.0 Hz
929 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
930 *
931 * This refreshes and returns a cached StatusSignal object.
932 *
933 * \param refresh Whether to refresh the StatusSignal before returning it;
934 * defaults to true
935 * \returns PositionSinceBoot Status Signal Object
936 */
938
939 /**
940 * \brief Measured supply voltage to the CANcoder.
941 *
942 * - Minimum Value: 4
943 * - Maximum Value: 16.75
944 * - Default Value: 4
945 * - Units: V
946 *
947 * Default Rates:
948 * - CAN 2.0: 4.0 Hz
949 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
950 *
951 * This refreshes and returns a cached StatusSignal object.
952 *
953 * \param refresh Whether to refresh the StatusSignal before returning it;
954 * defaults to true
955 * \returns SupplyVoltage Status Signal Object
956 */
958
959 /**
960 * \brief Magnet health as measured by CANcoder.
961 *
962 * Red indicates too close or too far, Orange is adequate but with
963 * reduced accuracy, green is ideal. Invalid means the accuracy cannot
964 * be determined.
965 *
966 *
967 * Default Rates:
968 * - CAN 2.0: 4.0 Hz
969 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
970 *
971 * This refreshes and returns a cached StatusSignal object.
972 *
973 * \param refresh Whether to refresh the StatusSignal before returning it;
974 * defaults to true
975 * \returns MagnetHealth Status Signal Object
976 */
978
979 /**
980 * \brief Whether the device is Phoenix Pro licensed.
981 *
982 * - Default Value: False
983 *
984 * Default Rates:
985 * - CAN: 4.0 Hz
986 *
987 * This refreshes and returns a cached StatusSignal object.
988 *
989 * \param refresh Whether to refresh the StatusSignal before returning it;
990 * defaults to true
991 * \returns IsProLicensed Status Signal Object
992 */
994
995 /**
996 * \brief Hardware fault occurred
997 *
998 * - Default Value: False
999 *
1000 * Default Rates:
1001 * - CAN: 4.0 Hz
1002 *
1003 * This refreshes and returns a cached StatusSignal object.
1004 *
1005 * \param refresh Whether to refresh the StatusSignal before returning it;
1006 * defaults to true
1007 * \returns Fault_Hardware Status Signal Object
1008 */
1010
1011 /**
1012 * \brief Hardware fault occurred
1013 *
1014 * - Default Value: False
1015 *
1016 * Default Rates:
1017 * - CAN: 4.0 Hz
1018 *
1019 * This refreshes and returns a cached StatusSignal object.
1020 *
1021 * \param refresh Whether to refresh the StatusSignal before returning it;
1022 * defaults to true
1023 * \returns StickyFault_Hardware Status Signal Object
1024 */
1026
1027 /**
1028 * \brief Device supply voltage dropped to near brownout levels
1029 *
1030 * - Default Value: False
1031 *
1032 * Default Rates:
1033 * - CAN: 4.0 Hz
1034 *
1035 * This refreshes and returns a cached StatusSignal object.
1036 *
1037 * \param refresh Whether to refresh the StatusSignal before returning it;
1038 * defaults to true
1039 * \returns Fault_Undervoltage Status Signal Object
1040 */
1042
1043 /**
1044 * \brief Device supply voltage dropped to near brownout levels
1045 *
1046 * - Default Value: False
1047 *
1048 * Default Rates:
1049 * - CAN: 4.0 Hz
1050 *
1051 * This refreshes and returns a cached StatusSignal object.
1052 *
1053 * \param refresh Whether to refresh the StatusSignal before returning it;
1054 * defaults to true
1055 * \returns StickyFault_Undervoltage Status Signal Object
1056 */
1058
1059 /**
1060 * \brief Device boot while detecting the enable signal
1061 *
1062 * - Default Value: False
1063 *
1064 * Default Rates:
1065 * - CAN: 4.0 Hz
1066 *
1067 * This refreshes and returns a cached StatusSignal object.
1068 *
1069 * \param refresh Whether to refresh the StatusSignal before returning it;
1070 * defaults to true
1071 * \returns Fault_BootDuringEnable Status Signal Object
1072 */
1074
1075 /**
1076 * \brief Device boot while detecting the enable signal
1077 *
1078 * - Default Value: False
1079 *
1080 * Default Rates:
1081 * - CAN: 4.0 Hz
1082 *
1083 * This refreshes and returns a cached StatusSignal object.
1084 *
1085 * \param refresh Whether to refresh the StatusSignal before returning it;
1086 * defaults to true
1087 * \returns StickyFault_BootDuringEnable Status Signal Object
1088 */
1090
1091 /**
1092 * \brief An unlicensed feature is in use, device may not behave as
1093 * expected.
1094 *
1095 * - Default Value: False
1096 *
1097 * Default Rates:
1098 * - CAN: 4.0 Hz
1099 *
1100 * This refreshes and returns a cached StatusSignal object.
1101 *
1102 * \param refresh Whether to refresh the StatusSignal before returning it;
1103 * defaults to true
1104 * \returns Fault_UnlicensedFeatureInUse Status Signal Object
1105 */
1107
1108 /**
1109 * \brief An unlicensed feature is in use, device may not behave as
1110 * expected.
1111 *
1112 * - Default Value: False
1113 *
1114 * Default Rates:
1115 * - CAN: 4.0 Hz
1116 *
1117 * This refreshes and returns a cached StatusSignal object.
1118 *
1119 * \param refresh Whether to refresh the StatusSignal before returning it;
1120 * defaults to true
1121 * \returns StickyFault_UnlicensedFeatureInUse Status Signal Object
1122 */
1124
1125 /**
1126 * \brief The magnet distance is not correct or magnet is missing
1127 *
1128 * - Default Value: False
1129 *
1130 * Default Rates:
1131 * - CAN: 4.0 Hz
1132 *
1133 * This refreshes and returns a cached StatusSignal object.
1134 *
1135 * \param refresh Whether to refresh the StatusSignal before returning it;
1136 * defaults to true
1137 * \returns Fault_BadMagnet Status Signal Object
1138 */
1140
1141 /**
1142 * \brief The magnet distance is not correct or magnet is missing
1143 *
1144 * - Default Value: False
1145 *
1146 * Default Rates:
1147 * - CAN: 4.0 Hz
1148 *
1149 * This refreshes and returns a cached StatusSignal object.
1150 *
1151 * \param refresh Whether to refresh the StatusSignal before returning it;
1152 * defaults to true
1153 * \returns StickyFault_BadMagnet Status Signal Object
1154 */
1156
1157
1158
1159 /**
1160 * \brief Control device with generic control request object. User must make
1161 * sure the specified object is castable to a valid control request,
1162 * otherwise this function will fail at run-time and return the NotSupported
1163 * StatusCode
1164 *
1165 * \param request Control object to request of the device
1166 * \returns Status Code of the request, 0 is OK
1167 */
1169
1170
1171 /**
1172 * \brief Sets the current position of the device.
1173 *
1174 * \param newValue Value to set to. Units are in rotations.
1175 * \param timeoutSeconds Maximum time to wait up to in seconds.
1176 * \returns StatusCode of the set command
1177 */
1178 ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
1179 {
1180 return GetConfigurator().SetPosition(newValue, timeoutSeconds);
1181 }
1182 /**
1183 * \brief Sets the current position of the device.
1184 *
1185 * This will wait up to 0.100 seconds (100ms) by default.
1186 *
1187 * \param newValue Value to set to. Units are in rotations.
1188 * \returns StatusCode of the set command
1189 */
1190 ctre::phoenix::StatusCode SetPosition(units::angle::turn_t newValue)
1191 {
1192 return SetPosition(newValue, 0.100_s);
1193 }
1194
1195 /**
1196 * \brief Clear the sticky faults in the device.
1197 *
1198 * \details This typically has no impact on the device functionality.
1199 * Instead, it just clears telemetry faults that are accessible via
1200 * API and Tuner Self-Test.
1201 *
1202 * \param timeoutSeconds Maximum time to wait up to in seconds.
1203 * \returns StatusCode of the set command
1204 */
1205 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
1206 {
1207 return GetConfigurator().ClearStickyFaults(timeoutSeconds);
1208 }
1209 /**
1210 * \brief Clear the sticky faults in the device.
1211 *
1212 * \details This typically has no impact on the device functionality.
1213 * Instead, it just clears telemetry faults that are accessible via
1214 * API and Tuner Self-Test.
1215 *
1216 * This will wait up to 0.100 seconds (100ms) by default.
1217 *
1218 * \returns StatusCode of the set command
1219 */
1221 {
1222 return ClearStickyFaults(0.100_s);
1223 }
1224
1225 /**
1226 * \brief Clear sticky fault: Hardware fault occurred
1227 *
1228 * \param timeoutSeconds Maximum time to wait up to in seconds.
1229 * \returns StatusCode of the set command
1230 */
1231 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
1232 {
1233 return GetConfigurator().ClearStickyFault_Hardware(timeoutSeconds);
1234 }
1235 /**
1236 * \brief Clear sticky fault: Hardware fault occurred
1237 *
1238 * This will wait up to 0.100 seconds (100ms) by default.
1239 *
1240 * \returns StatusCode of the set command
1241 */
1243 {
1244 return ClearStickyFault_Hardware(0.100_s);
1245 }
1246
1247 /**
1248 * \brief Clear sticky fault: Device supply voltage dropped to near
1249 * brownout levels
1250 *
1251 * \param timeoutSeconds Maximum time to wait up to in seconds.
1252 * \returns StatusCode of the set command
1253 */
1254 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
1255 {
1256 return GetConfigurator().ClearStickyFault_Undervoltage(timeoutSeconds);
1257 }
1258 /**
1259 * \brief Clear sticky fault: Device supply voltage dropped to near
1260 * brownout levels
1261 *
1262 * This will wait up to 0.100 seconds (100ms) by default.
1263 *
1264 * \returns StatusCode of the set command
1265 */
1267 {
1268 return ClearStickyFault_Undervoltage(0.100_s);
1269 }
1270
1271 /**
1272 * \brief Clear sticky fault: Device boot while detecting the enable
1273 * signal
1274 *
1275 * \param timeoutSeconds Maximum time to wait up to in seconds.
1276 * \returns StatusCode of the set command
1277 */
1279 {
1280 return GetConfigurator().ClearStickyFault_BootDuringEnable(timeoutSeconds);
1281 }
1282 /**
1283 * \brief Clear sticky fault: Device boot while detecting the enable
1284 * signal
1285 *
1286 * This will wait up to 0.100 seconds (100ms) by default.
1287 *
1288 * \returns StatusCode of the set command
1289 */
1291 {
1292 return ClearStickyFault_BootDuringEnable(0.100_s);
1293 }
1294
1295 /**
1296 * \brief Clear sticky fault: An unlicensed feature is in use, device
1297 * may not behave as expected.
1298 *
1299 * \param timeoutSeconds Maximum time to wait up to in seconds.
1300 * \returns StatusCode of the set command
1301 */
1303 {
1304 return GetConfigurator().ClearStickyFault_UnlicensedFeatureInUse(timeoutSeconds);
1305 }
1306 /**
1307 * \brief Clear sticky fault: An unlicensed feature is in use, device
1308 * may not behave as expected.
1309 *
1310 * This will wait up to 0.100 seconds (100ms) by default.
1311 *
1312 * \returns StatusCode of the set command
1313 */
1315 {
1316 return ClearStickyFault_UnlicensedFeatureInUse(0.100_s);
1317 }
1318
1319 /**
1320 * \brief Clear sticky fault: The magnet distance is not correct or
1321 * magnet is missing
1322 *
1323 * \param timeoutSeconds Maximum time to wait up to in seconds.
1324 * \returns StatusCode of the set command
1325 */
1326 ctre::phoenix::StatusCode ClearStickyFault_BadMagnet(units::time::second_t timeoutSeconds)
1327 {
1328 return GetConfigurator().ClearStickyFault_BadMagnet(timeoutSeconds);
1329 }
1330 /**
1331 * \brief Clear sticky fault: The magnet distance is not correct or
1332 * magnet is missing
1333 *
1334 * This will wait up to 0.100 seconds (100ms) by default.
1335 *
1336 * \returns StatusCode of the set command
1337 */
1339 {
1340 return ClearStickyFault_BadMagnet(0.100_s);
1341 }
1342};
1343
1344#if defined(_WIN32) || defined(_WIN64)
1345#pragma warning(pop)
1346#endif
1347
1348}
1349}
1350
1351}
1352}
1353
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:474
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:240
ctre::phoenix::StatusCode ClearStickyFault_BadMagnet()
Clear sticky fault: The magnet distance is not correct or magnet is missing.
Definition CoreCANcoder.hpp:567
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANcoder.hpp:534
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:331
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:468
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANcoder.hpp:501
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:365
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANcoder.hpp:401
ctre::phoenix::StatusCode Apply(const CANcoderConfiguration &configs)
Applies the contents of the specified config to the device.
Definition CoreCANcoder.hpp:210
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:224
ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:192
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:345
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:285
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANcoder.hpp:436
ctre::phoenix::StatusCode Refresh(CANcoderConfiguration &configs) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:178
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:313
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:300
ctre::phoenix::StatusCode Refresh(MagnetSensorConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANcoder.hpp:253
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:271
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
Definition Configurator.hpp:18
Common interface implemented by all control requests.
Definition ControlRequest.hpp:27
Definition DeviceIdentifier.hpp:16
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:602
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:1205
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANcoder.hpp:1266
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:1220
configs::CANcoderConfigurator & GetConfigurator()
Gets the configurator for this CANcoder.
Definition CoreCANcoder.hpp:646
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:1231
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:1314
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:1254
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:1190
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:676
ctre::phoenix::StatusCode ClearStickyFault_BadMagnet()
Clear sticky fault: The magnet distance is not correct or magnet is missing.
Definition CoreCANcoder.hpp:1338
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 SetControl(controls::ControlRequest const &request)
Control device with generic control request object.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANcoder.hpp:1278
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:1326
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:1178
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:1302
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:1242
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:658
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANcoder.hpp:1290
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