修正默认偏转角

This commit is contained in:
cyy_mac
2026-08-07 20:13:49 +08:00
parent 78d155c7b6
commit 576784bb4d
5 changed files with 13 additions and 7 deletions

View File

@@ -233,7 +233,7 @@ void Balance_task(void *pvParameters)
} }
//If Turn_Off(Voltage) returns to 1, the car is not allowed to move, and the PWM value is set to 0 //If Turn_Off(Voltage) returns to 1, the car is not allowed to move, and the PWM value is set to 0
//如果Turn_Off(Voltage)返回值为1不允许控制小车进行运动PWM值设置为0 //如果Turn_Off(Voltage)返回值为1不允许控制小车进行运动PWM值设置为0
else Set_Pwm(0,0,0,0,0); else Set_Pwm(0,0,0,0,(Car_Mode == Akm_Car) ? SERVO_INIT : 0);
} }
} }
} }

View File

@@ -15,7 +15,7 @@ u8 Car_Mode=4;
//Servo control PWM value, Ackerman car special //Servo control PWM value, Ackerman car special
//舵机控制PWM值阿克曼小车专用 //舵机控制PWM值阿克曼小车专用
int Servo; int Servo = SERVO_INIT;
//Default speed of remote control car, unit: mm/s //Default speed of remote control car, unit: mm/s
//遥控小车的默认速度单位mm/s //遥控小车的默认速度单位mm/s

View File

@@ -49,7 +49,7 @@
#define EN PDin(3) #define EN PDin(3)
#define Servo_PWM TIM12->CCR2 #define Servo_PWM TIM12->CCR2
#define SERVO_INIT 1600 //Servo zero point //¶æ»úÁãµã #define SERVO_INIT 1590 //Servo zero point //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void Enable_Pin(void); void Enable_Pin(void);
void Servo_PWM_Init(u16 arr,u16 psc); void Servo_PWM_Init(u16 arr,u16 psc);

View File

@@ -465,10 +465,9 @@ void TIM12_SERVO_Init(u16 arr,u16 psc)
//Enable timer //使能定时器 //Enable timer //使能定时器
TIM_Cmd(TIM12, ENABLE); TIM_Cmd(TIM12, ENABLE);
//The channel value is initialized to 1500, corresponding to the steering gear zero //Initialize both servo channels to the configured steering center.
//通道值初始化为1500舵机零点对应值 TIM12->CCR2=SERVO_INIT;
TIM12->CCR2=1500; TIM12->CCR1=SERVO_INIT;
TIM12->CCR1=1500;
} }

7
doc/todo.md Normal file
View File

@@ -0,0 +1,7 @@
1. 实测轮距、轴距和最大可用转角
修改了转角中位值的问题,保持直线行驶 SERVO_INIT 1590
2. 修正后轮半径公式
3. 先限制转角,再计算左右轮速
4. 重新标定舵机 PWM 与实际轮角关系
5. 辨识后轮电机和调整 PI