Skip to content

Commit

Permalink
December 2024 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
FrogAi committed Dec 1, 2024
1 parent 1f44f0f commit bb7c481
Show file tree
Hide file tree
Showing 55 changed files with 991 additions and 911 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:

**November 24th, 2024**
**December 1st, 2024**

Features
------
Expand Down
82 changes: 42 additions & 40 deletions cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
startup @75;
startupNoCar @76;
startupNoControl @77;
startupNoSecOcKey @149;
startupNoSecOcKey @121;
startupMaster @78;
startupNoFw @104;
fcw @79;
Expand Down Expand Up @@ -119,34 +119,35 @@ struct CarEvent @0x9b1657f34caf3ad3 {
actuatorsApiUnavailable @120;

# FrogPilot Events
accel30 @121;
accel35 @122;
accel40 @123;
blockUser @124;
customStartupAlert @125;
dejaVuCurve @126;
firefoxSteerSaturated @127;
forcingStop @128;
goatSteerSaturated @129;
greenLight @130;
hal9000 @131;
holidayActive @132;
laneChangeBlockedLoud @133;
leadDeparting @134;
noLaneAvailable @135;
openpilotCrashed @136;
openpilotCrashedRandomEvent @137;
pedalInterceptorNoBrake @138;
speedLimitChanged @139;
thisIsFineSteerSaturated @140;
torqueNNLoad @141;
trafficModeActive @142;
trafficModeInactive @143;
turningLeft @144;
turningRight @145;
vCruise69 @146;
yourFrogTriedToKillMe @147;
youveGotMail @148;
accel30 @122;
accel35 @123;
accel40 @124;
blockUser @125;
customStartupAlert @126;
dejaVuCurve @127;
firefoxSteerSaturated @128;
forcingStop @129;
goatSteerSaturated @130;
greenLight @131;
hal9000 @132;
holidayActive @133;
laneChangeBlockedLoud @134;
leadDeparting @135;
noLaneAvailable @136;
openpilotCrashed @137;
openpilotCrashedRandomEvent @138;
pedalInterceptorNoBrake @139;
speedLimitChanged @140;
thisIsFineSteerSaturated @141;
toBeContinued @142;
torqueNNLoad @143;
trafficModeActive @144;
trafficModeInactive @145;
turningLeft @146;
turningRight @147;
vCruise69 @148;
yourFrogTriedToKillMe @149;
youveGotMail @150;

radarCanErrorDEPRECATED @15;
communityFeatureDisallowedDEPRECATED @62;
Expand Down Expand Up @@ -446,17 +447,18 @@ struct CarControl {

# FrogPilot sounds
angry @9;
dejaVu @10;
doc @11;
fart @12;
firefox @13;
goat @14;
hal9000 @15;
mail @16;
nessie @17;
noice @18;
thisIsFine @19;
uwu @20;
continued @10;
dejaVu @11;
doc @12;
fart @13;
firefox @14;
goat @15;
hal9000 @16;
mail @17;
nessie @18;
noice @19;
thisIsFine @20;
uwu @21;
}
}

Expand Down
54 changes: 29 additions & 25 deletions cereal/custom.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,38 @@ struct FrogPilotNavigation @0xda96579883444c35 {
struct FrogPilotPlan @0x80ae746ee2596b11 {
accelerationJerk @0 :Float32;
accelerationJerkStock @1 :Float32;
adjustedCruise @2 :Float32;
dangerJerk @3 :Float32;
desiredFollowDistance @4 :Int64;
experimentalMode @5 :Bool;
forcingStop @6 :Bool;
forcingStopLength @7 :Float32;
frogpilotEvents @8 :List(Car.CarEvent);
lateralCheck @9 :Bool;
laneWidthLeft @10 :Float32;
laneWidthRight @11 :Float32;
maxAcceleration @12 :Float32;
minAcceleration @13 :Float32;
dangerJerk @2 :Float32;
desiredFollowDistance @3 :Int64;
experimentalMode @4 :Bool;
forcingStop @5 :Bool;
forcingStopLength @6 :Float32;
frogpilotEvents @7 :List(Car.CarEvent);
lateralCheck @8 :Bool;
laneWidthLeft @9 :Float32;
laneWidthRight @10 :Float32;
maxAcceleration @11 :Float32;
minAcceleration @12 :Float32;
mtscSpeed @13 :Float32;
redLight @14 :Bool;
safeObstacleDistance @15 :Int64;
safeObstacleDistanceStock @16 :Int64;
slcOverridden @17 :Bool;
slcOverriddenSpeed @18 :Float32;
slcSpeedLimit @19 :Float32;
slcSpeedLimitOffset @20 :Float32;
speedJerk @21 :Float32;
speedJerkStock @22 :Float32;
speedLimitChanged @23 :Bool;
stoppedEquivalenceFactor @24 :Int64;
tFollow @25 :Float32;
togglesUpdated @26 :Bool;
unconfirmedSlcSpeedLimit @27 :Float32;
vCruise @28 :Float32;
vtscControllingCurve @29 :Bool;
slcMapSpeedLimit @17 :Float32;
slcOverridden @18 :Bool;
slcOverriddenSpeed @19 :Float32;
slcSpeedLimit @20 :Float32;
slcSpeedLimitOffset @21 :Float32;
slcSpeedLimitSource @22 :Text;
speedJerk @23 :Float32;
speedJerkStock @24 :Float32;
speedLimitChanged @25 :Bool;
stoppedEquivalenceFactor @26 :Int64;
tFollow @27 :Float32;
togglesUpdated @28 :Bool;
unconfirmedSlcSpeedLimit @29 :Float32;
upcomingSLCSpeedLimit @30 :Float32;
vCruise @31 :Float32;
vtscControllingCurve @32 :Bool;
vtscSpeed @33 :Float32;
}

struct CustomReserved5 @0xa5cd762cd951a455 {
Expand Down
5 changes: 3 additions & 2 deletions common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ std::unordered_map<std::string, uint32_t> keys = {
{"DeveloperUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"DeviceManagement", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DeviceShutdown", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DisableCurveSpeedSmoothing", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DisableOnroadUploads", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DisableOpenpilotLongitudinal", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"DissolvedOxygenDrives", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
Expand Down Expand Up @@ -344,6 +343,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"HideAlerts", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideAOLStatusBar", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"HideCEMStatusBar", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"HideCSCUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"HideLeadMarker", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideMapIcon", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideMaxSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
Expand Down Expand Up @@ -441,6 +441,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"RadarlessModels", PERSISTENT},
{"RadicalTurtleDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"RadicalTurtleScore", PERSISTENT | FROGPILOT_CONTROLS},
{"RainbowPath", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"RandomEvents", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"RecertifiedHerbalistDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"RecertifiedHerbalistScore", PERSISTENT | FROGPILOT_CONTROLS},
Expand Down Expand Up @@ -499,6 +500,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"SoundToDownload", PERSISTENT},
{"SpeedLimitChangedAlert", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SpeedLimitController", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SpeedLimitSources", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"StandardFollow", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandardJerkAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandardJerkDanger", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
Expand Down Expand Up @@ -537,7 +539,6 @@ std::unordered_map<std::string, uint32_t> keys = {
{"UnlimitedLength", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"UnlockDoors", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"Updated", PERSISTENT},
{"UpdateTheme", PERSISTENT},
{"UpdateWheelImage", PERSISTENT},
{"UseSI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"UseStockColors", CLEAR_ON_MANAGER_START},
Expand Down
32 changes: 30 additions & 2 deletions panda/board/safety/safety_toyota.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ const CanMsg TOYOTA_TX_MSGS[] = {
TOYOTA_COMMON_TX_MSGS
};

const CanMsg TOYOTA_SECOC_TX_MSGS[] = {
TOYOTA_COMMON_TX_MSGS
};

const CanMsg TOYOTA_LONG_TX_MSGS[] = {
TOYOTA_COMMON_LONG_TX_MSGS
};
Expand Down Expand Up @@ -109,6 +113,7 @@ const uint32_t TOYOTA_PARAM_STOCK_LONGITUDINAL = 2UL << TOYOTA_PARAM_OFFSET;
const uint32_t TOYOTA_PARAM_LTA = 4UL << TOYOTA_PARAM_OFFSET;
const uint32_t TOYOTA_PARAM_GAS_INTERCEPTOR = 8UL << TOYOTA_PARAM_OFFSET;

bool toyota_secoc = false;
bool toyota_alt_brake = false;
bool toyota_stock_longitudinal = false;
bool toyota_lta = false;
Expand Down Expand Up @@ -292,7 +297,7 @@ static bool toyota_tx_hook(const CANPacket_t *to_send) {
}
}

// LTA angle steering check
// STEERING_LTA angle steering check
if (addr == 0x191) {
// check the STEER_REQUEST, STEER_REQUEST_2, TORQUE_WIND_DOWN, STEER_ANGLE_CMD signals
bool lta_request = GET_BIT(to_send, 0U);
Expand Down Expand Up @@ -340,6 +345,18 @@ static bool toyota_tx_hook(const CANPacket_t *to_send) {
}
}

// STEERING_LTA_2 angle steering check (SecOC)
if (toyota_secoc && (addr == 0x131)) {
// SecOC cars block any form of LTA actuation for now
bool lta_request = GET_BIT(to_send, 3U); // STEERING_LTA_2.STEER_REQUEST
bool lta_request2 = GET_BIT(to_send, 0U); // STEERING_LTA_2.STEER_REQUEST_2
int lta_angle_msb = GET_BYTE(to_send, 2); // STEERING_LTA_2.STEER_ANGLE_CMD (MSB)
int lta_angle_lsb = GET_BYTE(to_send, 3); // STEERING_LTA_2.STEER_ANGLE_CMD (LSB)
bool actuation = lta_request || lta_request2 || (lta_angle_msb != 0) || (lta_angle_lsb != 0);
if (actuation) {
tx = false;
}
}
// STEER: safety check on bytes 2-3
if (addr == 0x2E4) {
int desired_torque = (GET_BYTE(to_send, 1) << 8) | GET_BYTE(to_send, 2);
Expand Down Expand Up @@ -373,6 +390,11 @@ static bool toyota_tx_hook(const CANPacket_t *to_send) {
}

static safety_config toyota_init(uint16_t param) {
#ifdef ALLOW_DEBUG
const uint32_t TOYOTA_PARAM_SECOC = 8UL << TOYOTA_PARAM_OFFSET;
toyota_secoc = GET_FLAG(param, TOYOTA_PARAM_SECOC);
#endif

toyota_alt_brake = GET_FLAG(param, TOYOTA_PARAM_ALT_BRAKE);
toyota_stock_longitudinal = GET_FLAG(param, TOYOTA_PARAM_STOCK_LONGITUDINAL);
toyota_lta = GET_FLAG(param, TOYOTA_PARAM_LTA);
Expand All @@ -386,7 +408,11 @@ static safety_config toyota_init(uint16_t param) {

safety_config ret;
if (toyota_stock_longitudinal) {
SET_TX_MSGS(TOYOTA_TX_MSGS, ret);
if (toyota_secoc) {
SET_TX_MSGS(TOYOTA_SECOC_TX_MSGS, ret);
} else {
SET_TX_MSGS(TOYOTA_TX_MSGS, ret);
}
} else {
enable_gas_interceptor ? SET_TX_MSGS(TOYOTA_INTERCEPTOR_TX_MSGS, ret) : \
SET_TX_MSGS(TOYOTA_LONG_TX_MSGS, ret);
Expand Down Expand Up @@ -414,6 +440,8 @@ static int toyota_fwd_hook(int bus_num, int addr) {
// block stock lkas messages and stock acc messages (if OP is doing ACC)
// in TSS2, 0x191 is LTA which we need to block to avoid controls collision
bool is_lkas_msg = ((addr == 0x2E4) || (addr == 0x412) || (addr == 0x191));
// on SecOC cars 0x131 is also LTA
is_lkas_msg |= toyota_secoc && (addr == 0x131);
// in TSS2 the camera does ACC as well, so filter 0x343
bool is_acc_msg = (addr == 0x343);
bool block_msg = is_lkas_msg || (is_acc_msg && !toyota_stock_longitudinal);
Expand Down
6 changes: 3 additions & 3 deletions selfdrive/car/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ def __init__(self, CI=None):
# FrogPilot variables
self.frogpilot_toggles = get_frogpilot_toggles()

if self.frogpilot_toggles.acceleration_profile == 3:
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX

if self.frogpilot_toggles.always_on_lateral:
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.ALWAYS_ON_LATERAL
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS

if self.frogpilot_toggles.acceleration_profile == 3:
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX

# Write CarParams for controls and radard
cp_bytes = self.CP.to_bytes()
self.params.put("CarParams", cp_bytes)
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/hyundai/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def calculate_speed_limit(self, cp, cp_cam):
return speed_limit_bus.vl["CLUSTER_SPEED_LIMIT"]["SPEED_LIMIT_1"]
else:
speed_limit_nav = cp.vl["Navi_HU"]["SpeedLim_Nav_Clu"] if self.CP.flags & HyundaiFlags.NAV_MSG else 0
speed_limit_cam = cp_cam.vl["LKAS12"]["CF_Lkas_TsrSpeed_Display_Clu"] if self.CP.flags & HyundaiFlags.LKAS12 else 0
return speed_limit_cam if speed_limit_cam not in (0, 255) else speed_limit_nav
speed_limit_cam = cp_cam.vl["LKAS12"]["CF_Lkas_TsrSpeed_Display_Clu"] if self.CP.flags & HyundaiFlags.LKAS12 else None
return speed_limit_cam if speed_limit_cam is not None and speed_limit_cam not in (0, 255) else speed_limit_nav

def update(self, cp, cp_cam, frogpilot_toggles):
if self.CP.carFingerprint in CANFD_CAR:
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/subaru/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.subaru.values import CAR, GLOBAL_ES_ADDR, SubaruFlags

from openpilot.selfdrive.frogpilot.frogpilot_variables import params
from openpilot.selfdrive.frogpilot.frogpilot_variables import get_frogpilot_toggles

FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type

Expand All @@ -14,7 +14,7 @@ class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate: CAR, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
# FrogPilot variables
crosstrek_torque_increase = params.get_bool("CrosstrekTorque")
crosstrek_torque_increase = get_frogpilot_toggles().crosstrek_torque

ret.carName = "subaru"
ret.radarUnavailable = True
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/subaru/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from openpilot.selfdrive.car.docs_definitions import CarFootnote, CarHarness, CarDocs, CarParts, Tool, Column
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries, p16

from openpilot.selfdrive.frogpilot.frogpilot_variables import params
from openpilot.selfdrive.frogpilot.frogpilot_variables import get_frogpilot_toggles

Ecu = car.CarParams.Ecu

Expand All @@ -27,7 +27,7 @@ def __init__(self, CP):
self.STEER_DELTA_DOWN = 40
elif CP.carFingerprint == CAR.SUBARU_IMPREZA_2020:
self.STEER_MAX = 1439
elif CP.carFingerprint == CAR.SUBARU_IMPREZA and params.get_bool("CrosstrekTorque"):
elif CP.carFingerprint == CAR.SUBARU_IMPREZA and get_frogpilot_toggles().crosstrek_torque:
self.STEER_MAX = 3071
else:
self.STEER_MAX = 2047
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/controls/lib/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,14 @@ def torque_nn_load_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM
Priority.HIGHEST, VisualAlert.none, AudibleAlert.fart, 10.),
},

EventName.toBeContinued: {
ET.PERMANENT: Alert(
"To be continued...",
"⬅️",
AlertStatus.frogpilot, AlertSize.mid,
Priority.MID, VisualAlert.none, AudibleAlert.continued, 7.),
},

EventName.vCruise69: {
ET.PERMANENT: Alert(
"Lol 69",
Expand Down
Loading

0 comments on commit bb7c481

Please sign in to comment.