mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
This car b steery
This commit is contained in:
@@ -143,7 +143,7 @@ class TestHondaFingerprint:
|
||||
def test_modified_civic_b_testing_ground_forces_torque(self, monkeypatch):
|
||||
toggles = SimpleNamespace(force_torque_controller=False, nnff=False, nnff_lite=False)
|
||||
car_fw = [CarParams.CarFw(ecu=CarParams.Ecu.eps, fwVersion=b'39990-TGG,A020\x00\x00', address=0x18DA30F1, subAddress=0)]
|
||||
monkeypatch.setattr("openpilot.starpilot.common.testing_grounds.testing_ground.use", lambda slot_id, variant="B": slot_id == "8" and variant == "B")
|
||||
monkeypatch.setattr("openpilot.starpilot.common.testing_grounds.is_testing_ground_active", lambda slot_id, variant="B", refresh_interval_s=0.5: slot_id == "8" and variant == "B")
|
||||
|
||||
CP = CarInterface.get_params(CAR.HONDA_CIVIC_BOSCH, gen_empty_fingerprint(), car_fw, False, False, False, toggles)
|
||||
|
||||
|
||||
@@ -205,6 +205,8 @@ GENESIS_G90_UNWIND_FRICTION_REDUCTION_RIGHT = 0.22
|
||||
|
||||
IONIQ_6_FF_GAIN_LEFT = 0.040
|
||||
IONIQ_6_FF_GAIN_RIGHT = 0.000
|
||||
IONIQ_6_BASE_LAT_ACCEL_FACTOR_MULT = 1.15
|
||||
IONIQ_6_BASE_FRICTION_THRESHOLD = 0.30
|
||||
IONIQ_6_FF_ONSET = 0.10
|
||||
IONIQ_6_FF_ONSET_WIDTH = 0.04
|
||||
IONIQ_6_FF_CUTOFF = 0.48
|
||||
@@ -731,7 +733,7 @@ def get_ioniq_6_ff_scale(desired_lateral_accel: float, desired_lateral_jerk: flo
|
||||
|
||||
|
||||
def get_ioniq_6_friction_threshold(v_ego: float, desired_lateral_accel: float = 0.0, desired_lateral_jerk: float = 0.0) -> float:
|
||||
base_threshold = get_friction_threshold(v_ego)
|
||||
base_threshold = max(get_friction_threshold(v_ego), IONIQ_6_BASE_FRICTION_THRESHOLD)
|
||||
transition_envelope = _ioniq_6_transition_envelope(v_ego, desired_lateral_accel, desired_lateral_jerk)
|
||||
phase = _ioniq_6_transition_phase(desired_lateral_accel, desired_lateral_jerk)
|
||||
turn_in_weight = max(phase, 0.0)
|
||||
@@ -980,6 +982,8 @@ class LatControlTorque(LatControl):
|
||||
self.torque_ff_scale_neg = 1.0
|
||||
self.torque_deadzone_boost = float(getattr(self.torque_params, "kfDEPRECATED", 0.0))
|
||||
self.torque_ki_mult = 1.0
|
||||
if self.is_ioniq_6:
|
||||
self.torque_params.latAccelFactor *= IONIQ_6_BASE_LAT_ACCEL_FACTOR_MULT
|
||||
if self.is_bolt:
|
||||
kp_scale = getattr(self.torque_params, "kp", getattr(self.torque_params, "kpDEPRECATED", 1.0))
|
||||
ki_scale = getattr(self.torque_params, "ki", getattr(self.torque_params, "kiDEPRECATED", 1.0))
|
||||
@@ -991,6 +995,8 @@ class LatControlTorque(LatControl):
|
||||
self.pid._k_i = [self.pid._k_i[0], [k * self.torque_ki_mult for k in self.pid._k_i[1]]]
|
||||
|
||||
def update_live_torque_params(self, latAccelFactor, latAccelOffset, friction):
|
||||
if self.is_ioniq_6:
|
||||
latAccelFactor *= IONIQ_6_BASE_LAT_ACCEL_FACTOR_MULT
|
||||
self.torque_params.latAccelFactor = latAccelFactor
|
||||
self.torque_params.latAccelOffset = latAccelOffset
|
||||
self.torque_params.friction = friction
|
||||
|
||||
@@ -258,7 +258,7 @@ class TestLatControl:
|
||||
assert get_ioniq_6_output_taper_scale(1.2, 0.0, 25.0) > 0.94
|
||||
|
||||
def test_ioniq_6_friction_threshold_curve(self):
|
||||
base = get_friction_threshold(6.0)
|
||||
base = max(get_friction_threshold(6.0), 0.30)
|
||||
left_turn_in = get_ioniq_6_friction_threshold(6.0, 0.5, 0.8)
|
||||
right_turn_in = get_ioniq_6_friction_threshold(6.0, -0.5, -0.8)
|
||||
left_unwind = get_ioniq_6_friction_threshold(6.0, 0.5, -0.8)
|
||||
@@ -266,6 +266,7 @@ class TestLatControl:
|
||||
assert max(left_turn_in, right_turn_in) < base
|
||||
assert left_unwind >= base
|
||||
assert right_unwind >= base
|
||||
assert get_ioniq_6_friction_threshold(25.0, 0.0, 0.0) >= 0.30
|
||||
|
||||
def test_ioniq_6_friction_scale_curve(self):
|
||||
base = get_ioniq_6_friction_scale(25.0, 0.5, 0.8)
|
||||
@@ -366,6 +367,7 @@ class TestLatControl:
|
||||
_, _, lac_log = controller.update(True, CS, VM, params, False, 0.0025, False, 0.2, None, None, starpilot_toggles)
|
||||
|
||||
assert lac_log.active
|
||||
assert controller.torque_params.latAccelFactor == pytest.approx(3.0 * 1.15)
|
||||
|
||||
def test_ioniq_6_update_path_does_not_post_taper_output(self, monkeypatch):
|
||||
base_controller, VM, CS, params, starpilot_toggles = self._build_torque_controller(HYUNDAI.HYUNDAI_IONIQ_6)
|
||||
@@ -382,6 +384,8 @@ class TestLatControl:
|
||||
CP = CarInterface.get_non_essential_params(HONDA.HONDA_CIVIC_BOSCH)
|
||||
CP.flags |= int(HondaFlags.EPS_MODIFIED)
|
||||
CP.lateralTuning.init("torque")
|
||||
CP.lateralTuning.torque.latAccelFactor = 3.0
|
||||
CP.lateralTuning.torque.friction = 0.1
|
||||
CI = CarInterface(CP, custom.StarPilotCarParams.new_message())
|
||||
controller = LatControlTorque(CP.as_reader(), CI, DT_CTRL)
|
||||
VM = VehicleModel(CP)
|
||||
|
||||
Reference in New Issue
Block a user