mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 03:13:48 +08:00
Omnifarious Panoply
This commit is contained in:
Binary file not shown.
+14
-15
@@ -150,7 +150,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"AdvancedLateralTune", {PERSISTENT, BOOL, "1", "0", 2}},
|
||||
{"AdvancedLongitudinalTune", {PERSISTENT, BOOL, "1", "0", 3}},
|
||||
{"AggressiveFollow", {PERSISTENT, FLOAT, "1.25", "1.25", 2}},
|
||||
{"AggressiveFollowHigh", {PERSISTENT, FLOAT, "1.25", "1.25", 2}},
|
||||
{"AggressiveFollowHigh", {PERSISTENT, FLOAT, "1.0", "1.0", 2}},
|
||||
{"AggressiveJerkAcceleration", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
{"AggressiveJerkDanger", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"AggressiveJerkDeceleration", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
@@ -193,7 +193,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"CESpeedLead", {PERSISTENT, FLOAT, "0.0", "0.0", 1}},
|
||||
{"CEStatus", {CLEAR_ON_OFFROAD_TRANSITION, INT, "0", "0"}},
|
||||
{"CEStopLights", {PERSISTENT, BOOL, "1", "0", 1}},
|
||||
{"CEStoppedLead", {PERSISTENT, BOOL, "1", "0", 1}},
|
||||
{"CEStoppedLead", {PERSISTENT, BOOL, "0", "0", 1}},
|
||||
{"ClusterOffset", {PERSISTENT, FLOAT, "1.0", "1.0", 2}},
|
||||
{"ColorScheme", {PERSISTENT, STRING, "frog", "stock", 0}},
|
||||
{"ColorToDownload", {CLEAR_ON_MANAGER_START, STRING, "", ""}},
|
||||
@@ -275,7 +275,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"ForceFingerprint", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"ForceOffroad", {CLEAR_ON_MANAGER_START, BOOL, "0", "0"}},
|
||||
{"ForceOnroad", {CLEAR_ON_MANAGER_START, BOOL, "0", "0"}},
|
||||
{"ForceStops", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"ForceStops", {PERSISTENT, BOOL, "1", "0", 2}},
|
||||
{"ForceStopDistanceOffset", {PERSISTENT, INT, "0", "0", 2}},
|
||||
{"ForceStandstill", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"ForceTorqueController", {PERSISTENT, BOOL, "0", "0", 3}},
|
||||
@@ -298,7 +298,6 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"HigherBitrate", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"HolidayThemes", {PERSISTENT, BOOL, "1", "0", 0}},
|
||||
{"HumanAcceleration", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"HumanFollowing", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"CoastUpToLeads", {PERSISTENT, BOOL, "1", "1", 2}},
|
||||
{"HumanLaneChanges", {PERSISTENT, BOOL, "0", "0", 2}},
|
||||
{"IconPack", {PERSISTENT, STRING, "frog-animated", "stock", 0}},
|
||||
@@ -425,13 +424,13 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"ReduceLateralAccelerationRainStorm", {PERSISTENT, INT, "0", "0", 2}},
|
||||
{"ReduceLateralAccelerationSnow", {PERSISTENT, INT, "0", "0", 2}},
|
||||
{"RefuseVolume", {PERSISTENT, INT, "101", "101", 2}},
|
||||
{"RelaxedFollow", {PERSISTENT, FLOAT, "1.75", "1.75", 2}},
|
||||
{"RelaxedFollowHigh", {PERSISTENT, FLOAT, "1.75", "1.75", 2}},
|
||||
{"RelaxedJerkAcceleration", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
{"RelaxedFollow", {PERSISTENT, FLOAT, "1.6", "1.6", 2}},
|
||||
{"RelaxedFollowHigh", {PERSISTENT, FLOAT, "1.4", "1.4", 2}},
|
||||
{"RelaxedJerkAcceleration", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"RelaxedJerkDanger", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"RelaxedJerkDeceleration", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
{"RelaxedJerkSpeed", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
{"RelaxedJerkSpeedDecrease", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
{"RelaxedJerkDeceleration", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"RelaxedJerkSpeed", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"RelaxedJerkSpeedDecrease", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"ReverseCruise", {PERSISTENT, BOOL, "0", "0", 1}},
|
||||
{"RecoveryPower", {PERSISTENT, FLOAT, "1.0", "1.0", 2}},
|
||||
{"RoadEdgesWidth", {PERSISTENT, FLOAT, "2.0", "2.0", 2}},
|
||||
@@ -496,12 +495,12 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"VisionSpeedLimitDetection", {PERSISTENT, BOOL, "0", "0", 0}},
|
||||
{"VisionSpeedLimitTrainingCollector", {PERSISTENT, BOOL, "1", "1", 0}},
|
||||
{"StandardFollow", {PERSISTENT, FLOAT, "1.45", "1.45", 2}},
|
||||
{"StandardFollowHigh", {PERSISTENT, FLOAT, "1.45", "1.45", 2}},
|
||||
{"StandardJerkAcceleration", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
{"StandardFollowHigh", {PERSISTENT, FLOAT, "1.2", "1.2", 2}},
|
||||
{"StandardJerkAcceleration", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"StandardJerkDanger", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"StandardJerkDeceleration", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
{"StandardJerkSpeed", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
{"StandardJerkSpeedDecrease", {PERSISTENT, FLOAT, "50.0", "50.0", 3}},
|
||||
{"StandardJerkDeceleration", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"StandardJerkSpeed", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"StandardJerkSpeedDecrease", {PERSISTENT, FLOAT, "100.0", "100.0", 3}},
|
||||
{"StandbyMode", {PERSISTENT, BOOL, "0", "0", 1}},
|
||||
{"StartAccel", {PERSISTENT, FLOAT, "0.0", "0.0", 3}},
|
||||
{"StartAccelStock", {PERSISTENT, FLOAT, "0.0", "0.0", 3}},
|
||||
|
||||
Binary file not shown.
@@ -11,6 +11,7 @@ from opendbc.car.structs import CarParams, CarParamsT
|
||||
from opendbc.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars
|
||||
from opendbc.car.fw_versions import ObdCallback, get_fw_versions_ordered, get_present_ecus, match_fw_to_car
|
||||
from opendbc.car.mock.values import CAR as MOCK
|
||||
from opendbc.car.toyota.values import ToyotaSafetyFlags
|
||||
from opendbc.car.values import BRANDS
|
||||
from opendbc.car.vin import get_vin, is_valid_vin, VIN_UNKNOWN
|
||||
from openpilot.common.params import Params
|
||||
@@ -108,6 +109,20 @@ def _normalize_gm_bolt_candidate(candidate: str | None, fingerprints: dict[int,
|
||||
return candidate
|
||||
|
||||
|
||||
def _apply_disable_openpilot_long(CP: CarParams, FPCP: StarPilotCarParams) -> None:
|
||||
CP.openpilotLongitudinalControl = False
|
||||
CP.pcmCruise = True
|
||||
FPCP.openpilotLongitudinalControlDisabled = True
|
||||
|
||||
if CP.brand == "toyota":
|
||||
# Toyota stock longitudinal safety changes the forwarding rules so the
|
||||
# camera's ACC_CONTROL message can reach the PT bus again.
|
||||
for cfg in CP.safetyConfigs:
|
||||
cfg.safetyParam |= ToyotaSafetyFlags.STOCK_LONGITUDINAL.value
|
||||
for cfg in FPCP.safetyConfigs:
|
||||
cfg.safetyParam |= ToyotaSafetyFlags.STOCK_LONGITUDINAL.value
|
||||
|
||||
|
||||
def _normalize_gm_volt_candidate(candidate: str | None, fingerprints: dict[int, dict]) -> str | None:
|
||||
cam = fingerprints.get(GM_CAMERA_BUS, {})
|
||||
has_live_camera_msg = GM_VOLT_CAMERA_MSG in cam
|
||||
@@ -318,8 +333,7 @@ def get_car(can_recv: CanRecvCallable, can_send: CanSendCallable, set_obd_multip
|
||||
FPCP: StarPilotCarParams = CarInterface.get_starpilot_params(candidate, fingerprints, car_fw, CP, starpilot_toggles)
|
||||
|
||||
if not CP.alphaLongitudinalAvailable and starpilot_toggles.disable_openpilot_long:
|
||||
CP.openpilotLongitudinalControl = False
|
||||
FPCP.openpilotLongitudinalControlDisabled = True
|
||||
_apply_disable_openpilot_long(CP, FPCP)
|
||||
|
||||
return interfaces[CP.carFingerprint](CP, FPCP)
|
||||
|
||||
|
||||
@@ -571,9 +571,9 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.openpilotLongitudinalControl = not disable_openpilot_long
|
||||
|
||||
volt_test_tune_active = (
|
||||
testing_ground.use_2 and
|
||||
ret.openpilotLongitudinalControl and
|
||||
candidate in VOLT_LONG_TEST_TUNE_CARS
|
||||
candidate in VOLT_LONG_TEST_TUNE_CARS and
|
||||
(testing_ground.use_2 or not ret.enableGasInterceptorDEPRECATED)
|
||||
)
|
||||
if volt_test_tune_active:
|
||||
# Volt long can still fall back to an all-I tune on both the interceptor and
|
||||
|
||||
@@ -60,24 +60,39 @@ class TestGMInterface:
|
||||
|
||||
assert car_params.minSteerSpeed == pytest.approx(7 * CV.MPH_TO_MS)
|
||||
|
||||
@parameterized.expand([
|
||||
("interceptor", True),
|
||||
("ascm_int", False),
|
||||
])
|
||||
def test_volt_testing_ground_tune_sets_nonzero_p_and_starting_state(self, _name, pedal_present, monkeypatch):
|
||||
def test_volt_testing_ground_tune_sets_nonzero_p_and_starting_state(self, monkeypatch):
|
||||
CarInterface = interfaces[CAR.CHEVROLET_VOLT_ASCM]
|
||||
fingerprint = _empty_fingerprint()
|
||||
if pedal_present:
|
||||
fingerprint[0][0x201] = 8 # pedal detected
|
||||
fingerprint[0][0x201] = 8 # pedal detected
|
||||
fingerprint[0][0x2FF] = 8 # SASCM detected
|
||||
|
||||
monkeypatch.setattr(gm_interface.testing_ground, "use_2", True, raising=False)
|
||||
monkeypatch.setattr(gm_interface, "testing_ground", SimpleNamespace(use_2=True), raising=False)
|
||||
|
||||
car_params = CarInterface.get_params(CAR.CHEVROLET_VOLT_ASCM, fingerprint, [], alpha_long=False, is_release=False, docs=False,
|
||||
starpilot_toggles=_test_starpilot_toggles())
|
||||
|
||||
assert list(car_params.longitudinalTuning.kpV) == [0.10, 0.072, 0.05, 0.04]
|
||||
assert list(car_params.longitudinalTuning.kiV) == [0.025, 0.03, 0.04, 0.055]
|
||||
assert list(car_params.longitudinalTuning.kpV) == pytest.approx([0.10, 0.072, 0.05, 0.04])
|
||||
assert list(car_params.longitudinalTuning.kiV) == pytest.approx([0.025, 0.03, 0.04, 0.055])
|
||||
assert car_params.startingState
|
||||
assert car_params.startAccel == pytest.approx(1.15)
|
||||
|
||||
@parameterized.expand([
|
||||
("volt_2019", CAR.CHEVROLET_VOLT_2019, True),
|
||||
("volt_ascm", CAR.CHEVROLET_VOLT_ASCM, True),
|
||||
])
|
||||
def test_non_pedal_volt_alpha_long_uses_volt_tune_by_default(self, _name, car_model, needs_sascm):
|
||||
CarInterface = interfaces[car_model]
|
||||
fingerprint = _empty_fingerprint()
|
||||
if needs_sascm:
|
||||
fingerprint[0][0x2FF] = 8 # SASCM detected
|
||||
|
||||
car_params = CarInterface.get_params(car_model, fingerprint, [], alpha_long=True, is_release=False, docs=False,
|
||||
starpilot_toggles=_test_starpilot_toggles())
|
||||
|
||||
assert car_params.openpilotLongitudinalControl
|
||||
assert not car_params.enableGasInterceptorDEPRECATED
|
||||
assert list(car_params.longitudinalTuning.kpV) == pytest.approx([0.10, 0.072, 0.05, 0.04])
|
||||
assert list(car_params.longitudinalTuning.kiV) == pytest.approx([0.025, 0.03, 0.04, 0.055])
|
||||
assert car_params.startingState
|
||||
assert car_params.startAccel == pytest.approx(1.15)
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ HYUNDAI_CANFD_SCC_DECEL_STEP = 12.5 / 50.0
|
||||
IONIQ_6_RESPONSE_MULTIPLIER = 1.2
|
||||
IONIQ_6_CANFD_SCC_ACCEL_STEP = (6.0 / 50.0) * IONIQ_6_RESPONSE_MULTIPLIER
|
||||
IONIQ_6_CANFD_SCC_DECEL_STEP = (15.0 / 50.0) * IONIQ_6_RESPONSE_MULTIPLIER
|
||||
GENESIS_G90_STOP_HOLD_SPEED_BP = [0.0, 0.03, 0.08, 0.16, 0.3, 0.5]
|
||||
GENESIS_G90_STOP_HOLD_ACCEL_V = [-0.12, -0.12, -0.15, -0.22, -0.50, -0.95]
|
||||
GENESIS_G90_STOP_HOLD_RELAX_SPEED_BP = [0.0, 0.08, 0.16, 0.3, 0.5]
|
||||
GENESIS_G90_STOP_HOLD_RELAX_STEP_V = [0.08, 0.08, 0.06, 0.04, 0.025]
|
||||
GENESIS_G90_STOP_HOLD_SPEED_BP = [0.0, 0.03, 0.08, 0.16, 0.3, 0.5, 0.8, 1.2, 2.0, 3.0]
|
||||
GENESIS_G90_STOP_HOLD_ACCEL_V = [-0.10, -0.10, -0.12, -0.18, -0.30, -0.50, -0.75, -1.00, -1.40, -1.80]
|
||||
GENESIS_G90_STOP_HOLD_RELAX_SPEED_BP = [0.0, 0.08, 0.16, 0.3, 0.5, 0.8, 1.2, 2.0, 3.0]
|
||||
GENESIS_G90_STOP_HOLD_RELAX_STEP_V = [0.10, 0.10, 0.08, 0.06, 0.04, 0.035, 0.03, 0.022, 0.018]
|
||||
GENESIS_G90_RELEASE_SPEED_BP = [0.0, 0.3, 0.6]
|
||||
GENESIS_G90_RELEASE_ACCEL_STEP_V = [0.05, 0.07, 0.11]
|
||||
GENESIS_G90_RELEASE_DECEL_STEP_V = [0.16, 0.18, 0.18]
|
||||
@@ -163,7 +163,8 @@ def update_genesis_g90_longitudinal_tuning(state: GenesisG90LongitudinalTuningSt
|
||||
stopping = long_control_state == LongCtrlState.stopping
|
||||
if stopping and v_ego <= GENESIS_G90_STOP_HOLD_SPEED_BP[-1]:
|
||||
state.release_active = False
|
||||
target_hold = float(np.interp(v_ego, GENESIS_G90_STOP_HOLD_SPEED_BP, GENESIS_G90_STOP_HOLD_ACCEL_V))
|
||||
stop_brake_cap = float(np.interp(v_ego, GENESIS_G90_STOP_HOLD_SPEED_BP, GENESIS_G90_STOP_HOLD_ACCEL_V))
|
||||
target_hold = min(0.0, max(accel_cmd, stop_brake_cap))
|
||||
if state.actual_accel < target_hold:
|
||||
relax_step = float(np.interp(v_ego, GENESIS_G90_STOP_HOLD_RELAX_SPEED_BP, GENESIS_G90_STOP_HOLD_RELAX_STEP_V))
|
||||
state.actual_accel = min(state.actual_accel + relax_step, target_hold)
|
||||
|
||||
@@ -7,7 +7,8 @@ from opendbc.can import CANDefine, CANParser
|
||||
from opendbc.car import Bus, create_button_events, structs
|
||||
from opendbc.car.common.conversions import Conversions as CV
|
||||
from opendbc.car.hyundai.hyundaicanfd import CanBus
|
||||
from opendbc.car.hyundai.values import HyundaiFlags, HyundaiStarPilotFlags, CAR, DBC, Buttons, CarControllerParams
|
||||
from opendbc.car.hyundai.values import HyundaiFlags, HyundaiStarPilotFlags, CAR, DBC, Buttons, CarControllerParams, \
|
||||
hyundai_cancel_button_enables_cruise
|
||||
from opendbc.car.interfaces import CarStateBase
|
||||
|
||||
ButtonType = structs.CarState.ButtonEvent.Type
|
||||
@@ -59,6 +60,7 @@ class CarState(CarStateBase):
|
||||
self.left_paddle = 0
|
||||
self.mode_button = 0
|
||||
self.custom_button = 0
|
||||
self.cancel_button_enable_in_progress = False
|
||||
|
||||
self.gear_msg_canfd = "ACCELERATOR" if CP.flags & HyundaiFlags.EV else \
|
||||
"GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else \
|
||||
@@ -109,6 +111,25 @@ class CarState(CarStateBase):
|
||||
# Main button also can trigger an engagement on these cars
|
||||
return any(btn in ENABLE_BUTTONS for btn in self.cruise_buttons) or any(self.main_buttons)
|
||||
|
||||
def create_cruise_button_events(self, cur_button: int, prev_button: int) -> list[structs.CarState.ButtonEvent]:
|
||||
if cur_button != prev_button and prev_button != Buttons.CANCEL and cur_button == Buttons.CANCEL:
|
||||
self.cancel_button_enable_in_progress = (
|
||||
self.CP.openpilotLongitudinalControl and
|
||||
hyundai_cancel_button_enables_cruise(self.CP.carFingerprint) and
|
||||
not self.out.cruiseState.enabled
|
||||
)
|
||||
|
||||
buttons_dict = BUTTONS_DICT
|
||||
if self.cancel_button_enable_in_progress:
|
||||
buttons_dict = BUTTONS_DICT | {Buttons.CANCEL: ButtonType.accelCruise}
|
||||
|
||||
events = create_button_events(cur_button, prev_button, buttons_dict)
|
||||
|
||||
if cur_button != Buttons.CANCEL:
|
||||
self.cancel_button_enable_in_progress = False
|
||||
|
||||
return events
|
||||
|
||||
def update(self, can_parsers, starpilot_toggles) -> structs.CarState:
|
||||
cp = can_parsers[Bus.pt]
|
||||
cp_cam = can_parsers[Bus.cam]
|
||||
@@ -249,7 +270,7 @@ class CarState(CarStateBase):
|
||||
if self.CP.flags & HyundaiFlags.HAS_LDA_BUTTON:
|
||||
self.lda_button = cp.vl["BCM_PO_11"]["LDA_BTN"]
|
||||
|
||||
ret.buttonEvents = [*create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT),
|
||||
ret.buttonEvents = [*self.create_cruise_button_events(self.cruise_buttons[-1], prev_cruise_buttons),
|
||||
*create_button_events(self.main_buttons[-1], prev_main_buttons, {1: ButtonType.mainCruise}),
|
||||
*create_button_events(self.lda_button, prev_lda_button, {1: ButtonType.lkas})]
|
||||
|
||||
@@ -375,7 +396,7 @@ class CarState(CarStateBase):
|
||||
if cp.ts_nanos["BLINKER_STALKS"]["CHECKSUM_MAYBE"] > 0:
|
||||
self.stock_blinker_stalks_ts = cp.ts_nanos["BLINKER_STALKS"]["CHECKSUM_MAYBE"]
|
||||
|
||||
ret.buttonEvents = [*create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT),
|
||||
ret.buttonEvents = [*self.create_cruise_button_events(self.cruise_buttons[-1], prev_cruise_buttons),
|
||||
*create_button_events(self.main_buttons[-1], prev_main_buttons, {1: ButtonType.mainCruise}),
|
||||
*create_button_events(self.lda_button, prev_lda_button, {1: ButtonType.lkas}),
|
||||
*create_button_events(self.left_paddle, prev_left_paddle, {1: ButtonType.altButton2})]
|
||||
|
||||
@@ -4,7 +4,8 @@ from opendbc.car.hyundai.hyundaicanfd import CanBus
|
||||
from opendbc.car.hyundai.values import HyundaiFlags, CAR, DBC, \
|
||||
CANFD_UNSUPPORTED_LONGITUDINAL_CAR, \
|
||||
CANFD_SECURITYACCESS_CAR, \
|
||||
UNSUPPORTED_LONGITUDINAL_CAR, HyundaiSafetyFlags
|
||||
UNSUPPORTED_LONGITUDINAL_CAR, HyundaiSafetyFlags, \
|
||||
hyundai_cancel_button_enables_cruise
|
||||
from opendbc.car.hyundai.radar_interface import RADAR_START_ADDR
|
||||
from opendbc.car.interfaces import CarInterfaceBase
|
||||
from opendbc.car.disable_ecu import disable_ecu, ecu_log
|
||||
@@ -138,6 +139,8 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.flags |= HyundaiFlags.HAS_LDA_BUTTON.value
|
||||
if ret.flags & HyundaiFlags.CAN_CANFD_BLENDED:
|
||||
ret.safetyConfigs[-1].safetyParam |= HyundaiSafetyFlags.CAN_CANFD_BLENDED.value
|
||||
if hyundai_cancel_button_enables_cruise(candidate):
|
||||
ret.safetyConfigs[-1].safetyParam |= HyundaiSafetyFlags.CANCEL_BTN_ENABLE.value
|
||||
|
||||
if candidate == CAR.KIA_FORTE:
|
||||
has_scc_fw = any(fw.ecu == Ecu.fwdRadar for fw in car_fw)
|
||||
@@ -189,6 +192,10 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
# Car specific configuration overrides
|
||||
|
||||
if candidate == CAR.GENESIS_G90:
|
||||
ret.stoppingDecelRate = 0.55
|
||||
ret.vEgoStopping = 0.8
|
||||
|
||||
if candidate == CAR.KIA_OPTIMA_G4_FL:
|
||||
ret.steerActuatorDelay = 0.2
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ from opendbc.car.hyundai.radar_interface import RADAR_START_ADDR
|
||||
from opendbc.car.hyundai.values import CAMERA_SCC_CAR, CANFD_CAR, CAN_GEARS, CAR, CHECKSUM, DATE_FW_ECUS, \
|
||||
HYBRID_CAR, EV_CAR, FW_QUERY_CONFIG, LEGACY_SAFETY_MODE_CAR, CANFD_FUZZY_WHITELIST, \
|
||||
UNSUPPORTED_LONGITUDINAL_CAR, PLATFORM_CODE_ECUS, HYUNDAI_VERSION_REQUEST_LONG, \
|
||||
CarControllerParams, DBC, HyundaiFlags, get_platform_codes, HyundaiSafetyFlags
|
||||
CarControllerParams, DBC, HyundaiFlags, get_platform_codes, HyundaiSafetyFlags, Buttons
|
||||
|
||||
LongCtrlState = CarControl.Actuators.LongControlState
|
||||
from opendbc.car.hyundai.fingerprints import FW_VERSIONS
|
||||
@@ -101,6 +101,24 @@ class TestHyundaiFingerprint:
|
||||
assert palisade_2023.flags & HyundaiFlags.CAN_CANFD_BLENDED
|
||||
assert DBC[palisade_2023.carFingerprint][Bus.pt] == "hyundai_palisade_2023_generated"
|
||||
assert palisade_2023.safetyConfigs[-1].safetyParam & HyundaiSafetyFlags.CAN_CANFD_BLENDED
|
||||
assert palisade_2023.safetyConfigs[-1].safetyParam & HyundaiSafetyFlags.CANCEL_BTN_ENABLE
|
||||
|
||||
def test_palisade_2023_pause_resume_button_maps_to_enable(self):
|
||||
toggles = get_test_toggles()
|
||||
CP = CarInterface.get_params(CAR.HYUNDAI_PALISADE_2023, gen_empty_fingerprint(), [], True, False, False, toggles)
|
||||
FPCP = CarInterface.get_starpilot_params(CAR.HYUNDAI_PALISADE_2023, gen_empty_fingerprint(), [], CP, toggles)
|
||||
car_state = CarState(CP, FPCP)
|
||||
|
||||
car_state.out.cruiseState.enabled = False
|
||||
events = car_state.create_cruise_button_events(Buttons.CANCEL, Buttons.NONE)
|
||||
assert [(be.type, be.pressed) for be in events] == [(ButtonType.accelCruise, True)]
|
||||
|
||||
events = car_state.create_cruise_button_events(Buttons.NONE, Buttons.CANCEL)
|
||||
assert [(be.type, be.pressed) for be in events] == [(ButtonType.accelCruise, False)]
|
||||
|
||||
car_state.out.cruiseState.enabled = True
|
||||
events = car_state.create_cruise_button_events(Buttons.CANCEL, Buttons.NONE)
|
||||
assert [(be.type, be.pressed) for be in events] == [(ButtonType.cancel, True)]
|
||||
|
||||
def test_palisade_2023_disable_failure_falls_back_to_stock_acc(self, monkeypatch):
|
||||
toggles = get_test_toggles()
|
||||
@@ -130,6 +148,13 @@ class TestHyundaiFingerprint:
|
||||
assert CP.longitudinalActuatorDelay == pytest.approx(0.5)
|
||||
assert CP.startingState
|
||||
|
||||
def test_genesis_g90_longitudinal_params_bias_toward_earlier_stop_handoff(self):
|
||||
toggles = get_test_toggles()
|
||||
CP = CarInterface.get_params(CAR.GENESIS_G90, gen_empty_fingerprint(), [], True, False, False, toggles)
|
||||
|
||||
assert CP.vEgoStopping == pytest.approx(0.8)
|
||||
assert CP.stoppingDecelRate == pytest.approx(0.55)
|
||||
|
||||
def test_kia_forte_no_scc_fw_match(self):
|
||||
car_fw = [
|
||||
CarParams.CarFw(
|
||||
@@ -333,7 +358,7 @@ class TestHyundaiFingerprint:
|
||||
|
||||
state = update_genesis_g90_longitudinal_tuning(state, accel_cmd=-2.0, v_ego=0.02,
|
||||
long_control_state=LongCtrlState.stopping, long_active=True)
|
||||
assert state.actual_accel == pytest.approx(-0.12)
|
||||
assert state.actual_accel == pytest.approx(-0.10)
|
||||
assert not state.release_active
|
||||
|
||||
def test_genesis_g90_longitudinal_tuning_gradually_unwinds_into_stop_hold(self):
|
||||
@@ -341,11 +366,22 @@ class TestHyundaiFingerprint:
|
||||
|
||||
state = update_genesis_g90_longitudinal_tuning(state, accel_cmd=-2.0, v_ego=0.5,
|
||||
long_control_state=LongCtrlState.stopping, long_active=True)
|
||||
assert state.actual_accel == pytest.approx(-1.975)
|
||||
assert state.actual_accel == pytest.approx(-1.96)
|
||||
|
||||
state = update_genesis_g90_longitudinal_tuning(state, accel_cmd=-2.0, v_ego=0.3,
|
||||
long_control_state=LongCtrlState.stopping, long_active=True)
|
||||
assert state.actual_accel == pytest.approx(-1.935)
|
||||
assert state.actual_accel == pytest.approx(-1.9)
|
||||
|
||||
def test_genesis_g90_longitudinal_tuning_caps_low_speed_stop_brake(self):
|
||||
state = GenesisG90LongitudinalTuningState(actual_accel=-1.0)
|
||||
|
||||
state = update_genesis_g90_longitudinal_tuning(state, accel_cmd=-0.4, v_ego=0.3,
|
||||
long_control_state=LongCtrlState.stopping, long_active=True)
|
||||
assert state.actual_accel == pytest.approx(-0.94)
|
||||
|
||||
state = update_genesis_g90_longitudinal_tuning(state, accel_cmd=-0.4, v_ego=0.3,
|
||||
long_control_state=LongCtrlState.stopping, long_active=True)
|
||||
assert state.actual_accel == pytest.approx(-0.88)
|
||||
|
||||
def test_genesis_g90_longitudinal_tuning_ramps_out_of_stop_hold(self):
|
||||
state = GenesisG90LongitudinalTuningState(actual_accel=-0.12, long_control_state_last=LongCtrlState.stopping)
|
||||
|
||||
@@ -107,6 +107,7 @@ class HyundaiSafetyFlags(IntFlag):
|
||||
CANFD_ANGLE_STEERING = 1024
|
||||
NON_SCC = 4096
|
||||
CAN_CANFD_BLENDED = 8192
|
||||
CANCEL_BTN_ENABLE = 16384
|
||||
|
||||
|
||||
class HyundaiStarPilotSafetyFlags(IntFlag):
|
||||
@@ -672,6 +673,15 @@ class Buttons:
|
||||
CANCEL = 4 # on newer models, this is a pause/resume button
|
||||
|
||||
|
||||
CANCEL_BUTTON_ENABLE_CARS = frozenset({
|
||||
CAR.HYUNDAI_PALISADE_2023,
|
||||
})
|
||||
|
||||
|
||||
def hyundai_cancel_button_enables_cruise(car_fingerprint) -> bool:
|
||||
return car_fingerprint in CANCEL_BUTTON_ENABLE_CARS
|
||||
|
||||
|
||||
def get_platform_codes(fw_versions: list[bytes]) -> set[tuple[bytes, bytes | None]]:
|
||||
# Returns unique, platform-specific identification codes for a set of versions
|
||||
codes = set() # (code-Optional[part], date)
|
||||
|
||||
@@ -9,7 +9,7 @@ from typing import Any
|
||||
|
||||
from cereal import custom
|
||||
from opendbc.car import DT_CTRL, CanData, structs
|
||||
from opendbc.car.car_helpers import interfaces
|
||||
from opendbc.car.car_helpers import _apply_disable_openpilot_long, interfaces
|
||||
from opendbc.car.chrysler.carstate import CarState as ChryslerCarState
|
||||
from opendbc.car.fingerprints import FW_VERSIONS
|
||||
from opendbc.car.fw_versions import FW_QUERY_CONFIGS
|
||||
@@ -18,6 +18,7 @@ from opendbc.car.hyundai.values import CAR as HYUNDAI_CAR, HyundaiStarPilotSafet
|
||||
from opendbc.car.gm.values import CAR as GM_CAR, CanBus as GMCanBus, GMSafetyFlags
|
||||
from opendbc.car.interfaces import CarInterfaceBase, CarStateBase, get_interface_attr
|
||||
from opendbc.car.mock.values import CAR as MOCK
|
||||
from opendbc.car.toyota.values import CAR as TOYOTA_CAR, ToyotaSafetyFlags
|
||||
from opendbc.car.values import PLATFORMS
|
||||
|
||||
DrawType = Callable[[st.SearchStrategy], Any]
|
||||
@@ -213,6 +214,40 @@ class TestCarInterfaces:
|
||||
)
|
||||
assert fp_car_params.safetyConfigs[-1].safetyParam & HyundaiStarPilotSafetyFlags.AOL_LKAS_ON_ENGAGE.value
|
||||
|
||||
def test_toyota_disable_openpilot_long_sets_stock_long_safety_flag(self):
|
||||
CarInterface = interfaces[TOYOTA_CAR.TOYOTA_PRIUS_TSS2]
|
||||
fingerprint = {bus: {} for bus in range(8)}
|
||||
toggles = get_test_starpilot_toggles()
|
||||
|
||||
car_params = CarInterface.get_params(
|
||||
TOYOTA_CAR.TOYOTA_PRIUS_TSS2,
|
||||
fingerprint,
|
||||
[],
|
||||
alpha_long=False,
|
||||
is_release=False,
|
||||
docs=False,
|
||||
starpilot_toggles=toggles,
|
||||
)
|
||||
assert car_params.openpilotLongitudinalControl
|
||||
assert not car_params.alphaLongitudinalAvailable
|
||||
assert not (car_params.safetyConfigs[0].safetyParam & ToyotaSafetyFlags.STOCK_LONGITUDINAL.value)
|
||||
|
||||
fp_car_params = CarInterface.get_starpilot_params(
|
||||
TOYOTA_CAR.TOYOTA_PRIUS_TSS2,
|
||||
fingerprint,
|
||||
[],
|
||||
car_params,
|
||||
toggles,
|
||||
)
|
||||
|
||||
_apply_disable_openpilot_long(car_params, fp_car_params)
|
||||
|
||||
assert not car_params.openpilotLongitudinalControl
|
||||
assert car_params.pcmCruise
|
||||
assert fp_car_params.openpilotLongitudinalControlDisabled
|
||||
assert car_params.safetyConfigs[0].safetyParam & ToyotaSafetyFlags.STOCK_LONGITUDINAL.value
|
||||
assert fp_car_params.safetyConfigs[0].safetyParam & ToyotaSafetyFlags.STOCK_LONGITUDINAL.value
|
||||
|
||||
# FIXME: Due to the lists used in carParams, Phase.target is very slow and will cause
|
||||
# many generated examples to overrun when max_examples > ~20, don't use it
|
||||
@pytest.mark.parametrize("car_name", sorted(PLATFORMS))
|
||||
|
||||
@@ -54,6 +54,9 @@ bool hyundai_aol_lkas_on_engage = false;
|
||||
extern bool hyundai_non_scc;
|
||||
bool hyundai_non_scc = false;
|
||||
|
||||
extern bool hyundai_cancel_button_enable;
|
||||
bool hyundai_cancel_button_enable = false;
|
||||
|
||||
static uint8_t hyundai_last_button_interaction; // button messages since the user pressed an enable button
|
||||
|
||||
void hyundai_common_init(uint16_t param) {
|
||||
@@ -69,6 +72,7 @@ void hyundai_common_init(uint16_t param) {
|
||||
const uint16_t HYUNDAI_PARAM_AOL_LKAS_ON_ENGAGE = 2048;
|
||||
const uint16_t HYUNDAI_PARAM_NON_SCC = 4096;
|
||||
const uint16_t HYUNDAI_PARAM_CAN_CANFD_BLENDED = 8192;
|
||||
const uint16_t HYUNDAI_PARAM_CANCEL_BTN_ENABLE = 16384;
|
||||
|
||||
hyundai_ev_gas_signal = GET_FLAG(param, HYUNDAI_PARAM_EV_GAS);
|
||||
hyundai_hybrid_gas_signal = !hyundai_ev_gas_signal && GET_FLAG(param, HYUNDAI_PARAM_HYBRID_GAS);
|
||||
@@ -82,6 +86,7 @@ void hyundai_common_init(uint16_t param) {
|
||||
hyundai_has_lda_button = GET_FLAG(param, HYUNDAI_PARAM_HAS_LDA_BUTTON);
|
||||
hyundai_aol_lkas_on_engage = GET_FLAG(param, HYUNDAI_PARAM_AOL_LKAS_ON_ENGAGE);
|
||||
hyundai_non_scc = GET_FLAG(param, HYUNDAI_PARAM_NON_SCC);
|
||||
hyundai_cancel_button_enable = GET_FLAG(param, HYUNDAI_PARAM_CANCEL_BTN_ENABLE);
|
||||
|
||||
hyundai_last_button_interaction = HYUNDAI_PREV_BUTTON_SAMPLES;
|
||||
|
||||
@@ -125,7 +130,9 @@ void hyundai_common_cruise_buttons_check(const int cruise_button, const bool mai
|
||||
// enter controls on falling edge of resume or set
|
||||
bool set = (cruise_button != HYUNDAI_BTN_SET) && (cruise_button_prev == HYUNDAI_BTN_SET);
|
||||
bool res = (cruise_button != HYUNDAI_BTN_RESUME) && (cruise_button_prev == HYUNDAI_BTN_RESUME);
|
||||
if (set || res) {
|
||||
bool cancel_enable = hyundai_cancel_button_enable && !cruise_engaged_prev &&
|
||||
(cruise_button != HYUNDAI_BTN_CANCEL) && (cruise_button_prev == HYUNDAI_BTN_CANCEL);
|
||||
if (set || res || cancel_enable) {
|
||||
controls_allowed = true;
|
||||
|
||||
if (hyundai_aol_lkas_on_engage && ((alternative_experience & ALT_EXP_ALWAYS_ON_LATERAL) != 0)) {
|
||||
@@ -134,7 +141,7 @@ void hyundai_common_cruise_buttons_check(const int cruise_button, const bool mai
|
||||
}
|
||||
|
||||
// exit controls on cancel press
|
||||
if (cruise_button == HYUNDAI_BTN_CANCEL) {
|
||||
if ((cruise_button == HYUNDAI_BTN_CANCEL) && !(hyundai_cancel_button_enable && !cruise_engaged_prev)) {
|
||||
controls_allowed = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,8 @@ class TestHyundaiCanCanfdBlendedLongitudinalSafety(HyundaiLongitudinalBase, Test
|
||||
def setUp(self):
|
||||
self.packer = CANPackerSafety("hyundai_palisade_2023_generated")
|
||||
self.safety = libsafety_py.libsafety
|
||||
self.safety.set_safety_hooks(CarParams.SafetyModel.hyundai, HyundaiSafetyFlags.CAN_CANFD_BLENDED | HyundaiSafetyFlags.LONG)
|
||||
self.safety.set_safety_hooks(CarParams.SafetyModel.hyundai,
|
||||
HyundaiSafetyFlags.CAN_CANFD_BLENDED | HyundaiSafetyFlags.LONG | HyundaiSafetyFlags.CANCEL_BTN_ENABLE)
|
||||
self.safety.init_tests()
|
||||
|
||||
def _accel_msg(self, accel, aeb_req=False, aeb_decel=0):
|
||||
@@ -304,6 +305,15 @@ class TestHyundaiCanCanfdBlendedLongitudinalSafety(HyundaiLongitudinalBase, Test
|
||||
def test_no_aeb_fca11(self):
|
||||
pass
|
||||
|
||||
def test_cancel_button_enables_controls_from_standby(self):
|
||||
self.assertFalse(self.safety.get_controls_allowed())
|
||||
|
||||
self._rx(self._button_msg(Buttons.CANCEL))
|
||||
self.assertFalse(self.safety.get_controls_allowed())
|
||||
|
||||
self._rx(self._button_msg(Buttons.NONE))
|
||||
self.assertTrue(self.safety.get_controls_allowed())
|
||||
|
||||
|
||||
class TestHyundaiLongitudinalSafetyCameraSCC(HyundaiLongitudinalBase, TestHyundaiSafety):
|
||||
TX_MSGS = [[0x340, 0], [0x4F1, 2], [0x485, 0], [0x420, 0], [0x421, 0], [0x50A, 0], [0x389, 0], [0x4A2, 0]]
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
extern const uint8_t gitversion[19];
|
||||
const uint8_t gitversion[19] = "DEV-87327537-DEBUG";
|
||||
const uint8_t gitversion[19] = "DEV-5312ce30-DEBUG";
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
DEV-87327537-DEBUG
|
||||
DEV-5312ce30-DEBUG
|
||||
@@ -15,13 +15,13 @@ def civic_bosch_modified_lateral_testing_ground_active() -> bool:
|
||||
def get_civic_bosch_modified_pid_output_scale(desired_angle_deg: float, desired_angle_delta_deg: float, v_ego: float) -> float:
|
||||
abs_angle = abs(desired_angle_deg)
|
||||
speed_weight = min(max((v_ego - 4.0) / 10.0, 0.0), 1.0)
|
||||
center_speed_weight = 0.55 + (0.45 * speed_weight)
|
||||
center_weight = min(max((12.0 - abs_angle) / 12.0, 0.0), 1.0)
|
||||
angle_weight = min(max((abs_angle - 12.0) / 16.0, 0.0), 1.0)
|
||||
center_speed_weight = 0.60 + (0.40 * speed_weight)
|
||||
center_weight = min(max((14.0 - abs_angle) / 14.0, 0.0), 1.0)
|
||||
angle_weight = min(max((abs_angle - 14.0) / 14.0, 0.0), 1.0)
|
||||
phase = desired_angle_deg * desired_angle_delta_deg
|
||||
|
||||
is_left = desired_angle_deg > 0.0
|
||||
center_taper = 0.22
|
||||
center_taper = 0.26
|
||||
base_scale = 0.10 if is_left else 0.12
|
||||
turn_in_scale = 0.10 if is_left else 0.14
|
||||
unwind_scale = 0.14 if is_left else 0.20
|
||||
|
||||
@@ -211,21 +211,21 @@ IONIQ_6_FF_CUTOFF = 0.48
|
||||
IONIQ_6_FF_CUTOFF_WIDTH = 0.12
|
||||
IONIQ_6_TRANSITION_SPEED = 10.0
|
||||
IONIQ_6_PHASE_SCALE = 0.10
|
||||
IONIQ_6_TURN_IN_BOOST_LEFT = 1.02
|
||||
IONIQ_6_TURN_IN_BOOST_RIGHT = 1.12
|
||||
IONIQ_6_UNWIND_TAPER_LEFT = 1.66
|
||||
IONIQ_6_UNWIND_TAPER_RIGHT = 3.50
|
||||
IONIQ_6_TURN_IN_BOOST_LEFT = 1.08
|
||||
IONIQ_6_TURN_IN_BOOST_RIGHT = 1.24
|
||||
IONIQ_6_UNWIND_TAPER_LEFT = 1.84
|
||||
IONIQ_6_UNWIND_TAPER_RIGHT = 4.10
|
||||
IONIQ_6_FRICTION_MULT = 0.995
|
||||
IONIQ_6_FRICTION_LAT_RISE = 0.20
|
||||
IONIQ_6_FRICTION_JERK_RISE = 0.24
|
||||
IONIQ_6_TURN_IN_THRESHOLD_REDUCTION_LEFT = 0.31
|
||||
IONIQ_6_TURN_IN_THRESHOLD_REDUCTION_RIGHT = 0.46
|
||||
IONIQ_6_UNWIND_THRESHOLD_INCREASE_LEFT = 1.92
|
||||
IONIQ_6_UNWIND_THRESHOLD_INCREASE_RIGHT = 4.40
|
||||
IONIQ_6_TURN_IN_FRICTION_BOOST_LEFT = 0.16
|
||||
IONIQ_6_TURN_IN_FRICTION_BOOST_RIGHT = 0.28
|
||||
IONIQ_6_UNWIND_FRICTION_REDUCTION_LEFT = 1.66
|
||||
IONIQ_6_UNWIND_FRICTION_REDUCTION_RIGHT = 3.95
|
||||
IONIQ_6_TURN_IN_THRESHOLD_REDUCTION_LEFT = 0.34
|
||||
IONIQ_6_TURN_IN_THRESHOLD_REDUCTION_RIGHT = 0.54
|
||||
IONIQ_6_UNWIND_THRESHOLD_INCREASE_LEFT = 2.15
|
||||
IONIQ_6_UNWIND_THRESHOLD_INCREASE_RIGHT = 5.00
|
||||
IONIQ_6_TURN_IN_FRICTION_BOOST_LEFT = 0.18
|
||||
IONIQ_6_TURN_IN_FRICTION_BOOST_RIGHT = 0.34
|
||||
IONIQ_6_UNWIND_FRICTION_REDUCTION_LEFT = 1.86
|
||||
IONIQ_6_UNWIND_FRICTION_REDUCTION_RIGHT = 4.55
|
||||
IONIQ_6_CENTER_TAPER_MAX = 0.046
|
||||
IONIQ_6_CENTER_TAPER_LAT = 0.18
|
||||
IONIQ_6_CENTER_TAPER_LAT_WIDTH = 0.02
|
||||
@@ -242,8 +242,8 @@ IONIQ_6_DIRECTIONAL_TAPER_LAT_END = 0.90
|
||||
IONIQ_6_DIRECTIONAL_TAPER_LAT_WIDTH = 0.08
|
||||
IONIQ_6_DIRECTIONAL_TAPER_BASE_LEFT = 0.05
|
||||
IONIQ_6_DIRECTIONAL_TAPER_BASE_RIGHT = 0.47
|
||||
IONIQ_6_DIRECTIONAL_TAPER_UNWIND_LEFT = 0.90
|
||||
IONIQ_6_DIRECTIONAL_TAPER_UNWIND_RIGHT = 2.30
|
||||
IONIQ_6_DIRECTIONAL_TAPER_UNWIND_LEFT = 1.00
|
||||
IONIQ_6_DIRECTIONAL_TAPER_UNWIND_RIGHT = 2.65
|
||||
IONIQ_6_OUTPUT_TAPER_SPEED = 8.5
|
||||
IONIQ_6_OUTPUT_TAPER_SPEED_WIDTH = 2.5
|
||||
IONIQ_6_OUTPUT_CENTER_TAPER_BLEND = 0.90
|
||||
|
||||
@@ -383,8 +383,9 @@ class TestLatControl:
|
||||
assert get_civic_bosch_modified_pid_output_scale(0.0, 0.0, 12.0) < 1.0
|
||||
assert get_civic_bosch_modified_pid_output_scale(8.0, 0.0, 12.0) < 1.0
|
||||
assert get_civic_bosch_modified_pid_output_scale(10.0, 0.0, 12.0) < 1.0
|
||||
assert get_civic_bosch_modified_pid_output_scale(12.0, 0.0, 12.0) < 1.0
|
||||
assert get_civic_bosch_modified_pid_output_scale(0.0, 0.0, 6.0) < 0.9
|
||||
assert get_civic_bosch_modified_pid_output_scale(12.0, 0.0, 12.0) > get_civic_bosch_modified_pid_output_scale(8.0, 0.0, 12.0)
|
||||
assert get_civic_bosch_modified_pid_output_scale(14.0, 0.0, 12.0) > get_civic_bosch_modified_pid_output_scale(8.0, 0.0, 12.0)
|
||||
assert get_civic_bosch_modified_pid_output_scale(20.0, 0.5, 12.0) > get_civic_bosch_modified_pid_output_scale(20.0, 0.0, 12.0)
|
||||
assert get_civic_bosch_modified_pid_output_scale(-20.0, -0.5, 12.0) > get_civic_bosch_modified_pid_output_scale(-20.0, 0.0, 12.0)
|
||||
assert get_civic_bosch_modified_pid_output_scale(20.0, -0.5, 12.0) < get_civic_bosch_modified_pid_output_scale(20.0, 0.0, 12.0)
|
||||
|
||||
@@ -45,326 +45,326 @@ const static double MAHA_THRESH_31 = 3.8414588206941227;
|
||||
* *
|
||||
* This file is part of 'ekf' *
|
||||
******************************************************************************/
|
||||
void err_fun(double *nom_x, double *delta_x, double *out_7404715378150782082) {
|
||||
out_7404715378150782082[0] = delta_x[0] + nom_x[0];
|
||||
out_7404715378150782082[1] = delta_x[1] + nom_x[1];
|
||||
out_7404715378150782082[2] = delta_x[2] + nom_x[2];
|
||||
out_7404715378150782082[3] = delta_x[3] + nom_x[3];
|
||||
out_7404715378150782082[4] = delta_x[4] + nom_x[4];
|
||||
out_7404715378150782082[5] = delta_x[5] + nom_x[5];
|
||||
out_7404715378150782082[6] = delta_x[6] + nom_x[6];
|
||||
out_7404715378150782082[7] = delta_x[7] + nom_x[7];
|
||||
out_7404715378150782082[8] = delta_x[8] + nom_x[8];
|
||||
void err_fun(double *nom_x, double *delta_x, double *out_8994217345304474551) {
|
||||
out_8994217345304474551[0] = delta_x[0] + nom_x[0];
|
||||
out_8994217345304474551[1] = delta_x[1] + nom_x[1];
|
||||
out_8994217345304474551[2] = delta_x[2] + nom_x[2];
|
||||
out_8994217345304474551[3] = delta_x[3] + nom_x[3];
|
||||
out_8994217345304474551[4] = delta_x[4] + nom_x[4];
|
||||
out_8994217345304474551[5] = delta_x[5] + nom_x[5];
|
||||
out_8994217345304474551[6] = delta_x[6] + nom_x[6];
|
||||
out_8994217345304474551[7] = delta_x[7] + nom_x[7];
|
||||
out_8994217345304474551[8] = delta_x[8] + nom_x[8];
|
||||
}
|
||||
void inv_err_fun(double *nom_x, double *true_x, double *out_1067581222048175770) {
|
||||
out_1067581222048175770[0] = -nom_x[0] + true_x[0];
|
||||
out_1067581222048175770[1] = -nom_x[1] + true_x[1];
|
||||
out_1067581222048175770[2] = -nom_x[2] + true_x[2];
|
||||
out_1067581222048175770[3] = -nom_x[3] + true_x[3];
|
||||
out_1067581222048175770[4] = -nom_x[4] + true_x[4];
|
||||
out_1067581222048175770[5] = -nom_x[5] + true_x[5];
|
||||
out_1067581222048175770[6] = -nom_x[6] + true_x[6];
|
||||
out_1067581222048175770[7] = -nom_x[7] + true_x[7];
|
||||
out_1067581222048175770[8] = -nom_x[8] + true_x[8];
|
||||
void inv_err_fun(double *nom_x, double *true_x, double *out_8635883422281677209) {
|
||||
out_8635883422281677209[0] = -nom_x[0] + true_x[0];
|
||||
out_8635883422281677209[1] = -nom_x[1] + true_x[1];
|
||||
out_8635883422281677209[2] = -nom_x[2] + true_x[2];
|
||||
out_8635883422281677209[3] = -nom_x[3] + true_x[3];
|
||||
out_8635883422281677209[4] = -nom_x[4] + true_x[4];
|
||||
out_8635883422281677209[5] = -nom_x[5] + true_x[5];
|
||||
out_8635883422281677209[6] = -nom_x[6] + true_x[6];
|
||||
out_8635883422281677209[7] = -nom_x[7] + true_x[7];
|
||||
out_8635883422281677209[8] = -nom_x[8] + true_x[8];
|
||||
}
|
||||
void H_mod_fun(double *state, double *out_7894099950222537712) {
|
||||
out_7894099950222537712[0] = 1.0;
|
||||
out_7894099950222537712[1] = 0.0;
|
||||
out_7894099950222537712[2] = 0.0;
|
||||
out_7894099950222537712[3] = 0.0;
|
||||
out_7894099950222537712[4] = 0.0;
|
||||
out_7894099950222537712[5] = 0.0;
|
||||
out_7894099950222537712[6] = 0.0;
|
||||
out_7894099950222537712[7] = 0.0;
|
||||
out_7894099950222537712[8] = 0.0;
|
||||
out_7894099950222537712[9] = 0.0;
|
||||
out_7894099950222537712[10] = 1.0;
|
||||
out_7894099950222537712[11] = 0.0;
|
||||
out_7894099950222537712[12] = 0.0;
|
||||
out_7894099950222537712[13] = 0.0;
|
||||
out_7894099950222537712[14] = 0.0;
|
||||
out_7894099950222537712[15] = 0.0;
|
||||
out_7894099950222537712[16] = 0.0;
|
||||
out_7894099950222537712[17] = 0.0;
|
||||
out_7894099950222537712[18] = 0.0;
|
||||
out_7894099950222537712[19] = 0.0;
|
||||
out_7894099950222537712[20] = 1.0;
|
||||
out_7894099950222537712[21] = 0.0;
|
||||
out_7894099950222537712[22] = 0.0;
|
||||
out_7894099950222537712[23] = 0.0;
|
||||
out_7894099950222537712[24] = 0.0;
|
||||
out_7894099950222537712[25] = 0.0;
|
||||
out_7894099950222537712[26] = 0.0;
|
||||
out_7894099950222537712[27] = 0.0;
|
||||
out_7894099950222537712[28] = 0.0;
|
||||
out_7894099950222537712[29] = 0.0;
|
||||
out_7894099950222537712[30] = 1.0;
|
||||
out_7894099950222537712[31] = 0.0;
|
||||
out_7894099950222537712[32] = 0.0;
|
||||
out_7894099950222537712[33] = 0.0;
|
||||
out_7894099950222537712[34] = 0.0;
|
||||
out_7894099950222537712[35] = 0.0;
|
||||
out_7894099950222537712[36] = 0.0;
|
||||
out_7894099950222537712[37] = 0.0;
|
||||
out_7894099950222537712[38] = 0.0;
|
||||
out_7894099950222537712[39] = 0.0;
|
||||
out_7894099950222537712[40] = 1.0;
|
||||
out_7894099950222537712[41] = 0.0;
|
||||
out_7894099950222537712[42] = 0.0;
|
||||
out_7894099950222537712[43] = 0.0;
|
||||
out_7894099950222537712[44] = 0.0;
|
||||
out_7894099950222537712[45] = 0.0;
|
||||
out_7894099950222537712[46] = 0.0;
|
||||
out_7894099950222537712[47] = 0.0;
|
||||
out_7894099950222537712[48] = 0.0;
|
||||
out_7894099950222537712[49] = 0.0;
|
||||
out_7894099950222537712[50] = 1.0;
|
||||
out_7894099950222537712[51] = 0.0;
|
||||
out_7894099950222537712[52] = 0.0;
|
||||
out_7894099950222537712[53] = 0.0;
|
||||
out_7894099950222537712[54] = 0.0;
|
||||
out_7894099950222537712[55] = 0.0;
|
||||
out_7894099950222537712[56] = 0.0;
|
||||
out_7894099950222537712[57] = 0.0;
|
||||
out_7894099950222537712[58] = 0.0;
|
||||
out_7894099950222537712[59] = 0.0;
|
||||
out_7894099950222537712[60] = 1.0;
|
||||
out_7894099950222537712[61] = 0.0;
|
||||
out_7894099950222537712[62] = 0.0;
|
||||
out_7894099950222537712[63] = 0.0;
|
||||
out_7894099950222537712[64] = 0.0;
|
||||
out_7894099950222537712[65] = 0.0;
|
||||
out_7894099950222537712[66] = 0.0;
|
||||
out_7894099950222537712[67] = 0.0;
|
||||
out_7894099950222537712[68] = 0.0;
|
||||
out_7894099950222537712[69] = 0.0;
|
||||
out_7894099950222537712[70] = 1.0;
|
||||
out_7894099950222537712[71] = 0.0;
|
||||
out_7894099950222537712[72] = 0.0;
|
||||
out_7894099950222537712[73] = 0.0;
|
||||
out_7894099950222537712[74] = 0.0;
|
||||
out_7894099950222537712[75] = 0.0;
|
||||
out_7894099950222537712[76] = 0.0;
|
||||
out_7894099950222537712[77] = 0.0;
|
||||
out_7894099950222537712[78] = 0.0;
|
||||
out_7894099950222537712[79] = 0.0;
|
||||
out_7894099950222537712[80] = 1.0;
|
||||
void H_mod_fun(double *state, double *out_5835492163818982048) {
|
||||
out_5835492163818982048[0] = 1.0;
|
||||
out_5835492163818982048[1] = 0.0;
|
||||
out_5835492163818982048[2] = 0.0;
|
||||
out_5835492163818982048[3] = 0.0;
|
||||
out_5835492163818982048[4] = 0.0;
|
||||
out_5835492163818982048[5] = 0.0;
|
||||
out_5835492163818982048[6] = 0.0;
|
||||
out_5835492163818982048[7] = 0.0;
|
||||
out_5835492163818982048[8] = 0.0;
|
||||
out_5835492163818982048[9] = 0.0;
|
||||
out_5835492163818982048[10] = 1.0;
|
||||
out_5835492163818982048[11] = 0.0;
|
||||
out_5835492163818982048[12] = 0.0;
|
||||
out_5835492163818982048[13] = 0.0;
|
||||
out_5835492163818982048[14] = 0.0;
|
||||
out_5835492163818982048[15] = 0.0;
|
||||
out_5835492163818982048[16] = 0.0;
|
||||
out_5835492163818982048[17] = 0.0;
|
||||
out_5835492163818982048[18] = 0.0;
|
||||
out_5835492163818982048[19] = 0.0;
|
||||
out_5835492163818982048[20] = 1.0;
|
||||
out_5835492163818982048[21] = 0.0;
|
||||
out_5835492163818982048[22] = 0.0;
|
||||
out_5835492163818982048[23] = 0.0;
|
||||
out_5835492163818982048[24] = 0.0;
|
||||
out_5835492163818982048[25] = 0.0;
|
||||
out_5835492163818982048[26] = 0.0;
|
||||
out_5835492163818982048[27] = 0.0;
|
||||
out_5835492163818982048[28] = 0.0;
|
||||
out_5835492163818982048[29] = 0.0;
|
||||
out_5835492163818982048[30] = 1.0;
|
||||
out_5835492163818982048[31] = 0.0;
|
||||
out_5835492163818982048[32] = 0.0;
|
||||
out_5835492163818982048[33] = 0.0;
|
||||
out_5835492163818982048[34] = 0.0;
|
||||
out_5835492163818982048[35] = 0.0;
|
||||
out_5835492163818982048[36] = 0.0;
|
||||
out_5835492163818982048[37] = 0.0;
|
||||
out_5835492163818982048[38] = 0.0;
|
||||
out_5835492163818982048[39] = 0.0;
|
||||
out_5835492163818982048[40] = 1.0;
|
||||
out_5835492163818982048[41] = 0.0;
|
||||
out_5835492163818982048[42] = 0.0;
|
||||
out_5835492163818982048[43] = 0.0;
|
||||
out_5835492163818982048[44] = 0.0;
|
||||
out_5835492163818982048[45] = 0.0;
|
||||
out_5835492163818982048[46] = 0.0;
|
||||
out_5835492163818982048[47] = 0.0;
|
||||
out_5835492163818982048[48] = 0.0;
|
||||
out_5835492163818982048[49] = 0.0;
|
||||
out_5835492163818982048[50] = 1.0;
|
||||
out_5835492163818982048[51] = 0.0;
|
||||
out_5835492163818982048[52] = 0.0;
|
||||
out_5835492163818982048[53] = 0.0;
|
||||
out_5835492163818982048[54] = 0.0;
|
||||
out_5835492163818982048[55] = 0.0;
|
||||
out_5835492163818982048[56] = 0.0;
|
||||
out_5835492163818982048[57] = 0.0;
|
||||
out_5835492163818982048[58] = 0.0;
|
||||
out_5835492163818982048[59] = 0.0;
|
||||
out_5835492163818982048[60] = 1.0;
|
||||
out_5835492163818982048[61] = 0.0;
|
||||
out_5835492163818982048[62] = 0.0;
|
||||
out_5835492163818982048[63] = 0.0;
|
||||
out_5835492163818982048[64] = 0.0;
|
||||
out_5835492163818982048[65] = 0.0;
|
||||
out_5835492163818982048[66] = 0.0;
|
||||
out_5835492163818982048[67] = 0.0;
|
||||
out_5835492163818982048[68] = 0.0;
|
||||
out_5835492163818982048[69] = 0.0;
|
||||
out_5835492163818982048[70] = 1.0;
|
||||
out_5835492163818982048[71] = 0.0;
|
||||
out_5835492163818982048[72] = 0.0;
|
||||
out_5835492163818982048[73] = 0.0;
|
||||
out_5835492163818982048[74] = 0.0;
|
||||
out_5835492163818982048[75] = 0.0;
|
||||
out_5835492163818982048[76] = 0.0;
|
||||
out_5835492163818982048[77] = 0.0;
|
||||
out_5835492163818982048[78] = 0.0;
|
||||
out_5835492163818982048[79] = 0.0;
|
||||
out_5835492163818982048[80] = 1.0;
|
||||
}
|
||||
void f_fun(double *state, double dt, double *out_18918990587173632) {
|
||||
out_18918990587173632[0] = state[0];
|
||||
out_18918990587173632[1] = state[1];
|
||||
out_18918990587173632[2] = state[2];
|
||||
out_18918990587173632[3] = state[3];
|
||||
out_18918990587173632[4] = state[4];
|
||||
out_18918990587173632[5] = dt*((-state[4] + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*state[4]))*state[6] - 9.8100000000000005*state[8] + stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(mass*state[1]) + (-stiffness_front*state[0] - stiffness_rear*state[0])*state[5]/(mass*state[4])) + state[5];
|
||||
out_18918990587173632[6] = dt*(center_to_front*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(rotational_inertia*state[1]) + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])*state[5]/(rotational_inertia*state[4]) + (-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])*state[6]/(rotational_inertia*state[4])) + state[6];
|
||||
out_18918990587173632[7] = state[7];
|
||||
out_18918990587173632[8] = state[8];
|
||||
void f_fun(double *state, double dt, double *out_9046400166044584491) {
|
||||
out_9046400166044584491[0] = state[0];
|
||||
out_9046400166044584491[1] = state[1];
|
||||
out_9046400166044584491[2] = state[2];
|
||||
out_9046400166044584491[3] = state[3];
|
||||
out_9046400166044584491[4] = state[4];
|
||||
out_9046400166044584491[5] = dt*((-state[4] + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*state[4]))*state[6] - 9.8100000000000005*state[8] + stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(mass*state[1]) + (-stiffness_front*state[0] - stiffness_rear*state[0])*state[5]/(mass*state[4])) + state[5];
|
||||
out_9046400166044584491[6] = dt*(center_to_front*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(rotational_inertia*state[1]) + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])*state[5]/(rotational_inertia*state[4]) + (-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])*state[6]/(rotational_inertia*state[4])) + state[6];
|
||||
out_9046400166044584491[7] = state[7];
|
||||
out_9046400166044584491[8] = state[8];
|
||||
}
|
||||
void F_fun(double *state, double dt, double *out_164532203047016632) {
|
||||
out_164532203047016632[0] = 1;
|
||||
out_164532203047016632[1] = 0;
|
||||
out_164532203047016632[2] = 0;
|
||||
out_164532203047016632[3] = 0;
|
||||
out_164532203047016632[4] = 0;
|
||||
out_164532203047016632[5] = 0;
|
||||
out_164532203047016632[6] = 0;
|
||||
out_164532203047016632[7] = 0;
|
||||
out_164532203047016632[8] = 0;
|
||||
out_164532203047016632[9] = 0;
|
||||
out_164532203047016632[10] = 1;
|
||||
out_164532203047016632[11] = 0;
|
||||
out_164532203047016632[12] = 0;
|
||||
out_164532203047016632[13] = 0;
|
||||
out_164532203047016632[14] = 0;
|
||||
out_164532203047016632[15] = 0;
|
||||
out_164532203047016632[16] = 0;
|
||||
out_164532203047016632[17] = 0;
|
||||
out_164532203047016632[18] = 0;
|
||||
out_164532203047016632[19] = 0;
|
||||
out_164532203047016632[20] = 1;
|
||||
out_164532203047016632[21] = 0;
|
||||
out_164532203047016632[22] = 0;
|
||||
out_164532203047016632[23] = 0;
|
||||
out_164532203047016632[24] = 0;
|
||||
out_164532203047016632[25] = 0;
|
||||
out_164532203047016632[26] = 0;
|
||||
out_164532203047016632[27] = 0;
|
||||
out_164532203047016632[28] = 0;
|
||||
out_164532203047016632[29] = 0;
|
||||
out_164532203047016632[30] = 1;
|
||||
out_164532203047016632[31] = 0;
|
||||
out_164532203047016632[32] = 0;
|
||||
out_164532203047016632[33] = 0;
|
||||
out_164532203047016632[34] = 0;
|
||||
out_164532203047016632[35] = 0;
|
||||
out_164532203047016632[36] = 0;
|
||||
out_164532203047016632[37] = 0;
|
||||
out_164532203047016632[38] = 0;
|
||||
out_164532203047016632[39] = 0;
|
||||
out_164532203047016632[40] = 1;
|
||||
out_164532203047016632[41] = 0;
|
||||
out_164532203047016632[42] = 0;
|
||||
out_164532203047016632[43] = 0;
|
||||
out_164532203047016632[44] = 0;
|
||||
out_164532203047016632[45] = dt*(stiffness_front*(-state[2] - state[3] + state[7])/(mass*state[1]) + (-stiffness_front - stiffness_rear)*state[5]/(mass*state[4]) + (-center_to_front*stiffness_front + center_to_rear*stiffness_rear)*state[6]/(mass*state[4]));
|
||||
out_164532203047016632[46] = -dt*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(mass*pow(state[1], 2));
|
||||
out_164532203047016632[47] = -dt*stiffness_front*state[0]/(mass*state[1]);
|
||||
out_164532203047016632[48] = -dt*stiffness_front*state[0]/(mass*state[1]);
|
||||
out_164532203047016632[49] = dt*((-1 - (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*pow(state[4], 2)))*state[6] - (-stiffness_front*state[0] - stiffness_rear*state[0])*state[5]/(mass*pow(state[4], 2)));
|
||||
out_164532203047016632[50] = dt*(-stiffness_front*state[0] - stiffness_rear*state[0])/(mass*state[4]) + 1;
|
||||
out_164532203047016632[51] = dt*(-state[4] + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*state[4]));
|
||||
out_164532203047016632[52] = dt*stiffness_front*state[0]/(mass*state[1]);
|
||||
out_164532203047016632[53] = -9.8100000000000005*dt;
|
||||
out_164532203047016632[54] = dt*(center_to_front*stiffness_front*(-state[2] - state[3] + state[7])/(rotational_inertia*state[1]) + (-center_to_front*stiffness_front + center_to_rear*stiffness_rear)*state[5]/(rotational_inertia*state[4]) + (-pow(center_to_front, 2)*stiffness_front - pow(center_to_rear, 2)*stiffness_rear)*state[6]/(rotational_inertia*state[4]));
|
||||
out_164532203047016632[55] = -center_to_front*dt*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(rotational_inertia*pow(state[1], 2));
|
||||
out_164532203047016632[56] = -center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]);
|
||||
out_164532203047016632[57] = -center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]);
|
||||
out_164532203047016632[58] = dt*(-(-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])*state[5]/(rotational_inertia*pow(state[4], 2)) - (-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])*state[6]/(rotational_inertia*pow(state[4], 2)));
|
||||
out_164532203047016632[59] = dt*(-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(rotational_inertia*state[4]);
|
||||
out_164532203047016632[60] = dt*(-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])/(rotational_inertia*state[4]) + 1;
|
||||
out_164532203047016632[61] = center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]);
|
||||
out_164532203047016632[62] = 0;
|
||||
out_164532203047016632[63] = 0;
|
||||
out_164532203047016632[64] = 0;
|
||||
out_164532203047016632[65] = 0;
|
||||
out_164532203047016632[66] = 0;
|
||||
out_164532203047016632[67] = 0;
|
||||
out_164532203047016632[68] = 0;
|
||||
out_164532203047016632[69] = 0;
|
||||
out_164532203047016632[70] = 1;
|
||||
out_164532203047016632[71] = 0;
|
||||
out_164532203047016632[72] = 0;
|
||||
out_164532203047016632[73] = 0;
|
||||
out_164532203047016632[74] = 0;
|
||||
out_164532203047016632[75] = 0;
|
||||
out_164532203047016632[76] = 0;
|
||||
out_164532203047016632[77] = 0;
|
||||
out_164532203047016632[78] = 0;
|
||||
out_164532203047016632[79] = 0;
|
||||
out_164532203047016632[80] = 1;
|
||||
void F_fun(double *state, double dt, double *out_8585883916966185499) {
|
||||
out_8585883916966185499[0] = 1;
|
||||
out_8585883916966185499[1] = 0;
|
||||
out_8585883916966185499[2] = 0;
|
||||
out_8585883916966185499[3] = 0;
|
||||
out_8585883916966185499[4] = 0;
|
||||
out_8585883916966185499[5] = 0;
|
||||
out_8585883916966185499[6] = 0;
|
||||
out_8585883916966185499[7] = 0;
|
||||
out_8585883916966185499[8] = 0;
|
||||
out_8585883916966185499[9] = 0;
|
||||
out_8585883916966185499[10] = 1;
|
||||
out_8585883916966185499[11] = 0;
|
||||
out_8585883916966185499[12] = 0;
|
||||
out_8585883916966185499[13] = 0;
|
||||
out_8585883916966185499[14] = 0;
|
||||
out_8585883916966185499[15] = 0;
|
||||
out_8585883916966185499[16] = 0;
|
||||
out_8585883916966185499[17] = 0;
|
||||
out_8585883916966185499[18] = 0;
|
||||
out_8585883916966185499[19] = 0;
|
||||
out_8585883916966185499[20] = 1;
|
||||
out_8585883916966185499[21] = 0;
|
||||
out_8585883916966185499[22] = 0;
|
||||
out_8585883916966185499[23] = 0;
|
||||
out_8585883916966185499[24] = 0;
|
||||
out_8585883916966185499[25] = 0;
|
||||
out_8585883916966185499[26] = 0;
|
||||
out_8585883916966185499[27] = 0;
|
||||
out_8585883916966185499[28] = 0;
|
||||
out_8585883916966185499[29] = 0;
|
||||
out_8585883916966185499[30] = 1;
|
||||
out_8585883916966185499[31] = 0;
|
||||
out_8585883916966185499[32] = 0;
|
||||
out_8585883916966185499[33] = 0;
|
||||
out_8585883916966185499[34] = 0;
|
||||
out_8585883916966185499[35] = 0;
|
||||
out_8585883916966185499[36] = 0;
|
||||
out_8585883916966185499[37] = 0;
|
||||
out_8585883916966185499[38] = 0;
|
||||
out_8585883916966185499[39] = 0;
|
||||
out_8585883916966185499[40] = 1;
|
||||
out_8585883916966185499[41] = 0;
|
||||
out_8585883916966185499[42] = 0;
|
||||
out_8585883916966185499[43] = 0;
|
||||
out_8585883916966185499[44] = 0;
|
||||
out_8585883916966185499[45] = dt*(stiffness_front*(-state[2] - state[3] + state[7])/(mass*state[1]) + (-stiffness_front - stiffness_rear)*state[5]/(mass*state[4]) + (-center_to_front*stiffness_front + center_to_rear*stiffness_rear)*state[6]/(mass*state[4]));
|
||||
out_8585883916966185499[46] = -dt*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(mass*pow(state[1], 2));
|
||||
out_8585883916966185499[47] = -dt*stiffness_front*state[0]/(mass*state[1]);
|
||||
out_8585883916966185499[48] = -dt*stiffness_front*state[0]/(mass*state[1]);
|
||||
out_8585883916966185499[49] = dt*((-1 - (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*pow(state[4], 2)))*state[6] - (-stiffness_front*state[0] - stiffness_rear*state[0])*state[5]/(mass*pow(state[4], 2)));
|
||||
out_8585883916966185499[50] = dt*(-stiffness_front*state[0] - stiffness_rear*state[0])/(mass*state[4]) + 1;
|
||||
out_8585883916966185499[51] = dt*(-state[4] + (-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(mass*state[4]));
|
||||
out_8585883916966185499[52] = dt*stiffness_front*state[0]/(mass*state[1]);
|
||||
out_8585883916966185499[53] = -9.8100000000000005*dt;
|
||||
out_8585883916966185499[54] = dt*(center_to_front*stiffness_front*(-state[2] - state[3] + state[7])/(rotational_inertia*state[1]) + (-center_to_front*stiffness_front + center_to_rear*stiffness_rear)*state[5]/(rotational_inertia*state[4]) + (-pow(center_to_front, 2)*stiffness_front - pow(center_to_rear, 2)*stiffness_rear)*state[6]/(rotational_inertia*state[4]));
|
||||
out_8585883916966185499[55] = -center_to_front*dt*stiffness_front*(-state[2] - state[3] + state[7])*state[0]/(rotational_inertia*pow(state[1], 2));
|
||||
out_8585883916966185499[56] = -center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]);
|
||||
out_8585883916966185499[57] = -center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]);
|
||||
out_8585883916966185499[58] = dt*(-(-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])*state[5]/(rotational_inertia*pow(state[4], 2)) - (-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])*state[6]/(rotational_inertia*pow(state[4], 2)));
|
||||
out_8585883916966185499[59] = dt*(-center_to_front*stiffness_front*state[0] + center_to_rear*stiffness_rear*state[0])/(rotational_inertia*state[4]);
|
||||
out_8585883916966185499[60] = dt*(-pow(center_to_front, 2)*stiffness_front*state[0] - pow(center_to_rear, 2)*stiffness_rear*state[0])/(rotational_inertia*state[4]) + 1;
|
||||
out_8585883916966185499[61] = center_to_front*dt*stiffness_front*state[0]/(rotational_inertia*state[1]);
|
||||
out_8585883916966185499[62] = 0;
|
||||
out_8585883916966185499[63] = 0;
|
||||
out_8585883916966185499[64] = 0;
|
||||
out_8585883916966185499[65] = 0;
|
||||
out_8585883916966185499[66] = 0;
|
||||
out_8585883916966185499[67] = 0;
|
||||
out_8585883916966185499[68] = 0;
|
||||
out_8585883916966185499[69] = 0;
|
||||
out_8585883916966185499[70] = 1;
|
||||
out_8585883916966185499[71] = 0;
|
||||
out_8585883916966185499[72] = 0;
|
||||
out_8585883916966185499[73] = 0;
|
||||
out_8585883916966185499[74] = 0;
|
||||
out_8585883916966185499[75] = 0;
|
||||
out_8585883916966185499[76] = 0;
|
||||
out_8585883916966185499[77] = 0;
|
||||
out_8585883916966185499[78] = 0;
|
||||
out_8585883916966185499[79] = 0;
|
||||
out_8585883916966185499[80] = 1;
|
||||
}
|
||||
void h_25(double *state, double *unused, double *out_513824514853683092) {
|
||||
out_513824514853683092[0] = state[6];
|
||||
void h_25(double *state, double *unused, double *out_1895365982627284096) {
|
||||
out_1895365982627284096[0] = state[6];
|
||||
}
|
||||
void H_25(double *state, double *unused, double *out_4371119300233046035) {
|
||||
out_4371119300233046035[0] = 0;
|
||||
out_4371119300233046035[1] = 0;
|
||||
out_4371119300233046035[2] = 0;
|
||||
out_4371119300233046035[3] = 0;
|
||||
out_4371119300233046035[4] = 0;
|
||||
out_4371119300233046035[5] = 0;
|
||||
out_4371119300233046035[6] = 1;
|
||||
out_4371119300233046035[7] = 0;
|
||||
out_4371119300233046035[8] = 0;
|
||||
void H_25(double *state, double *unused, double *out_3357696062093255189) {
|
||||
out_3357696062093255189[0] = 0;
|
||||
out_3357696062093255189[1] = 0;
|
||||
out_3357696062093255189[2] = 0;
|
||||
out_3357696062093255189[3] = 0;
|
||||
out_3357696062093255189[4] = 0;
|
||||
out_3357696062093255189[5] = 0;
|
||||
out_3357696062093255189[6] = 1;
|
||||
out_3357696062093255189[7] = 0;
|
||||
out_3357696062093255189[8] = 0;
|
||||
}
|
||||
void h_24(double *state, double *unused, double *out_1763325166754368628) {
|
||||
out_1763325166754368628[0] = state[4];
|
||||
out_1763325166754368628[1] = state[5];
|
||||
void h_24(double *state, double *unused, double *out_5360338391580302842) {
|
||||
out_5360338391580302842[0] = state[4];
|
||||
out_5360338391580302842[1] = state[5];
|
||||
}
|
||||
void H_24(double *state, double *unused, double *out_813193701430722899) {
|
||||
out_813193701430722899[0] = 0;
|
||||
out_813193701430722899[1] = 0;
|
||||
out_813193701430722899[2] = 0;
|
||||
out_813193701430722899[3] = 0;
|
||||
out_813193701430722899[4] = 1;
|
||||
out_813193701430722899[5] = 0;
|
||||
out_813193701430722899[6] = 0;
|
||||
out_813193701430722899[7] = 0;
|
||||
out_813193701430722899[8] = 0;
|
||||
out_813193701430722899[9] = 0;
|
||||
out_813193701430722899[10] = 0;
|
||||
out_813193701430722899[11] = 0;
|
||||
out_813193701430722899[12] = 0;
|
||||
out_813193701430722899[13] = 0;
|
||||
out_813193701430722899[14] = 1;
|
||||
out_813193701430722899[15] = 0;
|
||||
out_813193701430722899[16] = 0;
|
||||
out_813193701430722899[17] = 0;
|
||||
void H_24(double *state, double *unused, double *out_5530345661098754755) {
|
||||
out_5530345661098754755[0] = 0;
|
||||
out_5530345661098754755[1] = 0;
|
||||
out_5530345661098754755[2] = 0;
|
||||
out_5530345661098754755[3] = 0;
|
||||
out_5530345661098754755[4] = 1;
|
||||
out_5530345661098754755[5] = 0;
|
||||
out_5530345661098754755[6] = 0;
|
||||
out_5530345661098754755[7] = 0;
|
||||
out_5530345661098754755[8] = 0;
|
||||
out_5530345661098754755[9] = 0;
|
||||
out_5530345661098754755[10] = 0;
|
||||
out_5530345661098754755[11] = 0;
|
||||
out_5530345661098754755[12] = 0;
|
||||
out_5530345661098754755[13] = 0;
|
||||
out_5530345661098754755[14] = 1;
|
||||
out_5530345661098754755[15] = 0;
|
||||
out_5530345661098754755[16] = 0;
|
||||
out_5530345661098754755[17] = 0;
|
||||
}
|
||||
void h_30(double *state, double *unused, double *out_2433901475501801869) {
|
||||
out_2433901475501801869[0] = state[4];
|
||||
void h_30(double *state, double *unused, double *out_2052552650978413241) {
|
||||
out_2052552650978413241[0] = state[4];
|
||||
}
|
||||
void H_30(double *state, double *unused, double *out_4500458247376286105) {
|
||||
out_4500458247376286105[0] = 0;
|
||||
out_4500458247376286105[1] = 0;
|
||||
out_4500458247376286105[2] = 0;
|
||||
out_4500458247376286105[3] = 0;
|
||||
out_4500458247376286105[4] = 1;
|
||||
out_4500458247376286105[5] = 0;
|
||||
out_4500458247376286105[6] = 0;
|
||||
out_4500458247376286105[7] = 0;
|
||||
out_4500458247376286105[8] = 0;
|
||||
void H_30(double *state, double *unused, double *out_839363103586006562) {
|
||||
out_839363103586006562[0] = 0;
|
||||
out_839363103586006562[1] = 0;
|
||||
out_839363103586006562[2] = 0;
|
||||
out_839363103586006562[3] = 0;
|
||||
out_839363103586006562[4] = 1;
|
||||
out_839363103586006562[5] = 0;
|
||||
out_839363103586006562[6] = 0;
|
||||
out_839363103586006562[7] = 0;
|
||||
out_839363103586006562[8] = 0;
|
||||
}
|
||||
void h_26(double *state, double *unused, double *out_1451817382166503757) {
|
||||
out_1451817382166503757[0] = state[7];
|
||||
void h_26(double *state, double *unused, double *out_2655868535654890758) {
|
||||
out_2655868535654890758[0] = state[7];
|
||||
}
|
||||
void H_26(double *state, double *unused, double *out_8112622619107102259) {
|
||||
out_8112622619107102259[0] = 0;
|
||||
out_8112622619107102259[1] = 0;
|
||||
out_8112622619107102259[2] = 0;
|
||||
out_8112622619107102259[3] = 0;
|
||||
out_8112622619107102259[4] = 0;
|
||||
out_8112622619107102259[5] = 0;
|
||||
out_8112622619107102259[6] = 0;
|
||||
out_8112622619107102259[7] = 1;
|
||||
out_8112622619107102259[8] = 0;
|
||||
void H_26(double *state, double *unused, double *out_53170092332454588) {
|
||||
out_53170092332454588[0] = 0;
|
||||
out_53170092332454588[1] = 0;
|
||||
out_53170092332454588[2] = 0;
|
||||
out_53170092332454588[3] = 0;
|
||||
out_53170092332454588[4] = 0;
|
||||
out_53170092332454588[5] = 0;
|
||||
out_53170092332454588[6] = 0;
|
||||
out_53170092332454588[7] = 1;
|
||||
out_53170092332454588[8] = 0;
|
||||
}
|
||||
void h_27(double *state, double *unused, double *out_8950950386849027759) {
|
||||
out_8950950386849027759[0] = state[3];
|
||||
void h_27(double *state, double *unused, double *out_3774772722470275260) {
|
||||
out_3774772722470275260[0] = state[3];
|
||||
}
|
||||
void H_27(double *state, double *unused, double *out_6675221559176711016) {
|
||||
out_6675221559176711016[0] = 0;
|
||||
out_6675221559176711016[1] = 0;
|
||||
out_6675221559176711016[2] = 0;
|
||||
out_6675221559176711016[3] = 1;
|
||||
out_6675221559176711016[4] = 0;
|
||||
out_6675221559176711016[5] = 0;
|
||||
out_6675221559176711016[6] = 0;
|
||||
out_6675221559176711016[7] = 0;
|
||||
out_6675221559176711016[8] = 0;
|
||||
void H_27(double *state, double *unused, double *out_1384230967597936655) {
|
||||
out_1384230967597936655[0] = 0;
|
||||
out_1384230967597936655[1] = 0;
|
||||
out_1384230967597936655[2] = 0;
|
||||
out_1384230967597936655[3] = 1;
|
||||
out_1384230967597936655[4] = 0;
|
||||
out_1384230967597936655[5] = 0;
|
||||
out_1384230967597936655[6] = 0;
|
||||
out_1384230967597936655[7] = 0;
|
||||
out_1384230967597936655[8] = 0;
|
||||
}
|
||||
void h_29(double *state, double *unused, double *out_7435574743162647514) {
|
||||
out_7435574743162647514[0] = state[1];
|
||||
void h_29(double *state, double *unused, double *out_4656957971787110892) {
|
||||
out_4656957971787110892[0] = state[1];
|
||||
}
|
||||
void H_29(double *state, double *unused, double *out_8388584286046262049) {
|
||||
out_8388584286046262049[0] = 0;
|
||||
out_8388584286046262049[1] = 1;
|
||||
out_8388584286046262049[2] = 0;
|
||||
out_8388584286046262049[3] = 0;
|
||||
out_8388584286046262049[4] = 0;
|
||||
out_8388584286046262049[5] = 0;
|
||||
out_8388584286046262049[6] = 0;
|
||||
out_8388584286046262049[7] = 0;
|
||||
out_8388584286046262049[8] = 0;
|
||||
void H_29(double *state, double *unused, double *out_329131759271614378) {
|
||||
out_329131759271614378[0] = 0;
|
||||
out_329131759271614378[1] = 1;
|
||||
out_329131759271614378[2] = 0;
|
||||
out_329131759271614378[3] = 0;
|
||||
out_329131759271614378[4] = 0;
|
||||
out_329131759271614378[5] = 0;
|
||||
out_329131759271614378[6] = 0;
|
||||
out_329131759271614378[7] = 0;
|
||||
out_329131759271614378[8] = 0;
|
||||
}
|
||||
void h_28(double *state, double *unused, double *out_4494120419199678212) {
|
||||
out_4494120419199678212[0] = state[0];
|
||||
void h_28(double *state, double *unused, double *out_1170367401661577609) {
|
||||
out_1170367401661577609[0] = state[0];
|
||||
}
|
||||
void H_28(double *state, double *unused, double *out_6424954014480935798) {
|
||||
out_6424954014480935798[0] = 1;
|
||||
out_6424954014480935798[1] = 0;
|
||||
out_6424954014480935798[2] = 0;
|
||||
out_6424954014480935798[3] = 0;
|
||||
out_6424954014480935798[4] = 0;
|
||||
out_6424954014480935798[5] = 0;
|
||||
out_6424954014480935798[6] = 0;
|
||||
out_6424954014480935798[7] = 0;
|
||||
out_6424954014480935798[8] = 0;
|
||||
void H_28(double *state, double *unused, double *out_5411530776341144952) {
|
||||
out_5411530776341144952[0] = 1;
|
||||
out_5411530776341144952[1] = 0;
|
||||
out_5411530776341144952[2] = 0;
|
||||
out_5411530776341144952[3] = 0;
|
||||
out_5411530776341144952[4] = 0;
|
||||
out_5411530776341144952[5] = 0;
|
||||
out_5411530776341144952[6] = 0;
|
||||
out_5411530776341144952[7] = 0;
|
||||
out_5411530776341144952[8] = 0;
|
||||
}
|
||||
void h_31(double *state, double *unused, double *out_6257010711496667844) {
|
||||
out_6257010711496667844[0] = state[8];
|
||||
void h_31(double *state, double *unused, double *out_1437164620468722434) {
|
||||
out_1437164620468722434[0] = state[8];
|
||||
}
|
||||
void H_31(double *state, double *unused, double *out_4340473338356085607) {
|
||||
out_4340473338356085607[0] = 0;
|
||||
out_4340473338356085607[1] = 0;
|
||||
out_4340473338356085607[2] = 0;
|
||||
out_4340473338356085607[3] = 0;
|
||||
out_4340473338356085607[4] = 0;
|
||||
out_4340473338356085607[5] = 0;
|
||||
out_4340473338356085607[6] = 0;
|
||||
out_4340473338356085607[7] = 0;
|
||||
out_4340473338356085607[8] = 1;
|
||||
void H_31(double *state, double *unused, double *out_7725407483200662889) {
|
||||
out_7725407483200662889[0] = 0;
|
||||
out_7725407483200662889[1] = 0;
|
||||
out_7725407483200662889[2] = 0;
|
||||
out_7725407483200662889[3] = 0;
|
||||
out_7725407483200662889[4] = 0;
|
||||
out_7725407483200662889[5] = 0;
|
||||
out_7725407483200662889[6] = 0;
|
||||
out_7725407483200662889[7] = 0;
|
||||
out_7725407483200662889[8] = 1;
|
||||
}
|
||||
#include <eigen3/Eigen/Dense>
|
||||
#include <iostream>
|
||||
@@ -518,68 +518,68 @@ void car_update_28(double *in_x, double *in_P, double *in_z, double *in_R, doubl
|
||||
void car_update_31(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
|
||||
update<1, 3, 0>(in_x, in_P, h_31, H_31, NULL, in_z, in_R, in_ea, MAHA_THRESH_31);
|
||||
}
|
||||
void car_err_fun(double *nom_x, double *delta_x, double *out_7404715378150782082) {
|
||||
err_fun(nom_x, delta_x, out_7404715378150782082);
|
||||
void car_err_fun(double *nom_x, double *delta_x, double *out_8994217345304474551) {
|
||||
err_fun(nom_x, delta_x, out_8994217345304474551);
|
||||
}
|
||||
void car_inv_err_fun(double *nom_x, double *true_x, double *out_1067581222048175770) {
|
||||
inv_err_fun(nom_x, true_x, out_1067581222048175770);
|
||||
void car_inv_err_fun(double *nom_x, double *true_x, double *out_8635883422281677209) {
|
||||
inv_err_fun(nom_x, true_x, out_8635883422281677209);
|
||||
}
|
||||
void car_H_mod_fun(double *state, double *out_7894099950222537712) {
|
||||
H_mod_fun(state, out_7894099950222537712);
|
||||
void car_H_mod_fun(double *state, double *out_5835492163818982048) {
|
||||
H_mod_fun(state, out_5835492163818982048);
|
||||
}
|
||||
void car_f_fun(double *state, double dt, double *out_18918990587173632) {
|
||||
f_fun(state, dt, out_18918990587173632);
|
||||
void car_f_fun(double *state, double dt, double *out_9046400166044584491) {
|
||||
f_fun(state, dt, out_9046400166044584491);
|
||||
}
|
||||
void car_F_fun(double *state, double dt, double *out_164532203047016632) {
|
||||
F_fun(state, dt, out_164532203047016632);
|
||||
void car_F_fun(double *state, double dt, double *out_8585883916966185499) {
|
||||
F_fun(state, dt, out_8585883916966185499);
|
||||
}
|
||||
void car_h_25(double *state, double *unused, double *out_513824514853683092) {
|
||||
h_25(state, unused, out_513824514853683092);
|
||||
void car_h_25(double *state, double *unused, double *out_1895365982627284096) {
|
||||
h_25(state, unused, out_1895365982627284096);
|
||||
}
|
||||
void car_H_25(double *state, double *unused, double *out_4371119300233046035) {
|
||||
H_25(state, unused, out_4371119300233046035);
|
||||
void car_H_25(double *state, double *unused, double *out_3357696062093255189) {
|
||||
H_25(state, unused, out_3357696062093255189);
|
||||
}
|
||||
void car_h_24(double *state, double *unused, double *out_1763325166754368628) {
|
||||
h_24(state, unused, out_1763325166754368628);
|
||||
void car_h_24(double *state, double *unused, double *out_5360338391580302842) {
|
||||
h_24(state, unused, out_5360338391580302842);
|
||||
}
|
||||
void car_H_24(double *state, double *unused, double *out_813193701430722899) {
|
||||
H_24(state, unused, out_813193701430722899);
|
||||
void car_H_24(double *state, double *unused, double *out_5530345661098754755) {
|
||||
H_24(state, unused, out_5530345661098754755);
|
||||
}
|
||||
void car_h_30(double *state, double *unused, double *out_2433901475501801869) {
|
||||
h_30(state, unused, out_2433901475501801869);
|
||||
void car_h_30(double *state, double *unused, double *out_2052552650978413241) {
|
||||
h_30(state, unused, out_2052552650978413241);
|
||||
}
|
||||
void car_H_30(double *state, double *unused, double *out_4500458247376286105) {
|
||||
H_30(state, unused, out_4500458247376286105);
|
||||
void car_H_30(double *state, double *unused, double *out_839363103586006562) {
|
||||
H_30(state, unused, out_839363103586006562);
|
||||
}
|
||||
void car_h_26(double *state, double *unused, double *out_1451817382166503757) {
|
||||
h_26(state, unused, out_1451817382166503757);
|
||||
void car_h_26(double *state, double *unused, double *out_2655868535654890758) {
|
||||
h_26(state, unused, out_2655868535654890758);
|
||||
}
|
||||
void car_H_26(double *state, double *unused, double *out_8112622619107102259) {
|
||||
H_26(state, unused, out_8112622619107102259);
|
||||
void car_H_26(double *state, double *unused, double *out_53170092332454588) {
|
||||
H_26(state, unused, out_53170092332454588);
|
||||
}
|
||||
void car_h_27(double *state, double *unused, double *out_8950950386849027759) {
|
||||
h_27(state, unused, out_8950950386849027759);
|
||||
void car_h_27(double *state, double *unused, double *out_3774772722470275260) {
|
||||
h_27(state, unused, out_3774772722470275260);
|
||||
}
|
||||
void car_H_27(double *state, double *unused, double *out_6675221559176711016) {
|
||||
H_27(state, unused, out_6675221559176711016);
|
||||
void car_H_27(double *state, double *unused, double *out_1384230967597936655) {
|
||||
H_27(state, unused, out_1384230967597936655);
|
||||
}
|
||||
void car_h_29(double *state, double *unused, double *out_7435574743162647514) {
|
||||
h_29(state, unused, out_7435574743162647514);
|
||||
void car_h_29(double *state, double *unused, double *out_4656957971787110892) {
|
||||
h_29(state, unused, out_4656957971787110892);
|
||||
}
|
||||
void car_H_29(double *state, double *unused, double *out_8388584286046262049) {
|
||||
H_29(state, unused, out_8388584286046262049);
|
||||
void car_H_29(double *state, double *unused, double *out_329131759271614378) {
|
||||
H_29(state, unused, out_329131759271614378);
|
||||
}
|
||||
void car_h_28(double *state, double *unused, double *out_4494120419199678212) {
|
||||
h_28(state, unused, out_4494120419199678212);
|
||||
void car_h_28(double *state, double *unused, double *out_1170367401661577609) {
|
||||
h_28(state, unused, out_1170367401661577609);
|
||||
}
|
||||
void car_H_28(double *state, double *unused, double *out_6424954014480935798) {
|
||||
H_28(state, unused, out_6424954014480935798);
|
||||
void car_H_28(double *state, double *unused, double *out_5411530776341144952) {
|
||||
H_28(state, unused, out_5411530776341144952);
|
||||
}
|
||||
void car_h_31(double *state, double *unused, double *out_6257010711496667844) {
|
||||
h_31(state, unused, out_6257010711496667844);
|
||||
void car_h_31(double *state, double *unused, double *out_1437164620468722434) {
|
||||
h_31(state, unused, out_1437164620468722434);
|
||||
}
|
||||
void car_H_31(double *state, double *unused, double *out_4340473338356085607) {
|
||||
H_31(state, unused, out_4340473338356085607);
|
||||
void car_H_31(double *state, double *unused, double *out_7725407483200662889) {
|
||||
H_31(state, unused, out_7725407483200662889);
|
||||
}
|
||||
void car_predict(double *in_x, double *in_P, double *in_Q, double dt) {
|
||||
predict(in_x, in_P, in_Q, dt);
|
||||
|
||||
@@ -9,27 +9,27 @@ void car_update_27(double *in_x, double *in_P, double *in_z, double *in_R, doubl
|
||||
void car_update_29(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea);
|
||||
void car_update_28(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea);
|
||||
void car_update_31(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea);
|
||||
void car_err_fun(double *nom_x, double *delta_x, double *out_7404715378150782082);
|
||||
void car_inv_err_fun(double *nom_x, double *true_x, double *out_1067581222048175770);
|
||||
void car_H_mod_fun(double *state, double *out_7894099950222537712);
|
||||
void car_f_fun(double *state, double dt, double *out_18918990587173632);
|
||||
void car_F_fun(double *state, double dt, double *out_164532203047016632);
|
||||
void car_h_25(double *state, double *unused, double *out_513824514853683092);
|
||||
void car_H_25(double *state, double *unused, double *out_4371119300233046035);
|
||||
void car_h_24(double *state, double *unused, double *out_1763325166754368628);
|
||||
void car_H_24(double *state, double *unused, double *out_813193701430722899);
|
||||
void car_h_30(double *state, double *unused, double *out_2433901475501801869);
|
||||
void car_H_30(double *state, double *unused, double *out_4500458247376286105);
|
||||
void car_h_26(double *state, double *unused, double *out_1451817382166503757);
|
||||
void car_H_26(double *state, double *unused, double *out_8112622619107102259);
|
||||
void car_h_27(double *state, double *unused, double *out_8950950386849027759);
|
||||
void car_H_27(double *state, double *unused, double *out_6675221559176711016);
|
||||
void car_h_29(double *state, double *unused, double *out_7435574743162647514);
|
||||
void car_H_29(double *state, double *unused, double *out_8388584286046262049);
|
||||
void car_h_28(double *state, double *unused, double *out_4494120419199678212);
|
||||
void car_H_28(double *state, double *unused, double *out_6424954014480935798);
|
||||
void car_h_31(double *state, double *unused, double *out_6257010711496667844);
|
||||
void car_H_31(double *state, double *unused, double *out_4340473338356085607);
|
||||
void car_err_fun(double *nom_x, double *delta_x, double *out_8994217345304474551);
|
||||
void car_inv_err_fun(double *nom_x, double *true_x, double *out_8635883422281677209);
|
||||
void car_H_mod_fun(double *state, double *out_5835492163818982048);
|
||||
void car_f_fun(double *state, double dt, double *out_9046400166044584491);
|
||||
void car_F_fun(double *state, double dt, double *out_8585883916966185499);
|
||||
void car_h_25(double *state, double *unused, double *out_1895365982627284096);
|
||||
void car_H_25(double *state, double *unused, double *out_3357696062093255189);
|
||||
void car_h_24(double *state, double *unused, double *out_5360338391580302842);
|
||||
void car_H_24(double *state, double *unused, double *out_5530345661098754755);
|
||||
void car_h_30(double *state, double *unused, double *out_2052552650978413241);
|
||||
void car_H_30(double *state, double *unused, double *out_839363103586006562);
|
||||
void car_h_26(double *state, double *unused, double *out_2655868535654890758);
|
||||
void car_H_26(double *state, double *unused, double *out_53170092332454588);
|
||||
void car_h_27(double *state, double *unused, double *out_3774772722470275260);
|
||||
void car_H_27(double *state, double *unused, double *out_1384230967597936655);
|
||||
void car_h_29(double *state, double *unused, double *out_4656957971787110892);
|
||||
void car_H_29(double *state, double *unused, double *out_329131759271614378);
|
||||
void car_h_28(double *state, double *unused, double *out_1170367401661577609);
|
||||
void car_H_28(double *state, double *unused, double *out_5411530776341144952);
|
||||
void car_h_31(double *state, double *unused, double *out_1437164620468722434);
|
||||
void car_H_31(double *state, double *unused, double *out_7725407483200662889);
|
||||
void car_predict(double *in_x, double *in_P, double *in_Q, double dt);
|
||||
void car_set_mass(double x);
|
||||
void car_set_rotational_inertia(double x);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,18 +5,18 @@ void pose_update_4(double *in_x, double *in_P, double *in_z, double *in_R, doubl
|
||||
void pose_update_10(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea);
|
||||
void pose_update_13(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea);
|
||||
void pose_update_14(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea);
|
||||
void pose_err_fun(double *nom_x, double *delta_x, double *out_5984861409348236479);
|
||||
void pose_inv_err_fun(double *nom_x, double *true_x, double *out_1707565234864444406);
|
||||
void pose_H_mod_fun(double *state, double *out_938651669609787352);
|
||||
void pose_f_fun(double *state, double dt, double *out_336566407888546136);
|
||||
void pose_F_fun(double *state, double dt, double *out_5996324224975557063);
|
||||
void pose_h_4(double *state, double *unused, double *out_2660879566845649022);
|
||||
void pose_H_4(double *state, double *unused, double *out_6786733476361746073);
|
||||
void pose_h_10(double *state, double *unused, double *out_323021619404120390);
|
||||
void pose_H_10(double *state, double *unused, double *out_4140593631986057126);
|
||||
void pose_h_13(double *state, double *unused, double *out_3801171022701447110);
|
||||
void pose_H_13(double *state, double *unused, double *out_3574459651029413272);
|
||||
void pose_h_14(double *state, double *unused, double *out_7703097660121677315);
|
||||
void pose_H_14(double *state, double *unused, double *out_2823492620022261544);
|
||||
void pose_err_fun(double *nom_x, double *delta_x, double *out_5188089899736494345);
|
||||
void pose_inv_err_fun(double *nom_x, double *true_x, double *out_516319331577825853);
|
||||
void pose_H_mod_fun(double *state, double *out_4951567132479851062);
|
||||
void pose_f_fun(double *state, double dt, double *out_898454825503606476);
|
||||
void pose_F_fun(double *state, double dt, double *out_906698228237069812);
|
||||
void pose_h_4(double *state, double *unused, double *out_6577940567349030778);
|
||||
void pose_H_4(double *state, double *unused, double *out_913158878120160673);
|
||||
void pose_h_10(double *state, double *unused, double *out_3373051515203641771);
|
||||
void pose_H_10(double *state, double *unused, double *out_7288760212554836769);
|
||||
void pose_h_13(double *state, double *unused, double *out_413669578140119338);
|
||||
void pose_H_13(double *state, double *unused, double *out_8523790086436861602);
|
||||
void pose_h_14(double *state, double *unused, double *out_8770101800505378255);
|
||||
void pose_H_14(double *state, double *unused, double *out_4876399734459645202);
|
||||
void pose_predict(double *in_x, double *in_P, double *in_Q, double dt);
|
||||
}
|
||||
Binary file not shown.
@@ -686,12 +686,7 @@ class StarPilotLongitudinalTuneLayout(_SettingsPage):
|
||||
set_state=lambda s: self._params.put_bool("CoastUpToLeads", s),
|
||||
visible=self._longitudinal_enabled),
|
||||
], column_pair="human_driving", row_height=UTILITY_ROW_HEIGHT),
|
||||
SettingSection(tr_noop("Following"), [
|
||||
SettingRow("HumanFollowing", "toggle", tr_noop("Human-Like Following"),
|
||||
subtitle=tr_noop("More natural following behavior behind other vehicles."),
|
||||
get_state=lambda: self._params.get_bool("HumanFollowing"),
|
||||
set_state=lambda s: self._params.put_bool("HumanFollowing", s),
|
||||
visible=self._longitudinal_enabled),
|
||||
SettingSection(tr_noop("Lane Changes"), [
|
||||
SettingRow("HumanLaneChanges", "toggle", tr_noop("Human-Like Lane Changes"),
|
||||
subtitle=tr_noop("Radar-informed behavior during lane changes."),
|
||||
get_state=lambda: self._params.get_bool("HumanLaneChanges"),
|
||||
|
||||
Binary file not shown.
@@ -2246,14 +2246,6 @@
|
||||
<source><b>Acceleration that mimics human behavior</b> by easing the throttle at low speeds and adding extra power when taking off from a stop.</source>
|
||||
<translation><b>Прискорення, що імітує поведінку людини</b>, шляхом послаблення дросельної заслінки на низьких швидкостях і додавання додаткової потужності при рушанні з місця.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Human-Like Following</source>
|
||||
<translation>Людиноподібне слідування</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source><b>Following behavior that mimics human drivers</b> by closing gaps behind faster vehicles for quicker takeoffs and dynamically adjusting the desired following distance for gentler, more efficient braking.</source>
|
||||
<translation><b>Поведінка, що імітує поведінку водіїв-людей</b>, шляхом скорочення відстані за швидшими транспортними засобами для швидшого старту та динамічного регулювання бажаної відстані для більш плавного та ефективного гальмування.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Lead Detection Sensitivity</source>
|
||||
<translation>Чутливість виявлення лідера</translation>
|
||||
|
||||
Binary file not shown.
@@ -67,7 +67,6 @@ SAFE_MODE_MANAGED_KEYS = (
|
||||
"AccelerationProfile",
|
||||
"DecelerationProfile",
|
||||
"HumanAcceleration",
|
||||
"HumanFollowing",
|
||||
"CoastUpToLeads",
|
||||
"HumanLaneChanges",
|
||||
"LeadDetectionThreshold",
|
||||
|
||||
@@ -946,7 +946,6 @@ class StarPilotVariables:
|
||||
else:
|
||||
toggle.custom_accel_profile_values = [custom_accel_defaults[key] for key in CUSTOM_ACCEL_PROFILE_PARAM_KEYS]
|
||||
toggle.human_acceleration = self.get_value("HumanAcceleration", condition=longitudinal_tuning)
|
||||
toggle.human_following = self.get_value("HumanFollowing", condition=longitudinal_tuning)
|
||||
toggle.coast_up_to_leads = self.get_value("CoastUpToLeads", condition=longitudinal_tuning)
|
||||
if longitudinal_tuning and self.params.get("CoastUpToLeads") is None:
|
||||
toggle.coast_up_to_leads = True
|
||||
|
||||
@@ -99,23 +99,7 @@ class StarPilotFollowing:
|
||||
self.desired_follow_distance = 0
|
||||
|
||||
def update_follow_values(self, lead_distance, v_ego, v_lead, starpilot_toggles):
|
||||
if starpilot_toggles.human_following and v_lead > v_ego:
|
||||
distance_factor = max(lead_distance - (v_ego * self.t_follow), 1)
|
||||
from starpilot.common.starpilot_variables import get_starpilot_toggles
|
||||
fp_toggles = get_starpilot_toggles()
|
||||
accelerating_offset = float(np.clip(fp_toggles.stop_distance - v_ego, 1, distance_factor))
|
||||
|
||||
self.acceleration_jerk /= accelerating_offset
|
||||
self.speed_jerk /= accelerating_offset
|
||||
self.t_follow /= accelerating_offset
|
||||
|
||||
if (starpilot_toggles.conditional_slower_lead or starpilot_toggles.human_following) and v_lead < v_ego:
|
||||
if starpilot_toggles.conditional_slower_lead and v_lead < v_ego:
|
||||
distance_factor = max(lead_distance - (v_lead * self.t_follow), 1)
|
||||
braking_offset = float(np.clip(min(v_ego - v_lead, v_lead) - COMFORT_BRAKE, 1, distance_factor))
|
||||
|
||||
if starpilot_toggles.human_following:
|
||||
from starpilot.common.starpilot_variables import get_starpilot_toggles
|
||||
fp_toggles = get_starpilot_toggles()
|
||||
far_lead_offset = max(lead_distance - (v_ego * self.t_follow) - fp_toggles.stop_distance, 0)
|
||||
self.t_follow /= braking_offset + far_lead_offset
|
||||
self.slower_lead = braking_offset > 1
|
||||
|
||||
@@ -832,7 +832,7 @@
|
||||
{
|
||||
"key": "RelaxedFollow",
|
||||
"label": "Following Distance",
|
||||
"description": "How many seconds openpilot follows behind lead vehicles when using the \"Relaxed\" profile. Increase for more space; decrease for tighter gaps.\n\nDefault: 1.75 seconds.",
|
||||
"description": "How many seconds openpilot follows behind lead vehicles when using the \"Relaxed\" profile. Increase for more space; decrease for tighter gaps.\n\nDefault: 1.6 seconds.",
|
||||
"data_type": "float",
|
||||
"ui_type": "numeric",
|
||||
"min": 0.5,
|
||||
@@ -970,14 +970,6 @@
|
||||
"ui_type": "toggle",
|
||||
"parent_key": "LongitudinalTune"
|
||||
},
|
||||
{
|
||||
"key": "HumanFollowing",
|
||||
"label": "Human-Like Following",
|
||||
"description": "Following behavior that mimics human drivers by closing gaps behind faster vehicles for quicker takeoffs and dynamically adjusting the desired following distance for gentler, more efficient braking.",
|
||||
"data_type": "bool",
|
||||
"ui_type": "toggle",
|
||||
"parent_key": "LongitudinalTune"
|
||||
},
|
||||
{
|
||||
"key": "CoastUpToLeads",
|
||||
"label": "Coast Up To Leads",
|
||||
|
||||
@@ -134,7 +134,7 @@ StarPilotLongitudinalPanel::StarPilotLongitudinalPanel(StarPilotSettingsWindow *
|
||||
{"ResetStandardPersonality", tr("Reset to Defaults"), tr("<b>Reset the \"Standard\" profile to defaults.</b>"), ""},
|
||||
|
||||
{"RelaxedPersonalityProfile", tr("Relaxed"), tr("<b>Customize the \"Relaxed\" personality profile.</b> Designed for smoother, more comfortable driving with larger gaps."), "../../starpilot/assets/stock_theme/distance_icons/relaxed.png"},
|
||||
{"RelaxedFollow", tr("Following Distance"), tr("<b>How many seconds openpilot follows behind lead vehicles when using the \"Relaxed\" profile.</b> Increase for more space; decrease for tighter gaps.<br><br>Default: 1.75 seconds."), ""},
|
||||
{"RelaxedFollow", tr("Following Distance"), tr("<b>How many seconds openpilot follows behind lead vehicles when using the \"Relaxed\" profile.</b> Increase for more space; decrease for tighter gaps.<br><br>Default: 1.6 seconds."), ""},
|
||||
{"RelaxedFollowHigh", tr("High Speed Following Distance"), tr("<b>Following distance for higher speeds in the \"Relaxed\" profile.</b> openpilot smoothly blends from the base value to this value as speed rises."), ""},
|
||||
{"RelaxedJerkAcceleration", tr("Acceleration Smoothness"), tr("<b>How smoothly openpilot accelerates with the \"Relaxed\" profile.</b> Increase for gentler starts; decrease for faster but more abrupt takeoffs."), ""},
|
||||
{"RelaxedJerkDeceleration", tr("Braking Smoothness"), tr("<b>How smoothly openpilot brakes with the \"Relaxed\" profile.</b> Increase for gentler stops; decrease for quicker but sharper braking."), ""},
|
||||
@@ -147,7 +147,6 @@ StarPilotLongitudinalPanel::StarPilotLongitudinalPanel(StarPilotSettingsWindow *
|
||||
{"AccelerationProfile", tr("Acceleration Profile"), tr("<b>How quickly openpilot speeds up.</b> \"Eco\" is gentle and efficient, \"Sport\" is firmer and more responsive, and \"Sport+\" accelerates at the maximum rate allowed."), ""},
|
||||
{"DecelerationProfile", tr("Deceleration Profile"), tr("<b>How firmly openpilot slows down.</b> \"Eco\" favors coasting, \"Sport\" applies stronger braking."), ""},
|
||||
{"HumanAcceleration", tr("Human-Like Acceleration"), tr("<b>Acceleration that mimics human behavior</b> by easing the throttle at low speeds and adding extra power when taking off from a stop."), ""},
|
||||
{"HumanFollowing", tr("Human-Like Following"), tr("<b>Following behavior that mimics human drivers</b> by closing gaps behind faster vehicles for quicker takeoffs and dynamically adjusting the desired following distance for gentler, more efficient braking."), ""},
|
||||
{"CoastUpToLeads", tr("Coast Up To Leads"), tr("<b>Allow openpilot to coast toward far leads before resuming normal throttle.</b> Disable this if your vehicle shows noticeable gas/brake alternation while approaching distant traffic."), ""},
|
||||
{"HumanLaneChanges", tr("Human-Like Lane Changes"), tr("<b>Lane-change behavior that mimics human drivers</b> by anticipating and tracking adjacent vehicles during lane changes."), ""},
|
||||
{"LeadDetectionThreshold", tr("Lead Detection Sensitivity"), tr("<b>How sensitive openpilot is to detecting vehicles.</b> Higher sensitivity allows quicker detection at longer distances but may react to non-vehicle objects; lower sensitivity is more conservative and reduces false detections."), ""},
|
||||
|
||||
@@ -33,7 +33,7 @@ private:
|
||||
QSet<QString> conditionalExperimentalKeys = {"PersistExperimentalState", "CESpeed", "CESpeedLead", "CECurves", "CELead", "CEModelStopTime", "CESignalSpeed", "CEStopLights", "ShowCEMStatus"};
|
||||
QSet<QString> curveSpeedKeys = {"CalibratedLateralAcceleration", "CalibrationProgress", "ResetCurveData", "ShowCSCStatus"};
|
||||
QSet<QString> customDrivingPersonalityKeys = {"AggressivePersonalityProfile", "RelaxedPersonalityProfile", "StandardPersonalityProfile", "TrafficPersonalityProfile"};
|
||||
QSet<QString> longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "HumanAcceleration", "HumanFollowing", "CoastUpToLeads", "HumanLaneChanges", "LeadDetectionThreshold", "TacoTune"};
|
||||
QSet<QString> longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "HumanAcceleration", "CoastUpToLeads", "HumanLaneChanges", "LeadDetectionThreshold", "TacoTune"};
|
||||
QSet<QString> qolKeys = {"CustomCruise", "CustomCruiseLong", "ForceStops", "ForceStopDistanceOffset", "ForceStandstill", "IncreasedStoppedDistance", "MapGears", "ReverseCruise", "SetSpeedOffset", "WeatherPresets"};
|
||||
QSet<QString> relaxedPersonalityKeys = {"RelaxedFollow", "RelaxedFollowHigh", "RelaxedJerkAcceleration", "RelaxedJerkDeceleration", "RelaxedJerkDanger", "RelaxedJerkSpeed", "RelaxedJerkSpeedDecrease", "ResetRelaxedPersonality"};
|
||||
QSet<QString> speedLimitControllerKeys = {"SLCOffsets", "SLCFallback", "SLCOverride", "SLCPriority", "SLCQOL", "SLCVisuals"};
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,6 +15,39 @@ LEGACY_STEER_KP = 0.7
|
||||
QT_STEER_KP_PLACEHOLDER = 1.0
|
||||
|
||||
LAUNCH_PARAM_MIGRATION_MARKER = ".starpilot_launch_param_migrations_v2"
|
||||
BRANCH_DEFAULTS_MIGRATION_MARKER = ".starpilot_branch_defaults_migrations_v1"
|
||||
|
||||
BRANCH_BOOL_DEFAULTS = {
|
||||
"ConditionalExperimental": True,
|
||||
"CELead": True,
|
||||
"CESlowerLead": True,
|
||||
"CEStoppedLead": False,
|
||||
"ForceStops": True,
|
||||
}
|
||||
|
||||
BRANCH_FLOAT_DEFAULTS = {
|
||||
"AggressiveFollow": 1.25,
|
||||
"AggressiveFollowHigh": 1.0,
|
||||
"AggressiveJerkAcceleration": 50.0,
|
||||
"AggressiveJerkDanger": 100.0,
|
||||
"AggressiveJerkDeceleration": 50.0,
|
||||
"AggressiveJerkSpeed": 50.0,
|
||||
"AggressiveJerkSpeedDecrease": 50.0,
|
||||
"StandardFollow": 1.45,
|
||||
"StandardFollowHigh": 1.2,
|
||||
"StandardJerkAcceleration": 100.0,
|
||||
"StandardJerkDanger": 100.0,
|
||||
"StandardJerkDeceleration": 100.0,
|
||||
"StandardJerkSpeed": 100.0,
|
||||
"StandardJerkSpeedDecrease": 100.0,
|
||||
"RelaxedFollow": 1.6,
|
||||
"RelaxedFollowHigh": 1.4,
|
||||
"RelaxedJerkAcceleration": 100.0,
|
||||
"RelaxedJerkDanger": 100.0,
|
||||
"RelaxedJerkDeceleration": 100.0,
|
||||
"RelaxedJerkSpeed": 100.0,
|
||||
"RelaxedJerkSpeedDecrease": 100.0,
|
||||
}
|
||||
|
||||
|
||||
class ParamsLike(Protocol):
|
||||
@@ -33,8 +66,11 @@ def _default_marker_path(params: ParamsLike) -> Path:
|
||||
return Path(params.get_param_path()) / LAUNCH_PARAM_MIGRATION_MARKER
|
||||
|
||||
|
||||
def apply_launch_param_migrations(params: ParamsLike, marker_path: Path | None = None) -> None:
|
||||
marker = marker_path or _default_marker_path(params)
|
||||
def _branch_defaults_marker_path(params: ParamsLike) -> Path:
|
||||
return Path(params.get_param_path()) / BRANCH_DEFAULTS_MIGRATION_MARKER
|
||||
|
||||
|
||||
def _apply_legacy_launch_param_migrations(params: ParamsLike, marker: Path) -> None:
|
||||
if marker.exists():
|
||||
return
|
||||
|
||||
@@ -61,6 +97,29 @@ def apply_launch_param_migrations(params: ParamsLike, marker_path: Path | None =
|
||||
marker.touch()
|
||||
|
||||
|
||||
def _apply_branch_default_migration(params: ParamsLike, marker: Path) -> None:
|
||||
if marker.exists():
|
||||
return
|
||||
|
||||
marker.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
for key, value in BRANCH_BOOL_DEFAULTS.items():
|
||||
params.put_bool(key, value)
|
||||
|
||||
for key, value in BRANCH_FLOAT_DEFAULTS.items():
|
||||
params.put_float(key, value)
|
||||
|
||||
marker.touch()
|
||||
|
||||
|
||||
def apply_launch_param_migrations(params: ParamsLike, marker_path: Path | None = None,
|
||||
branch_defaults_marker_path: Path | None = None) -> None:
|
||||
_apply_legacy_launch_param_migrations(params, marker_path or _default_marker_path(params))
|
||||
# Keep branch-default rollout on its own marker so older installs that already
|
||||
# have the legacy marker still receive this one-time param reset.
|
||||
_apply_branch_default_migration(params, branch_defaults_marker_path or _branch_defaults_marker_path(params))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
try:
|
||||
from openpilot.common.params import Params
|
||||
|
||||
@@ -40,6 +40,7 @@ STARPILOT_COAST_UP_TO_LEADS_MIGRATION_FLAG = Path("/data") / "starpilot_coast_up
|
||||
STARPILOT_PARAM_RENAME_MIGRATION_FLAG = Path("/data") / "starpilot_param_rename_v1"
|
||||
STARPILOT_PARAM_CANONICALIZATION_MIGRATION_FLAG = Path("/data") / "starpilot_param_canonicalization_v1"
|
||||
STARPILOT_PC_ROOT_MIGRATION_FLAG = Path("/data") / "starpilot_pc_root_v1"
|
||||
STARPILOT_REMOVED_PARAM_KEYS = ("HumanFollowing",)
|
||||
LEGACY_CARMODEL_MIGRATIONS = {
|
||||
"CHEVROLET_BOLT_CC_2019_2021": "CHEVROLET_BOLT_CC_2018_2021",
|
||||
}
|
||||
@@ -148,6 +149,35 @@ def _has_persisted_param_file(params: Params, key: str | bytes) -> bool:
|
||||
return bool(path) and os.path.isfile(path)
|
||||
|
||||
|
||||
def _remove_persisted_param_file(params: Params, key: str | bytes) -> bool:
|
||||
try:
|
||||
path = params.get_param_path(key)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
if not path or not os.path.isfile(path):
|
||||
return False
|
||||
|
||||
try:
|
||||
os.remove(path)
|
||||
return True
|
||||
except Exception:
|
||||
cloudlog.exception(f"Failed to remove deprecated param file: {key}")
|
||||
return False
|
||||
|
||||
|
||||
def cleanup_removed_starpilot_params(params: Params, params_cache: Params) -> None:
|
||||
removed_keys = []
|
||||
for key in STARPILOT_REMOVED_PARAM_KEYS:
|
||||
removed = _remove_persisted_param_file(params, key)
|
||||
removed = _remove_persisted_param_file(params_cache, key) or removed
|
||||
if removed:
|
||||
removed_keys.append(key)
|
||||
|
||||
if removed_keys:
|
||||
cloudlog.warning(f"Removed deprecated StarPilot params: {removed_keys}")
|
||||
|
||||
|
||||
def migrate_starpilot_param_renames(params: Params, params_cache: Params) -> None:
|
||||
if STARPILOT_PARAM_RENAME_MIGRATION_FLAG.exists():
|
||||
return
|
||||
@@ -337,7 +367,6 @@ def migrate_starpilot_default_parity(params: Params, params_cache: Params) -> No
|
||||
"AdvancedLateralTune": True,
|
||||
"ForceAutoTuneOff": True,
|
||||
"HumanAcceleration": False,
|
||||
"HumanFollowing": False,
|
||||
"NNFF": False,
|
||||
"NNFFLite": False,
|
||||
}
|
||||
@@ -385,7 +414,7 @@ def migrate_disable_humanlike_defaults(params: Params, params_cache: Params) ->
|
||||
|
||||
disabled_keys: list[str] = []
|
||||
|
||||
for key in ("HumanAcceleration", "HumanFollowing", "HumanLaneChanges"):
|
||||
for key in ("HumanAcceleration", "HumanLaneChanges"):
|
||||
if not (params.get_bool(key) or params_cache.get_bool(key)):
|
||||
continue
|
||||
|
||||
@@ -615,6 +644,7 @@ def manager_init() -> None:
|
||||
# Canonicalize legacy string encodings (e.g. INT params stored as "26.000000")
|
||||
# before bulk reads below to avoid repeated cast warnings and UI-side churn.
|
||||
migrate_param_type_canonicalization(params)
|
||||
cleanup_removed_starpilot_params(params, params_cache)
|
||||
migrate_starpilot_default_parity(params, params_cache)
|
||||
migrate_disable_humanlike_defaults(params, params_cache)
|
||||
migrate_cluster_offset_default(params, params_cache)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
from openpilot.system.manager.launch_param_migrations import (
|
||||
BRANCH_DEFAULTS_MIGRATION_MARKER,
|
||||
DEFAULT_STEER_KP,
|
||||
LAUNCH_PARAM_MIGRATION_MARKER,
|
||||
apply_launch_param_migrations,
|
||||
@@ -84,3 +85,59 @@ def test_apply_launch_param_migrations_does_not_reapply_after_marker(tmp_path):
|
||||
assert not params.get_bool("LongPitch")
|
||||
assert params.get_float("SteerKP") == 0.65
|
||||
assert params.get_float("SteerKPStock") == DEFAULT_STEER_KP
|
||||
|
||||
|
||||
def test_apply_launch_param_migrations_applies_branch_defaults_for_existing_installs(tmp_path):
|
||||
params = FileBackedFakeParams(tmp_path / "params")
|
||||
|
||||
params.put_bool("LongPitch", False)
|
||||
params.put_bool("ConditionalExperimental", False)
|
||||
params.put_bool("CELead", False)
|
||||
params.put_bool("CESlowerLead", False)
|
||||
params.put_bool("CEStoppedLead", True)
|
||||
params.put_bool("ForceStops", False)
|
||||
params.put_float("AggressiveFollowHigh", 1.25)
|
||||
params.put_float("StandardFollowHigh", 1.45)
|
||||
params.put_float("StandardJerkAcceleration", 50.0)
|
||||
params.put_float("RelaxedFollow", 1.75)
|
||||
params.put_float("RelaxedFollowHigh", 1.75)
|
||||
params.put_float("RelaxedJerkSpeed", 50.0)
|
||||
(tmp_path / "params" / LAUNCH_PARAM_MIGRATION_MARKER).touch()
|
||||
|
||||
apply_launch_param_migrations(params)
|
||||
|
||||
assert not params.get_bool("LongPitch")
|
||||
assert params.get_bool("ConditionalExperimental")
|
||||
assert params.get_bool("CELead")
|
||||
assert params.get_bool("CESlowerLead")
|
||||
assert not params.get_bool("CEStoppedLead")
|
||||
assert params.get_bool("ForceStops")
|
||||
assert params.get_float("AggressiveFollowHigh") == 1.0
|
||||
assert params.get_float("StandardFollowHigh") == 1.2
|
||||
assert params.get_float("StandardJerkAcceleration") == 100.0
|
||||
assert params.get_float("RelaxedFollow") == 1.6
|
||||
assert params.get_float("RelaxedFollowHigh") == 1.4
|
||||
assert params.get_float("RelaxedJerkSpeed") == 100.0
|
||||
assert (tmp_path / "params" / BRANCH_DEFAULTS_MIGRATION_MARKER).is_file()
|
||||
|
||||
|
||||
def test_apply_launch_param_migrations_does_not_reapply_branch_defaults_after_marker(tmp_path):
|
||||
params = FileBackedFakeParams(tmp_path / "params")
|
||||
branch_defaults_marker = tmp_path / "params" / BRANCH_DEFAULTS_MIGRATION_MARKER
|
||||
|
||||
params.put_bool("ConditionalExperimental", False)
|
||||
params.put_bool("CEStoppedLead", True)
|
||||
params.put_bool("ForceStops", False)
|
||||
params.put_float("AggressiveFollowHigh", 2.0)
|
||||
params.put_float("StandardJerkAcceleration", 25.0)
|
||||
params.put_float("RelaxedFollow", 2.0)
|
||||
branch_defaults_marker.touch()
|
||||
|
||||
apply_launch_param_migrations(params)
|
||||
|
||||
assert not params.get_bool("ConditionalExperimental")
|
||||
assert params.get_bool("CEStoppedLead")
|
||||
assert not params.get_bool("ForceStops")
|
||||
assert params.get_float("AggressiveFollowHigh") == 2.0
|
||||
assert params.get_float("StandardJerkAcceleration") == 25.0
|
||||
assert params.get_float("RelaxedFollow") == 2.0
|
||||
|
||||
@@ -168,15 +168,11 @@ class TestManager:
|
||||
assert params.get("CEModelStopTime") == "3.5"
|
||||
assert params_cache.get_bool("NNFF")
|
||||
|
||||
assert Path(params.get_param_path("HumanFollowing")).is_file()
|
||||
assert not params.get_bool("HumanFollowing")
|
||||
|
||||
def test_migrate_disable_humanlike_defaults(self, tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(manager, "STARPILOT_HUMANLIKE_DISABLE_MIGRATION_FLAG", tmp_path / "starpilot_humanlike_disable_v1")
|
||||
|
||||
params = FileBackedFakeParams(tmp_path / "params", {
|
||||
"HumanAcceleration": True,
|
||||
"HumanFollowing": True,
|
||||
})
|
||||
params_cache = FileBackedFakeParams(tmp_path / "cache", {
|
||||
"HumanLaneChanges": True,
|
||||
@@ -185,12 +181,23 @@ class TestManager:
|
||||
manager.migrate_disable_humanlike_defaults(params, params_cache)
|
||||
|
||||
assert not params.get_bool("HumanAcceleration")
|
||||
assert not params.get_bool("HumanFollowing")
|
||||
assert not params.get_bool("HumanLaneChanges")
|
||||
assert not params_cache.get_bool("HumanAcceleration")
|
||||
assert not params_cache.get_bool("HumanFollowing")
|
||||
assert not params_cache.get_bool("HumanLaneChanges")
|
||||
|
||||
def test_cleanup_removed_starpilot_params(self, tmp_path):
|
||||
params = FileBackedFakeParams(tmp_path / "params", {
|
||||
"HumanFollowing": True,
|
||||
})
|
||||
params_cache = FileBackedFakeParams(tmp_path / "cache", {
|
||||
"HumanFollowing": False,
|
||||
})
|
||||
|
||||
manager.cleanup_removed_starpilot_params(params, params_cache)
|
||||
|
||||
assert not Path(params.get_param_path("HumanFollowing")).exists()
|
||||
assert not Path(params_cache.get_param_path("HumanFollowing")).exists()
|
||||
|
||||
def test_migrate_cluster_offset_default_resets_legacy_default_only(self, tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(manager, "STARPILOT_CLUSTER_OFFSET_MIGRATION_FLAG", tmp_path / "starpilot_cluster_offset_v1")
|
||||
|
||||
|
||||
@@ -132,7 +132,6 @@ HideSpeedLimit
|
||||
HigherBitrate
|
||||
HolidayThemes
|
||||
HumanAcceleration
|
||||
HumanFollowing
|
||||
IncreaseThermalLimits
|
||||
IncreasedStoppedDistance
|
||||
IsDriverViewEnabled
|
||||
|
||||
Reference in New Issue
Block a user