No Gas-Gating (NoGG) - init

This commit is contained in:
Rick Lan
2025-04-19 16:00:17 +08:00
parent c85f3eab3f
commit c5ee4fd5c0
5 changed files with 11 additions and 2 deletions

View File

@@ -122,4 +122,5 @@ inline static std::unordered_map<std::string, uint32_t> keys = {
{"Version", PERSISTENT},
{"dp_device_last_log", CLEAR_ON_ONROAD_TRANSITION},
{"dp_device_reset_conf", CLEAR_ON_MANAGER_START},
{"dp_lon_no_gas_gating", PERSISTENT},
};

View File

@@ -27,6 +27,7 @@ _A_TOTAL_MAX_V = [1.7, 3.2]
_A_TOTAL_MAX_BP = [20., 40.]
class DPFlags:
NO_GAS_GATING = 2
pass
def get_max_accel(v_ego):
@@ -135,7 +136,7 @@ class LongitudinalPlanner:
# Don't clip at low speeds since throttle_prob doesn't account for creep
self.allow_throttle = throttle_prob > ALLOW_THROTTLE_THRESHOLD or v_ego <= MIN_ALLOW_THROTTLE_SPEED
if not self.allow_throttle:
if not (dp_flags & DPFlags.NO_GAS_GATING) and not self.allow_throttle:
clipped_accel_coast = max(accel_coast, accel_clip[0])
clipped_accel_coast_interp = np.interp(v_ego, [MIN_ALLOW_THROTTLE_SPEED, MIN_ALLOW_THROTTLE_SPEED*2], [accel_clip[1], clipped_accel_coast])
accel_clip[1] = min(accel_clip[1], clipped_accel_coast_interp)

View File

@@ -23,7 +23,8 @@ def main():
poll='modelV2')
dp_flags = 0
if params.get_bool("dp_lon_no_gas_gating"):
dp_flags |= DPFlags.NO_GAS_GATING
while True:
sm.update()
if sm.updated['modelV2']:

View File

@@ -139,6 +139,11 @@ void DPPanel::add_longitudinal_toggles() {
QString::fromUtf8("🐉 ") + tr("Longitudinal Ctrl"),
"",
},
{
"dp_lon_no_gas_gating",
tr("Enable No Gas Gating (NoGG)"),
tr("Allows the car to accelerate in situations where Gas Gating would normally prevent it, like approaching traffic lights or exits."),
},
};
QWidget *label = nullptr;

View File

@@ -40,6 +40,7 @@ def manager_init() -> None:
("OpenpilotEnabledToggle", "1"),
("LongitudinalPersonality", str(log.LongitudinalPersonality.standard)),
("DisableLogging", "0"),
("dp_lon_no_gas_gating", "0"),
]
if params.get_bool("RecordFrontLock"):