CTRE Phoenix 6 C++ 25.0.0-beta-4
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:
733 /**
734 * Constructs a new CANrange object.
735 *
736 * \param deviceId ID of the device, as configured in Phoenix Tuner.
737 * \param canbus Name of the CAN bus this device is on. Possible CAN bus strings are:
738 * - "rio" for the native roboRIO CAN bus
739 * - CANivore name or serial number
740 * - SocketCAN interface (non-FRC Linux only)
741 * - "*" for any CANivore seen by the program
742 * - empty string (default) to select the default for the system:
743 * - "rio" on roboRIO
744 * - "can0" on Linux
745 * - "*" on Windows
746 */
747 CoreCANrange(int deviceId, std::string canbus = "");
748
749 /**
750 * Constructs a new CANrange object.
751 *
752 * \param deviceId ID of the device, as configured in Phoenix Tuner.
753 * \param canbus The CAN bus this device is on.
754 */
755 CoreCANrange(int deviceId, CANBus canbus) :
756 CoreCANrange{deviceId, std::string{canbus.GetName()}}
757 {}
758
759 /**
760 * \brief Gets the configurator for this CANrange
761 *
762 * \details Gets the configurator for this CANrange
763 *
764 * \returns Configurator for this CANrange
765 */
767 {
768 return _configs;
769 }
770
771 /**
772 * \brief Gets the configurator for this CANrange
773 *
774 * \details Gets the configurator for this CANrange
775 *
776 * \returns Configurator for this CANrange
777 */
779 {
780 return _configs;
781 }
782
783
784private:
785 std::unique_ptr<sim::CANrangeSimState> _simState{};
786public:
787 /**
788 * \brief Get the simulation state for this device.
789 *
790 * \details This function reuses an allocated simulation
791 * state object, so it is safe to call this function multiple
792 * times in a robot loop.
793 *
794 * \returns Simulation state
795 */
797 {
798 if (_simState == nullptr)
799 _simState = std::make_unique<sim::CANrangeSimState>(*this);
800 return *_simState;
801 }
802
803
804
805 /**
806 * \brief App Major Version number.
807 *
808 * - Minimum Value: 0
809 * - Maximum Value: 255
810 * - Default Value: 0
811 * - Units:
812 *
813 * Default Rates:
814 * - CAN: 4.0 Hz
815 *
816 * This refreshes and returns a cached StatusSignal object.
817 *
818 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
819 * \returns VersionMajor Status Signal Object
820 */
821 StatusSignal<int> &GetVersionMajor(bool refresh = true);
822
823 /**
824 * \brief App Minor Version number.
825 *
826 * - Minimum Value: 0
827 * - Maximum Value: 255
828 * - Default Value: 0
829 * - Units:
830 *
831 * Default Rates:
832 * - CAN: 4.0 Hz
833 *
834 * This refreshes and returns a cached StatusSignal object.
835 *
836 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
837 * \returns VersionMinor Status Signal Object
838 */
839 StatusSignal<int> &GetVersionMinor(bool refresh = true);
840
841 /**
842 * \brief App Bugfix Version number.
843 *
844 * - Minimum Value: 0
845 * - Maximum Value: 255
846 * - Default Value: 0
847 * - Units:
848 *
849 * Default Rates:
850 * - CAN: 4.0 Hz
851 *
852 * This refreshes and returns a cached StatusSignal object.
853 *
854 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
855 * \returns VersionBugfix Status Signal Object
856 */
857 StatusSignal<int> &GetVersionBugfix(bool refresh = true);
858
859 /**
860 * \brief App Build Version number.
861 *
862 * - Minimum Value: 0
863 * - Maximum Value: 255
864 * - Default Value: 0
865 * - Units:
866 *
867 * Default Rates:
868 * - CAN: 4.0 Hz
869 *
870 * This refreshes and returns a cached StatusSignal object.
871 *
872 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
873 * \returns VersionBuild Status Signal Object
874 */
875 StatusSignal<int> &GetVersionBuild(bool refresh = true);
876
877 /**
878 * \brief Full Version of firmware in device. The format is a four
879 * byte value.
880 *
881 * - Minimum Value: 0
882 * - Maximum Value: 4294967295
883 * - Default Value: 0
884 * - Units:
885 *
886 * Default Rates:
887 * - CAN: 4.0 Hz
888 *
889 * This refreshes and returns a cached StatusSignal object.
890 *
891 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
892 * \returns Version Status Signal Object
893 */
894 StatusSignal<int> &GetVersion(bool refresh = true);
895
896 /**
897 * \brief Integer representing all fault flags reported by the device.
898 *
899 * \details These are device specific and are not used directly in
900 * typical applications. Use the signal specific GetFault_*() methods
901 * instead.
902 *
903 * - Minimum Value: 0
904 * - Maximum Value: 4294967295
905 * - Default Value: 0
906 * - Units:
907 *
908 * Default Rates:
909 * - CAN: 4.0 Hz
910 *
911 * This refreshes and returns a cached StatusSignal object.
912 *
913 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
914 * \returns FaultField Status Signal Object
915 */
916 StatusSignal<int> &GetFaultField(bool refresh = true);
917
918 /**
919 * \brief Integer representing all (persistent) sticky fault flags
920 * reported by the device.
921 *
922 * \details These are device specific and are not used directly in
923 * typical applications. Use the signal specific GetStickyFault_*()
924 * methods instead.
925 *
926 * - Minimum Value: 0
927 * - Maximum Value: 4294967295
928 * - Default Value: 0
929 * - Units:
930 *
931 * Default Rates:
932 * - CAN: 4.0 Hz
933 *
934 * This refreshes and returns a cached StatusSignal object.
935 *
936 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
937 * \returns StickyFaultField Status Signal Object
938 */
940
941 /**
942 * \brief Whether the device is Phoenix Pro licensed.
943 *
944 * - Default Value: False
945 *
946 * Default Rates:
947 * - CAN: 4.0 Hz
948 *
949 * This refreshes and returns a cached StatusSignal object.
950 *
951 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
952 * \returns IsProLicensed Status Signal Object
953 */
955
956 /**
957 * \brief Measured supply voltage to the CANrange.
958 *
959 * - Minimum Value: 4
960 * - Maximum Value: 16.75
961 * - Default Value: 4
962 * - Units: V
963 *
964 * Default Rates:
965 * - CAN 2.0: 100.0 Hz
966 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
967 *
968 * This refreshes and returns a cached StatusSignal object.
969 *
970 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
971 * \returns SupplyVoltage Status Signal Object
972 */
974
975 /**
976 * \brief Distance to the nearest object in the configured field of
977 * view of the CANrange.
978 *
979 * - Minimum Value: 0.0
980 * - Maximum Value: 65.535
981 * - Default Value: 0
982 * - Units: m
983 *
984 * Default Rates:
985 * - CAN 2.0: 100.0 Hz
986 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
987 *
988 * This refreshes and returns a cached StatusSignal object.
989 *
990 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
991 * \returns Distance Status Signal Object
992 */
994
995 /**
996 * \brief Timestamp of the most recent measurements. This is not
997 * synchronized to any other clock source.
998 *
999 * Users can use this to check when the measurements are updated.
1000 *
1001 * - Minimum Value: 0.0
1002 * - Maximum Value: 65.535
1003 * - Default Value: 0
1004 * - Units: s
1005 *
1006 * Default Rates:
1007 * - CAN 2.0: 100.0 Hz
1008 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1009 *
1010 * This refreshes and returns a cached StatusSignal object.
1011 *
1012 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1013 * \returns MeasurementTime Status Signal Object
1014 */
1016
1017 /**
1018 * \brief Approximate signal strength of the measurement. A higher
1019 * value indicates a higher strength of signal.
1020 *
1021 * A value of ~2500 is typical when detecting an object under
1022 * short-range conditions.
1023 *
1024 * - Minimum Value: 0
1025 * - Maximum Value: 65535
1026 * - Default Value: 0
1027 * - Units:
1028 *
1029 * Default Rates:
1030 * - CAN 2.0: 100.0 Hz
1031 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1032 *
1033 * This refreshes and returns a cached StatusSignal object.
1034 *
1035 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1036 * \returns SignalStrength Status Signal Object
1037 */
1039
1040 /**
1041 * \brief Whether the CANrange detects an object using the configured
1042 * proximity parameters.
1043 *
1044 * - Default Value: 0
1045 *
1046 * Default Rates:
1047 * - CAN 2.0: 100.0 Hz
1048 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1049 *
1050 * This refreshes and returns a cached StatusSignal object.
1051 *
1052 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1053 * \returns IsDetected Status Signal Object
1054 */
1055 StatusSignal<bool> &GetIsDetected(bool refresh = true);
1056
1057 /**
1058 * \brief Health of the distance measurement.
1059 *
1060 *
1061 * Default Rates:
1062 * - CAN 2.0: 100.0 Hz
1063 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1064 *
1065 * This refreshes and returns a cached StatusSignal object.
1066 *
1067 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1068 * \returns MeasurementHealth Status Signal Object
1069 */
1071
1072 /**
1073 * \brief The amount of ambient infrared light that the sensor is
1074 * detecting. For ideal operation, this should be as low as possible.
1075 *
1076 * \details Short-range mode reduces the influence of ambient infrared
1077 * light.
1078 *
1079 * - Minimum Value: 0
1080 * - Maximum Value: 65535
1081 * - Default Value: 0
1082 * - Units:
1083 *
1084 * Default Rates:
1085 * - CAN 2.0: 20.0 Hz
1086 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1087 *
1088 * This refreshes and returns a cached StatusSignal object.
1089 *
1090 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1091 * \returns AmbientSignal Status Signal Object
1092 */
1094
1095 /**
1096 * \brief Standard Deviation of the distance measurement.
1097 *
1098 * - Minimum Value: 0.0
1099 * - Maximum Value: 1.3107000000000002
1100 * - Default Value: 0
1101 * - Units: m
1102 *
1103 * Default Rates:
1104 * - CAN 2.0: 20.0 Hz
1105 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1106 *
1107 * This refreshes and returns a cached StatusSignal object.
1108 *
1109 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1110 * \returns DistanceStdDev Status Signal Object
1111 */
1113
1114 /**
1115 * \brief The actual center of the FOV in the X direction. This takes
1116 * into account the user-configured FOVCenterX and FOVRangeX.
1117 *
1118 * - Minimum Value: -16.0
1119 * - Maximum Value: 15.875
1120 * - Default Value: 0
1121 * - Units: deg
1122 *
1123 * Default Rates:
1124 * - CAN 2.0: 4.0 Hz
1125 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1126 *
1127 * This refreshes and returns a cached StatusSignal object.
1128 *
1129 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1130 * \returns RealFOVCenterX Status Signal Object
1131 */
1133
1134 /**
1135 * \brief The actual center of the FOV in the Y direction. This takes
1136 * into account the user-configured FOVCenterY and FOVRangeY.
1137 *
1138 * - Minimum Value: -16.0
1139 * - Maximum Value: 15.875
1140 * - Default Value: 0
1141 * - Units: deg
1142 *
1143 * Default Rates:
1144 * - CAN 2.0: 4.0 Hz
1145 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1146 *
1147 * This refreshes and returns a cached StatusSignal object.
1148 *
1149 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1150 * \returns RealFOVCenterY Status Signal Object
1151 */
1153
1154 /**
1155 * \brief The actual range of the FOV in the X direction. This takes
1156 * into account the user-configured FOVRangeX.
1157 *
1158 * - Minimum Value: 0.0
1159 * - Maximum Value: 31.875
1160 * - Default Value: 0
1161 * - Units: deg
1162 *
1163 * Default Rates:
1164 * - CAN 2.0: 4.0 Hz
1165 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1166 *
1167 * This refreshes and returns a cached StatusSignal object.
1168 *
1169 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1170 * \returns RealFOVRangeX Status Signal Object
1171 */
1173
1174 /**
1175 * \brief The actual range of the FOV in the Y direction. This takes
1176 * into account the user-configured FOVRangeY.
1177 *
1178 * - Minimum Value: 0.0
1179 * - Maximum Value: 31.875
1180 * - Default Value: 0
1181 * - Units: deg
1182 *
1183 * Default Rates:
1184 * - CAN 2.0: 4.0 Hz
1185 * - CAN FD: 100.0 Hz (TimeSynced with Pro)
1186 *
1187 * This refreshes and returns a cached StatusSignal object.
1188 *
1189 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1190 * \returns RealFOVRangeY Status Signal Object
1191 */
1193
1194 /**
1195 * \brief Hardware fault occurred
1196 *
1197 * - Default Value: False
1198 *
1199 * Default Rates:
1200 * - CAN: 4.0 Hz
1201 *
1202 * This refreshes and returns a cached StatusSignal object.
1203 *
1204 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1205 * \returns Fault_Hardware Status Signal Object
1206 */
1208
1209 /**
1210 * \brief Hardware fault occurred
1211 *
1212 * - Default Value: False
1213 *
1214 * Default Rates:
1215 * - CAN: 4.0 Hz
1216 *
1217 * This refreshes and returns a cached StatusSignal object.
1218 *
1219 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1220 * \returns StickyFault_Hardware Status Signal Object
1221 */
1223
1224 /**
1225 * \brief Device supply voltage dropped to near brownout levels
1226 *
1227 * - Default Value: False
1228 *
1229 * Default Rates:
1230 * - CAN: 4.0 Hz
1231 *
1232 * This refreshes and returns a cached StatusSignal object.
1233 *
1234 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1235 * \returns Fault_Undervoltage Status Signal Object
1236 */
1238
1239 /**
1240 * \brief Device supply voltage dropped to near brownout levels
1241 *
1242 * - Default Value: False
1243 *
1244 * Default Rates:
1245 * - CAN: 4.0 Hz
1246 *
1247 * This refreshes and returns a cached StatusSignal object.
1248 *
1249 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1250 * \returns StickyFault_Undervoltage Status Signal Object
1251 */
1253
1254 /**
1255 * \brief Device boot while detecting the enable signal
1256 *
1257 * - Default Value: False
1258 *
1259 * Default Rates:
1260 * - CAN: 4.0 Hz
1261 *
1262 * This refreshes and returns a cached StatusSignal object.
1263 *
1264 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1265 * \returns Fault_BootDuringEnable Status Signal Object
1266 */
1268
1269 /**
1270 * \brief Device boot while detecting the enable signal
1271 *
1272 * - Default Value: False
1273 *
1274 * Default Rates:
1275 * - CAN: 4.0 Hz
1276 *
1277 * This refreshes and returns a cached StatusSignal object.
1278 *
1279 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1280 * \returns StickyFault_BootDuringEnable Status Signal Object
1281 */
1283
1284 /**
1285 * \brief An unlicensed feature is in use, device may not behave as
1286 * expected.
1287 *
1288 * - Default Value: False
1289 *
1290 * Default Rates:
1291 * - CAN: 4.0 Hz
1292 *
1293 * This refreshes and returns a cached StatusSignal object.
1294 *
1295 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1296 * \returns Fault_UnlicensedFeatureInUse Status Signal Object
1297 */
1299
1300 /**
1301 * \brief An unlicensed feature is in use, device may not behave as
1302 * expected.
1303 *
1304 * - Default Value: False
1305 *
1306 * Default Rates:
1307 * - CAN: 4.0 Hz
1308 *
1309 * This refreshes and returns a cached StatusSignal object.
1310 *
1311 * \param refresh Whether to refresh the StatusSignal before returning it; defaults to true
1312 * \returns StickyFault_UnlicensedFeatureInUse Status Signal Object
1313 */
1315
1316
1317
1318 /**
1319 * \brief Control device with generic control request object. User must make
1320 * sure the specified object is castable to a valid control request,
1321 * otherwise this function will fail at run-time and return the NotSupported
1322 * StatusCode
1323 *
1324 * \param request Control object to request of the device
1325 * \returns Status Code of the request, 0 is OK
1326 */
1328 {
1329 controls::ControlRequest const *ptr = &request;
1330 (void)ptr;
1331
1333 }
1334
1335
1336 /**
1337 * \brief Clear the sticky faults in the device.
1338 *
1339 * \details This typically has no impact on the device functionality.
1340 * Instead, it just clears telemetry faults that are accessible via
1341 * API and Tuner Self-Test.
1342 *
1343 * \param timeoutSeconds Maximum time to wait up to in seconds.
1344 * \returns StatusCode of the set command
1345 */
1346 ctre::phoenix::StatusCode ClearStickyFaults(units::time::second_t timeoutSeconds)
1347 {
1348 return GetConfigurator().ClearStickyFaults(timeoutSeconds);
1349 }
1350 /**
1351 * \brief Clear the sticky faults in the device.
1352 *
1353 * \details This typically has no impact on the device functionality.
1354 * Instead, it just clears telemetry faults that are accessible via
1355 * API and Tuner Self-Test.
1356 *
1357 * This will wait up to 0.100 seconds (100ms) by default.
1358 *
1359 * \returns StatusCode of the set command
1360 */
1365
1366 /**
1367 * \brief Clear sticky fault: Hardware fault occurred
1368 *
1369 * \param timeoutSeconds Maximum time to wait up to in seconds.
1370 * \returns StatusCode of the set command
1371 */
1372 ctre::phoenix::StatusCode ClearStickyFault_Hardware(units::time::second_t timeoutSeconds)
1373 {
1374 return GetConfigurator().ClearStickyFault_Hardware(timeoutSeconds);
1375 }
1376 /**
1377 * \brief Clear sticky fault: Hardware fault occurred
1378 *
1379 * This will wait up to 0.100 seconds (100ms) by default.
1380 *
1381 * \returns StatusCode of the set command
1382 */
1387
1388 /**
1389 * \brief Clear sticky fault: Device supply voltage dropped to near
1390 * brownout levels
1391 *
1392 * \param timeoutSeconds Maximum time to wait up to in seconds.
1393 * \returns StatusCode of the set command
1394 */
1395 ctre::phoenix::StatusCode ClearStickyFault_Undervoltage(units::time::second_t timeoutSeconds)
1396 {
1397 return GetConfigurator().ClearStickyFault_Undervoltage(timeoutSeconds);
1398 }
1399 /**
1400 * \brief Clear sticky fault: Device supply voltage dropped to near
1401 * brownout levels
1402 *
1403 * This will wait up to 0.100 seconds (100ms) by default.
1404 *
1405 * \returns StatusCode of the set command
1406 */
1411
1412 /**
1413 * \brief Clear sticky fault: Device boot while detecting the enable
1414 * signal
1415 *
1416 * \param timeoutSeconds Maximum time to wait up to in seconds.
1417 * \returns StatusCode of the set command
1418 */
1420 {
1421 return GetConfigurator().ClearStickyFault_BootDuringEnable(timeoutSeconds);
1422 }
1423 /**
1424 * \brief Clear sticky fault: Device boot while detecting the enable
1425 * signal
1426 *
1427 * This will wait up to 0.100 seconds (100ms) by default.
1428 *
1429 * \returns StatusCode of the set command
1430 */
1435
1436 /**
1437 * \brief Clear sticky fault: An unlicensed feature is in use, device
1438 * may not behave as expected.
1439 *
1440 * \param timeoutSeconds Maximum time to wait up to in seconds.
1441 * \returns StatusCode of the set command
1442 */
1444 {
1446 }
1447 /**
1448 * \brief Clear sticky fault: An unlicensed feature is in use, device
1449 * may not behave as expected.
1450 *
1451 * This will wait up to 0.100 seconds (100ms) by default.
1452 *
1453 * \returns StatusCode of the set command
1454 */
1459};
1460
1461}
1462}
1463
1464}
1465}
1466
ii that the Software will be uninterrupted or error free
Definition CTRE_LICENSE.txt:226
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:657
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:3640
std::string ToString() const override
Definition Configs.hpp:3709
std::string Serialize() const override
Definition Configs.hpp:3718
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition Configs.hpp:3727
Configs that affect the ToF Field of View.
Definition Configs.hpp:4066
std::string ToString() const override
Definition Configs.hpp:4229
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition Configs.hpp:4251
std::string Serialize() const override
Definition Configs.hpp:4240
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:3898
std::string ToString() const override
Definition Configs.hpp:4022
std::string Serialize() const override
Definition Configs.hpp:4032
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition Configs.hpp:4042
Configs that affect the ToF sensor.
Definition Configs.hpp:3797
std::string Serialize() const override
Definition Configs.hpp:3869
std::string ToString() const override
Definition Configs.hpp:3860
ctre::phoenix::StatusCode Deserialize(const std::string &to_deserialize) override
Definition Configs.hpp:3878
Abstract Control Request class that other control requests extend for use.
Definition ControlRequest.hpp:29
Definition DeviceIdentifier.hpp:19
Parent class for all devices.
Definition ParentDevice.hpp:29
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:1395
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:1327
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:1372
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable(units::time::second_t timeoutSeconds)
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANrange.hpp:1419
sim::CANrangeSimState & GetSimState()
Get the simulation state for this device.
Definition CoreCANrange.hpp:796
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:1346
ctre::phoenix::StatusCode ClearStickyFault_UnlicensedFeatureInUse()
Clear sticky fault: An unlicensed feature is in use, device may not behave as expected.
Definition CoreCANrange.hpp:1455
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:1361
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:755
configs::CANrangeConfigurator const & GetConfigurator() const
Gets the configurator for this CANrange.
Definition CoreCANrange.hpp:778
ctre::phoenix::StatusCode ClearStickyFault_BootDuringEnable()
Clear sticky fault: Device boot while detecting the enable signal.
Definition CoreCANrange.hpp:1431
ctre::phoenix::StatusCode ClearStickyFault_Hardware()
Clear sticky fault: Hardware fault occurred.
Definition CoreCANrange.hpp:1383
ctre::phoenix::StatusCode ClearStickyFault_Undervoltage()
Clear sticky fault: Device supply voltage dropped to near brownout levels.
Definition CoreCANrange.hpp:1407
StatusSignal< int > & GetVersionMinor(bool refresh=true)
App Minor Version number.
configs::CANrangeConfigurator & GetConfigurator()
Gets the configurator for this CANrange.
Definition CoreCANrange.hpp:766
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:1443
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 StatusCodes.h:18
Definition span.hpp:401