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