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