CTRE Phoenix 6 C++ 26.0.0-beta-1
Loading...
Searching...
No Matches
TorqueCurrentConfigs.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
10#include <units/current.h>
11
12namespace ctre {
13namespace phoenix6 {
14
15
16namespace configs {
17
18/**
19 * \brief Configs that affect Torque Current control types.
20 *
21 * \details Includes the maximum and minimum applied torque output and
22 * the neutral deadband used during TorqueCurrentFOC
23 * requests.
24 */
26public:
27 constexpr TorqueCurrentConfigs() = default;
28
29 /**
30 * \brief Maximum (forward) output during torque current based control
31 * modes.
32 *
33 * - Minimum Value: -800
34 * - Maximum Value: 800
35 * - Default Value: 800
36 * - Units: A
37 */
38 units::current::ampere_t PeakForwardTorqueCurrent = 800_A;
39 /**
40 * \brief Minimum (reverse) output during torque current based control
41 * modes.
42 *
43 * - Minimum Value: -800
44 * - Maximum Value: 800
45 * - Default Value: -800
46 * - Units: A
47 */
48 units::current::ampere_t PeakReverseTorqueCurrent = -800_A;
49 /**
50 * \brief Configures the output deadband during torque current based
51 * control modes.
52 *
53 * - Minimum Value: 0
54 * - Maximum Value: 25
55 * - Default Value: 0.0
56 * - Units: A
57 */
58 units::current::ampere_t TorqueNeutralDeadband = 0.0_A;
59
60 /**
61 * \brief Modifies this configuration's PeakForwardTorqueCurrent parameter and returns itself for
62 * method-chaining and easier to use config API.
63 *
64 * Maximum (forward) output during torque current based control modes.
65 *
66 * - Minimum Value: -800
67 * - Maximum Value: 800
68 * - Default Value: 800
69 * - Units: A
70 *
71 * \param newPeakForwardTorqueCurrent Parameter to modify
72 * \returns Itself
73 */
74 constexpr TorqueCurrentConfigs &WithPeakForwardTorqueCurrent(units::current::ampere_t newPeakForwardTorqueCurrent)
75 {
76 PeakForwardTorqueCurrent = std::move(newPeakForwardTorqueCurrent);
77 return *this;
78 }
79
80 /**
81 * \brief Modifies this configuration's PeakReverseTorqueCurrent parameter and returns itself for
82 * method-chaining and easier to use config API.
83 *
84 * Minimum (reverse) output during torque current based control modes.
85 *
86 * - Minimum Value: -800
87 * - Maximum Value: 800
88 * - Default Value: -800
89 * - Units: A
90 *
91 * \param newPeakReverseTorqueCurrent Parameter to modify
92 * \returns Itself
93 */
94 constexpr TorqueCurrentConfigs &WithPeakReverseTorqueCurrent(units::current::ampere_t newPeakReverseTorqueCurrent)
95 {
96 PeakReverseTorqueCurrent = std::move(newPeakReverseTorqueCurrent);
97 return *this;
98 }
99
100 /**
101 * \brief Modifies this configuration's TorqueNeutralDeadband parameter and returns itself for
102 * method-chaining and easier to use config API.
103 *
104 * Configures the output deadband during torque current based control
105 * modes.
106 *
107 * - Minimum Value: 0
108 * - Maximum Value: 25
109 * - Default Value: 0.0
110 * - Units: A
111 *
112 * \param newTorqueNeutralDeadband Parameter to modify
113 * \returns Itself
114 */
115 constexpr TorqueCurrentConfigs &WithTorqueNeutralDeadband(units::current::ampere_t newTorqueNeutralDeadband)
116 {
117 TorqueNeutralDeadband = std::move(newTorqueNeutralDeadband);
118 return *this;
119 }
120
121
122
123 std::string ToString() const override;
124
125 std::string Serialize() const final;
126 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
127};
128
129}
130}
131}
Definition Configuration.hpp:17
Configs that affect Torque Current control types.
Definition TorqueCurrentConfigs.hpp:25
std::string ToString() const override
units::current::ampere_t PeakReverseTorqueCurrent
Minimum (reverse) output during torque current based control modes.
Definition TorqueCurrentConfigs.hpp:48
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
units::current::ampere_t PeakForwardTorqueCurrent
Maximum (forward) output during torque current based control modes.
Definition TorqueCurrentConfigs.hpp:38
constexpr TorqueCurrentConfigs & WithPeakForwardTorqueCurrent(units::current::ampere_t newPeakForwardTorqueCurrent)
Modifies this configuration's PeakForwardTorqueCurrent parameter and returns itself for method-chaini...
Definition TorqueCurrentConfigs.hpp:74
constexpr TorqueCurrentConfigs & WithTorqueNeutralDeadband(units::current::ampere_t newTorqueNeutralDeadband)
Modifies this configuration's TorqueNeutralDeadband parameter and returns itself for method-chaining ...
Definition TorqueCurrentConfigs.hpp:115
units::current::ampere_t TorqueNeutralDeadband
Configures the output deadband during torque current based control modes.
Definition TorqueCurrentConfigs.hpp:58
constexpr TorqueCurrentConfigs & WithPeakReverseTorqueCurrent(units::current::ampere_t newPeakReverseTorqueCurrent)
Modifies this configuration's PeakReverseTorqueCurrent parameter and returns itself for method-chaini...
Definition TorqueCurrentConfigs.hpp:94
Definition motor_constants.h:14