CTRE Phoenix 6 C++ 26.0.0-beta-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 <units/frequency.h>
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 */
34 /**
35 * \brief Rate at which the CANrange will take measurements. A lower
36 * frequency may provide more stable readings but will reduce the data
37 * rate of the sensor.
38 *
39 * - Minimum Value: 5
40 * - Maximum Value: 50
41 * - Default Value: 50
42 * - Units: Hz
43 */
44 units::frequency::hertz_t UpdateFrequency = 50_Hz;
45
46 /**
47 * \brief Modifies this configuration's UpdateMode parameter and returns itself for
48 * method-chaining and easier to use config API.
49 *
50 * Update mode of the CANrange. The CANrange supports short-range and
51 * long-range detection at various update frequencies.
52 *
53 *
54 * \param newUpdateMode Parameter to modify
55 * \returns Itself
56 */
58 {
59 UpdateMode = std::move(newUpdateMode);
60 return *this;
61 }
62
63 /**
64 * \brief Modifies this configuration's UpdateFrequency parameter and returns itself for
65 * method-chaining and easier to use config API.
66 *
67 * Rate at which the CANrange will take measurements. A lower
68 * frequency may provide more stable readings but will reduce the data
69 * rate of the sensor.
70 *
71 * - Minimum Value: 5
72 * - Maximum Value: 50
73 * - Default Value: 50
74 * - Units: Hz
75 *
76 * \param newUpdateFrequency Parameter to modify
77 * \returns Itself
78 */
79 constexpr ToFParamsConfigs &WithUpdateFrequency(units::frequency::hertz_t newUpdateFrequency)
80 {
81 UpdateFrequency = std::move(newUpdateFrequency);
82 return *this;
83 }
84
85
86
87 std::string ToString() const override;
88
89 std::string Serialize() const final;
90 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
91};
92
93}
94}
95}
Definition Configuration.hpp:17
Configs that affect the ToF sensor.
Definition ToFParamsConfigs.hpp:24
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
constexpr ToFParamsConfigs & WithUpdateFrequency(units::frequency::hertz_t newUpdateFrequency)
Modifies this configuration's UpdateFrequency parameter and returns itself for method-chaining and ea...
Definition ToFParamsConfigs.hpp:79
signals::UpdateModeValue UpdateMode
Update mode of the CANrange.
Definition ToFParamsConfigs.hpp:33
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:57
units::frequency::hertz_t UpdateFrequency
Rate at which the CANrange will take measurements.
Definition ToFParamsConfigs.hpp:44
std::string ToString() const override
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