CTRE Phoenix 6 C++ 26.0.0-beta-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 */
37 /**
38 * \brief Selects the motor and motor connections used with Talon.
39 *
40 * This setting determines what kind of motor and sensors are used
41 * with the Talon. This also determines what signals are used on the
42 * JST and Gadgeteer port.
43 *
44 * Motor drive will not function correctly if this setting does not
45 * match the physical setup.
46 *
47 */
49 /**
50 * \brief If a brushed motor is selected with Motor Arrangement, this
51 * config determines which of three leads to use.
52 *
53 */
55
56 /**
57 * \brief Modifies this configuration's AdvancedHallSupport parameter and returns itself for
58 * method-chaining and easier to use config API.
59 *
60 * Requires Phoenix Pro; Improves commutation and velocity measurement
61 * for motors with hall sensors. Talon can use advanced features to
62 * improve commutation and velocity measurement when using a motor
63 * with hall sensors. This can improve peak efficiency by as high as
64 * 2% and reduce noise in the measured velocity.
65 *
66 *
67 * \param newAdvancedHallSupport Parameter to modify
68 * \returns Itself
69 */
71 {
72 AdvancedHallSupport = std::move(newAdvancedHallSupport);
73 return *this;
74 }
75
76 /**
77 * \brief Modifies this configuration's MotorArrangement parameter and returns itself for
78 * method-chaining and easier to use config API.
79 *
80 * Selects the motor and motor connections used with Talon.
81 *
82 * This setting determines what kind of motor and sensors are used
83 * with the Talon. This also determines what signals are used on the
84 * JST and Gadgeteer port.
85 *
86 * Motor drive will not function correctly if this setting does not
87 * match the physical setup.
88 *
89 *
90 * \param newMotorArrangement Parameter to modify
91 * \returns Itself
92 */
94 {
95 MotorArrangement = std::move(newMotorArrangement);
96 return *this;
97 }
98
99 /**
100 * \brief Modifies this configuration's BrushedMotorWiring parameter and returns itself for
101 * method-chaining and easier to use config API.
102 *
103 * If a brushed motor is selected with Motor Arrangement, this config
104 * determines which of three leads to use.
105 *
106 *
107 * \param newBrushedMotorWiring Parameter to modify
108 * \returns Itself
109 */
111 {
112 BrushedMotorWiring = std::move(newBrushedMotorWiring);
113 return *this;
114 }
115
116
117
118 std::string ToString() const override;
119
120 std::string Serialize() const final;
121 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
122};
123
124}
125}
126}
Configs that determine motor selection and commutation.
Definition CommutationConfigs.hpp:24
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:70
signals::BrushedMotorWiringValue BrushedMotorWiring
If a brushed motor is selected with Motor Arrangement, this config determines which of three leads to...
Definition CommutationConfigs.hpp:54
signals::AdvancedHallSupportValue AdvancedHallSupport
Requires Phoenix Pro; Improves commutation and velocity measurement for motors with hall sensors.
Definition CommutationConfigs.hpp:36
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:48
constexpr CommutationConfigs & WithBrushedMotorWiring(signals::BrushedMotorWiringValue newBrushedMotorWiring)
Modifies this configuration's BrushedMotorWiring parameter and returns itself for method-chaining and...
Definition CommutationConfigs.hpp:110
constexpr CommutationConfigs & WithMotorArrangement(signals::MotorArrangementValue newMotorArrangement)
Modifies this configuration's MotorArrangement parameter and returns itself for method-chaining and e...
Definition CommutationConfigs.hpp:93
Definition Configuration.hpp:17
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