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