mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
Fix lateral test initialization
This commit is contained in:
@@ -97,16 +97,6 @@ class LatControlTorque(LatControl):
|
||||
self.prev_desired_lateral_accel = 0.0
|
||||
self.starpilot_lateral_state = custom.StarPilotLateralState.new_message()
|
||||
|
||||
def _clear_starpilot_lateral_state(self):
|
||||
self.starpilot_lateral_state.active = False
|
||||
self.starpilot_lateral_state.frictionThreshold = 0.0
|
||||
self.starpilot_lateral_state.frictionScale = 0.0
|
||||
self.starpilot_lateral_state.feedforward = 0.0
|
||||
self.starpilot_lateral_state.frictionJerk = 0.0
|
||||
self.starpilot_lateral_state.frictionJerkDeadzone = 0.0
|
||||
self.starpilot_lateral_state.lowSpeedFactor = 0.0
|
||||
self.starpilot_lateral_state.unwindDetected = False
|
||||
|
||||
self.is_bolt = CP.carFingerprint in BOLT_CARS
|
||||
self.is_bolt_2022_2023 = CP.carFingerprint in BOLT_2022_2023_CARS
|
||||
self.is_bolt_2018_2021 = CP.carFingerprint in BOLT_2018_2021_CARS
|
||||
@@ -179,6 +169,16 @@ class LatControlTorque(LatControl):
|
||||
if self.use_bolt_ki_multiplier and self.torque_ki_mult > 0.0 and self.torque_ki_mult != 1.0:
|
||||
self.pid._k_i = [self.pid._k_i[0], [k * self.torque_ki_mult for k in self.pid._k_i[1]]]
|
||||
|
||||
def _clear_starpilot_lateral_state(self):
|
||||
self.starpilot_lateral_state.active = False
|
||||
self.starpilot_lateral_state.frictionThreshold = 0.0
|
||||
self.starpilot_lateral_state.frictionScale = 0.0
|
||||
self.starpilot_lateral_state.feedforward = 0.0
|
||||
self.starpilot_lateral_state.frictionJerk = 0.0
|
||||
self.starpilot_lateral_state.frictionJerkDeadzone = 0.0
|
||||
self.starpilot_lateral_state.lowSpeedFactor = 0.0
|
||||
self.starpilot_lateral_state.unwindDetected = False
|
||||
|
||||
def update_live_torque_params(self, latAccelFactor, latAccelOffset, friction):
|
||||
if self.is_palisade:
|
||||
latAccelFactor *= PALISADE_BASE_LAT_ACCEL_FACTOR_MULT
|
||||
|
||||
@@ -129,7 +129,7 @@ class TestLatControl:
|
||||
highway_center = get_center_chatter_friction_jerk_deadzone(25.0, 0.0)
|
||||
highway_curve = get_center_chatter_friction_jerk_deadzone(25.0, 0.6)
|
||||
|
||||
assert low_speed_center == pytest.approx(0.08)
|
||||
assert low_speed_center == pytest.approx(0.096)
|
||||
assert highway_center == pytest.approx(0.18)
|
||||
assert highway_curve == pytest.approx(0.0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user