Skip to content

Commit

Permalink
速度制御の調整完了
Browse files Browse the repository at this point in the history
  • Loading branch information
ShunjiHashimoto committed Dec 14, 2024
1 parent 720ad55 commit a4ab2d3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Core/Inc/params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Core/Src/motor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion Core/Src/robot_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a4ab2d3

Please sign in to comment.