修改单个参数读取
This commit is contained in:
@@ -431,8 +431,13 @@ void computeInverseKinematics(float linear_velocity_x, float yaw_rate, float max
|
||||
// linear_velocity_x = constrain(linear_velocity_x, -max_torque, max_torque);
|
||||
// yaw_rate = constrain(yaw_rate, -2*max_torque, 2*max_torque);
|
||||
|
||||
if( diff_data.min_Torq > fabs(linear_velocity_x) )//20250728 增加死区 解决手柄回中,不停车问题
|
||||
{
|
||||
linear_velocity_x = 0;
|
||||
}
|
||||
|
||||
left_speed_mps = linear_velocity_x + yaw_rate;
|
||||
right_speed_mps = linear_velocity_x - yaw_rate;
|
||||
right_speed_mps = linear_velocity_x - yaw_rate;
|
||||
|
||||
//扭矩分配
|
||||
if(max_torque < left_speed_mps)
|
||||
@@ -608,7 +613,7 @@ static void diffProcess(void *signal_id)
|
||||
// 限制输出速度在当前速度和最大加速度计算出来的速度之间
|
||||
// output_speed = constrain(output_speed, diff_data.speed - max_acceleration * dt, diff_data.speed + max_acceleration * dt);
|
||||
|
||||
if( (0 == diff_data.desired_yaw_rate) && (0 == diff_data.desired_speed) )//手柄回中,速度小的时候清0
|
||||
if( (0 == diff_data.desired_yaw_rate) && (0 == diff_data.desired_speed) && ( 10 > fabs(diff_data.left_motor_speed) ) && ( 10 > fabs(diff_data.right_motor_speed) ) )//手柄回中,速度小的时候清0
|
||||
{
|
||||
resetPidIntegral(&speed_pid);
|
||||
resetPidIntegral(&yaw_rate_pid);
|
||||
@@ -620,6 +625,7 @@ static void diffProcess(void *signal_id)
|
||||
float out_torque[4] = {0,0,0,0};
|
||||
// 使用差速车辆动力学模型计算左右电机的期望速度
|
||||
computeInverseKinematics(output_speed, output_yaw_rate, diff_data.max_speed, out_torque);
|
||||
|
||||
|
||||
|
||||
if( fabs(diff_data.left_front_motor_speed - diff_data.left_rear_motor_speed) >= diff_data.diff_dead_zone )//如果超过系数
|
||||
|
||||
Reference in New Issue
Block a user