CTRE Phoenix 6 C++ 26.50.0-alpha-1
Loading...
Searching...
No Matches
ExternalTempConfigs.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/impedance.hpp>
12#include <wpi/units/temperature.hpp>
13
14namespace ctre {
15namespace phoenix6 {
16
17
18namespace configs {
19
20/**
21 * \brief Configs related to using an independent thermister for
22 * automatically disabling a motor when a threshold has been
23 * reached.
24 *
25 * \details Configs are only used when Motor Arrangement is set to
26 * Custom Brushless Motor or Brushed. Note this feature will
27 * only work device is not FRC-Locked.
28 *
29 * Users are responsible for ensuring that these configs are
30 * accurate to the motor. CTR Electronics is not responsible
31 * for damage caused by an incorrect custom motor
32 * configuration.
33 */
35public:
36 constexpr ExternalTempConfigs() = default;
37
38 /**
39 * \brief Threshold for thermal faulting a custom motor.
40 *
41 * \details The motor controller will fault if the connected motor
42 * thermistor exceeds this value.
43 *
44 * - Minimum Value: 0
45 * - Maximum Value: 150
46 * - Default Value: 0
47 * - Units: ℃
48 */
49 wpi::units::celsius_t ThermistorMaxTemperature = 0_degC;
50 /**
51 * \brief Beta K value for the connected NTC thermistor. This can
52 * usually be determined by consulting the motor manufacturer data
53 * sheet.
54 *
55 * - Minimum Value: 0
56 * - Maximum Value: 8000
57 * - Default Value: 0
58 * - Units: K
59 */
60 wpi::units::kelvin_t ThermistorBeta = 0_K;
61 /**
62 * \brief The thermistor resistance for the connected NTC thermistor
63 * as measured at 25'C. This can usually be determined by consulting
64 * the motor manufacturer data sheet.
65 *
66 * - Minimum Value: 0
67 * - Maximum Value: 400
68 * - Default Value: 0
69 * - Units: kOhm
70 */
71 wpi::units::kiloohm_t ThermistorR0 = 0_kOhm;
72 /**
73 * \brief Whether a temperature sensor should be required for motor
74 * control. This configuration is ignored in FRC environments and
75 * defaults to Required.
76 *
77 * - Default Value: signals#TempSensorRequiredValue#Required
78 */
80
81 /**
82 * \brief Modifies this configuration's ThermistorMaxTemperature parameter and returns itself for
83 * method-chaining and easier to use config API.
84 *
85 * Threshold for thermal faulting a custom motor.
86 *
87 * \details The motor controller will fault if the connected motor
88 * thermistor exceeds this value.
89 *
90 * - Minimum Value: 0
91 * - Maximum Value: 150
92 * - Default Value: 0
93 * - Units: ℃
94 *
95 * \param newThermistorMaxTemperature Parameter to modify
96 * \returns Itself
97 */
98 constexpr ExternalTempConfigs &WithThermistorMaxTemperature(wpi::units::celsius_t newThermistorMaxTemperature)
99 {
100 ThermistorMaxTemperature = std::move(newThermistorMaxTemperature);
101 return *this;
102 }
103
104 /**
105 * \brief Modifies this configuration's ThermistorBeta parameter and returns itself for
106 * method-chaining and easier to use config API.
107 *
108 * Beta K value for the connected NTC thermistor. This can usually be
109 * determined by consulting the motor manufacturer data sheet.
110 *
111 * - Minimum Value: 0
112 * - Maximum Value: 8000
113 * - Default Value: 0
114 * - Units: K
115 *
116 * \param newThermistorBeta Parameter to modify
117 * \returns Itself
118 */
119 constexpr ExternalTempConfigs &WithThermistorBeta(wpi::units::kelvin_t newThermistorBeta)
120 {
121 ThermistorBeta = std::move(newThermistorBeta);
122 return *this;
123 }
124
125 /**
126 * \brief Modifies this configuration's ThermistorR0 parameter and returns itself for
127 * method-chaining and easier to use config API.
128 *
129 * The thermistor resistance for the connected NTC thermistor as
130 * measured at 25'C. This can usually be determined by consulting the
131 * motor manufacturer data sheet.
132 *
133 * - Minimum Value: 0
134 * - Maximum Value: 400
135 * - Default Value: 0
136 * - Units: kOhm
137 *
138 * \param newThermistorR0 Parameter to modify
139 * \returns Itself
140 */
141 constexpr ExternalTempConfigs &WithThermistorR0(wpi::units::kiloohm_t newThermistorR0)
142 {
143 ThermistorR0 = std::move(newThermistorR0);
144 return *this;
145 }
146
147 /**
148 * \brief Modifies this configuration's TempSensorRequired parameter and returns itself for
149 * method-chaining and easier to use config API.
150 *
151 * Whether a temperature sensor should be required for motor control.
152 * This configuration is ignored in FRC environments and defaults to
153 * Required.
154 *
155 * - Default Value: signals#TempSensorRequiredValue#Required
156 *
157 * \param newTempSensorRequired Parameter to modify
158 * \returns Itself
159 */
161 {
162 TempSensorRequired = std::move(newTempSensorRequired);
163 return *this;
164 }
165
166
167
168 std::string ToString() const override;
169
170 std::string Serialize() const final;
171 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
172};
173
174}
175}
176}
wpi::units::kelvin_t ThermistorBeta
Beta K value for the connected NTC thermistor.
Definition ExternalTempConfigs.hpp:60
wpi::units::celsius_t ThermistorMaxTemperature
Threshold for thermal faulting a custom motor.
Definition ExternalTempConfigs.hpp:49
constexpr ExternalTempConfigs & WithTempSensorRequired(signals::TempSensorRequiredValue newTempSensorRequired)
Modifies this configuration's TempSensorRequired parameter and returns itself for method-chaining and...
Definition ExternalTempConfigs.hpp:160
constexpr ExternalTempConfigs & WithThermistorMaxTemperature(wpi::units::celsius_t newThermistorMaxTemperature)
Modifies this configuration's ThermistorMaxTemperature parameter and returns itself for method-chaini...
Definition ExternalTempConfigs.hpp:98
signals::TempSensorRequiredValue TempSensorRequired
Whether a temperature sensor should be required for motor control.
Definition ExternalTempConfigs.hpp:79
wpi::units::kiloohm_t ThermistorR0
The thermistor resistance for the connected NTC thermistor as measured at 25'C.
Definition ExternalTempConfigs.hpp:71
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
std::string ToString() const override
constexpr ExternalTempConfigs & WithThermistorR0(wpi::units::kiloohm_t newThermistorR0)
Modifies this configuration's ThermistorR0 parameter and returns itself for method-chaining and easie...
Definition ExternalTempConfigs.hpp:141
constexpr ExternalTempConfigs & WithThermistorBeta(wpi::units::kelvin_t newThermistorBeta)
Modifies this configuration's ThermistorBeta parameter and returns itself for method-chaining and eas...
Definition ExternalTempConfigs.hpp:119
Definition Configuration.hpp:17
Definition ExternalFeedbackConfigs.hpp:21
Definition ExternalFeedbackConfigs.hpp:16
Definition FrcUsageReport.hpp:12
Definition motor_constants.h:14
Whether a temperature sensor should be required for motor control.
Definition SpnEnums.hpp:4938
static constexpr int Required
Temperature sensor is required for motor control.
Definition SpnEnums.hpp:4944