CTRE Phoenix 6 C++ 26.0.0-beta-1
Loading...
Searching...
No Matches
GyroTrimConfigs.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/dimensionless.h>
11
12namespace ctre {
13namespace phoenix6 {
14
15
16namespace configs {
17
18/**
19 * \brief Configs to trim the Pigeon2's gyroscope.
20 *
21 * \details Pigeon2 allows the user to trim the gyroscope's
22 * sensitivity. While this isn't necessary for the Pigeon2,
23 * as it comes calibrated out-of-the-box, users can make use
24 * of this to make the Pigeon2 even more accurate for their
25 * application.
26 */
28public:
29 constexpr GyroTrimConfigs() = default;
30
31 /**
32 * \brief The gyro scalar component for the X axis.
33 *
34 * - Minimum Value: -180
35 * - Maximum Value: 180
36 * - Default Value: 0
37 * - Units: deg per rotation
38 */
39 units::dimensionless::scalar_t GyroScalarX = 0;
40 /**
41 * \brief The gyro scalar component for the Y axis.
42 *
43 * - Minimum Value: -180
44 * - Maximum Value: 180
45 * - Default Value: 0
46 * - Units: deg per rotation
47 */
48 units::dimensionless::scalar_t GyroScalarY = 0;
49 /**
50 * \brief The gyro scalar component for the Z axis.
51 *
52 * - Minimum Value: -180
53 * - Maximum Value: 180
54 * - Default Value: 0
55 * - Units: deg per rotation
56 */
57 units::dimensionless::scalar_t GyroScalarZ = 0;
58
59 /**
60 * \brief Modifies this configuration's GyroScalarX parameter and returns itself for
61 * method-chaining and easier to use config API.
62 *
63 * The gyro scalar component for the X axis.
64 *
65 * - Minimum Value: -180
66 * - Maximum Value: 180
67 * - Default Value: 0
68 * - Units: deg per rotation
69 *
70 * \param newGyroScalarX Parameter to modify
71 * \returns Itself
72 */
73 constexpr GyroTrimConfigs &WithGyroScalarX(units::dimensionless::scalar_t newGyroScalarX)
74 {
75 GyroScalarX = std::move(newGyroScalarX);
76 return *this;
77 }
78
79 /**
80 * \brief Modifies this configuration's GyroScalarY parameter and returns itself for
81 * method-chaining and easier to use config API.
82 *
83 * The gyro scalar component for the Y axis.
84 *
85 * - Minimum Value: -180
86 * - Maximum Value: 180
87 * - Default Value: 0
88 * - Units: deg per rotation
89 *
90 * \param newGyroScalarY Parameter to modify
91 * \returns Itself
92 */
93 constexpr GyroTrimConfigs &WithGyroScalarY(units::dimensionless::scalar_t newGyroScalarY)
94 {
95 GyroScalarY = std::move(newGyroScalarY);
96 return *this;
97 }
98
99 /**
100 * \brief Modifies this configuration's GyroScalarZ parameter and returns itself for
101 * method-chaining and easier to use config API.
102 *
103 * The gyro scalar component for the Z axis.
104 *
105 * - Minimum Value: -180
106 * - Maximum Value: 180
107 * - Default Value: 0
108 * - Units: deg per rotation
109 *
110 * \param newGyroScalarZ Parameter to modify
111 * \returns Itself
112 */
113 constexpr GyroTrimConfigs &WithGyroScalarZ(units::dimensionless::scalar_t newGyroScalarZ)
114 {
115 GyroScalarZ = std::move(newGyroScalarZ);
116 return *this;
117 }
118
119
120
121 std::string ToString() const override;
122
123 std::string Serialize() const final;
124 ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final;
125};
126
127}
128}
129}
Configs to trim the Pigeon2's gyroscope.
Definition GyroTrimConfigs.hpp:27
std::string Serialize() const final
constexpr GyroTrimConfigs & WithGyroScalarX(units::dimensionless::scalar_t newGyroScalarX)
Modifies this configuration's GyroScalarX parameter and returns itself for method-chaining and easier...
Definition GyroTrimConfigs.hpp:73
constexpr GyroTrimConfigs & WithGyroScalarY(units::dimensionless::scalar_t newGyroScalarY)
Modifies this configuration's GyroScalarY parameter and returns itself for method-chaining and easier...
Definition GyroTrimConfigs.hpp:93
std::string ToString() const override
units::dimensionless::scalar_t GyroScalarY
The gyro scalar component for the Y axis.
Definition GyroTrimConfigs.hpp:48
ctre::phoenix::StatusCode Deserialize(std::string const &to_deserialize) final
units::dimensionless::scalar_t GyroScalarX
The gyro scalar component for the X axis.
Definition GyroTrimConfigs.hpp:39
constexpr GyroTrimConfigs & WithGyroScalarZ(units::dimensionless::scalar_t newGyroScalarZ)
Modifies this configuration's GyroScalarZ parameter and returns itself for method-chaining and easier...
Definition GyroTrimConfigs.hpp:113
units::dimensionless::scalar_t GyroScalarZ
The gyro scalar component for the Z axis.
Definition GyroTrimConfigs.hpp:57
Definition Configuration.hpp:17
Definition motor_constants.h:14