CTRE Phoenix 6 C++ 26.3.0
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 <units/angle.h>
21#include <units/dimensionless.h>
22#include <units/length.h>
23#include <units/time.h>
24#include <units/voltage.h>
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 */
238{
239private:
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 */
258 {
259 return Apply(configs, DefaultTimeoutSeconds);
260 }
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, units::time::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 */
287 {
288 return Apply(configs, DefaultTimeoutSeconds);
289 }
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, units::time::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 */
316 {
317 return Apply(configs, DefaultTimeoutSeconds);
318 }
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, units::time::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 */
345 {
346 return Apply(configs, DefaultTimeoutSeconds);
347 }
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, units::time::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 */
374 {
375 return Apply(configs, DefaultTimeoutSeconds);
376 }
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, units::time::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 */
403 {
404 return Refresh(configs, DefaultTimeoutSeconds);
405 }
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, units::time::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 */
435 {
436 return Refresh(configs, DefaultTimeoutSeconds);
437 }
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, units::time::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 */
466 {
467 return Refresh(configs, DefaultTimeoutSeconds);
468 }
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, units::time::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 */
497 {
498 return Refresh(configs, DefaultTimeoutSeconds);
499 }
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, units::time::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 */
528 {
529 return Refresh(configs, DefaultTimeoutSeconds);
530 }
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, units::time::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 */
567 {
568 return ClearStickyFaults(DefaultTimeoutSeconds);
569 }
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(units::time::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 */
602 {
603 return ClearStickyFault_Hardware(DefaultTimeoutSeconds);
604 }
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(units::time::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 */
634 {
635 return ClearStickyFault_Undervoltage(DefaultTimeoutSeconds);
636 }
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(units::time::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 */
667 {
668 return ClearStickyFault_BootDuringEnable(DefaultTimeoutSeconds);
669 }
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 */
700 {
701 return ClearStickyFault_UnlicensedFeatureInUse(DefaultTimeoutSeconds);
702 }
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 * Constructs a new CANrange object.
754 *
755 * \param deviceId ID of the device, as configured in Phoenix Tuner
756 * \param canbus Name of the CAN bus this device is on. Possible CAN bus strings are:
757 * - "rio" for the native roboRIO CAN bus
758 * - CANivore name or serial number
759 * - SocketCAN interface (non-FRC Linux only)
760 * - "*" for any CANivore seen by the program
761 * - empty string (default) to select the default for the system:
762 * - "rio" on roboRIO
763 * - "can0" on Linux
764 * - "*" on Windows
765 *
766 * \deprecated Constructing devices with a CAN bus string is deprecated for removal
767 * in the 2027 season. Construct devices using a CANBus instance instead.
768 */
769 CoreCANrange(int deviceId, std::string canbus);
770
771 /**
772 * \brief Constructs a stubbed-out CoreCANrange, where all status signals, controls,
773 * configs, etc. perform no action and immediately return OK. This can be used to
774 * silence error messages for devices that have been completely removed from the robot.
775 *
776 * \returns Stubbed-out CoreCANrange
777 */
779 {
780 return CoreCANrange{-1, CANBus{}};
781 }
782
783 /**
784 * \brief Gets the configurator for this CANrange
785 *
786 * \details Gets the configurator for this CANrange
787 *
788 * \returns Configurator for this CANrange
789 */
791 {
792 return _configs;
793 }
794
795 /**
796 * \brief Gets the configurator for this CANrange
797 *
798 * \details Gets the configurator for this CANrange
799 *
800 * \returns Configurator for this CANrange
801 */
803 {
804 return _configs;
805 }
806
807
808private:
809 std::unique_ptr<sim::CANrangeSimState> _simState{};
810public:
811 /**
812 * \brief Get the simulation state for this device.
813 *
814 * \details This function reuses an allocated simulation
815 * state object, so it is safe to call this function multiple
816 * times in a robot loop.
817 *
818 * \returns Simulation state
819 */
821 {
822 if (_simState == nullptr)
823 _simState = std::make_unique<sim::CANrangeSimState>(*this);
824 return *_simState;
825 }
826
827
828
829 /**
830 * \brief App Major 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 VersionMajor Status Signal Object
845 */
846 StatusSignal<int> &GetVersionMajor(bool refresh = true);
847
848 /**
849 * \brief App Minor 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 VersionMinor Status Signal Object
864 */
865 StatusSignal<int> &GetVersionMinor(bool refresh = true);
866
867 /**
868 * \brief App Bugfix 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 VersionBugfix Status Signal Object
883 */
884 StatusSignal<int> &GetVersionBugfix(bool refresh = true);
885
886 /**
887 * \brief App Build Version number.
888 *
889 * - Minimum Value: 0
890 * - Maximum Value: 255
891 * - Default Value: 0
892 * - Units:
893 *
894 * Default Rates:
895 * - CAN: 4.0 Hz
896 *
897 * This refreshes and returns a cached StatusSignal object.
898 *
899 * \param refresh Whether to refresh the StatusSignal before returning it;
900 * defaults to true
901 * \returns VersionBuild Status Signal Object
902 */
903 StatusSignal<int> &GetVersionBuild(bool refresh = true);
904
905 /**
906 * \brief Full Version of firmware in device. The format is a four
907 * byte value.
908 *
909 * - Minimum Value: 0
910 * - Maximum Value: 4294967295
911 * - Default Value: 0
912 * - Units:
913 *
914 * Default Rates:
915 * - CAN: 4.0 Hz
916 *
917 * This refreshes and returns a cached StatusSignal object.
918 *
919 * \param refresh Whether to refresh the StatusSignal before returning it;
920 * defaults to true
921 * \returns Version Status Signal Object
922 */
923 StatusSignal<int> &GetVersion(bool refresh = true);
924
925 /**
926 * \brief Integer representing all fault flags reported by the device.
927 *
928 * \details These are device specific and are not used directly in
929 * typical applications. Use the signal specific GetFault_*() methods
930 * instead.
931 *
932 * - Minimum Value: 0
933 * - Maximum Value: 4294967295
934 * - Default Value: 0
935 * - Units:
936 *
937 * Default Rates:
938 * - CAN: 4.0 Hz
939 *
940 * This refreshes and returns a cached StatusSignal object.
941 *
942 * \param refresh Whether to refresh the StatusSignal before returning it;
943 * defaults to true
944 * \returns FaultField Status Signal Object
945 */
946 StatusSignal<int> &GetFaultField(bool refresh = true);
947
948 /**
949 * \brief Integer representing all (persistent) sticky fault flags
950 * reported by the device.
951 *
952 * \details These are device specific and are not used directly in
953 * typical applications. Use the signal specific GetStickyFault_*()
954 * methods instead.
955 *
956 * - Minimum Value: 0
957 * - Maximum Value: 4294967295
958 * - Default Value: 0
959 * - Units:
960 *
961 * Default Rates:
962 * - CAN: 4.0 Hz
963 *
964 * This refreshes and returns a cached StatusSignal object.
965 *
966 * \param refresh Whether to refresh the StatusSignal before returning it;
967 * defaults to true
968 * \returns StickyFaultField Status Signal Object
969 */
971
972 /**
973 * \brief Whether the device is Phoenix Pro licensed.
974 *
975 * - Default Value: False
976 *
977 * Default Rates:
978 * - CAN: 4.0 Hz
979 *
980 * This refreshes and returns a cached StatusSignal object.
981 *
982 * \param refresh Whether to refresh the StatusSignal before returning it;
983 * defaults to true
984 * \returns IsProLicensed Status Signal Object
985 */
987
988 /**
989 * \brief Measured supply voltage to the CANrange.
990 *
991 * - Minimum Value: 4
992 * - Maximum Value: 16.75
993 * - Default Value: 4
994 * - Units: V
995 *
996 * Default Rates:
997 * - CAN 2.0: 100.0 Hz
998 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
999 *
1000 * This refreshes and returns a cached StatusSignal object.
1001 *
1002 * \param refresh Whether to refresh the StatusSignal before returning it;
1003 * defaults to true
1004 * \returns SupplyVoltage Status Signal Object
1005 */
1007
1008 /**
1009 * \brief Distance to the nearest object in the configured field of
1010 * view of the CANrange.
1011 *
1012 * - Minimum Value: 0.0
1013 * - Maximum Value: 65.535
1014 * - Default Value: 0
1015 * - Units: m
1016 *
1017 * Default Rates:
1018 * - CAN 2.0: 100.0 Hz
1019 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1020 *
1021 * This refreshes and returns a cached StatusSignal object.
1022 *
1023 * \param refresh Whether to refresh the StatusSignal before returning it;
1024 * defaults to true
1025 * \returns Distance Status Signal Object
1026 */
1028
1029 /**
1030 * \brief Timestamp of the most recent measurements. This is not
1031 * synchronized to any other clock source.
1032 *
1033 * Users can use this to check when the measurements are updated.
1034 *
1035 * - Minimum Value: 0.0
1036 * - Maximum Value: 65.535
1037 * - Default Value: 0
1038 * - Units: s
1039 *
1040 * Default Rates:
1041 * - CAN 2.0: 100.0 Hz
1042 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1043 *
1044 * This refreshes and returns a cached StatusSignal object.
1045 *
1046 * \param refresh Whether to refresh the StatusSignal before returning it;
1047 * defaults to true
1048 * \returns MeasurementTime Status Signal Object
1049 */
1051
1052 /**
1053 * \brief Approximate signal strength of the measurement. A higher
1054 * value indicates a higher strength of signal.
1055 *
1056 * A value of ~2500 is typical when detecting an object under
1057 * short-range conditions.
1058 *
1059 * - Minimum Value: 0
1060 * - Maximum Value: 65535
1061 * - Default Value: 0
1062 * - Units:
1063 *
1064 * Default Rates:
1065 * - CAN 2.0: 100.0 Hz
1066 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1067 *
1068 * This refreshes and returns a cached StatusSignal object.
1069 *
1070 * \param refresh Whether to refresh the StatusSignal before returning it;
1071 * defaults to true
1072 * \returns SignalStrength Status Signal Object
1073 */
1075
1076 /**
1077 * \brief Whether the CANrange detects an object using the configured
1078 * proximity parameters.
1079 *
1080 * - Default Value: 0
1081 *
1082 * Default Rates:
1083 * - CAN 2.0: 100.0 Hz
1084 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1085 *
1086 * This refreshes and returns a cached StatusSignal object.
1087 *
1088 * \param refresh Whether to refresh the StatusSignal before returning it;
1089 * defaults to true
1090 * \returns IsDetected Status Signal Object
1091 */
1092 StatusSignal<bool> &GetIsDetected(bool refresh = true);
1093
1094 /**
1095 * \brief Health of the distance measurement.
1096 *
1097 *
1098 * Default Rates:
1099 * - CAN 2.0: 100.0 Hz
1100 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1101 *
1102 * This refreshes and returns a cached StatusSignal object.
1103 *
1104 * \param refresh Whether to refresh the StatusSignal before returning it;
1105 * defaults to true
1106 * \returns MeasurementHealth Status Signal Object
1107 */
1109
1110 /**
1111 * \brief The amount of ambient infrared light that the sensor is
1112 * detecting. For ideal operation, this should be as low as possible.
1113 *
1114 * \details Short-range mode reduces the influence of ambient infrared
1115 * light.
1116 *
1117 * - Minimum Value: 0
1118 * - Maximum Value: 65535
1119 * - Default Value: 0
1120 * - Units:
1121 *
1122 * Default Rates:
1123 * - CAN 2.0: 20.0 Hz
1124 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1125 *
1126 * This refreshes and returns a cached StatusSignal object.
1127 *
1128 * \param refresh Whether to refresh the StatusSignal before returning it;
1129 * defaults to true
1130 * \returns AmbientSignal Status Signal Object
1131 */
1133
1134 /**
1135 * \brief Standard Deviation of the distance measurement.
1136 *
1137 * - Minimum Value: 0.0
1138 * - Maximum Value: 1.3107000000000002
1139 * - Default Value: 0
1140 * - Units: m
1141 *
1142 * Default Rates:
1143 * - CAN 2.0: 20.0 Hz
1144 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1145 *
1146 * This refreshes and returns a cached StatusSignal object.
1147 *
1148 * \param refresh Whether to refresh the StatusSignal before returning it;
1149 * defaults to true
1150 * \returns DistanceStdDev Status Signal Object
1151 */
1153
1154 /**
1155 * \brief The actual center of the FOV in the X direction. This takes
1156 * into account the user-configured FOVCenterX and FOVRangeX.
1157 *
1158 * - Minimum Value: -16.0
1159 * - Maximum Value: 15.875
1160 * - Default Value: 0
1161 * - Units: deg
1162 *
1163 * Default Rates:
1164 * - CAN 2.0: 4.0 Hz
1165 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1166 *
1167 * This refreshes and returns a cached StatusSignal object.
1168 *
1169 * \param refresh Whether to refresh the StatusSignal before returning it;
1170 * defaults to true
1171 * \returns RealFOVCenterX Status Signal Object
1172 */
1174
1175 /**
1176 * \brief The actual center of the FOV in the Y direction. This takes
1177 * into account the user-configured FOVCenterY and FOVRangeY.
1178 *
1179 * - Minimum Value: -16.0
1180 * - Maximum Value: 15.875
1181 * - Default Value: 0
1182 * - Units: deg
1183 *
1184 * Default Rates:
1185 * - CAN 2.0: 4.0 Hz
1186 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1187 *
1188 * This refreshes and returns a cached StatusSignal object.
1189 *
1190 * \param refresh Whether to refresh the StatusSignal before returning it;
1191 * defaults to true
1192 * \returns RealFOVCenterY Status Signal Object
1193 */
1195
1196 /**
1197 * \brief The actual range of the FOV in the X direction. This takes
1198 * into account the user-configured FOVRangeX.
1199 *
1200 * - Minimum Value: 0.0
1201 * - Maximum Value: 31.875
1202 * - Default Value: 0
1203 * - Units: deg
1204 *
1205 * Default Rates:
1206 * - CAN 2.0: 4.0 Hz
1207 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1208 *
1209 * This refreshes and returns a cached StatusSignal object.
1210 *
1211 * \param refresh Whether to refresh the StatusSignal before returning it;
1212 * defaults to true
1213 * \returns RealFOVRangeX Status Signal Object
1214 */
1216
1217 /**
1218 * \brief The actual range of the FOV in the Y direction. This takes
1219 * into account the user-configured FOVRangeY.
1220 *
1221 * - Minimum Value: 0.0
1222 * - Maximum Value: 31.875
1223 * - Default Value: 0
1224 * - Units: deg
1225 *
1226 * Default Rates:
1227 * - CAN 2.0: 4.0 Hz
1228 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1229 *
1230 * This refreshes and returns a cached StatusSignal object.
1231 *
1232 * \param refresh Whether to refresh the StatusSignal before returning it;
1233 * defaults to true
1234 * \returns RealFOVRangeY Status Signal Object
1235 */
1237
1238 /**
1239 * \brief Hardware fault occurred
1240 *
1241 * - Default Value: False
1242 *
1243 * Default Rates:
1244 * - CAN: 4.0 Hz
1245 *
1246 * This refreshes and returns a cached StatusSignal object.
1247 *
1248 * \param refresh Whether to refresh the StatusSignal before returning it;
1249 * defaults to true
1250 * \returns Fault_Hardware Status Signal Object
1251 */
1253
1254 /**
1255 * \brief Hardware fault occurred
1256 *
1257 * - Default Value: False
1258 *
1259 * Default Rates:
1260 * - CAN: 4.0 Hz
1261 *
1262 * This refreshes and returns a cached StatusSignal object.
1263 *
1264 * \param refresh Whether to refresh the StatusSignal before returning it;
1265 * defaults to true
1266 * \returns StickyFault_Hardware Status Signal Object
1267 */
1269
1270 /**
1271 * \brief Device supply voltage dropped to near brownout levels
1272 *
1273 * - Default Value: False
1274 *
1275 * Default Rates:
1276 * - CAN: 4.0 Hz
1277 *
1278 * This refreshes and returns a cached StatusSignal object.
1279 *
1280 * \param refresh Whether to refresh the StatusSignal before returning it;
1281 * defaults to true
1282 * \returns Fault_Undervoltage Status Signal Object
1283 */
1285
1286 /**
1287 * \brief Device supply voltage dropped to near brownout levels
1288 *
1289 * - Default Value: False
1290 *
1291 * Default Rates:
1292 * - CAN: 4.0 Hz
1293 *
1294 * This refreshes and returns a cached StatusSignal object.
1295 *
1296 * \param refresh Whether to refresh the StatusSignal before returning it;
1297 * defaults to true
1298 * \returns StickyFault_Undervoltage Status Signal Object
1299 */
1301
1302 /**
1303 * \brief Device boot while detecting the enable signal
1304 *
1305 * - Default Value: False
1306 *
1307 * Default Rates:
1308 * - CAN: 4.0 Hz
1309 *
1310 * This refreshes and returns a cached StatusSignal object.
1311 *
1312 * \param refresh Whether to refresh the StatusSignal before returning it;
1313 * defaults to true
1314 * \returns Fault_BootDuringEnable Status Signal Object
1315 */
1317
1318 /**
1319 * \brief Device boot while detecting the enable signal
1320 *
1321 * - Default Value: False
1322 *
1323 * Default Rates:
1324 * - CAN: 4.0 Hz
1325 *
1326 * This refreshes and returns a cached StatusSignal object.
1327 *
1328 * \param refresh Whether to refresh the StatusSignal before returning it;
1329 * defaults to true
1330 * \returns StickyFault_BootDuringEnable Status Signal Object
1331 */
1333
1334 /**
1335 * \brief An unlicensed feature is in use, device may not behave as
1336 * expected.
1337 *
1338 * - Default Value: False
1339 *
1340 * Default Rates:
1341 * - CAN: 4.0 Hz
1342 *
1343 * This refreshes and returns a cached StatusSignal object.
1344 *
1345 * \param refresh Whether to refresh the StatusSignal before returning it;
1346 * defaults to true
1347 * \returns Fault_UnlicensedFeatureInUse Status Signal Object
1348 */
1350
1351 /**
1352 * \brief An unlicensed feature is in use, device may not behave as
1353 * expected.
1354 *
1355 * - Default Value: False
1356 *
1357 * Default Rates:
1358 * - CAN: 4.0 Hz
1359 *
1360 * This refreshes and returns a cached StatusSignal object.
1361 *
1362 * \param refresh Whether to refresh the StatusSignal before returning it;
1363 * defaults to true
1364 * \returns StickyFault_UnlicensedFeatureInUse Status Signal Object
1365 */
1367
1368
1369
1370
1371 /**
1372 * \brief Clear the sticky faults in the device.
1373 *
1374 * \details This typically has no impact on the device functionality.
1375 * Instead, it just clears telemetry faults that are accessible via
1376 * API and Tuner Self-Test.
1377 *
1378 * \param timeoutSeconds Maximum time to wait up to in seconds.
1379 * \returns StatusCode of the set command
1380 */
1381 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
1382 {
1383 return GetConfigurator().ClearStickyFaults(timeoutSeconds);
1384 }
1385 /**
1386 * \brief Clear the sticky faults in the device.
1387 *
1388 * \details This typically has no impact on the device functionality.
1389 * Instead, it just clears telemetry faults that are accessible via
1390 * API and Tuner Self-Test.
1391 *
1392 * This will wait up to 0.100 seconds (100ms) by default.
1393 *
1394 * \returns StatusCode of the set command
1395 */
1397 {
1398 return ClearStickyFaults(0.100_s);
1399 }
1400
1401 /**
1402 * \brief Clear sticky fault: Hardware fault occurred
1403 *
1404 * \param timeoutSeconds Maximum time to wait up to in seconds.
1405 * \returns StatusCode of the set command
1406 */
1407 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
1408 {
1409 return GetConfigurator().ClearStickyFault_Hardware(timeoutSeconds);
1410 }
1411 /**
1412 * \brief Clear sticky fault: Hardware fault occurred
1413 *
1414 * This will wait up to 0.100 seconds (100ms) by default.
1415 *
1416 * \returns StatusCode of the set command
1417 */
1419 {
1420 return ClearStickyFault_Hardware(0.100_s);
1421 }
1422
1423 /**
1424 * \brief Clear sticky fault: Device supply voltage dropped to near
1425 * brownout levels
1426 *
1427 * \param timeoutSeconds Maximum time to wait up to in seconds.
1428 * \returns StatusCode of the set command
1429 */
1430 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
1431 {
1432 return GetConfigurator().ClearStickyFault_Undervoltage(timeoutSeconds);
1433 }
1434 /**
1435 * \brief Clear sticky fault: Device supply voltage dropped to near
1436 * brownout levels
1437 *
1438 * This will wait up to 0.100 seconds (100ms) by default.
1439 *
1440 * \returns StatusCode of the set command
1441 */
1443 {
1444 return ClearStickyFault_Undervoltage(0.100_s);
1445 }
1446
1447 /**
1448 * \brief Clear sticky fault: Device boot while detecting the enable
1449 * signal
1450 *
1451 * \param timeoutSeconds Maximum time to wait up to in seconds.
1452 * \returns StatusCode of the set command
1453 */
1455 {
1456 return GetConfigurator().ClearStickyFault_BootDuringEnable(timeoutSeconds);
1457 }
1458 /**
1459 * \brief Clear sticky fault: Device boot while detecting the enable
1460 * signal
1461 *
1462 * This will wait up to 0.100 seconds (100ms) by default.
1463 *
1464 * \returns StatusCode of the set command
1465 */
1467 {
1468 return ClearStickyFault_BootDuringEnable(0.100_s);
1469 }
1470
1471 /**
1472 * \brief Clear sticky fault: An unlicensed feature is in use, device
1473 * may not behave as expected.
1474 *
1475 * \param timeoutSeconds Maximum time to wait up to in seconds.
1476 * \returns StatusCode of the set command
1477 */
1479 {
1480 return GetConfigurator().ClearStickyFault_UnlicensedFeatureInUse(timeoutSeconds);
1481 }
1482 /**
1483 * \brief Clear sticky fault: An unlicensed feature is in use, device
1484 * may not behave as expected.
1485 *
1486 * This will wait up to 0.100 seconds (100ms) by default.
1487 *
1488 * \returns StatusCode of the set command
1489 */
1491 {
1492 return ClearStickyFault_UnlicensedFeatureInUse(0.100_s);
1493 }
1494};
1495
1496#if defined(_WIN32) || defined(_WIN64)
1497#pragma warning(pop)
1498#endif
1499
1500}
1501}
1502
1503}
1504}
1505
Class for getting information about an available CAN bus.
Definition CANBus.hpp:19
Represents a status signal with data of type T, and operations available to retrieve information abou...
Definition StatusSignal.hpp:567
Class for 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 ClearStickyFaults()
Clear the sticky faults in the device.
Definition CoreCANrange.hpp:566
ctre::phoenix::StatusCode Apply(const CustomParamsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:300
ctre::phoenix::StatusCode Refresh(ToFParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:478
ctre::phoenix::StatusCode Refresh(FovParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:540
ctre::phoenix::StatusCode Apply(const CANrangeConfiguration &configs)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:257
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANrange.hpp:601
ctre::phoenix::StatusCode Refresh(CustomParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:447
ctre::phoenix::StatusCode Refresh(CANrangeConfiguration &configs) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:402
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(units::time::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
ctre::phoenix::StatusCode Refresh(CANrangeConfiguration &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:416
ctre::phoenix::StatusCode Apply(const FovParamsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:387
ctre::phoenix::StatusCode Apply(const CANrangeConfiguration &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:271
ctre::phoenix::StatusCode Apply(const ToFParamsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:329
ctre::phoenix::StatusCode Apply(const ProximityParamsConfigs &configs, units::time::second_t timeoutSeconds)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:358
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANrange.hpp:666
ctre::phoenix::StatusCode Refresh(ProximityParamsConfigs &configs, units::time::second_t timeoutSeconds) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:509
ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
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 ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
ctre::phoenix::StatusCode Apply(const FovParamsConfigs &configs)
Applies the contents of the specified config to the device.
Definition CoreCANrange.hpp:373
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
ctre::phoenix::StatusCode Refresh(ProximityParamsConfigs &configs) const
Refreshes the values of the specified config group.
Definition CoreCANrange.hpp:496
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
Custom Params.
Definition CustomParamsConfigs.hpp:23
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Configs that affect the ToF Field of View.
Definition FovParamsConfigs.hpp:23
std::string Serialize() const final
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Definition Configuration.hpp:17
The base class for all device configurators.
Definition Configurator.hpp:21
Configs that affect the ToF Proximity detection.
Definition ProximityParamsConfigs.hpp:25
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
Configs that affect the ToF sensor.
Definition ToFParamsConfigs.hpp:24
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
std::string Serialize() const final
The unique identifier for a device.
Definition DeviceIdentifier.hpp:19
Parent class for all devices.
Definition ParentDevice.hpp:23
Class for CANrange, a CAN based Time of Flight (ToF) sensor that measures the distance to the front o...
Definition CoreCANrange.hpp:734
StatusSignal< bool > & GetStickyFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
StatusSignal< int > & GetVersionMajor(bool refresh=true)
App Major Version number.
StatusSignal< units::dimensionless::scalar_t > & GetSignalStrength(bool refresh=true)
Approximate signal strength of the measurement.
StatusSignal< units::time::second_t > & GetMeasurementTime(bool refresh=true)
Timestamp of the most recent measurements.
static CoreCANrange None()
Constructs a stubbed-out CoreCANrange, where all status signals, controls, configs,...
Definition CoreCANrange.hpp:778
StatusSignal< bool > & GetFault_Undervoltage(bool refresh=true)
Device supply voltage dropped to near brownout levels.
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANrange.hpp:1430
CoreCANrange(int deviceId, CANBus canbus={})
Constructs a new CANrange object.
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.
StatusSignal< units::angle::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.
ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
Clear sticky fault: Hardware fault occurred.
Definition CoreCANrange.hpp:1407
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANrange.hpp:1454
sim::CANrangeSimState & GetSimState()
Get the simulation state for this device.
Definition CoreCANrange.hpp:820
StatusSignal< bool > & GetFault_Hardware(bool refresh=true)
Hardware fault occurred.
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.
ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
Clear the sticky faults in the device.
Definition CoreCANrange.hpp:1381
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANrange.hpp:1490
StatusSignal< bool > & GetIsDetected(bool refresh=true)
Whether the CANrange detects an object using the configured proximity parameters.
StatusSignal< units::angle::degree_t > & GetRealFOVCenterY(bool refresh=true)
The actual center of the FOV in the Y direction.
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< units::length::meter_t > & GetDistanceStdDev(bool refresh=true)
Standard Deviation of the distance measurement.
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:1396
StatusSignal< bool > & GetStickyFault_BootDuringEnable(bool refresh=true)
Device boot while detecting the enable signal.
StatusSignal< units::angle::degree_t > & GetRealFOVCenterX(bool refresh=true)
The actual center of the FOV in the X direction.
StatusSignal< units::voltage::volt_t > & GetSupplyVoltage(bool refresh=true)
Measured supply voltage to the CANrange.
StatusSignal< units::length::meter_t > & GetDistance(bool refresh=true)
Distance to the nearest object in the configured field of view of the CANrange.
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, std::string canbus)
Constructs a new CANrange object.
configs::CANrangeConfigurator const & GetConfigurator() const
Gets the configurator for this CANrange.
Definition CoreCANrange.hpp:802
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANrange.hpp:1466
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANrange.hpp:1418
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANrange.hpp:1442
StatusSignal< int > & GetVersionMinor(bool refresh=true)
App Minor Version number.
configs::CANrangeConfigurator & GetConfigurator()
Gets the configurator for this CANrange.
Definition CoreCANrange.hpp:790
StatusSignal< units::angle::degree_t > & GetRealFOVRangeX(bool refresh=true)
The actual range of the FOV in the X direction.
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse(units::time::second_t timeoutSeconds)
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANrange.hpp:1478
StatusSignal< units::dimensionless::scalar_t > & GetAmbientSignal(bool refresh=true)
The amount of ambient infrared light that the sensor is detecting.
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 motor_constants.h:14