mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
honda lpf
This commit is contained in:
@@ -25,22 +25,37 @@ def get_civic_bosch_modified_steer_can_max(base_steer_can_max: int, CP) -> int:
|
||||
|
||||
def get_civic_bosch_modified_torque_lpf_tau(torque_cmd: float, prev_torque_cmd: float, v_ego: float) -> float:
|
||||
torque_delta = abs(float(torque_cmd) - float(prev_torque_cmd))
|
||||
torque_cmd_abs = abs(float(torque_cmd))
|
||||
sign_change = (float(torque_cmd) * float(prev_torque_cmd)) < 0.0
|
||||
highway = v_ego > (50.0 * 0.44704)
|
||||
low_speed = v_ego < (30.0 * 0.44704)
|
||||
|
||||
if highway:
|
||||
if sign_change and torque_delta > 0.15:
|
||||
return 0.09
|
||||
return 0.11
|
||||
return 0.10
|
||||
return 0.12
|
||||
|
||||
if sign_change and torque_cmd_abs < 0.25:
|
||||
return 0.22 if low_speed else 0.18
|
||||
|
||||
if low_speed:
|
||||
if torque_delta > 0.50:
|
||||
return 0.14
|
||||
elif torque_delta > 0.20:
|
||||
return 0.16
|
||||
elif torque_delta > 0.05:
|
||||
return 0.18
|
||||
else:
|
||||
return 0.22
|
||||
|
||||
if torque_delta > 0.50:
|
||||
return 0.10
|
||||
elif torque_delta > 0.20:
|
||||
return 0.11
|
||||
elif torque_delta > 0.05:
|
||||
return 0.12
|
||||
else:
|
||||
elif torque_delta > 0.20:
|
||||
return 0.13
|
||||
elif torque_delta > 0.05:
|
||||
return 0.15
|
||||
else:
|
||||
return 0.18
|
||||
|
||||
|
||||
def get_civic_bosch_modified_steering_pressed(raw_pressed: bool, steering_torque: float, torque_cmd: float,
|
||||
|
||||
@@ -40,9 +40,11 @@ class TestHondaFingerprint:
|
||||
assert get_civic_bosch_modified_steer_can_max(4096, CP) == 4096
|
||||
|
||||
def test_modified_civic_torque_lpf_tau_reacts_to_sign_change(self):
|
||||
assert get_civic_bosch_modified_torque_lpf_tau(0.7, -0.1, 25.0) == 0.09
|
||||
assert get_civic_bosch_modified_torque_lpf_tau(0.02, 0.01, 12.0) == 0.15
|
||||
assert get_civic_bosch_modified_torque_lpf_tau(0.30, 0.0, 12.0) == 0.11
|
||||
assert get_civic_bosch_modified_torque_lpf_tau(0.7, -0.1, 25.0) == 0.10
|
||||
assert get_civic_bosch_modified_torque_lpf_tau(0.02, -0.01, 8.0) == 0.22
|
||||
assert get_civic_bosch_modified_torque_lpf_tau(0.02, 0.01, 12.0) == 0.22
|
||||
assert get_civic_bosch_modified_torque_lpf_tau(0.30, 0.0, 12.0) == 0.16
|
||||
assert get_civic_bosch_modified_torque_lpf_tau(0.30, 0.0, 20.0) == 0.13
|
||||
|
||||
def test_modified_civic_steering_pressed_filter_rejects_short_same_direction_spikes(self):
|
||||
filter_s, pressed = get_civic_bosch_modified_steering_pressed(True, 1500.0, 0.8, 0.01, False)
|
||||
@@ -58,7 +60,7 @@ class TestHondaFingerprint:
|
||||
assert pressed
|
||||
|
||||
def test_modified_civic_steering_pressed_filter_allows_opposing_driver_torque_quickly(self):
|
||||
filter_s, pressed = get_civic_bosch_modified_steering_pressed(True, -1500.0, 0.8, 0.07, False)
|
||||
filter_s, pressed = get_civic_bosch_modified_steering_pressed(True, -1500.0, 0.8, 0.10, False)
|
||||
assert pressed
|
||||
|
||||
def test_official_modified_eps_firmwares_restored(self):
|
||||
|
||||
Reference in New Issue
Block a user