CTRE Phoenix 6 C++ 26.50.0-alpha-1
Loading...
Searching...
No Matches
CommutationConfigs.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
12namespace ctre {
13namespace phoenix6 {
14
15
16namespace configs {
17
18/**
19 * \brief Configs that determine motor selection and commutation.
20 *
21 * \details Set these configs to match your motor setup before
22 * commanding motor output.
23 */
25public:
26 constexpr CommutationConfigs() = default;
27
28 /**
29 * \brief Requires Phoenix Pro; Improves commutation and velocity
30 * measurement for motors with hall sensors. Talon can use advanced
31 * features to improve commutation and velocity measurement when using
32 * a motor with hall sensors. This can improve peak efficiency by as
33 * high as 2% and reduce noise in the measured velocity.
34 *
35 * - Default Value: signals#AdvancedHallSupportValue#Disabled
36 */
38 /**
39 * \brief Selects the motor and motor connections used with Talon.
40 *
41 * This setting determines what kind of motor and sensors are used
42 * with the Talon. This also determines what signals are used on the
43 * JST and Gadgeteer port.
44 *
45 * Motor drive will not function correctly if this setting does not
46 * match the physical setup.
47 *
48 * - Default Value: signals#MotorArrangementValue#Disabled
49 */
51 /**
52 * \brief If a brushed motor is selected with Motor Arrangement, this
53 * config determines which of three leads to use.
54 *
55 * - Default Value: signals#BrushedMotorWiringValue#Leads_A_and_B
56 */
58
59 /**
60 * \brief Modifies this configuration's AdvancedHallSupport parameter and returns itself for
61 * method-chaining and easier to use config API.
62 *
63 * Requires Phoenix Pro; Improves commutation and velocity measurement
64 * for motors with hall sensors. Talon can use advanced features to
65 * improve commutation and velocity measurement when using a motor
66 * with hall sensors. This can improve peak efficiency by as high as
67 * 2% and reduce noise in the measured velocity.
68 *
69 * - Default Value: signals#AdvancedHallSupportValue#Disabled
70 *
71 * \param newAdvancedHallSupport Parameter to modify
72 * \returns Itself
73 */
75 {
76 AdvancedHallSupport = std::move(newAdvancedHallSupport);
77 return *this;
78 }
79
80 /**
81 * \brief Modifies this configuration's MotorArrangement parameter and returns itself for
82 * method-chaining and easier to use config API.
83 *
84 * Selects the motor and motor connections used with Talon.
85 *
86 * This setting determines what kind of motor and sensors are used
87 * with the Talon. This also determines what signals are used on the
88 * JST and Gadgeteer port.
89 *
90 * Motor drive will not function correctly if this setting does not
91 * match the physical setup.
92 *
93 * - Default Value: signals#MotorArrangementValue#Disabled
94 *
95 * \param newMotorArrangement Parameter to modify
96 * \returns Itself
97 */
99 {
100 MotorArrangement = std::move(newMotorArrangement);
101 return *this;
102 }
103
104 /**
105 * \brief Modifies this configuration's BrushedMotorWiring parameter and returns itself for
106 * method-chaining and easier to use config API.
107 *
108 * If a brushed motor is selected with Motor Arrangement, this config
109 * determines which of three leads to use.
110 *
111 * - Default Value: signals#BrushedMotorWiringValue#Leads_A_and_B
112 *
113 * \param newBrushedMotorWiring Parameter to modify
114 * \returns Itself
115 */
117 {
118 BrushedMotorWiring = std::move(newBrushedMotorWiring);
119 return *this;
120 }
121
122
123
124 std::string ToString() const override;
125
126 std::string Serialize() const final;
127 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
128};
129
130}
131}
132}
std::string ToString() const override
constexpr CommutationConfigs & WithAdvancedHallSupport(signals::AdvancedHallSupportValue newAdvancedHallSupport)
Modifies this configuration's AdvancedHallSupport parameter and returns itself for method-chaining an...
Definition CommutationConfigs.hpp:74
signals::BrushedMotorWiringValue BrushedMotorWiring
If a brushed motor is selected with Motor Arrangement, this config determines which of three leads to...
Definition CommutationConfigs.hpp:57
signals::AdvancedHallSupportValue AdvancedHallSupport
Requires Phoenix Pro; Improves commutation and velocity measurement for motors with hall sensors.
Definition CommutationConfigs.hpp:37
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
signals::MotorArrangementValue MotorArrangement
Selects the motor and motor connections used with Talon.
Definition CommutationConfigs.hpp:50
constexpr CommutationConfigs & WithBrushedMotorWiring(signals::BrushedMotorWiringValue newBrushedMotorWiring)
Modifies this configuration's BrushedMotorWiring parameter and returns itself for method-chaining and...
Definition CommutationConfigs.hpp:116
constexpr CommutationConfigs & WithMotorArrangement(signals::MotorArrangementValue newMotorArrangement)
Modifies this configuration's MotorArrangement parameter and returns itself for method-chaining and e...
Definition CommutationConfigs.hpp:98
Definition Configuration.hpp:17
Definition ExternalFeedbackConfigs.hpp:21
Definition ExternalFeedbackConfigs.hpp:16
Definition FrcUsageReport.hpp:12
Definition motor_constants.h:14
Requires Phoenix Pro; Improves commutation and velocity measurement for motors with hall sensors.
Definition SpnEnums.hpp:2775
static constexpr int Disabled
Talon will utilize hall sensors without advanced features.
Definition SpnEnums.hpp:2781
If a brushed motor is selected with Motor Arrangement, this config determines which of three leads to...
Definition SpnEnums.hpp:3686
static constexpr int Leads_A_and_B
Third party brushed DC motor with two leads.
Definition SpnEnums.hpp:3700
Selects the motor and motor connections used with Talon.
Definition SpnEnums.hpp:2839
static constexpr int Disabled
Motor is not selected.
Definition SpnEnums.hpp:2847