CTRE Phoenix 6 C++ 26.0.0-beta-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 <units/impedance.h>
12#include <units/temperature.h>
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 units::temperature::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 units::temperature::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 units::impedance::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 */
79
80 /**
81 * \brief Modifies this configuration's ThermistorMaxTemperature parameter and returns itself for
82 * method-chaining and easier to use config API.
83 *
84 * Threshold for thermal faulting a custom motor.
85 *
86 * \details The motor controller will fault if the connected motor
87 * thermistor exceeds this value.
88 *
89 * - Minimum Value: 0
90 * - Maximum Value: 150
91 * - Default Value: 0
92 * - Units: ℃
93 *
94 * \param newThermistorMaxTemperature Parameter to modify
95 * \returns Itself
96 */
97 constexpr ExternalTempConfigs &WithThermistorMaxTemperature(units::temperature::celsius_t newThermistorMaxTemperature)
98 {
99 ThermistorMaxTemperature = std::move(newThermistorMaxTemperature);
100 return *this;
101 }
102
103 /**
104 * \brief Modifies this configuration's ThermistorBeta parameter and returns itself for
105 * method-chaining and easier to use config API.
106 *
107 * Beta K value for the connected NTC thermistor. This can usually be
108 * determined by consulting the motor manufacturer data sheet.
109 *
110 * - Minimum Value: 0
111 * - Maximum Value: 8000
112 * - Default Value: 0
113 * - Units: K
114 *
115 * \param newThermistorBeta Parameter to modify
116 * \returns Itself
117 */
118 constexpr ExternalTempConfigs &WithThermistorBeta(units::temperature::kelvin_t newThermistorBeta)
119 {
120 ThermistorBeta = std::move(newThermistorBeta);
121 return *this;
122 }
123
124 /**
125 * \brief Modifies this configuration's ThermistorR0 parameter and returns itself for
126 * method-chaining and easier to use config API.
127 *
128 * The thermistor resistance for the connected NTC thermistor as
129 * measured at 25'C. This can usually be determined by consulting the
130 * motor manufacturer data sheet.
131 *
132 * - Minimum Value: 0
133 * - Maximum Value: 400
134 * - Default Value: 0
135 * - Units: kOhm
136 *
137 * \param newThermistorR0 Parameter to modify
138 * \returns Itself
139 */
140 constexpr ExternalTempConfigs &WithThermistorR0(units::impedance::kiloohm_t newThermistorR0)
141 {
142 ThermistorR0 = std::move(newThermistorR0);
143 return *this;
144 }
145
146 /**
147 * \brief Modifies this configuration's TempSensorRequired parameter and returns itself for
148 * method-chaining and easier to use config API.
149 *
150 * Whether a temperature sensor should be required for motor control.
151 * This configuration is ignored in FRC environments and defaults to
152 * Required.
153 *
154 *
155 * \param newTempSensorRequired Parameter to modify
156 * \returns Itself
157 */
159 {
160 TempSensorRequired = std::move(newTempSensorRequired);
161 return *this;
162 }
163
164
165
166 std::string ToString() const override;
167
168 std::string Serialize() const final;
169 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
170};
171
172}
173}
174}
Configs related to using an independent thermister for automatically disabling a motor when a thresho...
Definition ExternalTempConfigs.hpp:34
units::impedance::kiloohm_t ThermistorR0
The thermistor resistance for the connected NTC thermistor as measured at 25'C.
Definition ExternalTempConfigs.hpp:71
constexpr ExternalTempConfigs & WithThermistorMaxTemperature(units::temperature::celsius_t newThermistorMaxTemperature)
Modifies this configuration's ThermistorMaxTemperature parameter and returns itself for method-chaini...
Definition ExternalTempConfigs.hpp:97
constexpr ExternalTempConfigs & WithTempSensorRequired(signals::TempSensorRequiredValue newTempSensorRequired)
Modifies this configuration's TempSensorRequired parameter and returns itself for method-chaining and...
Definition ExternalTempConfigs.hpp:158
constexpr ExternalTempConfigs & WithThermistorBeta(units::temperature::kelvin_t newThermistorBeta)
Modifies this configuration's ThermistorBeta parameter and returns itself for method-chaining and eas...
Definition ExternalTempConfigs.hpp:118
signals::TempSensorRequiredValue TempSensorRequired
Whether a temperature sensor should be required for motor control.
Definition ExternalTempConfigs.hpp:78
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
std::string ToString() const override
units::temperature::kelvin_t ThermistorBeta
Beta K value for the connected NTC thermistor.
Definition ExternalTempConfigs.hpp:60
constexpr ExternalTempConfigs & WithThermistorR0(units::impedance::kiloohm_t newThermistorR0)
Modifies this configuration's ThermistorR0 parameter and returns itself for method-chaining and easie...
Definition ExternalTempConfigs.hpp:140
units::temperature::celsius_t ThermistorMaxTemperature
Threshold for thermal faulting a custom motor.
Definition ExternalTempConfigs.hpp:49
Definition Configuration.hpp:17
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