CTRE Phoenix 6 C++ 26.50.0-alpha-1
Loading...
Searching...
No Matches
ToFParamsConfigs.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
11#include <wpi/units/frequency.hpp>
12
13namespace ctre {
14namespace phoenix6 {
15
16
17namespace configs {
18
19/**
20 * \brief Configs that affect the ToF sensor
21 *
22 * \details Includes Update mode and frequency
23 */
25public:
26 constexpr ToFParamsConfigs() = default;
27
28 /**
29 * \brief Update mode of the CANrange. The CANrange supports
30 * short-range and long-range detection at various update frequencies.
31 *
32 * - Default Value: signals#UpdateModeValue#ShortRange100Hz
33 */
35 /**
36 * \brief Rate at which the CANrange will take measurements. A lower
37 * frequency may provide more stable readings but will reduce the data
38 * rate of the sensor.
39 *
40 * - Minimum Value: 5
41 * - Maximum Value: 50
42 * - Default Value: 50
43 * - Units: Hz
44 */
45 wpi::units::hertz_t UpdateFrequency = 50_Hz;
46
47 /**
48 * \brief Modifies this configuration's UpdateMode parameter and returns itself for
49 * method-chaining and easier to use config API.
50 *
51 * Update mode of the CANrange. The CANrange supports short-range and
52 * long-range detection at various update frequencies.
53 *
54 * - Default Value: signals#UpdateModeValue#ShortRange100Hz
55 *
56 * \param newUpdateMode Parameter to modify
57 * \returns Itself
58 */
60 {
61 UpdateMode = std::move(newUpdateMode);
62 return *this;
63 }
64
65 /**
66 * \brief Modifies this configuration's UpdateFrequency parameter and returns itself for
67 * method-chaining and easier to use config API.
68 *
69 * Rate at which the CANrange will take measurements. A lower
70 * frequency may provide more stable readings but will reduce the data
71 * rate of the sensor.
72 *
73 * - Minimum Value: 5
74 * - Maximum Value: 50
75 * - Default Value: 50
76 * - Units: Hz
77 *
78 * \param newUpdateFrequency Parameter to modify
79 * \returns Itself
80 */
81 constexpr ToFParamsConfigs &WithUpdateFrequency(wpi::units::hertz_t newUpdateFrequency)
82 {
83 UpdateFrequency = std::move(newUpdateFrequency);
84 return *this;
85 }
86
87
88
89 std::string ToString() const override;
90
91 std::string Serialize() const final;
92 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
93};
94
95}
96}
97}
Definition Configuration.hpp:17
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
constexpr ToFParamsConfigs & WithUpdateFrequency(wpi::units::hertz_t newUpdateFrequency)
Modifies this configuration's UpdateFrequency parameter and returns itself for method-chaining and ea...
Definition ToFParamsConfigs.hpp:81
wpi::units::hertz_t UpdateFrequency
Rate at which the CANrange will take measurements.
Definition ToFParamsConfigs.hpp:45
signals::UpdateModeValue UpdateMode
Update mode of the CANrange.
Definition ToFParamsConfigs.hpp:34
std::string Serialize() const final
constexpr ToFParamsConfigs & WithUpdateMode(signals::UpdateModeValue newUpdateMode)
Modifies this configuration's UpdateMode parameter and returns itself for method-chaining and easier ...
Definition ToFParamsConfigs.hpp:59
std::string ToString() const override
Definition ExternalFeedbackConfigs.hpp:21
Definition ExternalFeedbackConfigs.hpp:16
Definition FrcUsageReport.hpp:12
Definition motor_constants.h:14
Update mode of the CANrange.
Definition SpnEnums.hpp:2710
static constexpr int ShortRange100Hz
Updates distance/proximity at 100hz using short-range detection mode.
Definition SpnEnums.hpp:2716