Skip to content

Commit

Permalink
October 13th, 2024 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
FrogAi committed Oct 13, 2024
1 parent 7363293 commit d474df8
Show file tree
Hide file tree
Showing 122 changed files with 668 additions and 1,948 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ FrogPilot is a fully open-sourced fork of openpilot, featuring clear and concise
------
FrogPilot was last updated on:

**October 7th, 2024**
**October 15th, 2024**

Features
------
Expand Down
3 changes: 1 addition & 2 deletions cereal/log.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -1958,8 +1958,7 @@ struct Joystick {
struct DriverStateV2 {
frameId @0 :UInt32;
modelExecutionTime @1 :Float32;
dspExecutionTimeDEPRECATED @2 :Float32;
gpuExecutionTime @8 :Float32;
dspExecutionTime @2 :Float32;
rawPredictions @3 :Data;

poorVisionProb @4 :Float32;
Expand Down
2 changes: 1 addition & 1 deletion common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"ConditionalExperimental", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CrosstrekTorque", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"CurrentHolidayTheme", CLEAR_ON_MANAGER_START},
{"CurrentModelName", CLEAR_ON_MANAGER_START},
{"CurveSensitivity", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CurveSpeedControl", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CustomAlerts", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
Expand Down Expand Up @@ -390,7 +391,6 @@ std::unordered_map<std::string, uint32_t> keys = {
{"MapsSelected", PERSISTENT | FROGPILOT_OTHER},
{"MapSpeedLimit", PERSISTENT},
{"MapStyle", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"MapTargetLatA", PERSISTENT},
{"MapTargetVelocities", PERSISTENT},
{"MaxDesiredAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"MinimumBackupSize", PERSISTENT},
Expand Down
4 changes: 1 addition & 3 deletions selfdrive/car/car_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
def get_startup_event(car_recognized, controller_available, fw_seen, block_user, frogpilot_toggles):
if block_user:
return EventName.blockUser
elif frogpilot_toggles.personalize_openpilot:
event = EventName.customStartupAlert
else:
event = EventName.startupMaster
event = EventName.customStartupAlert

if not car_recognized:
if fw_seen:
Expand Down
49 changes: 23 additions & 26 deletions selfdrive/car/toyota/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
# - prolonged high driver torque: 17 (permanent)
PERM_STEER_FAULTS = (3, 17)

ZSS_THRESHOLD = 4.0
ZSS_THRESHOLD_COUNT = 10

# Traffic signals for Speed Limit Controller - Credit goes to the DragonPilot team!
@staticmethod
def calculate_speed_limit(cp_cam, frogpilot_toggles):
Expand Down Expand Up @@ -70,11 +67,11 @@ def __init__(self, CP):
self.slope_angle = 0.0

# FrogPilot variables
self.zss_compute = False
self.zss_cruise_active_last = False
self.latActive_previous = False
self.needs_angle_offset_zss = True

self.zss_angle_offset = 0
self.zss_threshold_count = 0
self.angle_offset_zss = 0
self.zorro_steer_value = 0

def update(self, cp, cp_cam, CC, frogpilot_toggles):
ret = car.CarState.new_message()
Expand Down Expand Up @@ -243,28 +240,27 @@ def update(self, cp, cp_cam, CC, frogpilot_toggles):
self.lkas_previously_enabled = self.lkas_enabled
self.lkas_enabled = self.lkas_hud.get("LDA_ON_MESSAGE") == 1

# ZSS Support - Credit goes to the DragonPilot team!
if self.CP.flags & ToyotaFlags.ZSS and self.zss_threshold_count <= ZSS_THRESHOLD_COUNT:
zorro_steer = cp.vl["SECONDARY_STEER_ANGLE"]["ZORRO_STEER"]
# ZSS Support - Credit goes to Erich!
if self.CP.flags & ToyotaFlags.ZSS:
if abs(torque_sensor_angle_deg) > 1e-3:
self.accurate_steer_angle_seen = True

# Only compute ZSS offset when control is active
if CC.latActive and not self.zss_cruise_active_last:
self.zss_threshold_count = 0
self.zss_compute = True # Control was just activated, so allow offset to be recomputed
self.zss_cruise_active_last = CC.latActive
if CC.latActive and not self.latActive_previous:
self.needs_angle_offset_zss = True
self.latActive_previous = CC.latActive

# Compute ZSS offset
if self.zss_compute:
if self.needs_angle_offset_zss:
zorro_steer = cp.vl["SECONDARY_STEER_ANGLE"]["ZORRO_STEER"]
if abs(ret.steeringAngleDeg) > 1e-3 and abs(zorro_steer) > 1e-3:
self.zss_compute = False
self.zss_angle_offset = zorro_steer - ret.steeringAngleDeg
self.needs_angle_offset_zss = False
self.angle_offset_zss = zorro_steer - ret.steeringAngleDeg
self.zorro_steer_value = cp.vl["SECONDARY_STEER_ANGLE"]["ZORRO_STEER"] - self.angle_offset_zss

# Safety checks
steering_angle_deg = zorro_steer - self.zss_angle_offset
if abs(ret.steeringAngleDeg - steering_angle_deg) > ZSS_THRESHOLD:
self.zss_threshold_count += 1
else:
ret.steeringAngleDeg = steering_angle_deg
if not self.needs_angle_offset_zss:
if abs(ret.steeringAngleDeg - self.zorro_steer_value) > 4.0:
ret.steeringAngleDeg = ret.steeringAngleDeg
else:
ret.steeringAngleDeg = self.zorro_steer_value

return ret, fp_ret

Expand Down Expand Up @@ -325,7 +321,8 @@ def get_can_parser(CP):
("SDSU", 100),
]

messages += [("SECONDARY_STEER_ANGLE", 0)]
if CP.flags & ToyotaFlags.ZSS:
messages += [("SECONDARY_STEER_ANGLE", 0)]

return CANParser(DBC[CP.carFingerprint]["pt"], messages, 0)

Expand Down
10 changes: 5 additions & 5 deletions selfdrive/car/toyota/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, exp
ret.steerActuatorDelay = 0.12 # Default delay, Prius has larger delay
ret.steerLimitTimer = 0.4

if 0x23 in fingerprint[0]: # Detect if ZSS is present
ret.flags |= ToyotaFlags.ZSS.value

ret.stoppingControl = False # Toyota starts braking more when it thinks you want to stop

# Detect smartDSU, which intercepts ACC_CMD from the DSU (or radar) allowing openpilot to send it
Expand Down Expand Up @@ -73,6 +70,9 @@ def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, exp
ret.steerActuatorDelay = 0.25
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning, steering_angle_deadzone_deg=0.2)

if 0x23 in fingerprint[0]: # Detect if ZSS is present
ret.flags |= ToyotaFlags.ZSS.value

elif candidate in (CAR.LEXUS_RX, CAR.LEXUS_RX_TSS2):
ret.wheelSpeedFactor = 1.035

Expand Down Expand Up @@ -156,10 +156,10 @@ def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, exp
tune.kiV = [3.6, 2.4, 1.5]

if params.get_bool("FrogsGoMoosTweak"):
if candidate in TSS2_CAR or ret.flags & ToyotaFlags.NEW_TOYOTA_TUNE:
if ret.flags & ToyotaFlags.NEW_TOYOTA_TUNE or ret.flags & ToyotaFlags.RAISED_ACCEL_LIMIT:
tune.kiV = [0.3]

ret.stoppingDecelRate = 0.01 # reach stopping target smoothly
ret.stoppingDecelRate = 0.1 # reach stopping target smoothly
ret.vEgoStopping = 0.15
ret.vEgoStarting = 0.15

Expand Down
5 changes: 3 additions & 2 deletions selfdrive/classic_modeld/classic_modeld.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ def __init__(self, context: CLContext, frogpilot_toggles: SimpleNamespace):
self.enable_navigation = not frogpilot_toggles.navigationless_model
self.radarless = frogpilot_toggles.radarless_model

if frogpilot_toggles.model != DEFAULT_MODEL:
MODEL_PATHS[ModelRunner.THNEED] = Path(__file__).parent / f'{MODELS_PATH}/{frogpilot_toggles.model}.thneed'
model_path = Path(__file__).parent / f'{MODELS_PATH}/{frogpilot_toggles.model}.thneed'
if frogpilot_toggles.model != DEFAULT_MODEL and model_path.exists():
MODEL_PATHS[ModelRunner.THNEED] = model_path

self.frame = ModelFrame(context)
self.wide_frame = ModelFrame(context)
Expand Down
10 changes: 0 additions & 10 deletions selfdrive/classic_modeld/modeld

This file was deleted.

Loading

0 comments on commit d474df8

Please sign in to comment.