Compile FrogPilot
This commit is contained in:
@@ -136,8 +136,8 @@ class CarController:
|
||||
pedal_offset = interp(CS.out.vEgo, [0.0, 2.3, MIN_ACC_SPEED + PEDAL_TRANSITION], [-.4, 0.0, 0.2])
|
||||
pedal_command = PEDAL_SCALE * (actuators.accel + pedal_offset)
|
||||
interceptor_gas_cmd = clip(pedal_command, 0., MAX_INTERCEPTOR_GAS)
|
||||
elif ((CC.longActive and actuators.accel > 0.) or (not self.CP.openpilotLongitudinalControl and CS.stock_resume_ready)) \
|
||||
and self.CP.carFingerprint in STOP_AND_GO_CAR and self.CP.enableGasInterceptor and CS.out.vEgo < 1e-3:
|
||||
elif self.CP.enableGasInterceptor and CC.longActive and self.CP.carFingerprint in STOP_AND_GO_CAR and actuators.accel > 0.0 \
|
||||
and CS.out.standstill:
|
||||
interceptor_gas_cmd = 0.12
|
||||
else:
|
||||
interceptor_gas_cmd = 0.
|
||||
|
||||
@@ -182,19 +182,7 @@ class CarState(CarStateBase):
|
||||
if self.CP.carFingerprint != CAR.PRIUS_V:
|
||||
self.lkas_hud = copy.copy(cp_cam.vl["LKAS_HUD"])
|
||||
|
||||
# if openpilot does not control longitudinal, in this case, assume 0x343 is on bus0
|
||||
# 1) the car is no longer sending standstill
|
||||
# 2) the car is still in standstill
|
||||
if not self.CP.openpilotLongitudinalControl:
|
||||
self.stock_resume_ready = cp.vl["ACC_CONTROL"]["RELEASE_STANDSTILL"] == 1
|
||||
|
||||
# FrogPilot functions
|
||||
if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) or (self.CP.flags & ToyotaFlags.SMART_DSU and not self.CP.flags & ToyotaFlags.RADAR_CAN_FILTER):
|
||||
# distance button is wired to the ACC module (camera or radar)
|
||||
if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR):
|
||||
distance_pressed = cp_acc.vl["ACC_CONTROL"]["DISTANCE"]
|
||||
else:
|
||||
distance_pressed = cp.vl["SDSU"]["FD_BUTTON"]
|
||||
|
||||
# Switch the current state of Experimental Mode if the LKAS button is double pressed
|
||||
if frogpilot_variables.experimental_mode_via_lkas and ret.cruiseState.available and self.CP.carFingerprint != CAR.PRIUS_V:
|
||||
@@ -209,6 +197,19 @@ class CarState(CarStateBase):
|
||||
|
||||
self.lkas_previously_pressed = lkas_pressed
|
||||
|
||||
if self.CP.carFingerprint not in UNSUPPORTED_DSU_CAR:
|
||||
# Need to subtract by 1 to comply with the personality profiles of "0", "1", and "2"
|
||||
self.personality_profile = cp.vl["PCM_CRUISE_SM"]["DISTANCE_LINES"] - 1
|
||||
|
||||
if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) or self.CP.flags & ToyotaFlags.SMART_DSU:
|
||||
# distance button is wired to the ACC module (camera or radar)
|
||||
if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR):
|
||||
distance_pressed = cp_acc.vl["ACC_CONTROL"]["DISTANCE"]
|
||||
else:
|
||||
distance_pressed = cp.vl["SDSU"]["FD_BUTTON"]
|
||||
else:
|
||||
distance_pressed = False
|
||||
|
||||
# Distance button functions
|
||||
if ret.cruiseState.available:
|
||||
if distance_pressed:
|
||||
@@ -243,9 +244,6 @@ class CarState(CarStateBase):
|
||||
|
||||
# Update the distance lines on the dash upon ignition/onroad UI button clicked
|
||||
if frogpilot_variables.personalities_via_wheel and ret.cruiseState.available:
|
||||
# Need to subtract by 1 to comply with the personality profiles of "0", "1", and "2"
|
||||
self.personality_profile = cp.vl["PCM_CRUISE_SM"]["DISTANCE_LINES"] - 1
|
||||
|
||||
# Sync with the onroad UI button
|
||||
if self.fpf.personality_changed_via_ui:
|
||||
self.profile_restored = False
|
||||
@@ -341,7 +339,7 @@ class CarState(CarStateBase):
|
||||
if CP.enableBsm:
|
||||
messages.append(("BSM", 1))
|
||||
|
||||
if not CP.openpilotLongitudinalControl or (CP.carFingerprint in RADAR_ACC_CAR and not CP.flags & ToyotaFlags.DISABLE_RADAR.value):
|
||||
if CP.carFingerprint in RADAR_ACC_CAR and not CP.flags & ToyotaFlags.DISABLE_RADAR.value:
|
||||
if not CP.flags & ToyotaFlags.SMART_DSU.value:
|
||||
messages += [
|
||||
("ACC_CONTROL", 33),
|
||||
@@ -355,7 +353,7 @@ class CarState(CarStateBase):
|
||||
("PRE_COLLISION", 33),
|
||||
]
|
||||
|
||||
if CP.flags & ToyotaFlags.SMART_DSU and not CP.flags & ToyotaFlags.RADAR_CAN_FILTER:
|
||||
if CP.flags & ToyotaFlags.SMART_DSU:
|
||||
messages += [
|
||||
("SDSU", 100),
|
||||
]
|
||||
@@ -385,7 +383,4 @@ class CarState(CarStateBase):
|
||||
("PCS_HUD", 1),
|
||||
]
|
||||
|
||||
if not CP.openpilotLongitudinalControl and CP.carFingerprint not in (TSS2_CAR, UNSUPPORTED_DSU_CAR):
|
||||
messages.append(("ACC_CONTROL", 33))
|
||||
|
||||
return CANParser(DBC[CP.carFingerprint]["pt"], messages, 2)
|
||||
|
||||
@@ -47,7 +47,6 @@ class ToyotaFlags(IntFlag):
|
||||
SMART_DSU = 2
|
||||
DISABLE_RADAR = 4
|
||||
ZSS = 8
|
||||
RADAR_CAN_FILTER = 16
|
||||
|
||||
|
||||
class CAR(StrEnum):
|
||||
|
||||
Reference in New Issue
Block a user