From a4ab2d3affd6c7395a03b211aa7cd94f758e3972 Mon Sep 17 00:00:00 2001 From: ShunjiHashimoto Date: Sat, 14 Dec 2024 17:32:35 +0900 Subject: [PATCH] =?UTF-8?q?=E9=80=9F=E5=BA=A6=E5=88=B6=E5=BE=A1=E3=81=AE?= =?UTF-8?q?=E8=AA=BF=E6=95=B4=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Inc/params.hpp | 2 +- Core/Src/motor.cpp | 2 +- Core/Src/robot_controller.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/Inc/params.hpp b/Core/Inc/params.hpp index 6f59d97..22891c1 100644 --- a/Core/Inc/params.hpp +++ b/Core/Inc/params.hpp @@ -8,7 +8,7 @@ namespace MotorParam { const float R = 1.07; // 巻線抵抗[Ω] const float GEAR_RATIO = 43.0/13.0; // ギア比 const float m = 90.0/1000.0; - const float r = 12.0*0.001; // タイヤ半径[m] + const float r = (12.0 + 0.6)*0.001; // タイヤ半径[m], 両面テープの厚さ分0.1*2 const int bit = 4096; // const float stm32_vat = 3.3; const float BAT_RATIO = (25.0/10.0)*(stm32_vat/bit); // 電圧倍率(分圧)*(12bit=4096/3.3V) diff --git a/Core/Src/motor.cpp b/Core/Src/motor.cpp index 6c280b7..cbbcd5b 100644 --- a/Core/Src/motor.cpp +++ b/Core/Src/motor.cpp @@ -40,7 +40,7 @@ extern "C" { int duty_l = motor_l.calcDuty(torque); if(duty_r < 0) duty_r = 0; if(duty_l < 0) duty_l = 0; - motor_r.duty = duty_r; + motor_r.duty = duty_r*1.25; motor_l.duty = duty_l; motor_r.Run(GPIO_PIN_RESET); motor_l.Run(GPIO_PIN_SET); diff --git a/Core/Src/robot_controller.cpp b/Core/Src/robot_controller.cpp index 32a7376..63a8189 100644 --- a/Core/Src/robot_controller.cpp +++ b/Core/Src/robot_controller.cpp @@ -106,11 +106,12 @@ void RobotController::mainControl(){ Mode::ModeType current_mode = mode_manager.getCurrentMode(); if(current_mode == Mode::ModeType::RUN) { - printf("cur_LinearVelocityPIDvel %lf tar_vel %lf\n\r", LinearVelocityPID::current_linear_vel, LinearVelocityPID::target_linear_vel); // printf("tar_vel %lf cur_vel %lf\n\r", AngularVelocityPID::target_angular_vel, this->getCurrentAngularVel()); // printf("duty_r %d, duty_l %d\n\r", motor_r.duty, motor_l.duty); + printf("cur_LinearVelocityPIDvel %lf tar_vel %lf\n\r", LinearVelocityPID::current_linear_vel, LinearVelocityPID::target_linear_vel); printf("current_distance: %lf angle: %lf\n\r", LinearVelocityPID::current_distance, AngularVelocityPID::current_angle); this->straight(540); + // タイヤ系を調整する必要がある // 目標速度のみ与える // float target_distance = 1000;