|
|
@@ -14,7 +14,7 @@ void thro_torque_reset(void) {
|
|
|
_torque.accl = false;
|
|
|
_torque.thro_filted = 0.0f;
|
|
|
_torque.thro_ration = _torque.thro_ration_last = 0.0f;
|
|
|
- _torque.torque_req = _torque.torque_real = 0.0f;
|
|
|
+ _torque.torque_req = _torque.torque_real = _torque.torque_acc_ = 0.0f;
|
|
|
_torque.gear = mc_get_internal_gear();
|
|
|
}
|
|
|
|
|
|
@@ -80,6 +80,8 @@ float thro_get_ration(float f_thro) {
|
|
|
|
|
|
static float _thro_torque_for_accelerate(float ration) {
|
|
|
float max_torque = thro_torque_gear_map((s16)_torque.spd_filted, _torque.gear);
|
|
|
+ float thro_torque = max_torque * ration;
|
|
|
+
|
|
|
float acc_r = 1.0f;
|
|
|
if (_torque.thro_ration_last < 1.0f) {
|
|
|
acc_r = (ration - _torque.thro_ration_last)/ (1.0f - _torque.thro_ration_last);
|
|
|
@@ -89,7 +91,20 @@ static float _thro_torque_for_accelerate(float ration) {
|
|
|
if (acc_torque < 0) {
|
|
|
acc_torque = 0;
|
|
|
}
|
|
|
- return acc_torque;
|
|
|
+ /*
|
|
|
+ 直接获取油门开度对应的加速扭矩thro_torque 不小于间接计算得到的 acc_torque
|
|
|
+ 如果差值在正负5以上,需要step 补偿
|
|
|
+ */
|
|
|
+ float torque_acc_ = thro_torque - acc_torque;
|
|
|
+ float step = 0.01f;
|
|
|
+ if (ABS(torque_acc_) < 5) {
|
|
|
+ torque_acc_ = 0;
|
|
|
+ }else {
|
|
|
+ float acc_t = mc_get_gear_config()->n_accl_time;
|
|
|
+ step = torque_acc_ / (acc_t + 0.00001f);
|
|
|
+ }
|
|
|
+ step_towards(&_torque.torque_acc_, torque_acc_, step);
|
|
|
+ return (acc_torque + _torque.torque_acc_);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -203,6 +218,7 @@ void thro_torque_process(u8 run_mode, float f_throttle) {
|
|
|
if (_torque.torque_real < 0) { //电子刹车的时候,扭矩可能为负
|
|
|
_torque.torque_real = 0;
|
|
|
}
|
|
|
+ _torque.torque_acc_ = 0;
|
|
|
acc_r = thro_r;
|
|
|
acc_r_last = _torque.thro_ration_last;
|
|
|
acc_trq = _torque.torque_real;
|