CTRE Phoenix 6 C++ 26.70.0-alpha-2
Loading...
Searching...
No Matches
CoreCANrange.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
18
20#include <wpi/units/angle.hpp>
21#include <wpi/units/dimensionless.hpp>
22#include <wpi/units/length.hpp>
23#include <wpi/units/time.hpp>
24#include <wpi/units/voltage.hpp>
25
26namespace ctre {
27namespace phoenix6 {
28
29namespace hardware {
30namespace core {
31 class CoreCANrange;
32}
33}
34
35namespace configs {
36
37/**
38 * All configurations for the hardware#CANrange.
39 */
41{
42public:
43 constexpr CANrangeConfiguration() = default;
44
45 /**
46 * \brief True if we should factory default newer unsupported configs,
47 * false to leave newer unsupported configs alone.
48 *
49 * \details This flag addresses a corner case where the device may have
50 * firmware with newer configs that didn't exist when this
51 * version of the API was built. If this occurs and this
52 * flag is true, unsupported new configs will be factory
53 * defaulted to avoid unexpected behavior.
54 *
55 * This is also the behavior in Phoenix 5, so this flag
56 * is defaulted to true to match.
57 */
59
60
61 /**
62 * \brief Custom Params.
63 *
64 * \details Custom paramaters that have no real impact on controller.
65 *
66 * Parameter list:
67 *
68 * - CustomParamsConfigs#CustomParam0
69 * - CustomParamsConfigs#CustomParam1
70 *
71 */
73
74 /**
75 * \brief Configs that affect the ToF sensor
76 *
77 * \details Includes Update mode and frequency
78 *
79 * Parameter list:
80 *
81 * - ToFParamsConfigs#UpdateMode
82 * - ToFParamsConfigs#UpdateFrequency
83 *
84 */
86
87 /**
88 * \brief Configs that affect the ToF Proximity detection
89 *
90 * \details Includes proximity mode and the threshold for simple
91 * detection
92 *
93 * Parameter list:
94 *
95 * - ProximityParamsConfigs#ProximityThreshold
96 * - ProximityParamsConfigs#ProximityHysteresis
97 * - ProximityParamsConfigs#MinSignalStrengthForValidMeasurement
98 *
99 */
101
102 /**
103 * \brief Configs that affect the ToF Field of View
104 *
105 * \details Includes range and center configs
106 *
107 * Parameter list:
108 *
109 * - FovParamsConfigs#FOVCenterX
110 * - FovParamsConfigs#FOVCenterY
111 * - FovParamsConfigs#FOVRangeX
112 * - FovParamsConfigs#FOVRangeY
113 *
114 */
116
117 /**
118 * \brief Modifies this configuration's CustomParams parameter and returns itself for
119 * method-chaining and easier to use config API.
120 *
121 * Custom Params.
122 *
123 * \details Custom paramaters that have no real impact on controller.
124 *
125 * Parameter list:
126 *
127 * - CustomParamsConfigs#CustomParam0
128 * - CustomParamsConfigs#CustomParam1
129 *
130 *
131 * \param newCustomParams Parameter to modify
132 * \returns Itself
133 */
135 {
136 CustomParams = std::move(newCustomParams);
137 return *this;
138 }
139
140 /**
141 * \brief Modifies this configuration's ToFParams parameter and returns itself for
142 * method-chaining and easier to use config API.
143 *
144 * Configs that affect the ToF sensor
145 *
146 * \details Includes Update mode and frequency
147 *
148 * Parameter list:
149 *
150 * - ToFParamsConfigs#UpdateMode
151 * - ToFParamsConfigs#UpdateFrequency
152 *
153 *
154 * \param newToFParams Parameter to modify
155 * \returns Itself
156 */
158 {
159 ToFParams = std::move(newToFParams);
160 return *this;
161 }
162
163 /**
164 * \brief Modifies this configuration's ProximityParams parameter and returns itself for
165 * method-chaining and easier to use config API.
166 *
167 * Configs that affect the ToF Proximity detection
168 *
169 * \details Includes proximity mode and the threshold for simple
170 * detection
171 *
172 * Parameter list:
173 *
174 * - ProximityParamsConfigs#ProximityThreshold
175 * - ProximityParamsConfigs#ProximityHysteresis
176 * - ProximityParamsConfigs#MinSignalStrengthForValidMeasurement
177 *
178 *
179 * \param newProximityParams Parameter to modify
180 * \returns Itself
181 */
183 {
184 ProximityParams = std::move(newProximityParams);
185 return *this;
186 }
187
188 /**
189 * \brief Modifies this configuration's FovParams parameter and returns itself for
190 * method-chaining and easier to use config API.
191 *
192 * Configs that affect the ToF Field of View
193 *
194 * \details Includes range and center configs
195 *
196 * Parameter list:
197 *
198 * - FovParamsConfigs#FOVCenterX
199 * - FovParamsConfigs#FOVCenterY
200 * - FovParamsConfigs#FOVRangeX
201 * - FovParamsConfigs#FOVRangeY
202 *
203 *
204 * \param newFovParams Parameter to modify
205 * \returns Itself
206 */
208 {
209 FovParams = std::move(newFovParams);
210 return *this;
211 }
212
213 /**
214 * \brief Get the string representation of this configuration
215 */
216 std::string ToString() const override;
217
218 /**
219 * \brief Get the serialized form of this configuration
220 */
221 std::string Serialize() const final;
222 /**
223 * \brief Take a string and deserialize it to this configuration
224 */
225 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
226};
227
228/**
229 * Handles applying and refreshing configurations for the hardware#CANrange.
230 */
231class CANrangeConfigurator : public ParentConfigurator
232{
233private:
234 CANrangeConfigurator(hardware::DeviceIdentifier id) :
235 ParentConfigurator{std::move(id)}
236 {}
237
239
240public:
241 /**
242 * \brief Applies the contents of the specified config to the device.
243 *
244 * This will wait up to #DefaultTimeoutSeconds.
245 *
246 * \details Call to apply the selected configs.
247 *
248 * \param configs Configs to apply against.
249 * \returns Status code of applying the configs
250 */
255
256 /**
257 * \brief Applies the contents of the specified config to the device.
258 *
259 * \details Call to apply the selected configs.
260 *
261 * \param configs Configs to apply against.
262 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
263 * \returns Status code of applying the configs
264 */
265 ctre::phoenix::StatusCode Apply(const CANrangeConfiguration &configs, wpi::units::second_t timeoutSeconds)
266 {
267 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, configs.FutureProofConfigs, false);
268 }
269
270 /**
271 * \brief Applies the contents of the specified config to the device.
272 *
273 * This will wait up to #DefaultTimeoutSeconds.
274 *
275 * \details Call to apply the selected configs.
276 *
277 * \param configs Configs to apply against.
278 * \returns Status code of applying the configs
279 */
284
285 /**
286 * \brief Applies the contents of the specified config to the device.
287 *
288 * \details Call to apply the selected configs.
289 *
290 * \param configs Configs to apply against.
291 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
292 * \returns Status code of applying the configs
293 */
294 ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
295 {
296 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
297 }
298
299 /**
300 * \brief Applies the contents of the specified config to the device.
301 *
302 * This will wait up to #DefaultTimeoutSeconds.
303 *
304 * \details Call to apply the selected configs.
305 *
306 * \param configs Configs to apply against.
307 * \returns Status code of applying the configs
308 */
313
314 /**
315 * \brief Applies the contents of the specified config to the device.
316 *
317 * \details Call to apply the selected configs.
318 *
319 * \param configs Configs to apply against.
320 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
321 * \returns Status code of applying the configs
322 */
323 ctre::phoenix::StatusCode Apply(const ToFParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
324 {
325 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
326 }
327
328 /**
329 * \brief Applies the contents of the specified config to the device.
330 *
331 * This will wait up to #DefaultTimeoutSeconds.
332 *
333 * \details Call to apply the selected configs.
334 *
335 * \param configs Configs to apply against.
336 * \returns Status code of applying the configs
337 */
342
343 /**
344 * \brief Applies the contents of the specified config to the device.
345 *
346 * \details Call to apply the selected configs.
347 *
348 * \param configs Configs to apply against.
349 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
350 * \returns Status code of applying the configs
351 */
352 ctre::phoenix::StatusCode Apply(const ProximityParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
353 {
354 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
355 }
356
357 /**
358 * \brief Applies the contents of the specified config to the device.
359 *
360 * This will wait up to #DefaultTimeoutSeconds.
361 *
362 * \details Call to apply the selected configs.
363 *
364 * \param configs Configs to apply against.
365 * \returns Status code of applying the configs
366 */
371
372 /**
373 * \brief Applies the contents of the specified config to the device.
374 *
375 * \details Call to apply the selected configs.
376 *
377 * \param configs Configs to apply against.
378 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
379 * \returns Status code of applying the configs
380 */
381 ctre::phoenix::StatusCode Apply(const FovParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
382 {
383 return SetConfigsPrivate(configs.Serialize(), timeoutSeconds, false, false);
384 }
385
386 /**
387 * \brief Refreshes the values of the specified config group.
388 *
389 * This will wait up to #DefaultTimeoutSeconds.
390 *
391 * \details Call to refresh the selected configs from the device.
392 *
393 * \param configs The configs to refresh
394 * \returns Status code of refreshing the configs
395 */
400
401 /**
402 * \brief Refreshes the values of the specified config group.
403 *
404 * \details Call to refresh the selected configs from the device.
405 *
406 * \param configs The configs to refresh
407 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
408 * \returns Status code of refreshing the configs
409 */
410 ctre::phoenix::StatusCode Refresh(CANrangeConfiguration &configs, wpi::units::second_t timeoutSeconds) const
411 {
412 std::string ref;
413 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
414 configs.Deserialize(ref);
415 return ret;
416 }
417
418 /**
419 * \brief Refreshes the values of the specified config group.
420 *
421 * This will wait up to #DefaultTimeoutSeconds.
422 *
423 * \details Call to refresh the selected configs from the device.
424 *
425 * \param configs The configs to refresh
426 * \returns Status code of refreshing the configs
427 */
432 /**
433 * \brief Refreshes the values of the specified config group.
434 *
435 * \details Call to refresh the selected configs from the device.
436 *
437 * \param configs The configs to refresh
438 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
439 * \returns Status code of refreshing the configs
440 */
441 ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
442 {
443 std::string ref;
444 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
445 configs.Deserialize(ref);
446 return ret;
447 }
448
449 /**
450 * \brief Refreshes the values of the specified config group.
451 *
452 * This will wait up to #DefaultTimeoutSeconds.
453 *
454 * \details Call to refresh the selected configs from the device.
455 *
456 * \param configs The configs to refresh
457 * \returns Status code of refreshing the configs
458 */
463 /**
464 * \brief Refreshes the values of the specified config group.
465 *
466 * \details Call to refresh the selected configs from the device.
467 *
468 * \param configs The configs to refresh
469 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
470 * \returns Status code of refreshing the configs
471 */
472 ctre::phoenix::StatusCode Refresh(ToFParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
473 {
474 std::string ref;
475 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
476 configs.Deserialize(ref);
477 return ret;
478 }
479
480 /**
481 * \brief Refreshes the values of the specified config group.
482 *
483 * This will wait up to #DefaultTimeoutSeconds.
484 *
485 * \details Call to refresh the selected configs from the device.
486 *
487 * \param configs The configs to refresh
488 * \returns Status code of refreshing the configs
489 */
494 /**
495 * \brief Refreshes the values of the specified config group.
496 *
497 * \details Call to refresh the selected configs from the device.
498 *
499 * \param configs The configs to refresh
500 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
501 * \returns Status code of refreshing the configs
502 */
503 ctre::phoenix::StatusCode Refresh(ProximityParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
504 {
505 std::string ref;
506 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
507 configs.Deserialize(ref);
508 return ret;
509 }
510
511 /**
512 * \brief Refreshes the values of the specified config group.
513 *
514 * This will wait up to #DefaultTimeoutSeconds.
515 *
516 * \details Call to refresh the selected configs from the device.
517 *
518 * \param configs The configs to refresh
519 * \returns Status code of refreshing the configs
520 */
525 /**
526 * \brief Refreshes the values of the specified config group.
527 *
528 * \details Call to refresh the selected configs from the device.
529 *
530 * \param configs The configs to refresh
531 * \param timeoutSeconds Maximum amount of time to wait when performing configuration
532 * \returns Status code of refreshing the configs
533 */
534 ctre::phoenix::StatusCode Refresh(FovParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
535 {
536 std::string ref;
537 ctre::phoenix::StatusCode ret = GetConfigsPrivate(ref, timeoutSeconds);
538 configs.Deserialize(ref);
539 return ret;
540 }
541
542
543 /**
544 * \brief Clear the sticky faults in the device.
545 *
546 * \details This typically has no impact on the device functionality.
547 * Instead, it just clears telemetry faults that are accessible via
548 * API and Tuner Self-Test.
549 *
550 * This will wait up to #DefaultTimeoutSeconds.
551 *
552 * This is available in the configurator in case the user wants
553 * to initialize their device entirely without passing a device
554 * reference down to the code that performs the initialization.
555 * In this case, the user passes down the configurator object
556 * and performs all the initialization code on the object.
557 *
558 * \returns StatusCode of the set command
559 */
564 /**
565 * \brief Clear the sticky faults in the device.
566 *
567 * \details This typically has no impact on the device functionality.
568 * Instead, it just clears telemetry faults that are accessible via
569 * API and Tuner Self-Test.
570 *
571 * This is available in the configurator in case the user wants
572 * to initialize their device entirely without passing a device
573 * reference down to the code that performs the initialization.
574 * In this case, the user passes down the configurator object
575 * and performs all the initialization code on the object.
576 *
577 * \param timeoutSeconds Maximum time to wait up to in seconds.
578 * \returns StatusCode of the set command
579 */
580 ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds);
581
582 /**
583 * \brief Clear sticky fault: Hardware fault occurred
584 *
585 * This will wait up to #DefaultTimeoutSeconds.
586 *
587 * This is available in the configurator in case the user wants
588 * to initialize their device entirely without passing a device
589 * reference down to the code that performs the initialization.
590 * In this case, the user passes down the configurator object
591 * and performs all the initialization code on the object.
592 *
593 * \returns StatusCode of the set command
594 */
599 /**
600 * \brief Clear sticky fault: Hardware fault occurred
601 *
602 * This is available in the configurator in case the user wants
603 * to initialize their device entirely without passing a device
604 * reference down to the code that performs the initialization.
605 * In this case, the user passes down the configurator object
606 * and performs all the initialization code on the object.
607 *
608 * \param timeoutSeconds Maximum time to wait up to in seconds.
609 * \returns StatusCode of the set command
610 */
611 ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds);
612
613 /**
614 * \brief Clear sticky fault: Device supply voltage dropped to near
615 * brownout levels
616 *
617 * This will wait up to #DefaultTimeoutSeconds.
618 *
619 * This is available in the configurator in case the user wants
620 * to initialize their device entirely without passing a device
621 * reference down to the code that performs the initialization.
622 * In this case, the user passes down the configurator object
623 * and performs all the initialization code on the object.
624 *
625 * \returns StatusCode of the set command
626 */
631 /**
632 * \brief Clear sticky fault: Device supply voltage dropped to near
633 * brownout levels
634 *
635 * This is available in the configurator in case the user wants
636 * to initialize their device entirely without passing a device
637 * reference down to the code that performs the initialization.
638 * In this case, the user passes down the configurator object
639 * and performs all the initialization code on the object.
640 *
641 * \param timeoutSeconds Maximum time to wait up to in seconds.
642 * \returns StatusCode of the set command
643 */
644 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(wpi::units::second_t timeoutSeconds);
645
646 /**
647 * \brief Clear sticky fault: Device boot while detecting the enable
648 * signal
649 *
650 * This will wait up to #DefaultTimeoutSeconds.
651 *
652 * This is available in the configurator in case the user wants
653 * to initialize their device entirely without passing a device
654 * reference down to the code that performs the initialization.
655 * In this case, the user passes down the configurator object
656 * and performs all the initialization code on the object.
657 *
658 * \returns StatusCode of the set command
659 */
664 /**
665 * \brief Clear sticky fault: Device boot while detecting the enable
666 * signal
667 *
668 * This is available in the configurator in case the user wants
669 * to initialize their device entirely without passing a device
670 * reference down to the code that performs the initialization.
671 * In this case, the user passes down the configurator object
672 * and performs all the initialization code on the object.
673 *
674 * \param timeoutSeconds Maximum time to wait up to in seconds.
675 * \returns StatusCode of the set command
676 */
678
679 /**
680 * \brief Clear sticky fault: An unlicensed feature is in use, device
681 * may not behave as expected.
682 *
683 * This will wait up to #DefaultTimeoutSeconds.
684 *
685 * This is available in the configurator in case the user wants
686 * to initialize their device entirely without passing a device
687 * reference down to the code that performs the initialization.
688 * In this case, the user passes down the configurator object
689 * and performs all the initialization code on the object.
690 *
691 * \returns StatusCode of the set command
692 */
697 /**
698 * \brief Clear sticky fault: An unlicensed feature is in use, device
699 * may not behave as expected.
700 *
701 * This is available in the configurator in case the user wants
702 * to initialize their device entirely without passing a device
703 * reference down to the code that performs the initialization.
704 * In this case, the user passes down the configurator object
705 * and performs all the initialization code on the object.
706 *
707 * \param timeoutSeconds Maximum time to wait up to in seconds.
708 * \returns StatusCode of the set command
709 */
711};
712
713}
714
715namespace hardware {
716namespace core {
717
718#if defined(_WIN32) || defined(_WIN64)
719#pragma warning(push)
720#pragma warning(disable : 4250)
721#endif
722
723/**
724 * Class for CANrange, a CAN based Time of Flight (ToF) sensor that measures the
725 * distance to the front of the device.
726 */
728{
729private:
731
732public:
733 /**
734 * \brief The configuration class for this device.
735 */
737
738 /**
739 * Constructs a new CANrange object.
740 *
741 * \param deviceId ID of the device, as configured in Phoenix Tuner
742 * \param canbus The CAN bus this device is on
743 */
744 CoreCANrange(int deviceId, CANBus canbus);
745
746 /**
747 * \brief Constructs a stubbed-out CoreCANrange, where all status signals, controls,
748 * configs, etc. perform no action and immediately return OK. This can be used to
749 * silence error messages for devices that have been completely removed from the robot.
750 *
751 * \returns Stubbed-out CoreCANrange
752 */
754 {
755 return CoreCANrange{-1, CANBus{}};
756 }
757
758 /**
759 * \brief Gets the configurator for this CANrange. Users may use this to refresh
760 * and apply configs.
761 *
762 * \returns Configurator for this CANrange
763 */
765 {
766 return _configs;
767 }
768
769 /**
770 * \brief Gets the configurator for this CANrange
771 *
772 * \details Gets the configurator for this CANrange
773 *
774 * \returns Configurator for this CANrange
775 */
777 {
778 return _configs;
779 }
780
781
782private:
783 std::unique_ptr<sim::CANrangeSimState> _simState{};
784public:
785 /**
786 * \brief Get the simulation state for this device.
787 *
788 * \details This function reuses an allocated simulation
789 * state object, so it is safe to call this function multiple
790 * times in a robot loop.
791 *
792 * \returns Simulation state
793 */
795 {
796 if (_simState == nullptr)
797 _simState = std::make_unique<sim::CANrangeSimState>(*this);
798 return *_simState;
799 }
800
801
802
803 /**
804 * \brief App Major Version number.
805 *
806 * - Minimum Value: 0
807 * - Maximum Value: 255
808 * - Default Value: 0
809 * - Units:
810 *
811 * Default Rates:
812 * - CAN: 4.0 Hz
813 *
814 * This refreshes and returns a cached StatusSignal object.
815 *
816 * \param refresh Whether to refresh the StatusSignal before returning it;
817 * defaults to true
818 * \returns VersionMajor Status Signal Object
819 */
820 StatusSignal<int> &GetVersionMajor(bool refresh = true);
821
822 /**
823 * \brief App Minor Version number.
824 *
825 * - Minimum Value: 0
826 * - Maximum Value: 255
827 * - Default Value: 0
828 * - Units:
829 *
830 * Default Rates:
831 * - CAN: 4.0 Hz
832 *
833 * This refreshes and returns a cached StatusSignal object.
834 *
835 * \param refresh Whether to refresh the StatusSignal before returning it;
836 * defaults to true
837 * \returns VersionMinor Status Signal Object
838 */
839 StatusSignal<int> &GetVersionMinor(bool refresh = true);
840
841 /**
842 * \brief App Bugfix Version number.
843 *
844 * - Minimum Value: 0
845 * - Maximum Value: 255
846 * - Default Value: 0
847 * - Units:
848 *
849 * Default Rates:
850 * - CAN: 4.0 Hz
851 *
852 * This refreshes and returns a cached StatusSignal object.
853 *
854 * \param refresh Whether to refresh the StatusSignal before returning it;
855 * defaults to true
856 * \returns VersionBugfix Status Signal Object
857 */
858 StatusSignal<int> &GetVersionBugfix(bool refresh = true);
859
860 /**
861 * \brief App Build Version number.
862 *
863 * - Minimum Value: 0
864 * - Maximum Value: 255
865 * - Default Value: 0
866 * - Units:
867 *
868 * Default Rates:
869 * - CAN: 4.0 Hz
870 *
871 * This refreshes and returns a cached StatusSignal object.
872 *
873 * \param refresh Whether to refresh the StatusSignal before returning it;
874 * defaults to true
875 * \returns VersionBuild Status Signal Object
876 */
877 StatusSignal<int> &GetVersionBuild(bool refresh = true);
878
879 /**
880 * \brief Full Version of firmware in device. The format is a four
881 * byte value.
882 *
883 * - Minimum Value: 0
884 * - Maximum Value: 4294967295
885 * - Default Value: 0
886 * - Units:
887 *
888 * Default Rates:
889 * - CAN: 4.0 Hz
890 *
891 * This refreshes and returns a cached StatusSignal object.
892 *
893 * \param refresh Whether to refresh the StatusSignal before returning it;
894 * defaults to true
895 * \returns Version Status Signal Object
896 */
897 StatusSignal<int> &GetVersion(bool refresh = true);
898
899 /**
900 * \brief Integer representing all fault flags reported by the device.
901 *
902 * \details These are device specific and are not used directly in
903 * typical applications. Use the signal specific GetFault_*() methods
904 * instead.
905 *
906 * - Minimum Value: 0
907 * - Maximum Value: 4294967295
908 * - Default Value: 0
909 * - Units:
910 *
911 * Default Rates:
912 * - CAN: 4.0 Hz
913 *
914 * This refreshes and returns a cached StatusSignal object.
915 *
916 * \param refresh Whether to refresh the StatusSignal before returning it;
917 * defaults to true
918 * \returns FaultField Status Signal Object
919 */
920 StatusSignal<int> &GetFaultField(bool refresh = true);
921
922 /**
923 * \brief Integer representing all (persistent) sticky fault flags
924 * reported by the device.
925 *
926 * \details These are device specific and are not used directly in
927 * typical applications. Use the signal specific GetStickyFault_*()
928 * methods instead.
929 *
930 * - Minimum Value: 0
931 * - Maximum Value: 4294967295
932 * - Default Value: 0
933 * - Units:
934 *
935 * Default Rates:
936 * - CAN: 4.0 Hz
937 *
938 * This refreshes and returns a cached StatusSignal object.
939 *
940 * \param refresh Whether to refresh the StatusSignal before returning it;
941 * defaults to true
942 * \returns StickyFaultField Status Signal Object
943 */
945
946 /**
947 * \brief Whether the device is Phoenix Pro licensed.
948 *
949 * - Default Value: False
950 *
951 * Default Rates:
952 * - CAN: 4.0 Hz
953 *
954 * This refreshes and returns a cached StatusSignal object.
955 *
956 * \param refresh Whether to refresh the StatusSignal before returning it;
957 * defaults to true
958 * \returns IsProLicensed Status Signal Object
959 */
961
962 /**
963 * \brief Measured supply voltage to the CANrange.
964 *
965 * - Minimum Value: 4
966 * - Maximum Value: 16.75
967 * - Default Value: 4
968 * - Units: V
969 *
970 * Default Rates:
971 * - CAN 2.0: 100.0 Hz
972 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
973 *
974 * This refreshes and returns a cached StatusSignal object.
975 *
976 * \param refresh Whether to refresh the StatusSignal before returning it;
977 * defaults to true
978 * \returns SupplyVoltage Status Signal Object
979 */
981
982 /**
983 * \brief Distance to the nearest object in the configured field of
984 * view of the CANrange.
985 *
986 * - Minimum Value: 0.0
987 * - Maximum Value: 65.535
988 * - Default Value: 0
989 * - Units: m
990 *
991 * Default Rates:
992 * - CAN 2.0: 100.0 Hz
993 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
994 *
995 * This refreshes and returns a cached StatusSignal object.
996 *
997 * \param refresh Whether to refresh the StatusSignal before returning it;
998 * defaults to true
999 * \returns Distance Status Signal Object
1000 */
1002
1003 /**
1004 * \brief Timestamp of the most recent measurements. This is not
1005 * synchronized to any other clock source.
1006 *
1007 * Users can use this to check when the measurements are updated.
1008 *
1009 * - Minimum Value: 0.0
1010 * - Maximum Value: 65.535
1011 * - Default Value: 0
1012 * - Units: s
1013 *
1014 * Default Rates:
1015 * - CAN 2.0: 100.0 Hz
1016 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1017 *
1018 * This refreshes and returns a cached StatusSignal object.
1019 *
1020 * \param refresh Whether to refresh the StatusSignal before returning it;
1021 * defaults to true
1022 * \returns MeasurementTime Status Signal Object
1023 */
1025
1026 /**
1027 * \brief Approximate signal strength of the measurement. A higher
1028 * value indicates a higher strength of signal.
1029 *
1030 * A value of ~2500 is typical when detecting an object under
1031 * short-range conditions.
1032 *
1033 * - Minimum Value: 0
1034 * - Maximum Value: 65535
1035 * - Default Value: 0
1036 * - Units:
1037 *
1038 * Default Rates:
1039 * - CAN 2.0: 100.0 Hz
1040 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1041 *
1042 * This refreshes and returns a cached StatusSignal object.
1043 *
1044 * \param refresh Whether to refresh the StatusSignal before returning it;
1045 * defaults to true
1046 * \returns SignalStrength Status Signal Object
1047 */
1049
1050 /**
1051 * \brief Whether the CANrange detects an object using the configured
1052 * proximity parameters.
1053 *
1054 * - Default Value: 0
1055 *
1056 * Default Rates:
1057 * - CAN 2.0: 100.0 Hz
1058 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1059 *
1060 * This refreshes and returns a cached StatusSignal object.
1061 *
1062 * \param refresh Whether to refresh the StatusSignal before returning it;
1063 * defaults to true
1064 * \returns IsDetected Status Signal Object
1065 */
1066 StatusSignal<bool> &GetIsDetected(bool refresh = true);
1067
1068 /**
1069 * \brief Health of the distance measurement.
1070 *
1071 * - Default Value: signals#MeasurementHealthValue#Good
1072 *
1073 * Default Rates:
1074 * - CAN 2.0: 100.0 Hz
1075 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1076 *
1077 * This refreshes and returns a cached StatusSignal object.
1078 *
1079 * \param refresh Whether to refresh the StatusSignal before returning it;
1080 * defaults to true
1081 * \returns MeasurementHealth Status Signal Object
1082 */
1084
1085 /**
1086 * \brief The amount of ambient infrared light that the sensor is
1087 * detecting. For ideal operation, this should be as low as possible.
1088 *
1089 * \details Short-range mode reduces the influence of ambient infrared
1090 * light.
1091 *
1092 * - Minimum Value: 0
1093 * - Maximum Value: 65535
1094 * - Default Value: 0
1095 * - Units:
1096 *
1097 * Default Rates:
1098 * - CAN 2.0: 20.0 Hz
1099 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1100 *
1101 * This refreshes and returns a cached StatusSignal object.
1102 *
1103 * \param refresh Whether to refresh the StatusSignal before returning it;
1104 * defaults to true
1105 * \returns AmbientSignal Status Signal Object
1106 */
1108
1109 /**
1110 * \brief Standard Deviation of the distance measurement.
1111 *
1112 * - Minimum Value: 0.0
1113 * - Maximum Value: 1.3107000000000002
1114 * - Default Value: 0
1115 * - Units: m
1116 *
1117 * Default Rates:
1118 * - CAN 2.0: 20.0 Hz
1119 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1120 *
1121 * This refreshes and returns a cached StatusSignal object.
1122 *
1123 * \param refresh Whether to refresh the StatusSignal before returning it;
1124 * defaults to true
1125 * \returns DistanceStdDev Status Signal Object
1126 */
1128
1129 /**
1130 * \brief The actual center of the FOV in the X direction. This takes
1131 * into account the user-configured FOVCenterX and FOVRangeX.
1132 *
1133 * - Minimum Value: -16.0
1134 * - Maximum Value: 15.875
1135 * - Default Value: 0
1136 * - Units: deg
1137 *
1138 * Default Rates:
1139 * - CAN 2.0: 4.0 Hz
1140 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1141 *
1142 * This refreshes and returns a cached StatusSignal object.
1143 *
1144 * \param refresh Whether to refresh the StatusSignal before returning it;
1145 * defaults to true
1146 * \returns RealFOVCenterX Status Signal Object
1147 */
1149
1150 /**
1151 * \brief The actual center of the FOV in the Y direction. This takes
1152 * into account the user-configured FOVCenterY and FOVRangeY.
1153 *
1154 * - Minimum Value: -16.0
1155 * - Maximum Value: 15.875
1156 * - Default Value: 0
1157 * - Units: deg
1158 *
1159 * Default Rates:
1160 * - CAN 2.0: 4.0 Hz
1161 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1162 *
1163 * This refreshes and returns a cached StatusSignal object.
1164 *
1165 * \param refresh Whether to refresh the StatusSignal before returning it;
1166 * defaults to true
1167 * \returns RealFOVCenterY Status Signal Object
1168 */
1170
1171 /**
1172 * \brief The actual range of the FOV in the X direction. This takes
1173 * into account the user-configured FOVRangeX.
1174 *
1175 * - Minimum Value: 0.0
1176 * - Maximum Value: 31.875
1177 * - Default Value: 0
1178 * - Units: deg
1179 *
1180 * Default Rates:
1181 * - CAN 2.0: 4.0 Hz
1182 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1183 *
1184 * This refreshes and returns a cached StatusSignal object.
1185 *
1186 * \param refresh Whether to refresh the StatusSignal before returning it;
1187 * defaults to true
1188 * \returns RealFOVRangeX Status Signal Object
1189 */
1191
1192 /**
1193 * \brief The actual range of the FOV in the Y direction. This takes
1194 * into account the user-configured FOVRangeY.
1195 *
1196 * - Minimum Value: 0.0
1197 * - Maximum Value: 31.875
1198 * - Default Value: 0
1199 * - Units: deg
1200 *
1201 * Default Rates:
1202 * - CAN 2.0: 4.0 Hz
1203 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1204 *
1205 * This refreshes and returns a cached StatusSignal object.
1206 *
1207 * \param refresh Whether to refresh the StatusSignal before returning it;
1208 * defaults to true
1209 * \returns RealFOVRangeY Status Signal Object
1210 */
1212
1213 /**
1214 * \brief Hardware fault occurred
1215 *
1216 * - Default Value: False
1217 *
1218 * Default Rates:
1219 * - CAN: 4.0 Hz
1220 *
1221 * This refreshes and returns a cached StatusSignal object.
1222 *
1223 * \param refresh Whether to refresh the StatusSignal before returning it;
1224 * defaults to true
1225 * \returns Fault_Hardware Status Signal Object
1226 */
1228
1229 /**
1230 * \brief Hardware fault occurred
1231 *
1232 * - Default Value: False
1233 *
1234 * Default Rates:
1235 * - CAN: 4.0 Hz
1236 *
1237 * This refreshes and returns a cached StatusSignal object.
1238 *
1239 * \param refresh Whether to refresh the StatusSignal before returning it;
1240 * defaults to true
1241 * \returns StickyFault_Hardware Status Signal Object
1242 */
1244
1245 /**
1246 * \brief Device supply voltage dropped to near brownout levels
1247 *
1248 * - Default Value: False
1249 *
1250 * Default Rates:
1251 * - CAN: 4.0 Hz
1252 *
1253 * This refreshes and returns a cached StatusSignal object.
1254 *
1255 * \param refresh Whether to refresh the StatusSignal before returning it;
1256 * defaults to true
1257 * \returns Fault_Undervoltage Status Signal Object
1258 */
1260
1261 /**
1262 * \brief Device supply voltage dropped to near brownout levels
1263 *
1264 * - Default Value: False
1265 *
1266 * Default Rates:
1267 * - CAN: 4.0 Hz
1268 *
1269 * This refreshes and returns a cached StatusSignal object.
1270 *
1271 * \param refresh Whether to refresh the StatusSignal before returning it;
1272 * defaults to true
1273 * \returns StickyFault_Undervoltage Status Signal Object
1274 */
1276
1277 /**
1278 * \brief Device boot while detecting the enable signal
1279 *
1280 * - Default Value: False
1281 *
1282 * Default Rates:
1283 * - CAN: 4.0 Hz
1284 *
1285 * This refreshes and returns a cached StatusSignal object.
1286 *
1287 * \param refresh Whether to refresh the StatusSignal before returning it;
1288 * defaults to true
1289 * \returns Fault_BootDuringEnable Status Signal Object
1290 */
1292
1293 /**
1294 * \brief Device boot while detecting the enable signal
1295 *
1296 * - Default Value: False
1297 *
1298 * Default Rates:
1299 * - CAN: 4.0 Hz
1300 *
1301 * This refreshes and returns a cached StatusSignal object.
1302 *
1303 * \param refresh Whether to refresh the StatusSignal before returning it;
1304 * defaults to true
1305 * \returns StickyFault_BootDuringEnable Status Signal Object
1306 */
1308
1309 /**
1310 * \brief An unlicensed feature is in use, device may not behave as
1311 * expected.
1312 *
1313 * - Default Value: False
1314 *
1315 * Default Rates:
1316 * - CAN: 4.0 Hz
1317 *
1318 * This refreshes and returns a cached StatusSignal object.
1319 *
1320 * \param refresh Whether to refresh the StatusSignal before returning it;
1321 * defaults to true
1322 * \returns Fault_UnlicensedFeatureInUse Status Signal Object
1323 */
1325
1326 /**
1327 * \brief An unlicensed feature is in use, device may not behave as
1328 * expected.
1329 *
1330 * - Default Value: False
1331 *
1332 * Default Rates:
1333 * - CAN: 4.0 Hz
1334 *
1335 * This refreshes and returns a cached StatusSignal object.
1336 *
1337 * \param refresh Whether to refresh the StatusSignal before returning it;
1338 * defaults to true
1339 * \returns StickyFault_UnlicensedFeatureInUse Status Signal Object
1340 */
1342
1343
1344
1345
1346 /**
1347 * \brief Clear the sticky faults in the device.
1348 *
1349 * \details This typically has no impact on the device functionality.
1350 * Instead, it just clears telemetry faults that are accessible via
1351 * API and Tuner Self-Test.
1352 *
1353 * \param timeoutSeconds Maximum time to wait up to in seconds.
1354 * \returns StatusCode of the set command
1355 */
1356 ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds)
1357 {
1358 return GetConfigurator().ClearStickyFaults(timeoutSeconds);
1359 }
1360 /**
1361 * \brief Clear the sticky faults in the device.
1362 *
1363 * \details This typically has no impact on the device functionality.
1364 * Instead, it just clears telemetry faults that are accessible via
1365 * API and Tuner Self-Test.
1366 *
1367 * This will wait up to 0.100 seconds (100ms) by default.
1368 *
1369 * \returns StatusCode of the set command
1370 */
1375
1376 /**
1377 * \brief Clear sticky fault: Hardware fault occurred
1378 *
1379 * \param timeoutSeconds Maximum time to wait up to in seconds.
1380 * \returns StatusCode of the set command
1381 */
1382 ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds)
1383 {
1384 return GetConfigurator().ClearStickyFault_Hardware(timeoutSeconds);
1385 }
1386 /**
1387 * \brief Clear sticky fault: Hardware fault occurred
1388 *
1389 * This will wait up to 0.100 seconds (100ms) by default.
1390 *
1391 * \returns StatusCode of the set command
1392 */
1397
1398 /**
1399 * \brief Clear sticky fault: Device supply voltage dropped to near
1400 * brownout levels
1401 *
1402 * \param timeoutSeconds Maximum time to wait up to in seconds.
1403 * \returns StatusCode of the set command
1404 */
1406 {
1407 return GetConfigurator().ClearStickyFault_Undervoltage(timeoutSeconds);
1408 }
1409 /**
1410 * \brief Clear sticky fault: Device supply voltage dropped to near
1411 * brownout levels
1412 *
1413 * This will wait up to 0.100 seconds (100ms) by default.
1414 *
1415 * \returns StatusCode of the set command
1416 */
1421
1422 /**
1423 * \brief Clear sticky fault: Device boot while detecting the enable
1424 * signal
1425 *
1426 * \param timeoutSeconds Maximum time to wait up to in seconds.
1427 * \returns StatusCode of the set command
1428 */
1430 {
1431 return GetConfigurator().ClearStickyFault_BootDuringEnable(timeoutSeconds);
1432 }
1433 /**
1434 * \brief Clear sticky fault: Device boot while detecting the enable
1435 * signal
1436 *
1437 * This will wait up to 0.100 seconds (100ms) by default.
1438 *
1439 * \returns StatusCode of the set command
1440 */
1445
1446 /**
1447 * \brief Clear sticky fault: An unlicensed feature is in use, device
1448 * may not behave as expected.
1449 *
1450 * \param timeoutSeconds Maximum time to wait up to in seconds.
1451 * \returns StatusCode of the set command
1452 */
1454 {
1455 return GetConfigurator().ClearStickyFault_UnlicensedFeatureInUse(timeoutSeconds);
1456 }
1457 /**
1458 * \brief Clear sticky fault: An unlicensed feature is in use, device
1459 * may not behave as expected.
1460 *
1461 * This will wait up to 0.100 seconds (100ms) by default.
1462 *
1463 * \returns StatusCode of the set command
1464 */
1469
1470 void RegisterAlerts(AlertableCollection &collection) override;
1471};
1472
1473#if defined(_WIN32) || defined(_WIN64)
1474#pragma warning(pop)
1475#endif
1476
1477}
1478}
1479
1480}
1481}
1482
Collection of objects that can report alerts.
Definition Alertable.hpp:109
Class for getting information about an available CAN bus.
Definition CANBus.hpp:142
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:523
All configurations for the hardware::CANrange.
Definition CoreCANrange.hpp:41
ToFParamsConfigs ToFParams
Configs that affect the ToF sensor.
Definition CoreCANrange.hpp:85
constexpr CANrangeConfiguration & WithFovParams(FovParamsConfigs newFovParams)
Modifies this configuration's FovParams parameter and returns itself for method-chaining and easier t...
Definition CoreCANrange.hpp:207
bool FutureProofConfigs
True if we should factory default newer unsupported configs, false to leave newer unsupported configs...
Definition CoreCANrange.hpp:58
ProximityParamsConfigs ProximityParams
Configs that affect the ToF Proximity detection.
Definition CoreCANrange.hpp:100
std::string Serialize() const final
Get the serialized form of this configuration.
std::string ToString() const override
Get the string representation of this configuration.
FovParamsConfigs FovParams
Configs that affect the ToF Field of View.
Definition CoreCANrange.hpp:115
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Take a string and deserialize it to this configuration.
CustomParamsConfigs CustomParams
Custom Params.
Definition CoreCANrange.hpp:72
constexpr CANrangeConfiguration & WithCustomParams(CustomParamsConfigs newCustomParams)
Modifies this configuration's CustomParams parameter and returns itself for method-chaining and easie...
Definition CoreCANrange.hpp:134
constexpr CANrangeConfiguration & WithToFParams(ToFParamsConfigs newToFParams)
Modifies this configuration's ToFParams parameter and returns itself for method-chaining and easier t...
Definition CoreCANrange.hpp:157
constexpr CANrangeConfiguration & WithProximityParams(ProximityParamsConfigs newProximityParams)
Modifies this configuration's ProximityParams parameter and returns itself for method-chaining and ea...
Definition CoreCANrange.hpp:182
Handles applying and refreshing configurations for the hardware::CANrange.
Definition CoreCANrange.hpp:232
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:280
ctre::phoenix::StatusCode Apply(const ToFParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:309
ctre::phoenix::StatusCode Apply(const ProximityParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:352
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANrange.hpp:560
ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds)
Clear the sticky faults in the device.
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:294
ctre::phoenix::StatusCode Refresh(ProximityParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:503
ctre::phoenix::StatusCode Apply(const CANrangeConfiguration &configs)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:251
ctre::phoenix::StatusCode Refresh(ToFParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:472
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANrange.hpp:595
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:441
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode Refresh(CANrangeConfiguration &configs) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:396
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANrange.hpp:660
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(wpi::units::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
ctre::phoenix::StatusCode Refresh(ToFParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:459
ctre::phoenix::StatusCode Refresh(FovParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:521
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:428
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANrange.hpp:693
ctre::phoenix::StatusCode Refresh(FovParamsConfigs &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:534
ctre::phoenix::StatusCode Apply(const FovParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:367
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
ctre::phoenix::StatusCode Refresh(CANrangeConfiguration &configs, wpi::units::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:410
ctre::phoenix::StatusCode Refresh(ProximityParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:490
ctre::phoenix::StatusCode Apply(const CANrangeConfiguration &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:265
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANrange.hpp:627
ctre::phoenix::StatusCode Apply(const ProximityParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:338
ctre::phoenix::StatusCode Apply(const ToFParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:323
ctre::phoenix::StatusCode Apply(const FovParamsConfigs &configs, wpi::units::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:381
Custom Params.
Definition CustomParamsConfigs.hpp:23
Configs that affect the ToF Field of View.
Definition FovParamsConfigs.hpp:23
Common interface for all configuration objects.
Definition Configuration.hpp:20
ctre::phoenix::StatusCode SetConfigsPrivate(std::string_view serializedString, wpi::units::second_t timeoutSeconds, bool futureProofConfigs, bool overrideIfDuplicate)
wpi::units::second_t DefaultTimeoutSeconds
The default maximum amount of time to wait for a config.
Definition Configurator.hpp:27
ParentConfigurator(hardware::DeviceIdentifier deviceIdentifier)
ctre::phoenix::StatusCode GetConfigsPrivate(std::string &serializedString, wpi::units::second_t timeoutSeconds) const
Configs that affect the ToF Proximity detection.
Definition ProximityParamsConfigs.hpp:25
Configs that affect the ToF sensor.
Definition ToFParamsConfigs.hpp:24
The unique identifier for a device.
Definition DeviceIdentifier.hpp:19
ParentDevice(int deviceID, std::string model, CANBus canbus)
Class for CANrange, a CAN based Time of Flight (ToF) sensor that measures the distance to the front o...
Definition CoreCANrange.hpp:728
StatusSignal< wpi::units::meter_t > & GetDistanceStdDev(bool refresh=true)
Standard Deviation of the distance measurement.
StatusSignal< bool > & GetStickyFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
StatusSignal< wpi::units::degree_t > & GetRealFOVRangeX(bool refresh=true)
The actual range of the FOV in the X direction.
StatusSignal< int > & GetVersionMajor(bool refresh=true)
App Major Version number.
configs::CANrangeConfiguration Configuration
The configuration class for this device.
Definition CoreCANrange.hpp:736
static CoreCANrange None()
Constructs a stubbed-out CoreCANrange, where all status signals, controls, configs,...
Definition CoreCANrange.hpp:753
StatusSignal< bool > & GetFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
StatusSignal< int > & GetVersionBuild(bool refresh=true)
App Build Version number.
StatusSignal< bool > & GetFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANrange.hpp:1429
StatusSignal< wpi::units::degree_t > & GetRealFOVRangeY(bool refresh=true)
The actual range of the FOV in the Y direction.
StatusSignal< bool > & GetFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
StatusSignal< wpi::units::meter_t > & GetDistance(bool refresh=true)
Distance to the nearest object in the configured field of view of the CANrange.
sim::CANrangeSimState & GetSimState()
Get the simulation state for this device.
Definition CoreCANrange.hpp:794
StatusSignal< bool > & GetFault_Hardware(bool refresh=true)
Hardware fault occurred.
StatusSignal< wpi::units::degree_t > & GetRealFOVCenterX(bool refresh=true)
The actual center of the FOV in the X direction.
StatusSignal< bool > & GetStickyFault_UnlicensedFeatureInUse(bool refresh=true)
An unlicensed feature is in use, device may not behave as expected.
StatusSignal< int > & GetVersionBugfix(bool refresh=true)
App Bugfix Version number.
StatusSignal< wpi::units::volt_t > & GetSupplyVoltage(bool refresh=true)
Measured supply voltage to the CANrange.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANrange.hpp:1465
StatusSignal< wpi::units::scalar_t > & GetAmbientSignal(bool refresh=true)
The amount of ambient infrared light that the sensor is detecting.
StatusSignal< bool > & GetIsDetected(bool refresh=true)
Whether the CANrange detects an object using the configured proximity parameters.
StatusSignal< int > & GetFaultField(bool refresh=true)
Integer representing all fault flags reported by the device.
StatusSignal< bool > & GetStickyFault_Hardware(bool refresh=true)
Hardware fault occurred.
StatusSignal< bool > & GetIsProLicensed(bool refresh=true)
Whether the device is Phoenix Pro licensed.
ctre::phoenix::StatusCode ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANrange.hpp:1371
ctre::phoenix::StatusCode ClearStickyFaults(wpi::units::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition CoreCANrange.hpp:1356
void RegisterAlerts(AlertableCollection &collection) override
Registers all alerts for this type to the provided collection.
StatusSignal< bool > & GetStickyFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
StatusSignal< int > & GetStickyFaultField(bool refresh=true)
Integer representing all (persistent) sticky fault flags reported by the device.
StatusSignal< signals::MeasurementHealthValue > & GetMeasurementHealth(bool refresh=true)
Health of the distance measurement.
StatusSignal< int > & GetVersion(bool refresh=true)
Full Version of firmware in device.
CoreCANrange(int deviceId, CANBus canbus)
Constructs a new CANrange object.
StatusSignal< wpi::units::second_t > & GetMeasurementTime(bool refresh=true)
Timestamp of the most recent measurements.
configs::CANrangeConfigurator const & GetConfigurator() const
Gets the configurator for this CANrange.
Definition CoreCANrange.hpp:776
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(wpi::units::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANrange.hpp:1453
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANrange.hpp:1405
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANrange.hpp:1441
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANrange.hpp:1393
StatusSignal< wpi::units::degree_t > & GetRealFOVCenterY(bool refresh=true)
The actual center of the FOV in the Y direction.
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANrange.hpp:1417
StatusSignal< wpi::units::scalar_t > & GetSignalStrength(bool refresh=true)
Approximate signal strength of the measurement.
StatusSignal< int > & GetVersionMinor(bool refresh=true)
App Minor Version number.
configs::CANrangeConfigurator & GetConfigurator()
Gets the configurator for this CANrange.
Definition CoreCANrange.hpp:764
ctre::phoenix::StatusCode ClearStickyFault_Hardware(wpi::units::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
Definition CoreCANrange.hpp:1382
Class to control the state of a simulated hardware::CANrange.
Definition CANrangeSimState.hpp:30
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
Definition ExternalFeedbackConfigs.hpp:21
Definition ExternalFeedbackConfigs.hpp:17
Definition ExternalFeedbackConfigs.hpp:17
Definition ExternalFeedbackConfigs.hpp:16
Definition StatusCodes.h:22
Definition motor_constants.h:14