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