Przeglądaj źródła

加速的转把处理修改

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 2 lat temu
rodzic
commit
685bfd8d9d
1 zmienionych plików z 4 dodań i 14 usunięć
  1. 4 14
      Applications/foc/core/thro_torque.c

+ 4 - 14
Applications/foc/core/thro_torque.c

@@ -93,15 +93,14 @@ static float _thro_torque_for_accelerate(float ration) {
 	}
 	/*
 	   直接获取油门开度对应的加速扭矩thro_torque 不小于间接计算得到的 acc_torque
-	   如果差值在正负5以上,需要step 补偿
 	*/
 	float torque_acc_ = thro_torque - acc_torque;
 	float step = 0.0f;
-	if (ABS(torque_acc_) < 5) {
-		torque_acc_ = 0;
-	}else {
+	if (torque_acc_ > 0) {
 		float acc_t = mc_get_gear_config()->n_accl_time;
 		step = torque_acc_ / (acc_t + 0.00001f);
+	}else {
+		torque_acc_ = 0;
 	}
 	step_towards(&_torque.torque_acc_, torque_acc_, step);
 	return (acc_torque + _torque.torque_acc_);
@@ -202,8 +201,7 @@ static void thro_torque_filter(float f_throttle) {
 		LowPass_Filter(_torque.spd_filted, curr_rpm, 0.01f);
 	}
 }
-static float acc_r, acc_r_last, acc_trq;
-static float dec_r, dec_r_last, dec_trq;
+
 void thro_torque_process(u8 run_mode, float f_throttle) {
 
 	thro_torque_filter(f_throttle);
@@ -219,9 +217,6 @@ void thro_torque_process(u8 run_mode, float f_throttle) {
 				_torque.torque_real = 0;
 			}
 			_torque.torque_acc_ = 0;
-			acc_r = thro_r;
-			acc_r_last = _torque.thro_ration_last;
-			acc_trq = _torque.torque_real;
 		}
 		_torque.accl = true;
 	}else if (thro_r < _torque.thro_ration) {
@@ -231,9 +226,6 @@ void thro_torque_process(u8 run_mode, float f_throttle) {
 			if (_torque.torque_real < 0) { //电子刹车的时候,扭矩可能为负
 				_torque.torque_real = 0;
 			}
-			dec_r = thro_r;
-			dec_r_last = _torque.thro_ration_last;
-			dec_trq = _torque.torque_real;
 		}
 		_torque.accl = false;
 	}
@@ -279,6 +271,4 @@ float get_user_request_torque(void) {
 void thro_torque_log(void) {
 	sys_debug("accl %d, real %f, req %f\n", _torque.accl, _torque.torque_real, _torque.torque_req);
 	sys_debug("ration %f - %f - %f - %d\n", _torque.thro_ration, _torque.thro_ration_last, thro_torque_for_accelerate(), _torque.gear);
-	sys_debug("acc:%f,%f,%f\n", acc_r, acc_r_last, acc_trq);
-	sys_debug("dec:%f,%f,%f\n", dec_r, dec_r_last, dec_trq);
 }