From 0adaf5b89f6bc725c38b2c86e5a9659520249190 Mon Sep 17 00:00:00 2001 From: rein0925 Date: Fri, 12 Apr 2024 20:51:24 +0900 Subject: [PATCH 1/3] =?UTF-8?q?set=5Fq()=E5=86=85=E3=81=AE=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=90=E5=A4=89=E6=95=B0=E3=81=AEthis=E3=83=9D?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=BF=E3=82=92=E6=98=8E=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/schneider_model.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/schneider_model.cpp b/src/schneider_model.cpp index 7e0406d..f93d763 100644 --- a/src/schneider_model.cpp +++ b/src/schneider_model.cpp @@ -167,25 +167,25 @@ inline void Schneider::state_equation() { void Schneider::set_q() { using std::abs; if (abs(q[0] <= 0.4F)) { - q[0] = 0; + this->q[0] = 0; } if (abs(q[1] <= 0.4F)) { - q[1] = 0; + this->q[1] = 0; } - fet_1 = q[0]; - fet_2 = q[1]; + this->fet_1 = this->q[0]; + this->fet_2 = this->q[1]; while (q[2] >= schneider_PI) { - q[2] -= 2 * schneider_PI; + this->q[2] -= 2 * schneider_PI; } while (q[3] >= schneider_PI) { - q[3] -= 2 * schneider_PI; + this->q[3] -= 2 * schneider_PI; } while (q[2] < -schneider_PI) { - q[2] += 2 * schneider_PI; + this->q[2] += 2 * schneider_PI; } while (q[3] < -schneider_PI) { - q[3] += 2 * schneider_PI; + this->q[3] += 2 * schneider_PI; } if (0 < q[2] && q[2] < schneider_PI) { From c415356a66dac0bb2d2228f90cf90744345fdd30 Mon Sep 17 00:00:00 2001 From: rein0925 Date: Fri, 12 Apr 2024 21:47:40 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=BC=8F=E5=86=85?= =?UTF-8?q?=E3=81=A8=E6=AE=8B=E3=82=8A=E3=81=AE=E9=83=A8=E5=88=86=E3=81=AE?= =?UTF-8?q?this=E3=83=9D=E3=82=A4=E3=83=B3=E3=82=BF=E3=82=92=E6=98=8E?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/schneider_model.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/schneider_model.cpp b/src/schneider_model.cpp index f93d763..75eb3aa 100644 --- a/src/schneider_model.cpp +++ b/src/schneider_model.cpp @@ -166,35 +166,35 @@ inline void Schneider::state_equation() { void Schneider::set_q() { using std::abs; - if (abs(q[0] <= 0.4F)) { + if (abs(this->q[0] <= 0.4F)) { this->q[0] = 0; } - if (abs(q[1] <= 0.4F)) { + if (abs(this->q[1] <= 0.4F)) { this->q[1] = 0; } this->fet_1 = this->q[0]; this->fet_2 = this->q[1]; - while (q[2] >= schneider_PI) { + while (this->q[2] >= schneider_PI) { this->q[2] -= 2 * schneider_PI; } - while (q[3] >= schneider_PI) { + while (this->q[3] >= schneider_PI) { this->q[3] -= 2 * schneider_PI; } - while (q[2] < -schneider_PI) { + while (this->q[2] < -schneider_PI) { this->q[2] += 2 * schneider_PI; } - while (q[3] < -schneider_PI) { + while (this->q[3] < -schneider_PI) { this->q[3] += 2 * schneider_PI; } - if (0 < q[2] && q[2] < schneider_PI) { - int width = static_cast(500 + 1900 / schneider_PI * q[2] - 2200 * gyro[2]); - servo_1.pulsewidth_us(width); + if (0 < this->q[2] && this->q[2] < schneider_PI) { + int width = static_cast(500 + 1900 / schneider_PI * this->q[2] - 2200 * this->gyro[2]); + this->servo_1.pulsewidth_us(width); } - if (0 < q[3] && q[3] < schneider_PI) { - int width = static_cast(500 + 1900 / schneider_PI * q[3] + 2200 * gyro[2]); - servo_2.pulsewidth_us(width); + if (0 < this->q[3] && this->q[3] < schneider_PI) { + int width = static_cast(500 + 1900 / schneider_PI * this->q[3] + 2200 * this->gyro[2]); + this->servo_2.pulsewidth_us(width); } } From 94c701abc6402094e3cd74a61eb382f0994566ca Mon Sep 17 00:00:00 2001 From: H1rono Date: Fri, 12 Apr 2024 21:56:39 +0900 Subject: [PATCH 3/3] fmt --- src/schneider_model.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/schneider_model.cpp b/src/schneider_model.cpp index 724f089..d3d7812 100644 --- a/src/schneider_model.cpp +++ b/src/schneider_model.cpp @@ -189,11 +189,13 @@ void Schneider::set_q() { } if (0 < this->q[2] && this->q[2] < schneider_PI) { - const int width = static_cast(500 + 1900 / schneider_PI * this->q[2] - 2200 * this->gyro[2]); + const int width + = static_cast(500 + 1900 / schneider_PI * this->q[2] - 2200 * this->gyro[2]); this->servo_1.pulsewidth_us(width); } if (0 < this->q[3] && this->q[3] < schneider_PI) { - const int width = static_cast(500 + 1900 / schneider_PI * this->q[3] + 2200 * this->gyro[2]); + const int width + = static_cast(500 + 1900 / schneider_PI * this->q[3] + 2200 * this->gyro[2]); this->servo_2.pulsewidth_us(width); } }