mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 11:23:49 +08:00
XT4 Sigmoid
This commit is contained in:
@@ -62,6 +62,10 @@ NON_LINEAR_TORQUE_PARAMS = {
|
||||
"left": [3.8, 0.81, 0.24, 0.0465122],
|
||||
"right": [3.8, 0.81, 0.24, 0.0465122],
|
||||
},
|
||||
CAR.CADILLAC_XT4: {
|
||||
"left": [3.6, 0.85, 0.28, 0.0],
|
||||
"right": [3.6, 0.85, 0.28, 0.0],
|
||||
},
|
||||
CAR.CHEVROLET_VOLT: {
|
||||
"left": [1.5, 1.0, 0.155, 0.0],
|
||||
"right": [1.5, 1.0, 0.155, 0.0],
|
||||
|
||||
@@ -2,6 +2,7 @@ import pytest
|
||||
from types import SimpleNamespace
|
||||
from parameterized import parameterized
|
||||
|
||||
from cereal import custom
|
||||
from opendbc.can import CANPacker, CANParser
|
||||
from opendbc.car import Bus, DT_CTRL, structs
|
||||
from opendbc.car.car_helpers import interfaces
|
||||
@@ -245,6 +246,24 @@ class TestGMInterface:
|
||||
assert not sascm_params.pcmCruise
|
||||
assert sascm_params.safetyConfigs[0].safetyParam & GMSafetyFlags.HW_CAM_LONG.value
|
||||
|
||||
def test_cadillac_xt4_uses_nonlinear_torque_curve_with_center_boost(self):
|
||||
CarInterface = interfaces[CAR.CADILLAC_XT4]
|
||||
car_params = CarInterface.get_non_essential_params(CAR.CADILLAC_XT4)
|
||||
ci = CarInterface(car_params, custom.StarPilotCarParams.new_message())
|
||||
torque_from_lataccel = ci.torque_from_lateral_accel()
|
||||
|
||||
low_lataccel = 0.2
|
||||
high_lataccel = 1.0
|
||||
low_torque = torque_from_lataccel(low_lataccel, car_params.lateralTuning.torque)
|
||||
high_torque = torque_from_lataccel(high_lataccel, car_params.lateralTuning.torque)
|
||||
|
||||
linear_low_torque = low_lataccel / car_params.lateralTuning.torque.latAccelFactor
|
||||
linear_high_torque = high_lataccel / car_params.lateralTuning.torque.latAccelFactor
|
||||
|
||||
assert low_torque > linear_low_torque * 1.35
|
||||
assert high_torque == pytest.approx(linear_high_torque, rel=0.02)
|
||||
assert torque_from_lataccel(-low_lataccel, car_params.lateralTuning.torque) == pytest.approx(-low_torque, rel=1e-6)
|
||||
|
||||
|
||||
class TestGMCarController:
|
||||
def test_dash_speed_spoof_respects_live_stock_acc_toggles(self):
|
||||
|
||||
Reference in New Issue
Block a user