Compiled on Mar.26,2024
@@ -1,4 +1,19 @@
|
||||
[](https://comma.ai/shop/comma-3x)
|
||||

|
||||
|
||||
Table of Contents
|
||||
=======================
|
||||
|
||||
* [What is openpilot?](#what-is-openpilot)
|
||||
* [What is FrogPilot?](#what-is-frogpilot)
|
||||
* [Features](#features)
|
||||
* [How to Install](#how-to-install)
|
||||
* [Bug reports / Feature Requests](#bug-reports--feature-requests)
|
||||
* [Discord](#discord)
|
||||
* [Donations](#donations)
|
||||
* [Credits](#credits)
|
||||
* [Licensing](#licensing)
|
||||
|
||||
---
|
||||
|
||||
What is openpilot?
|
||||
------
|
||||
@@ -7,21 +22,30 @@ What is openpilot?
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="https://youtu.be/NmBfgOanCyk" title="Video By Greer Viau"><img src="https://github.com/commaai/openpilot/assets/8762862/2f7112ae-f748-4f39-b617-fabd689c3772"></a></td>
|
||||
<td><a href="https://youtu.be/VHKyqZ7t8Gw" title="Video By Logan LeGrand"><img src="https://github.com/commaai/openpilot/assets/8762862/92351544-2833-40d7-9e0b-7ef7ae37ec4c"></a></td>
|
||||
<td><a href="https://youtu.be/SUIZYzxtMQs" title="A drive to Taco Bell"><img src="https://github.com/commaai/openpilot/assets/8762862/05ceefc5-2628-439c-a9b2-89ce77dc6f63"></a></td>
|
||||
<td><a href="https://youtu.be/NmBfgOanCyk" title="Video By Greer Viau"><img src="https://i.imgur.com/1w8c6d2.jpg"></a></td>
|
||||
<td><a href="https://youtu.be/VHKyqZ7t8Gw" title="Video By Logan LeGrand"><img src="https://i.imgur.com/LnBucik.jpg"></a></td>
|
||||
<td><a href="https://youtu.be/VxiR4iyBruo" title="Video By Charlie Kim"><img src="https://i.imgur.com/4Qoy48c.jpg"></a></td>
|
||||
<td><a href="https://youtu.be/-IkImTe1NYE" title="Video By Aragon"><img src="https://i.imgur.com/04VNzPf.jpg"></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="https://youtu.be/iIUICQkdwFQ" title="Video By Logan LeGrand"><img src="https://i.imgur.com/b1LHQTy.jpg"></a></td>
|
||||
<td><a href="https://youtu.be/XOsa0FsVIsg" title="Video By PinoyDrives"><img src="https://i.imgur.com/6FG0Bd8.jpg"></a></td>
|
||||
<td><a href="https://youtu.be/bCwcJ98R_Xw" title="Video By JS"><img src="https://i.imgur.com/zO18CbW.jpg"></a></td>
|
||||
<td><a href="https://youtu.be/BQ0tF3MTyyc" title="Video By Tsai-Fi"><img src="https://i.imgur.com/eZzelq3.jpg"></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
What is FrogPilot? 🐸
|
||||
------
|
||||
|
||||
FrogPilot is a fully open-sourced fork of openpilot, featuring clear and focused commits aimed at benefiting the openpilot community. It thrives on contributions from both users and developers, focusing on a collaborative, community-led approach to deliver an advanced openpilot experience for all!
|
||||
FrogPilot is a bi-weekly updated and 100% open-sourced fork of openpilot with clean commits dedicated to serve the openpilot community. FrogPilot is shaped by user and developer contributions, emphasizing collaborative, community-driven development to provide a bleeding-edge openpilot experience for everyone!
|
||||
|
||||
------
|
||||
FrogPilot was last updated on:
|
||||
<img width="10%" align="left" src="./selfdrive/assets/img_spinner_comma.png">
|
||||
|
||||
**March 15th, 2024**
|
||||
**March 1st, 2024**
|
||||
|
||||
Features
|
||||
------
|
||||
@@ -177,26 +201,27 @@ Discord
|
||||
|
||||
[Join the FrogPilot Community Discord for easy access to updates, bug reporting, feature requests, future planned updates, and other FrogPilot related discussions!](https://discord.gg/frogpilot)
|
||||
|
||||
Donations
|
||||
------
|
||||
|
||||
I DO NOT accept donations! So if anyone is claiming to be me or to be a part of FrogPilot and is asking for any type of financial compensation, IT IS A SCAM!
|
||||
|
||||
I work on FrogPilot on my own and is purely a passion project to refine my skills and to help improve openpilot for the community. I do not and will not ever expect any type of financial exchange for my work. The only thing I’ll ever ask for in return is constructive feedback!
|
||||
|
||||
Credits
|
||||
------
|
||||
|
||||
* [AlexandreSato](https://github.com/AlexandreSato)
|
||||
* [Crwusiz](https://github.com/crwusiz)
|
||||
* [DragonPilot](https://github.com/dragonpilot-community)
|
||||
* [ErichMoraga](https://github.com/ErichMoraga)
|
||||
* [Garrettpall](https://github.com/garrettpall)
|
||||
* [Henrycc](https://github.com/henryccy)
|
||||
* [KRKeegan](https://github.com/krkeegan)
|
||||
* [Mike8643](https://github.com/mike8643)
|
||||
* [Move-Fast](https://github.com/move-fast)
|
||||
* [Neokii](https://github.com/Neokii)
|
||||
* [OPGM](https://github.com/opgm)
|
||||
* [OPKR](https://github.com/openpilotkr)
|
||||
* [Pfeiferj](https://github.com/pfeiferj)
|
||||
* [ServerDummy](https://github.com/ServerDummy)
|
||||
* [Sunnyhaibin](https://github.com/sunnyhaibin)
|
||||
* [Thinkpad4by3](https://github.com/Thinkpad4by3)
|
||||
* [Twilsonco](https://github.com/twilsonco)
|
||||
* [AlexandreSato](https://github.com/AlexandreSato/openpilot)
|
||||
* [Aragon7777](https://github.com/Aragon7777/openpilot)
|
||||
* [Crwusiz](https://github.com/crwusiz/openpilot)
|
||||
* [DragonPilot](https://github.com/dragonpilot-community/dragonpilot)
|
||||
* [ErichMoraga](https://github.com/ErichMoraga/openpilot)
|
||||
* [KRKeegan](https://github.com/krkeegan/openpilot)
|
||||
* [Move-Fast](https://github.com/move-fast/openpilot)
|
||||
* [OPGM](https://github.com/opgm/openpilot)
|
||||
* [Pfeiferj](https://github.com/pfeiferj/openpilot)
|
||||
* [Sunnyhaibin](https://github.com/sunnyhaibin/sunnypilot)
|
||||
* [Twilsonco](https://github.com/twilsonco/openpilot)
|
||||
|
||||
Licensing
|
||||
------
|
||||
@@ -213,5 +238,5 @@ NO WARRANTY EXPRESSED OR IMPLIED.**
|
||||
|
||||
<img src="https://d1qb2nb5cznatu.cloudfront.net/startups/i/1061157-bc7e9bf3b246ece7322e6ffe653f6af8-medium_jpg.jpg?buster=1458363130" width="75"></img> <img src="https://cdn-images-1.medium.com/max/1600/1*C87EjxGeMPrkTuVRVWVg4w.png" width="225"></img>
|
||||
|
||||

|
||||
[](https://github.com/commaai/openpilot/actions)
|
||||
[](https://codecov.io/gh/commaai/openpilot)
|
||||
|
||||
@@ -1 +1 @@
|
||||
const uint8_t gitversion[8] = "c566c96a";
|
||||
const uint8_t gitversion[8] = "c8448d1c";
|
||||
|
||||
@@ -247,6 +247,8 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"CrosstrekTorque", PERSISTENT},
|
||||
{"CurrentHolidayTheme", PERSISTENT},
|
||||
{"CurrentRandomEvent", PERSISTENT},
|
||||
{"CSLCEnabled", PERSISTENT},
|
||||
{"CSLCSpeed", PERSISTENT},
|
||||
{"CurveSensitivity", PERSISTENT},
|
||||
{"CustomAlerts", PERSISTENT},
|
||||
{"CustomColors", PERSISTENT},
|
||||
@@ -263,8 +265,10 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"DisableOnroadUploads", PERSISTENT},
|
||||
{"DisableVTSCSmoothing", PERSISTENT},
|
||||
{"DisengageVolume", PERSISTENT},
|
||||
{"DoSoftReboot", CLEAR_ON_MANAGER_START},
|
||||
{"DragonPilotTune", PERSISTENT},
|
||||
{"DriverCamera", PERSISTENT},
|
||||
{"DriverPrivacyProtection", PERSISTENT},
|
||||
{"DriveStats", PERSISTENT},
|
||||
{"DynamicPathWidth", PERSISTENT},
|
||||
{"EngageVolume", PERSISTENT},
|
||||
@@ -416,6 +420,8 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"StockTune", PERSISTENT},
|
||||
{"StoppingDistance", PERSISTENT},
|
||||
{"TetheringEnabled", PERSISTENT},
|
||||
{"TrafficMode", PERSISTENT},
|
||||
{"TrafficModeActive", CLEAR_ON_OFFROAD_TRANSITION},
|
||||
{"TurnAggressiveness", PERSISTENT},
|
||||
{"TurnDesires", PERSISTENT},
|
||||
{"UnlimitedLength", PERSISTENT},
|
||||
@@ -430,6 +436,17 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"WarningImmediateVolume", PERSISTENT},
|
||||
{"WheelIcon", PERSISTENT},
|
||||
{"WheelSpeed", PERSISTENT},
|
||||
// Customize Params
|
||||
{"MinSteerSpeedStandard", PERSISTENT},
|
||||
{"MinSteerSpeedEngage", PERSISTENT},
|
||||
{"DashSpeedRatio1", PERSISTENT},
|
||||
{"DashSpeedRatio2", PERSISTENT},
|
||||
{"DashSpeedRatio3", PERSISTENT},
|
||||
{"SetSpeedRatio1", PERSISTENT},
|
||||
{"SetSpeedRatio2", PERSISTENT},
|
||||
{"SetSpeedRatio3", PERSISTENT},
|
||||
{"SpeedDecimal", PERSISTENT},
|
||||
{"CalibrationCircle", PERSISTENT},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -165,6 +165,7 @@ BO_ 481 ASCMSteeringButton: 7 K124_ASCM
|
||||
SG_ DistanceButton : 22|1@0+ (1,0) [0|0] "" NEO
|
||||
SG_ LKAButton : 23|1@0+ (1,0) [0|0] "" NEO
|
||||
SG_ ACCAlwaysOne : 24|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ ACCByFive : 26|2@0+ (1,0) [0|3] "" XXX
|
||||
SG_ ACCButtons : 46|3@0+ (1,0) [0|0] "" NEO
|
||||
SG_ DriveModeButton : 39|1@0+ (1,0) [0|1] "" XXX
|
||||
SG_ RollingCounter : 33|2@0+ (1,0) [0|3] "" NEO
|
||||
|
||||
@@ -1 +1 @@
|
||||
const uint8_t gitversion[] = "DEV-c566c96a-DEBUG";
|
||||
const uint8_t gitversion[] = "DEV-c8448d1c-DEBUG";
|
||||
|
||||
@@ -1 +1 @@
|
||||
DEV-c566c96a-DEBUG
|
||||
DEV-c8448d1c-DEBUG
|
||||
@@ -58,7 +58,7 @@ const CanMsg GM_CAM_LONG_TX_MSGS[] = {{0x180, 0, 4}, {0x315, 0, 5}, {0x2CB, 0, 8
|
||||
{0x1E1, 2, 7}, {0x184, 2, 8}}; // camera bus
|
||||
|
||||
const CanMsg GM_SDGM_TX_MSGS[] = {{0x180, 0, 4}, {0x1E1, 0, 7}, // pt bus
|
||||
{0x184, 2, 8}}; // camera bus
|
||||
{0x184, 2, 8}, {0x1E1, 2, 7}}; // camera bus
|
||||
|
||||
const CanMsg GM_CC_LONG_TX_MSGS[] = {{0x180, 0, 4}, {0x1E1, 0, 7}, // pt bus
|
||||
{0x184, 2, 8}, {0x1E1, 2, 7}}; // camera bus
|
||||
@@ -255,7 +255,7 @@ static bool gm_tx_hook(const CANPacket_t *to_send) {
|
||||
|
||||
bool allowed_btn = (button == GM_BTN_CANCEL) && cruise_engaged_prev;
|
||||
// For standard CC, allow spamming of SET / RESUME
|
||||
if (gm_cc_long) {
|
||||
if (gm_cc_long || (gm_hw == GM_SDGM) || (gm_hw == GM_CAM && gm_pcm_cruise)) {
|
||||
allowed_btn |= cruise_engaged_prev && (button == GM_BTN_SET || button == GM_BTN_RESUME || button == GM_BTN_UNPRESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ def crash_log(candidate):
|
||||
"OfflineMode", "LateralTune", "ForceAutoTune", "NNFF", "SteerRatio", "UseLateralJerk", "LongitudinalTune", "AccelerationProfile",
|
||||
"DecelerationProfile", "AggressiveAcceleration", "StoppingDistance", "SmoothBraking", "Model", "MTSCEnabled", "DisableMTSCSmoothing",
|
||||
"MTSCAggressiveness", "MTSCCurvatureCheck", "MTSCLimit", "NudgelessLaneChange", "LaneChangeTime", "LaneDetection", "LaneDetectionWidth",
|
||||
"OneLaneChange", "QOLControls", "DisableOnroadUploads", "HigherBitrate", "NavChill", "PauseLateralOnSignal", "ReverseCruise", "ReverseCruiseUI",
|
||||
"OneLaneChange", "QOLControls", "DisableOnroadUploads", "HigherBitrate", "NavChill", "MinSteerSpeedStandard", "MinSteerSpeedEngage", "PauseLateralOnSignal", "ReverseCruise", "ReverseCruiseUI",
|
||||
"SetSpeedLimit", "SetSpeedOffset", "SpeedLimitController", "Offset1", "Offset2", "Offset3", "Offset4", "SLCConfirmation", "SLCFallback",
|
||||
"SLCPriority1", "SLCPriority2", "SLCPriority3", "SLCOverride", "TurnDesires", "VisionTurnControl", "DisableVTSCSmoothing", "CurveSensitivity",
|
||||
"TurnAggressiveness"
|
||||
@@ -232,6 +232,7 @@ def crash_log(candidate):
|
||||
"AdjacentPath", "AdjacentPathMetrics", "BlindSpotPath", "FPSCounter", "LeadInfo", "UseSI", "PedalsOnUI", "RoadNameUI", "UseVienna", "DriverCamera",
|
||||
"ModelUI", "DynamicPathWidth", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength", "QOLVisuals", "DriveStats",
|
||||
"FullMap", "HideSpeed", "HideSpeedUI", "ShowSLCOffset", "SpeedLimitChangedAlert", "WheelSpeed", "RandomEvents", "ScreenBrightness", "WheelIcon",
|
||||
"DashSpeedRatio1", "DashSpeedRatio2", "DashSpeedRatio3", "SetSpeedRatio1", "SetSpeedRatio2", "SetSpeedRatio3",
|
||||
"RotatingWheel", "NumericalTemp", "Fahrenheit", "ShowCPU", "ShowGPU", "ShowIP", "ShowMemoryUsage", "ShowStorageLeft", "ShowStorageUsed", "Sidebar"
|
||||
], [
|
||||
"FrogPilotDrives", "FrogPilotKilometers", "FrogPilotMinutes"
|
||||
|
||||
@@ -6,9 +6,10 @@ from openpilot.common.realtime import DT_CTRL
|
||||
from opendbc.can.packer import CANPacker
|
||||
from openpilot.selfdrive.car import apply_driver_steer_torque_limits, create_gas_interceptor_command
|
||||
from openpilot.selfdrive.car.gm import gmcan
|
||||
from openpilot.selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons, GMFlags, CC_ONLY_CAR, EV_CAR, SDGM_CAR
|
||||
from openpilot.selfdrive.controls.lib.drive_helpers import apply_deadzone
|
||||
from openpilot.selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons, GMFlags, CC_ONLY_CAR, EV_CAR, SDGM_CAR, CAMERA_ACC_CAR
|
||||
from openpilot.selfdrive.controls.lib.drive_helpers import apply_deadzone, V_CRUISE_MAX
|
||||
from openpilot.selfdrive.controls.lib.vehicle_model import ACCELERATION_DUE_TO_GRAVITY
|
||||
from openpilot.common.params import Params
|
||||
|
||||
VisualAlert = car.CarControl.HUDControl.VisualAlert
|
||||
NetworkLocation = car.CarParams.NetworkLocation
|
||||
@@ -16,6 +17,8 @@ LongCtrlState = car.CarControl.Actuators.LongControlState
|
||||
GearShifter = car.CarState.GearShifter
|
||||
TransmissionType = car.CarParams.TransmissionType
|
||||
|
||||
params_memory = Params("/dev/shm/params")
|
||||
|
||||
# Camera cancels up to 0.1s after brake is pressed, ECM allows 0.5s
|
||||
CAMERA_CANCEL_DELAY_FRAMES = 10
|
||||
# Enforce a minimum interval between steering messages to avoid a fault
|
||||
@@ -40,6 +43,8 @@ class CarController:
|
||||
self.cancel_counter = 0
|
||||
self.pedal_steady = 0.
|
||||
|
||||
self.is_metric = Params().get_bool("IsMetric")
|
||||
|
||||
self.lka_steering_cmd_counter = 0
|
||||
self.lka_icon_status_last = (False, False)
|
||||
|
||||
@@ -113,7 +118,7 @@ class CarController:
|
||||
idx = self.lka_steering_cmd_counter % 4
|
||||
can_sends.append(gmcan.create_steering_control(self.packer_pt, CanBus.POWERTRAIN, apply_steer, idx, CC.latActive))
|
||||
|
||||
if self.CP.openpilotLongitudinalControl:
|
||||
if self.CP.openpilotLongitudinalControl and not frogpilot_variables.CSLC:
|
||||
# Gas/regen, brakes, and UI commands - all at 25Hz
|
||||
if self.frame % 4 == 0:
|
||||
stopping = actuators.longControlState == LongCtrlState.stopping
|
||||
@@ -240,6 +245,16 @@ class CarController:
|
||||
else:
|
||||
can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.CAMERA, CS.buttons_counter, CruiseButtons.CANCEL))
|
||||
|
||||
# ACC Spam
|
||||
if (self.CP.carFingerprint in SDGM_CAR or self.CP.carFingerprint in CAMERA_ACC_CAR) and frogpilot_variables.CSLC:
|
||||
if CC.enabled and self.frame % 3 == 0 and CS.cruise_buttons == CruiseButtons.UNPRESS and not CS.out.gasPressed:
|
||||
bus = CanBus.CAMERA if self.CP.carFingerprint in SDGM_CAR else CanBus.POWERTRAIN
|
||||
# slcSet = get_set_speed(self, hud_v_cruise)
|
||||
# can_sends.extend(gmcan.create_gm_acc_spam_command(self.packer_pt, self, CS, slcSet, bus, CS.out.vEgo, frogpilot_variables, accel))
|
||||
# using ms
|
||||
slcSet_ms = get_set_speed(self, hud_v_cruise)
|
||||
can_sends.extend(gmcan.create_gm_acc_spam_command_ms(self.packer_pt, self, CS, slcSet_ms, bus, CS.out.vEgo, frogpilot_variables, accel))
|
||||
|
||||
if self.CP.networkLocation == NetworkLocation.fwdCamera:
|
||||
# Silence "Take Steering" alert sent by camera, forward PSCMStatus with HandsOffSWlDetectionStatus=1
|
||||
if self.frame % 10 == 0:
|
||||
@@ -255,3 +270,24 @@ class CarController:
|
||||
|
||||
self.frame += 1
|
||||
return new_actuators, can_sends
|
||||
|
||||
def get_set_speed(self, hud_v_cruise):
|
||||
# v_cruise_kph = min(hud_v_cruise * CV.MS_TO_KPH, V_CRUISE_MAX)
|
||||
# v_cruise = int(round(v_cruise_kph * CV.KPH_TO_MPH))
|
||||
|
||||
# v_cruise_slc: int = 0
|
||||
# v_cruise_slc = params_memory.get_int("CSLCSpeed")
|
||||
|
||||
# if v_cruise_slc > 0:
|
||||
# v_cruise = v_cruise_slc
|
||||
# return v_cruise
|
||||
|
||||
# using ms
|
||||
v_cruise_ms = min(hud_v_cruise, V_CRUISE_MAX * CV.KPH_TO_MS)
|
||||
|
||||
v_cruise_slc_ms: float = 0.
|
||||
v_cruise_slc_ms = params_memory.get_float("CSLCSpeed")
|
||||
|
||||
if v_cruise_slc_ms > 0.:
|
||||
v_cruise_ms = v_cruise_slc_ms
|
||||
return v_cruise_ms
|
||||
|
||||
@@ -6,6 +6,7 @@ from opendbc.can.can_define import CANDefine
|
||||
from opendbc.can.parser import CANParser
|
||||
from openpilot.selfdrive.car.interfaces import CarStateBase
|
||||
from openpilot.selfdrive.car.gm.values import DBC, AccState, CanBus, STEER_THRESHOLD, GMFlags, CC_ONLY_CAR, CAMERA_ACC_CAR, SDGM_CAR
|
||||
from openpilot.selfdrive.controls.lib.drive_helpers import CRUISE_LONG_PRESS
|
||||
|
||||
TransmissionType = car.CarParams.TransmissionType
|
||||
NetworkLocation = car.CarParams.NetworkLocation
|
||||
@@ -167,44 +168,68 @@ class CarState(CarStateBase):
|
||||
ret.leftBlindspot = cam_cp.vl["BCMBlindSpotMonitor"]["LeftBSM"] == 1
|
||||
ret.rightBlindspot = cam_cp.vl["BCMBlindSpotMonitor"]["RightBSM"] == 1
|
||||
|
||||
# FrogPilot functions
|
||||
has_camera = self.CP.networkLocation == NetworkLocation.fwdCamera
|
||||
has_camera &= not self.CP.flags & GMFlags.NO_CAMERA.value
|
||||
has_camera &= not self.CP.carFingerprint in (CC_ONLY_CAR)
|
||||
|
||||
if self.CP.carFingerprint in SDGM_CAR:
|
||||
distance_pressed = cam_cp.vl["ASCMSteeringButton"]["DistanceButton"]
|
||||
else:
|
||||
distance_pressed = pt_cp.vl["ASCMSteeringButton"]["DistanceButton"]
|
||||
|
||||
# Driving personalities function - Credit goes to Mangomoose!
|
||||
if frogpilot_variables.personalities_via_wheel and ret.cruiseState.available:
|
||||
if ret.cruiseState.available:
|
||||
# Sync with the onroad UI button
|
||||
if self.fpf.personality_changed_via_ui:
|
||||
self.personality_profile = self.fpf.current_personality
|
||||
self.previous_personality_profile = self.personality_profile
|
||||
self.fpf.reset_personality_changed_param()
|
||||
|
||||
# Check if the car has a camera
|
||||
has_camera = self.CP.networkLocation == NetworkLocation.fwdCamera
|
||||
has_camera &= not self.CP.flags & GMFlags.NO_CAMERA.value
|
||||
has_camera &= not self.CP.carFingerprint in (CC_ONLY_CAR)
|
||||
if distance_pressed:
|
||||
self.distance_pressed_counter += 1
|
||||
|
||||
if has_camera:
|
||||
# Need to subtract by 1 to comply with the personality profiles of "0", "1", and "2"
|
||||
self.personality_profile = cam_cp.vl["ASCMActiveCruiseControlStatus"]["ACCGapLevel"] - 1
|
||||
else:
|
||||
if self.CP.carFingerprint in SDGM_CAR:
|
||||
distance_button = cam_cp.vl["ASCMSteeringButton"]["DistanceButton"]
|
||||
else:
|
||||
distance_button = pt_cp.vl["ASCMSteeringButton"]["DistanceButton"]
|
||||
|
||||
if distance_button and not self.distance_previously_pressed:
|
||||
if self.display_menu:
|
||||
self.personality_profile = (self.previous_personality_profile + 2) % 3
|
||||
if not self.distance_previously_pressed:
|
||||
self.display_timer = 350
|
||||
self.distance_previously_pressed = distance_button
|
||||
|
||||
# Check if the display is open
|
||||
if self.display_timer > 0:
|
||||
self.display_timer -= 1
|
||||
self.display_menu = True
|
||||
elif self.distance_previously_pressed:
|
||||
# Set the distance lines on the dash to match the new personality if the button was held down for less than 0.5 seconds
|
||||
if self.distance_pressed_counter < CRUISE_LONG_PRESS and frogpilot_variables.personalities_via_wheel:
|
||||
if has_camera:
|
||||
# Need to subtract by 1 to comply with the personality profiles of "0", "1", and "2"
|
||||
self.personality_profile = cam_cp.vl["ASCMActiveCruiseControlStatus"]["ACCGapLevel"] - 1
|
||||
else:
|
||||
self.personality_profile = (self.personality_profile + 2) % 3
|
||||
|
||||
self.fpf.distance_button_function(self.personality_profile)
|
||||
|
||||
self.distance_pressed_counter = 0
|
||||
|
||||
# Check if the display is open
|
||||
if self.display_timer > 0:
|
||||
self.display_timer -= 1
|
||||
self.display_menu = True
|
||||
else:
|
||||
self.display_menu = False
|
||||
|
||||
# Switch the current state of Experimental Mode if the button is held down for 0.5 seconds
|
||||
if self.distance_pressed_counter == (CRUISE_LONG_PRESS - (CRUISE_LONG_PRESS - 1) * frogpilot_variables.CSLC) and frogpilot_variables.experimental_mode_via_distance:
|
||||
if frogpilot_variables.conditional_experimental_mode:
|
||||
self.fpf.update_cestatus_distance()
|
||||
else:
|
||||
self.display_menu = False
|
||||
self.fpf.update_experimental_mode()
|
||||
|
||||
if self.personality_profile != self.previous_personality_profile and self.personality_profile >= 0:
|
||||
self.fpf.distance_button_function(self.personality_profile)
|
||||
self.previous_personality_profile = self.personality_profile
|
||||
# Switch the current state of Traffic Mode if the button is held down for 2.5 seconds
|
||||
if self.distance_pressed_counter == CRUISE_LONG_PRESS * 5 and frogpilot_variables.traffic_mode:
|
||||
self.fpf.update_traffic_mode()
|
||||
|
||||
# Revert the previous changes to Experimental Mode
|
||||
if frogpilot_variables.experimental_mode_via_distance:
|
||||
if frogpilot_variables.conditional_experimental_mode:
|
||||
self.fpf.update_cestatus_distance()
|
||||
else:
|
||||
self.fpf.update_experimental_mode()
|
||||
|
||||
self.distance_previously_pressed = distance_pressed
|
||||
|
||||
# Toggle Experimental Mode from steering wheel function
|
||||
if frogpilot_variables.experimental_mode_via_lkas and ret.cruiseState.available:
|
||||
|
||||
@@ -180,6 +180,16 @@ FINGERPRINTS = {
|
||||
{
|
||||
190: 6, 193: 8, 197: 8, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 298: 8, 304: 3, 309: 8, 311: 8, 313: 8, 320: 4, 322: 7, 328: 1, 352: 5, 381: 8, 384: 4, 386: 8, 388: 8, 413: 8, 451: 8, 452: 8, 453: 6, 455: 7, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 500: 6, 501: 8, 532: 6, 560: 8, 562: 8, 563: 5, 565: 5, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 707: 8, 715: 8, 717: 5, 761: 7, 789: 5, 800: 6, 810: 8, 840: 5, 842: 5, 844: 8, 869: 4, 880: 6, 977: 8, 1001: 8, 1011: 6, 1017: 8, 1020: 8, 1217: 8, 1221: 5, 1233: 8, 1249: 8, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1271: 8, 1280: 4, 1296: 4, 1300: 8, 1930: 7
|
||||
}],
|
||||
CAR.BABYENCLAVE: [
|
||||
# Buick Baby Enclave w/ ACC 2020-23
|
||||
{
|
||||
190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 208: 8, 209: 7, 211: 2, 241: 6, 249: 8, 257: 8, 288: 5, 289: 8, 292: 2, 298: 8, 304: 3, 309: 8, 311: 8, 313: 8, 320: 4, 322: 7, 328: 1, 331: 3, 352: 5, 353: 3, 368: 3, 381: 8, 384: 4, 386: 8, 388: 8, 394: 7, 398: 8, 401: 8, 405: 8, 407: 7, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 450: 4, 451: 8, 452: 8, 453: 6, 454: 8, 455: 7, 456: 8, 457: 6, 462: 4, 463: 3, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 6, 501: 8, 503: 2, 508: 8, 528: 5, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 569: 3, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 723: 4, 730: 4, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 869: 4, 872: 1, 880: 6, 882: 8, 890: 1, 892: 2, 893: 2, 894: 1, 961: 8, 969: 8, 975: 2, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1011: 6, 1013: 6, 1017: 8, 1020: 8, 1033: 7, 1034: 7, 1037: 5, 1105: 5, 1187: 5, 1195: 3, 1201: 3, 1217: 8, 1218: 3, 1221: 5, 1223: 3, 1225: 7, 1233: 8, 1236: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1268: 2, 1271: 8, 1273: 3, 1276: 2, 1277: 7, 1278: 4, 1279: 4, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1345: 8, 1417: 8, 1512: 8, 1514: 8, 1517: 8, 1601: 8, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1914: 7, 1916: 7, 1919: 7, 1927: 7, 1930: 7, 2018: 8, 2020: 8, 2021: 8, 2028: 8
|
||||
}],
|
||||
CAR.BABYAVENIR: [
|
||||
# Buick Baby Enclave Avenir w/ ACC 2020-23
|
||||
{
|
||||
190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 208: 8, 209: 7, 211: 2, 241: 6, 249: 8, 257: 8, 288: 5, 289: 8, 292: 2, 298: 8, 304: 3, 309: 8, 311: 8, 313: 8, 320: 4, 322: 7, 328: 1, 331: 3, 352: 5, 353: 3, 368: 3, 381: 8, 384: 4, 386: 8, 388: 8, 394: 7, 398: 8, 401: 8, 405: 8, 407: 7, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 450: 4, 451: 8, 452: 8, 453: 6, 454: 8, 455: 7, 456: 8, 457: 6, 462: 4, 463: 3, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 6, 501: 8, 503: 2, 508: 8, 528: 5, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 569: 3, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 723: 4, 730: 4, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 869: 4, 872: 1, 880: 6, 882: 8, 890: 1, 892: 2, 893: 2, 894: 1, 961: 8, 969: 8, 975: 2, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1011: 6, 1013: 6, 1017: 8, 1020: 8, 1033: 7, 1034: 7, 1037: 5, 1105: 5, 1187: 5, 1195: 3, 1201: 3, 1217: 8, 1218: 3, 1221: 5, 1223: 3, 1225: 7, 1233: 8, 1236: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1268: 2, 1271: 8, 1273: 3, 1276: 2, 1277: 7, 1278: 4, 1279: 4, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1345: 8, 1417: 8, 1512: 8, 1514: 8, 1517: 8, 1601: 8, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1914: 7, 1916: 7, 1919: 7, 1927: 7, 1930: 7, 2018: 8, 2020: 8, 2021: 8, 2028: 8
|
||||
}],
|
||||
}
|
||||
|
||||
FW_VERSIONS: dict[str, dict[tuple, list[bytes]]] = {
|
||||
|
||||
@@ -12,6 +12,7 @@ def create_buttons(packer, bus, idx, button):
|
||||
"RollingCounter": idx,
|
||||
"ACCAlwaysOne": 1,
|
||||
"DistanceButton": 0,
|
||||
"ACCByFive": 0,
|
||||
}
|
||||
|
||||
checksum = 240 + int(values["ACCAlwaysOne"] * 0xf)
|
||||
@@ -22,6 +23,37 @@ def create_buttons(packer, bus, idx, button):
|
||||
values["SteeringButtonChecksum"] = checksum
|
||||
return packer.make_can_msg("ASCMSteeringButton", bus, values)
|
||||
|
||||
def create_buttons_five(packer, bus, idx, button, byfive):
|
||||
if byfive and button == CruiseButtons.RES_ACCEL:
|
||||
accbyfive = 2
|
||||
ACCAlwaysOne = 1
|
||||
checkoffset = -4
|
||||
elif byfive and button == CruiseButtons.DECEL_SET:
|
||||
accbyfive = 3
|
||||
ACCAlwaysOne = 0
|
||||
checkoffset = 255*idx+10
|
||||
else:
|
||||
accbyfive = 0
|
||||
ACCAlwaysOne = 1
|
||||
checkoffset = 0
|
||||
|
||||
values = {
|
||||
"ACCButtons": button,
|
||||
"RollingCounter": idx,
|
||||
"ACCAlwaysOne": ACCAlwaysOne,
|
||||
"DistanceButton": 0,
|
||||
"ACCByFive": accbyfive,
|
||||
}
|
||||
|
||||
checksum = 240 + int(values["ACCAlwaysOne"] * 0xf)
|
||||
checksum += values["RollingCounter"] * (0x4ef if values["ACCAlwaysOne"] != 0 else 0x3f0)
|
||||
checksum -= int(values["ACCButtons"] - 1) << 4 # not correct if value is 0
|
||||
checksum -= 2 * values["DistanceButton"]
|
||||
checksum += checkoffset
|
||||
|
||||
values["SteeringButtonChecksum"] = checksum
|
||||
return packer.make_can_msg("ASCMSteeringButton", bus, values)
|
||||
|
||||
|
||||
def create_pscm_status(packer, bus, pscm_status):
|
||||
values = {s: pscm_status[s] for s in [
|
||||
@@ -217,3 +249,82 @@ def create_gm_cc_spam_command(packer, controller, CS, actuators):
|
||||
return [create_buttons(packer, CanBus.POWERTRAIN, idx, cruiseBtn)]
|
||||
else:
|
||||
return []
|
||||
|
||||
def create_gm_acc_spam_command(packer, controller, CS, slcSet, bus, Vego, frogpilot_variables, accel):
|
||||
cruiseBtn = CruiseButtons.INIT
|
||||
byfive = 0
|
||||
speedSetPoint = int(round(CS.out.cruiseState.speed * CV.MS_TO_MPH))
|
||||
|
||||
FRAMES_ON = 6
|
||||
FRAMES_OFF = 30 - FRAMES_ON
|
||||
|
||||
if not frogpilot_variables.experimentalMode:
|
||||
if slcSet + 5 < Vego * CV.MS_TO_MPH:
|
||||
slcSet = slcSet - 10
|
||||
else:
|
||||
slcSet = int(round((Vego * 1.01 + 4.6 * accel + 0.7 * accel ** 3 - 1 / 35 * accel ** 5) * CV.MS_TO_MPH)) # 1.01 factor to match cluster speed better
|
||||
|
||||
if slcSet <= int(math.floor((speedSetPoint - 1)/5.0)*5.0) and speedSetPoint > 20:
|
||||
cruiseBtn = CruiseButtons.DECEL_SET
|
||||
byfive = 1
|
||||
elif slcSet >= int(math.ceil((speedSetPoint + 1)/5.0)*5.0):
|
||||
cruiseBtn = CruiseButtons.RES_ACCEL
|
||||
byfive = 1
|
||||
elif slcSet < speedSetPoint and speedSetPoint > 16:
|
||||
cruiseBtn = CruiseButtons.DECEL_SET
|
||||
byfive = 0
|
||||
elif slcSet > speedSetPoint:
|
||||
cruiseBtn = CruiseButtons.RES_ACCEL
|
||||
byfive = 0
|
||||
else:
|
||||
cruiseBtn = CruiseButtons.INIT
|
||||
byfive = 0
|
||||
|
||||
if (cruiseBtn != CruiseButtons.INIT) and controller.frame % (FRAMES_ON + FRAMES_OFF) < FRAMES_ON:
|
||||
controller.last_button_frame = controller.frame
|
||||
idx = (CS.buttons_counter + 1) % 4
|
||||
return [create_buttons_five(packer, bus, idx, cruiseBtn, byfive)]*23
|
||||
else:
|
||||
return []
|
||||
|
||||
# using ms
|
||||
def create_gm_acc_spam_command_ms(packer, controller, CS, slcSet_ms, bus, Vego, frogpilot_variables, accel):
|
||||
is_metric = controller.is_metric
|
||||
MS_CONVERT = CV.MS_TO_KPH if is_metric else CV.MS_TO_MPH
|
||||
slcSet = slcSet_ms * MS_CONVERT
|
||||
|
||||
cruiseBtn = CruiseButtons.INIT
|
||||
byfive = 0
|
||||
speedSetPoint = int(round(CS.out.cruiseState.speed * MS_CONVERT))
|
||||
|
||||
FRAMES_ON = 6
|
||||
FRAMES_OFF = 30 - FRAMES_ON
|
||||
|
||||
if not frogpilot_variables.experimentalMode:
|
||||
if slcSet + 5 < Vego * MS_CONVERT:
|
||||
slcSet = slcSet - 10
|
||||
else:
|
||||
slcSet = int(round((Vego * 1.01 + 4.6 * accel + 0.7 * accel ** 3 - 1 / 35 * accel ** 5) * MS_CONVERT)) # 1.01 factor to match cluster speed better
|
||||
|
||||
if slcSet <= int(math.floor((speedSetPoint - 1)/5.0)*5.0) and speedSetPoint > (28 if is_metric else 20):
|
||||
cruiseBtn = CruiseButtons.DECEL_SET
|
||||
byfive = 1
|
||||
elif slcSet >= int(math.ceil((speedSetPoint + 1)/5.0)*5.0):
|
||||
cruiseBtn = CruiseButtons.RES_ACCEL
|
||||
byfive = 1
|
||||
elif slcSet <= (speedSetPoint - 1) and speedSetPoint > (24 if is_metric else 16):
|
||||
cruiseBtn = CruiseButtons.DECEL_SET
|
||||
byfive = 0
|
||||
elif slcSet >= (speedSetPoint + 1):
|
||||
cruiseBtn = CruiseButtons.RES_ACCEL
|
||||
byfive = 0
|
||||
else:
|
||||
cruiseBtn = CruiseButtons.INIT
|
||||
byfive = 0
|
||||
|
||||
if (cruiseBtn != CruiseButtons.INIT) and controller.frame % (FRAMES_ON + FRAMES_OFF) < FRAMES_ON:
|
||||
controller.last_button_frame = controller.frame
|
||||
idx = (CS.buttons_counter + 1) % 4
|
||||
return [create_buttons_five(packer, bus, idx, cruiseBtn, byfive)]*23
|
||||
else:
|
||||
return []
|
||||
|
||||
@@ -12,6 +12,10 @@ from openpilot.selfdrive.car.gm.values import CAR, CruiseButtons, CarControllerP
|
||||
from openpilot.selfdrive.car.interfaces import CarInterfaceBase, TorqueFromLateralAccelCallbackType, FRICTION_THRESHOLD, LatControlInputs, NanoFFModel
|
||||
from openpilot.selfdrive.controls.lib.drive_helpers import get_friction
|
||||
|
||||
from openpilot.common.params import Params
|
||||
|
||||
params = Params() #params_memory = Params("/dev/shm/params")
|
||||
|
||||
ButtonType = car.CarState.ButtonEvent.Type
|
||||
EventName = car.CarEvent.EventName
|
||||
GearShifter = car.CarState.GearShifter
|
||||
@@ -149,6 +153,19 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.minSteerSpeed = 30 * CV.MPH_TO_MS
|
||||
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_SDGM
|
||||
|
||||
# Used for CEM with CSLC
|
||||
ret.openpilotLongitudinalControl = params.get_bool("CSLCEnabled") #True
|
||||
ret.longitudinalTuning.deadzoneBP = [0.]
|
||||
ret.longitudinalTuning.deadzoneV = [0.9] # == 2 mph allowable delta
|
||||
ret.stoppingDecelRate = 7.45 # == 16.67 mph/s (OFF + ON = 30 frames)
|
||||
ret.longitudinalActuatorDelayLowerBound = 1.
|
||||
ret.longitudinalActuatorDelayUpperBound = 2.
|
||||
|
||||
ret.longitudinalTuning.kpBP = [7.15, 7.2, 28.] # 7.15 m/s == 16 mph
|
||||
ret.longitudinalTuning.kpV = [0., 4., 2.] # set lower end to 0 since we can't drive below that speed
|
||||
ret.longitudinalTuning.kiBP = [0.]
|
||||
ret.longitudinalTuning.kiV = [0.1]
|
||||
|
||||
else: # ASCM, OBD-II harness
|
||||
ret.openpilotLongitudinalControl = True
|
||||
ret.networkLocation = NetworkLocation.gateway
|
||||
@@ -336,6 +353,26 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.steerActuatorDelay = 0.2
|
||||
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
||||
|
||||
elif candidate == CAR.BABYENCLAVE:
|
||||
ret.mass = 2050. #3660. * CV.LB_TO_KG
|
||||
ret.wheelbase = 2.86 #2.78
|
||||
ret.steerRatio = 16.0 #Avenir 15.0 / Others 16.0 #14.4
|
||||
ret.centerToFront = ret.wheelbase * 0.5 #ret.wheelbase * 0.4
|
||||
ret.steerActuatorDelay = 0.2
|
||||
ret.minSteerSpeed = 10 * CV.KPH_TO_MS
|
||||
#ret.wheelSpeedFactor = 1.05
|
||||
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
||||
|
||||
elif candidate == CAR.BABYAVENIR:
|
||||
ret.mass = 2050. #3660. * CV.LB_TO_KG
|
||||
ret.wheelbase = 2.86 #2.78
|
||||
ret.steerRatio = 15.0 #Avenir 15.0 / Others 16.0 #14.4
|
||||
ret.centerToFront = ret.wheelbase * 0.5 #ret.wheelbase * 0.4
|
||||
ret.steerActuatorDelay = 0.2
|
||||
ret.minSteerSpeed = 10 * CV.KPH_TO_MS
|
||||
#ret.wheelSpeedFactor = 1.05
|
||||
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
||||
|
||||
elif candidate == CAR.CT6_CC:
|
||||
ret.wheelbase = 3.11
|
||||
ret.mass = 5198. * CV.LB_TO_KG
|
||||
|
||||
@@ -122,7 +122,9 @@ class CAR(StrEnum):
|
||||
TRAILBLAZER_CC = "CHEVROLET TRAILBLAZER 2024 NO ACC"
|
||||
XT4 = "CADILLAC XT4 2023"
|
||||
TRAX = "CHEVROLET TRAX 2024"
|
||||
|
||||
# 昂科旗
|
||||
BABYENCLAVE = "BUICK BABY ENCLAVE 2020"
|
||||
BABYAVENIR = "BUICK BABY ENCLAVE AVENIR 2020"
|
||||
|
||||
class Footnote(Enum):
|
||||
OBD_II = CarFootnote(
|
||||
@@ -175,6 +177,9 @@ CAR_INFO: Dict[str, Union[GMCarInfo, List[GMCarInfo]]] = {
|
||||
CAR.TRAILBLAZER_CC: GMCarInfo("Chevrolet Trailblazer 2024 No ACC"),
|
||||
CAR.XT4: GMCarInfo("Cadillac XT4 2023", "Driver Assist Package"),
|
||||
CAR.TRAX: GMCarInfo("Chevrolet TRAX 2024"),
|
||||
# 昂科旗
|
||||
CAR.BABYENCLAVE: GMCarInfo("BUICK BABY ENCLAVE 2020"),
|
||||
CAR.BABYAVENIR: GMCarInfo("BUICK BABY ENCLAVE AVENIR 2020"),
|
||||
}
|
||||
|
||||
|
||||
@@ -210,22 +215,35 @@ class GMFlags(IntFlag):
|
||||
# In a Data Module, an identifier is a string used to recognize an object,
|
||||
# either by itself or together with the identifiers of parent objects.
|
||||
# Each returns a 4 byte hex representation of the decimal part number. `b"\x02\x8c\xf0'"` -> 42790951
|
||||
GM_BOOT_SOFTWARE_PART_NUMER_REQUEST = b'\x1a\xc0' # likely does not contain anything useful
|
||||
GM_SOFTWARE_MODULE_1_REQUEST = b'\x1a\xc1'
|
||||
GM_SOFTWARE_MODULE_2_REQUEST = b'\x1a\xc2'
|
||||
GM_SOFTWARE_MODULE_3_REQUEST = b'\x1a\xc3'
|
||||
|
||||
# Part number of XML data file that is used to configure ECU
|
||||
GM_XML_DATA_FILE_PART_NUMBER = b'\x1a\x9c'
|
||||
GM_XML_CONFIG_COMPAT_ID = b'\x1a\x9b' # used to know if XML file is compatible with the ECU software/hardware
|
||||
|
||||
# This DID is for identifying the part number that reflects the mix of hardware,
|
||||
# software, and calibrations in the ECU when it first arrives at the vehicle assembly plant.
|
||||
# If there's an Alpha Code, it's associated with this part number and stored in the DID $DB.
|
||||
GM_END_MODEL_PART_NUMBER_REQUEST = b'\x1a\xcb'
|
||||
GM_END_MODEL_PART_NUMBER_ALPHA_CODE_REQUEST = b'\x1a\xdb'
|
||||
GM_BASE_MODEL_PART_NUMBER_REQUEST = b'\x1a\xcc'
|
||||
GM_BASE_MODEL_PART_NUMBER_ALPHA_CODE_REQUEST = b'\x1a\xdc'
|
||||
GM_FW_RESPONSE = b'\x5a'
|
||||
|
||||
GM_FW_REQUESTS = [
|
||||
GM_BOOT_SOFTWARE_PART_NUMER_REQUEST,
|
||||
GM_SOFTWARE_MODULE_1_REQUEST,
|
||||
GM_SOFTWARE_MODULE_2_REQUEST,
|
||||
GM_SOFTWARE_MODULE_3_REQUEST,
|
||||
GM_XML_DATA_FILE_PART_NUMBER,
|
||||
GM_XML_CONFIG_COMPAT_ID,
|
||||
GM_END_MODEL_PART_NUMBER_REQUEST,
|
||||
GM_END_MODEL_PART_NUMBER_ALPHA_CODE_REQUEST,
|
||||
GM_BASE_MODEL_PART_NUMBER_REQUEST,
|
||||
GM_BASE_MODEL_PART_NUMBER_ALPHA_CODE_REQUEST,
|
||||
]
|
||||
|
||||
GM_RX_OFFSET = 0x400
|
||||
@@ -251,7 +269,7 @@ EV_CAR = {CAR.VOLT, CAR.BOLT_EUV, CAR.VOLT_CC, CAR.BOLT_CC}
|
||||
CC_ONLY_CAR = {CAR.VOLT_CC, CAR.BOLT_CC, CAR.EQUINOX_CC, CAR.SUBURBAN_CC, CAR.YUKON_CC, CAR.CT6_CC, CAR.TRAILBLAZER_CC}
|
||||
|
||||
# We're integrated at the Safety Data Gateway Module on these cars
|
||||
SDGM_CAR = {CAR.XT4}
|
||||
SDGM_CAR = {CAR.XT4, CAR.BABYENCLAVE, CAR.BABYAVENIR}
|
||||
|
||||
# Slow acceleration cars
|
||||
SLOW_ACC = {CAR.SILVERADO}
|
||||
|
||||
@@ -212,6 +212,17 @@ class CarState(CarStateBase):
|
||||
else:
|
||||
self.fpf.update_experimental_mode()
|
||||
|
||||
# Switch the current state of Traffic Mode if the button is held down for 2.5 seconds
|
||||
if self.distance_pressed_counter == CRUISE_LONG_PRESS * 5 and frogpilot_variables.traffic_mode:
|
||||
self.fpf.update_traffic_mode()
|
||||
|
||||
# Revert the previous changes to Experimental Mode
|
||||
if frogpilot_variables.experimental_mode_via_distance:
|
||||
if frogpilot_variables.conditional_experimental_mode:
|
||||
self.fpf.update_cestatus_distance()
|
||||
else:
|
||||
self.fpf.update_experimental_mode()
|
||||
|
||||
self.distance_previously_pressed = distance_pressed
|
||||
|
||||
# Toggle Experimental Mode from steering wheel function
|
||||
@@ -342,6 +353,17 @@ class CarState(CarStateBase):
|
||||
else:
|
||||
self.fpf.update_experimental_mode()
|
||||
|
||||
# Switch the current state of Traffic Mode if the button is held down for 2.5 seconds
|
||||
if self.distance_pressed_counter == CRUISE_LONG_PRESS * 5 and frogpilot_variables.traffic_mode:
|
||||
self.fpf.update_traffic_mode()
|
||||
|
||||
# Revert the previous changes to Experimental Mode
|
||||
if frogpilot_variables.experimental_mode_via_distance:
|
||||
if frogpilot_variables.conditional_experimental_mode:
|
||||
self.fpf.update_cestatus_distance()
|
||||
else:
|
||||
self.fpf.update_experimental_mode()
|
||||
|
||||
self.distance_previously_pressed = distance_pressed
|
||||
|
||||
# Toggle Experimental Mode from steering wheel function
|
||||
|
||||
@@ -263,7 +263,7 @@ class TestFwFingerprintTiming(unittest.TestCase):
|
||||
print(f'get_vin {name} case, query time={self.total_time / self.N} seconds')
|
||||
|
||||
def test_fw_query_timing(self):
|
||||
total_ref_time = {1: 8.4, 2: 9.3}
|
||||
total_ref_time = {1: 8.3, 2: 9.2}
|
||||
brand_ref_times = {
|
||||
1: {
|
||||
'gm': 1.0,
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"input_std":[[10.088922],[1.7304039],[1.4375063],[0.032994103],[1.6795603],[1.705598],[1.7235253],[1.6614505],[1.6000563],[1.5353311],[1.4539971],[0.03317187],[0.03311562],[0.033051275],[0.03286789],[0.032877274],[0.032806873],[0.03260343]],"model_test_loss":0.03966723382472992,"input_size":18,"current_date_and_time":"2024-01-01_14-14-43","input_mean":[[20.066832],[-0.05136131],[-0.012342298],[-0.008433405],[-0.04397132],[-0.046372537],[-0.048583414],[-0.045400653],[-0.04217297],[-0.04097941],[-0.044701155],[-0.008306612],[-0.008348125],[-0.00839202],[-0.008467563],[-0.008504569],[-0.008618364],[-0.008788095]],"input_vars":["v_ego","lateral_accel","lateral_jerk","roll","lateral_accel_m03","lateral_accel_m02","lateral_accel_m01","lateral_accel_p03","lateral_accel_p06","lateral_accel_p10","lateral_accel_p15","roll_m03","roll_m02","roll_m01","roll_p03","roll_p06","roll_p10","roll_p15"],"output_size":1,"layers":[{"dense_1_b":[[0.10824418],[-3.950648],[0.5197182],[0.3076343],[0.10567791],[-0.3259538],[-4.7028112]],"dense_1_W":[[-0.049621016,4.9386864,0.22225372,-0.50468636,-3.3765612,-1.9841615,0.5936033,1.2246263,1.095548,-0.47902176,-0.7616768,1.3234537,0.16300178,-0.07880985,-1.8373971,-0.049319483,-0.60459226,1.2156714],[-2.9402063,-1.0523149,-1.5185233,0.08499111,1.0865579,1.0525727,-0.1465986,-1.1851599,-0.058953725,-0.71784014,-0.2685184,0.71635437,0.251132,-0.30601355,-1.5897934,0.29047543,0.6667731,-0.10071236],[0.08765433,-1.4536031,-0.041436948,1.4752282,1.1028615,-0.103432536,-1.5968647,-2.285883,-0.6667483,-0.57892895,-0.23919246,-1.3221359,0.07155015,0.059983663,0.39822084,-0.11438429,-0.4005641,-0.04918819],[-0.1959526,-2.809933,-0.022276916,-0.57120407,-2.1798573,2.0513213,1.8356556,-0.055707194,0.3841646,0.12270313,-0.29532853,0.49275506,0.28545102,-0.02213581,-0.521218,-0.03942573,0.23347743,0.14229931],[-0.24373251,1.262901,-0.030217288,-0.12808013,1.2804521,-0.5394455,-0.38009447,0.18441972,-1.0359122,-0.0037286265,0.45743093,0.09319222,-0.36370987,0.3297252,-0.08393048,-0.0047107562,0.5613129,-0.4091355],[-0.23719503,-0.9404126,0.0926261,-0.051616613,-0.8165314,-0.9222617,-0.7448186,-1.2979639,-0.98353225,-1.2773293,-0.8675987,-0.014418147,-0.33688357,0.1969778,0.24246852,0.3851128,-0.19693658,-0.17832237],[-3.5865424,0.25134856,2.0410974,-0.36557475,-0.38683096,-0.8154279,-0.29506618,1.6679535,0.08965232,0.930452,0.45192754,-0.89868283,0.07440813,0.741106,1.1072174,-0.32913235,-0.4937108,0.14072369]],"activation":"σ"},{"dense_2_W":[[0.62462366,0.024357427,-0.34448272,-0.58292437,0.30916855,-0.50713134,-0.024550552],[0.43805766,-1.7579072,1.6740372,0.7165605,-0.42498606,1.1669543,-1.0991927],[-0.48364595,0.32843345,0.16262369,0.47115666,0.27874565,-0.32797176,-0.09075741],[-0.43172115,2.606324,1.8938895,-0.05707055,-3.4264026,1.739798,1.4022785],[0.33687568,0.41764873,0.16324182,-0.43559888,0.41784057,-0.07301598,-0.5026542],[0.11593532,-0.18869904,0.1762756,0.060152486,-0.23414135,-0.2395376,-0.46473634],[0.47535148,-0.34020066,-0.45831692,-0.397216,0.49522024,-0.36963704,0.23053196],[-2.9408336,2.4035687,0.8452914,2.4860463,0.75528365,-1.2101015,-2.6158304],[-0.4068932,0.35180044,-0.11634056,0.06763626,0.5883134,0.23572896,-0.39835322],[0.07357192,0.06712496,0.3003713,0.59648097,-0.07899983,-0.172574,-0.40611476],[-1.287874,0.50961626,0.59372807,1.2224478,-0.7302619,0.4823332,-0.67932415],[-0.5403362,-0.27858207,-0.40738842,0.40268764,-0.063495964,0.51690423,-0.04180467],[-0.07790316,-0.10537112,0.4429389,-0.092080735,-0.37243918,0.21537852,0.37400663]],"activation":"σ","dense_2_b":[[-0.06885159],[0.3566078],[0.0072980775],[-2.5390923],[-0.023952484],[0.047878355],[-0.13942967],[0.07728126],[0.03442184],[-0.054491904],[0.41003013],[0.026669098],[0.0048307395]]},{"dense_3_W":[[0.57360715,-0.6479148,-0.0929001,-0.7427764,0.39374602,0.2991983,0.48279104,-0.5929245,0.5512572,-0.41308194,-0.4991242,0.3139667,-0.36608085],[0.07104535,0.3203424,0.088158935,0.30987358,0.60674554,0.020095633,0.1591004,-0.4921284,-0.53741044,-0.07802789,0.20392969,0.43387452,0.3946713],[0.46675494,0.124138534,0.43950367,0.19262728,0.35888654,-0.19278255,0.13110434,0.084211424,0.0558524,-0.47238368,0.27825364,-0.1752686,-0.319111]],"activation":"identity","dense_3_b":[[0.060640067],[0.019549234],[0.04906507]]},{"dense_4_W":[[0.80676174,0.060901254,0.5398813]],"dense_4_b":[[0.057569314]],"activation":"identity"}]}
|
||||
@@ -0,0 +1 @@
|
||||
{"input_std":[[10.088922],[1.7304039],[1.4375063],[0.032994103],[1.6795603],[1.705598],[1.7235253],[1.6614505],[1.6000563],[1.5353311],[1.4539971],[0.03317187],[0.03311562],[0.033051275],[0.03286789],[0.032877274],[0.032806873],[0.03260343]],"model_test_loss":0.03966723382472992,"input_size":18,"current_date_and_time":"2024-01-01_14-14-43","input_mean":[[20.066832],[-0.05136131],[-0.012342298],[-0.008433405],[-0.04397132],[-0.046372537],[-0.048583414],[-0.045400653],[-0.04217297],[-0.04097941],[-0.044701155],[-0.008306612],[-0.008348125],[-0.00839202],[-0.008467563],[-0.008504569],[-0.008618364],[-0.008788095]],"input_vars":["v_ego","lateral_accel","lateral_jerk","roll","lateral_accel_m03","lateral_accel_m02","lateral_accel_m01","lateral_accel_p03","lateral_accel_p06","lateral_accel_p10","lateral_accel_p15","roll_m03","roll_m02","roll_m01","roll_p03","roll_p06","roll_p10","roll_p15"],"output_size":1,"layers":[{"dense_1_b":[[0.10824418],[-3.950648],[0.5197182],[0.3076343],[0.10567791],[-0.3259538],[-4.7028112]],"dense_1_W":[[-0.049621016,4.9386864,0.22225372,-0.50468636,-3.3765612,-1.9841615,0.5936033,1.2246263,1.095548,-0.47902176,-0.7616768,1.3234537,0.16300178,-0.07880985,-1.8373971,-0.049319483,-0.60459226,1.2156714],[-2.9402063,-1.0523149,-1.5185233,0.08499111,1.0865579,1.0525727,-0.1465986,-1.1851599,-0.058953725,-0.71784014,-0.2685184,0.71635437,0.251132,-0.30601355,-1.5897934,0.29047543,0.6667731,-0.10071236],[0.08765433,-1.4536031,-0.041436948,1.4752282,1.1028615,-0.103432536,-1.5968647,-2.285883,-0.6667483,-0.57892895,-0.23919246,-1.3221359,0.07155015,0.059983663,0.39822084,-0.11438429,-0.4005641,-0.04918819],[-0.1959526,-2.809933,-0.022276916,-0.57120407,-2.1798573,2.0513213,1.8356556,-0.055707194,0.3841646,0.12270313,-0.29532853,0.49275506,0.28545102,-0.02213581,-0.521218,-0.03942573,0.23347743,0.14229931],[-0.24373251,1.262901,-0.030217288,-0.12808013,1.2804521,-0.5394455,-0.38009447,0.18441972,-1.0359122,-0.0037286265,0.45743093,0.09319222,-0.36370987,0.3297252,-0.08393048,-0.0047107562,0.5613129,-0.4091355],[-0.23719503,-0.9404126,0.0926261,-0.051616613,-0.8165314,-0.9222617,-0.7448186,-1.2979639,-0.98353225,-1.2773293,-0.8675987,-0.014418147,-0.33688357,0.1969778,0.24246852,0.3851128,-0.19693658,-0.17832237],[-3.5865424,0.25134856,2.0410974,-0.36557475,-0.38683096,-0.8154279,-0.29506618,1.6679535,0.08965232,0.930452,0.45192754,-0.89868283,0.07440813,0.741106,1.1072174,-0.32913235,-0.4937108,0.14072369]],"activation":"σ"},{"dense_2_W":[[0.62462366,0.024357427,-0.34448272,-0.58292437,0.30916855,-0.50713134,-0.024550552],[0.43805766,-1.7579072,1.6740372,0.7165605,-0.42498606,1.1669543,-1.0991927],[-0.48364595,0.32843345,0.16262369,0.47115666,0.27874565,-0.32797176,-0.09075741],[-0.43172115,2.606324,1.8938895,-0.05707055,-3.4264026,1.739798,1.4022785],[0.33687568,0.41764873,0.16324182,-0.43559888,0.41784057,-0.07301598,-0.5026542],[0.11593532,-0.18869904,0.1762756,0.060152486,-0.23414135,-0.2395376,-0.46473634],[0.47535148,-0.34020066,-0.45831692,-0.397216,0.49522024,-0.36963704,0.23053196],[-2.9408336,2.4035687,0.8452914,2.4860463,0.75528365,-1.2101015,-2.6158304],[-0.4068932,0.35180044,-0.11634056,0.06763626,0.5883134,0.23572896,-0.39835322],[0.07357192,0.06712496,0.3003713,0.59648097,-0.07899983,-0.172574,-0.40611476],[-1.287874,0.50961626,0.59372807,1.2224478,-0.7302619,0.4823332,-0.67932415],[-0.5403362,-0.27858207,-0.40738842,0.40268764,-0.063495964,0.51690423,-0.04180467],[-0.07790316,-0.10537112,0.4429389,-0.092080735,-0.37243918,0.21537852,0.37400663]],"activation":"σ","dense_2_b":[[-0.06885159],[0.3566078],[0.0072980775],[-2.5390923],[-0.023952484],[0.047878355],[-0.13942967],[0.07728126],[0.03442184],[-0.054491904],[0.41003013],[0.026669098],[0.0048307395]]},{"dense_3_W":[[0.57360715,-0.6479148,-0.0929001,-0.7427764,0.39374602,0.2991983,0.48279104,-0.5929245,0.5512572,-0.41308194,-0.4991242,0.3139667,-0.36608085],[0.07104535,0.3203424,0.088158935,0.30987358,0.60674554,0.020095633,0.1591004,-0.4921284,-0.53741044,-0.07802789,0.20392969,0.43387452,0.3946713],[0.46675494,0.124138534,0.43950367,0.19262728,0.35888654,-0.19278255,0.13110434,0.084211424,0.0558524,-0.47238368,0.27825364,-0.1752686,-0.319111]],"activation":"identity","dense_3_b":[[0.060640067],[0.019549234],[0.04906507]]},{"dense_4_W":[[0.80676174,0.060901254,0.5398813]],"dense_4_b":[[0.057569314]],"activation":"identity"}]}
|
||||
@@ -0,0 +1 @@
|
||||
{"input_std":[[10.088922],[1.7304039],[1.4375063],[0.032994103],[1.6795603],[1.705598],[1.7235253],[1.6614505],[1.6000563],[1.5353311],[1.4539971],[0.03317187],[0.03311562],[0.033051275],[0.03286789],[0.032877274],[0.032806873],[0.03260343]],"model_test_loss":0.03966723382472992,"input_size":18,"current_date_and_time":"2024-01-01_14-14-43","input_mean":[[20.066832],[-0.05136131],[-0.012342298],[-0.008433405],[-0.04397132],[-0.046372537],[-0.048583414],[-0.045400653],[-0.04217297],[-0.04097941],[-0.044701155],[-0.008306612],[-0.008348125],[-0.00839202],[-0.008467563],[-0.008504569],[-0.008618364],[-0.008788095]],"input_vars":["v_ego","lateral_accel","lateral_jerk","roll","lateral_accel_m03","lateral_accel_m02","lateral_accel_m01","lateral_accel_p03","lateral_accel_p06","lateral_accel_p10","lateral_accel_p15","roll_m03","roll_m02","roll_m01","roll_p03","roll_p06","roll_p10","roll_p15"],"output_size":1,"layers":[{"dense_1_b":[[0.10824418],[-3.950648],[0.5197182],[0.3076343],[0.10567791],[-0.3259538],[-4.7028112]],"dense_1_W":[[-0.049621016,4.9386864,0.22225372,-0.50468636,-3.3765612,-1.9841615,0.5936033,1.2246263,1.095548,-0.47902176,-0.7616768,1.3234537,0.16300178,-0.07880985,-1.8373971,-0.049319483,-0.60459226,1.2156714],[-2.9402063,-1.0523149,-1.5185233,0.08499111,1.0865579,1.0525727,-0.1465986,-1.1851599,-0.058953725,-0.71784014,-0.2685184,0.71635437,0.251132,-0.30601355,-1.5897934,0.29047543,0.6667731,-0.10071236],[0.08765433,-1.4536031,-0.041436948,1.4752282,1.1028615,-0.103432536,-1.5968647,-2.285883,-0.6667483,-0.57892895,-0.23919246,-1.3221359,0.07155015,0.059983663,0.39822084,-0.11438429,-0.4005641,-0.04918819],[-0.1959526,-2.809933,-0.022276916,-0.57120407,-2.1798573,2.0513213,1.8356556,-0.055707194,0.3841646,0.12270313,-0.29532853,0.49275506,0.28545102,-0.02213581,-0.521218,-0.03942573,0.23347743,0.14229931],[-0.24373251,1.262901,-0.030217288,-0.12808013,1.2804521,-0.5394455,-0.38009447,0.18441972,-1.0359122,-0.0037286265,0.45743093,0.09319222,-0.36370987,0.3297252,-0.08393048,-0.0047107562,0.5613129,-0.4091355],[-0.23719503,-0.9404126,0.0926261,-0.051616613,-0.8165314,-0.9222617,-0.7448186,-1.2979639,-0.98353225,-1.2773293,-0.8675987,-0.014418147,-0.33688357,0.1969778,0.24246852,0.3851128,-0.19693658,-0.17832237],[-3.5865424,0.25134856,2.0410974,-0.36557475,-0.38683096,-0.8154279,-0.29506618,1.6679535,0.08965232,0.930452,0.45192754,-0.89868283,0.07440813,0.741106,1.1072174,-0.32913235,-0.4937108,0.14072369]],"activation":"σ"},{"dense_2_W":[[0.62462366,0.024357427,-0.34448272,-0.58292437,0.30916855,-0.50713134,-0.024550552],[0.43805766,-1.7579072,1.6740372,0.7165605,-0.42498606,1.1669543,-1.0991927],[-0.48364595,0.32843345,0.16262369,0.47115666,0.27874565,-0.32797176,-0.09075741],[-0.43172115,2.606324,1.8938895,-0.05707055,-3.4264026,1.739798,1.4022785],[0.33687568,0.41764873,0.16324182,-0.43559888,0.41784057,-0.07301598,-0.5026542],[0.11593532,-0.18869904,0.1762756,0.060152486,-0.23414135,-0.2395376,-0.46473634],[0.47535148,-0.34020066,-0.45831692,-0.397216,0.49522024,-0.36963704,0.23053196],[-2.9408336,2.4035687,0.8452914,2.4860463,0.75528365,-1.2101015,-2.6158304],[-0.4068932,0.35180044,-0.11634056,0.06763626,0.5883134,0.23572896,-0.39835322],[0.07357192,0.06712496,0.3003713,0.59648097,-0.07899983,-0.172574,-0.40611476],[-1.287874,0.50961626,0.59372807,1.2224478,-0.7302619,0.4823332,-0.67932415],[-0.5403362,-0.27858207,-0.40738842,0.40268764,-0.063495964,0.51690423,-0.04180467],[-0.07790316,-0.10537112,0.4429389,-0.092080735,-0.37243918,0.21537852,0.37400663]],"activation":"σ","dense_2_b":[[-0.06885159],[0.3566078],[0.0072980775],[-2.5390923],[-0.023952484],[0.047878355],[-0.13942967],[0.07728126],[0.03442184],[-0.054491904],[0.41003013],[0.026669098],[0.0048307395]]},{"dense_3_W":[[0.57360715,-0.6479148,-0.0929001,-0.7427764,0.39374602,0.2991983,0.48279104,-0.5929245,0.5512572,-0.41308194,-0.4991242,0.3139667,-0.36608085],[0.07104535,0.3203424,0.088158935,0.30987358,0.60674554,0.020095633,0.1591004,-0.4921284,-0.53741044,-0.07802789,0.20392969,0.43387452,0.3946713],[0.46675494,0.124138534,0.43950367,0.19262728,0.35888654,-0.19278255,0.13110434,0.084211424,0.0558524,-0.47238368,0.27825364,-0.1752686,-0.319111]],"activation":"identity","dense_3_b":[[0.060640067],[0.019549234],[0.04906507]]},{"dense_4_W":[[0.80676174,0.060901254,0.5398813]],"dense_4_b":[[0.057569314]],"activation":"identity"}]}
|
||||
@@ -40,6 +40,9 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
|
||||
"CADILLAC ESCALADE 2017" = [1.899999976158142, 1.842270016670227, 0.1120000034570694]
|
||||
"CADILLAC ESCALADE ESV 2019" = [1.15, 1.3, 0.2]
|
||||
"CADILLAC XT4 2023" = [1.45, 1.6, 0.2]
|
||||
# 昂科旗
|
||||
"BUICK BABY ENCLAVE 2020" = [1.45, 1.6, 0.2]
|
||||
"BUICK BABY ENCLAVE AVENIR 2020" = [1.45, 1.6, 0.2]
|
||||
"CHEVROLET BOLT EUV 2022" = [2.0, 2.0, 0.05]
|
||||
"CHEVROLET SILVERADO 1500 2020" = [1.9, 1.9, 0.112]
|
||||
"CHEVROLET TRAILBLAZER 2021" = [1.33, 1.9, 0.16]
|
||||
|
||||
@@ -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 self.CP.enableGasInterceptor and CC.longActive and self.CP.carFingerprint in STOP_AND_GO_CAR and actuators.accel > 0.0 \
|
||||
and CS.out.standstill:
|
||||
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:
|
||||
interceptor_gas_cmd = 0.12
|
||||
else:
|
||||
interceptor_gas_cmd = 0.
|
||||
|
||||
@@ -182,7 +182,18 @@ 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.flags & ToyotaFlags.SMART_DSU:
|
||||
distance_pressed = cp.vl["SDSU"]["FD_BUTTON"] == 1
|
||||
elif self.CP.openpilotLongitudinalControl:
|
||||
# KRKeegan - Add support for toyota distance button
|
||||
distance_pressed = cp_acc.vl["ACC_CONTROL"]["DISTANCE"] == 1
|
||||
|
||||
# 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:
|
||||
@@ -197,19 +208,6 @@ 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:
|
||||
@@ -229,10 +227,24 @@ class CarState(CarStateBase):
|
||||
else:
|
||||
self.fpf.update_experimental_mode()
|
||||
|
||||
# Switch the current state of Traffic Mode if the button is held down for 2.5 seconds
|
||||
if self.distance_pressed_counter == CRUISE_LONG_PRESS * 5 and frogpilot_variables.traffic_mode:
|
||||
self.fpf.update_traffic_mode()
|
||||
|
||||
# Revert the previous changes to Experimental Mode
|
||||
if frogpilot_variables.experimental_mode_via_distance:
|
||||
if frogpilot_variables.conditional_experimental_mode:
|
||||
self.fpf.update_cestatus_lkas()
|
||||
else:
|
||||
self.fpf.update_experimental_mode()
|
||||
|
||||
self.distance_previously_pressed = distance_pressed
|
||||
|
||||
# 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
|
||||
@@ -328,7 +340,7 @@ class CarState(CarStateBase):
|
||||
if CP.enableBsm:
|
||||
messages.append(("BSM", 1))
|
||||
|
||||
if CP.carFingerprint in RADAR_ACC_CAR and not CP.flags & ToyotaFlags.DISABLE_RADAR.value:
|
||||
if not CP.openpilotLongitudinalControl or (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),
|
||||
@@ -343,9 +355,7 @@ class CarState(CarStateBase):
|
||||
]
|
||||
|
||||
if CP.flags & ToyotaFlags.SMART_DSU:
|
||||
messages += [
|
||||
("SDSU", 100),
|
||||
]
|
||||
messages.append(("SDSU", 33))
|
||||
|
||||
messages += [("SECONDARY_STEER_ANGLE", 0)]
|
||||
|
||||
@@ -372,4 +382,7 @@ 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)
|
||||
|
||||
@@ -177,23 +177,19 @@ class Controls:
|
||||
# FrogPilot variables
|
||||
self.params = Params()
|
||||
self.params_memory = Params("/dev/shm/params")
|
||||
self.params_storage = Params("/persist/comma/params")
|
||||
|
||||
self.frogpilot_variables = SimpleNamespace()
|
||||
|
||||
self.drive_added = False
|
||||
self.driving_gear = False
|
||||
self.fcw_random_event_triggered = False
|
||||
self.holiday_theme_alerted = False
|
||||
self.previously_enabled = False
|
||||
self.openpilot_crashed = False
|
||||
self.previously_enabled = False
|
||||
self.random_event_triggered = False
|
||||
self.stopped_for_light_previously = False
|
||||
|
||||
self.drive_distance = 0
|
||||
self.drive_time = 0
|
||||
self.max_acceleration = 0
|
||||
self.previous_drive_distance = 0
|
||||
self.previous_lead_distance = 0
|
||||
self.previous_speed_limit = SpeedLimitController.desired_speed_limit
|
||||
self.random_event_timer = 0
|
||||
@@ -201,6 +197,12 @@ class Controls:
|
||||
ignore = self.sensor_packets + ['testJoystick']
|
||||
if SIMULATION:
|
||||
ignore += ['driverCameraState', 'managerState']
|
||||
|
||||
self.driver_privacy_protection = self.params.get_bool("DriverPrivacyProtection")
|
||||
if self.driver_privacy_protection:
|
||||
self.camera_packets = ["roadCameraState", "wideRoadCameraState"]
|
||||
ignore += ['driverMonitoringState'] if SIMULATION else ['driverCameraState', 'managerState', 'driverMonitoringState']
|
||||
|
||||
self.sm = messaging.SubMaster(['deviceState', 'pandaStates', 'peripheralState', 'modelV2', 'liveCalibration',
|
||||
'driverMonitoringState', 'longitudinalPlan', 'liveLocationKalman',
|
||||
'managerState', 'liveParameters', 'radarState', 'liveTorqueParameters',
|
||||
@@ -301,6 +303,7 @@ class Controls:
|
||||
self.experimental_mode = False
|
||||
self.v_cruise_helper = VCruiseHelper(self.CP)
|
||||
self.recalibrating_seen = False
|
||||
self.nn_alert_shown = False
|
||||
|
||||
self.can_log_mono_time = 0
|
||||
|
||||
@@ -346,9 +349,8 @@ class Controls:
|
||||
return
|
||||
|
||||
# Show holiday related event to indicate which holiday is active
|
||||
if self.sm.frame >= 1000 and self.holiday_themes and self.params_memory.get_int("CurrentHolidayTheme") != 0 and not self.holiday_theme_alerted:
|
||||
if self.sm.frame % 1000 == 0 and self.holiday_themes and self.params_memory.get_int("CurrentHolidayTheme") != 0:
|
||||
self.events.add(EventName.holidayActive)
|
||||
self.holiday_theme_alerted = True
|
||||
|
||||
# Add joystick event, static on cars, dynamic on nonCars
|
||||
if self.joystick_mode:
|
||||
@@ -370,7 +372,8 @@ class Controls:
|
||||
return
|
||||
|
||||
# show alert to indicate whether NNFF is loaded
|
||||
if self.sm.frame == 550 and self.CP.lateralTuning.which() == 'torque' and self.CI.has_lateral_torque_nn:
|
||||
if not self.nn_alert_shown and self.sm.frame % 550 == 0 and self.CP.lateralTuning.which() == 'torque' and self.CI.has_lateral_torque_nn:
|
||||
self.nn_alert_shown = True
|
||||
self.events.add(EventName.torqueNNLoad)
|
||||
|
||||
# Block resume if cruise never previously enabled
|
||||
@@ -588,36 +591,10 @@ class Controls:
|
||||
|
||||
# Store the total distance traveled
|
||||
self.drive_distance += CS.vEgo * DT_CTRL
|
||||
self.drive_time += DT_CTRL
|
||||
|
||||
# Store the current drive's data after a minute when at a standstill - Need to do this live for comma powerless users
|
||||
if self.drive_time > 60 and CS.standstill:
|
||||
current_total_distance = self.params.get_float("FrogPilotKilometers")
|
||||
distance_to_add = self.drive_distance / 1000
|
||||
new_total_distance = current_total_distance + distance_to_add
|
||||
|
||||
self.params.put_float("FrogPilotKilometers", new_total_distance)
|
||||
self.params_storage.put_float("FrogPilotKilometers", new_total_distance)
|
||||
|
||||
self.drive_distance = 0
|
||||
|
||||
current_total_time = self.params.get_float("FrogPilotMinutes")
|
||||
time_to_add = self.drive_time / 60
|
||||
new_total_time = current_total_time + time_to_add
|
||||
|
||||
self.params.put_float("FrogPilotMinutes", new_total_time)
|
||||
self.params_storage.put_float("FrogPilotMinutes", new_total_time)
|
||||
|
||||
self.drive_time = 0
|
||||
|
||||
# Only count the drive if it lasted longer than 5 minutes
|
||||
if self.sm.frame * DT_CTRL > 60 * 5 and not self.drive_added:
|
||||
new_total_drives = self.params.get_int("FrogPilotDrives") + 1
|
||||
|
||||
self.params.put_int("FrogPilotDrives", new_total_drives)
|
||||
self.params_storage.put_int("FrogPilotDrives", new_total_drives)
|
||||
|
||||
self.drive_added = True
|
||||
if self.drive_distance != self.previous_drive_distance:
|
||||
self.params_memory.put_float("FrogPilotKilometers", self.drive_distance / 1000)
|
||||
self.params_memory.put_float("FrogPilotMinutes", self.sm.frame * DT_CTRL / 60)
|
||||
|
||||
# Acceleration Random Event alerts
|
||||
if self.random_events:
|
||||
@@ -687,7 +664,7 @@ class Controls:
|
||||
else:
|
||||
self.params_memory.put_bool("SLCConfirmed", True)
|
||||
|
||||
if self.params_memory.get_bool("SLCConfirmedPressed") or abs(current_speed_limit - desired_speed_limit) < 1 or not self.speed_limit_confirmation:
|
||||
if self.params_memory.get_bool("SLCConfirmedPressed") or current_speed_limit == desired_speed_limit or not self.speed_limit_confirmation:
|
||||
self.FPCC.speedLimitChanged = False
|
||||
self.params_memory.put_bool("SLCConfirmedPressed", False)
|
||||
|
||||
@@ -770,6 +747,13 @@ class Controls:
|
||||
def state_transition(self, CS):
|
||||
"""Compute conditional state transitions and execute actions on state transitions"""
|
||||
|
||||
resume_pressed = any(be.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for be in CS.buttonEvents)
|
||||
set_pressed = any(be.type in (ButtonType.decelCruise, ButtonType.setCruise) for be in CS.buttonEvents)
|
||||
if resume_pressed:
|
||||
self.frogpilot_variables.prev_button = ButtonType.resumeCruise
|
||||
elif set_pressed:
|
||||
self.frogpilot_variables.prev_button = ButtonType.setCruise
|
||||
|
||||
self.v_cruise_helper.update_v_cruise(CS, self.enabled, self.is_metric, self.FPCC.speedLimitChanged, self.frogpilot_variables)
|
||||
|
||||
# decrement the soft disable timer at every step, as it's reset on
|
||||
@@ -881,7 +865,7 @@ class Controls:
|
||||
# Reset the Random Event flag after 5 seconds
|
||||
if self.random_event_triggered:
|
||||
self.random_event_timer += 1
|
||||
if self.random_event_timer * DT_CTRL >= 4:
|
||||
if self.random_event_timer * DT_CTRL >= 5:
|
||||
self.random_event_triggered = False
|
||||
self.random_event_timer = 0
|
||||
self.params_memory.remove("CurrentRandomEvent")
|
||||
@@ -895,6 +879,12 @@ class Controls:
|
||||
|
||||
signal_check = not ((CS.leftBlinker or CS.rightBlinker) and CS.vEgo < self.pause_lateral_on_signal and not CS.standstill)
|
||||
|
||||
#测试最低启用速度
|
||||
#1.非巡航状态下,速度小于standard,暂停横向控制
|
||||
#2.在巡航状态下,速度小于engage,暂停横向控制
|
||||
min_steer_speed_check = not ((self.state not in ACTIVE_STATES) and CS.vEgo < max(self.CP.minSteerSpeed, self.min_steer_speed_standard) and not CS.standstill) and \
|
||||
not ((self.state in ACTIVE_STATES) and CS.vEgo < max(self.CP.minSteerSpeed, self.min_steer_speed_engage) and not CS.standstill)
|
||||
|
||||
# Always on lateral
|
||||
self.FPCC.alwaysOnLateral |= CS.cruiseState.enabled or self.always_on_lateral_main
|
||||
self.FPCC.alwaysOnLateral &= self.always_on_lateral
|
||||
@@ -908,7 +898,8 @@ class Controls:
|
||||
# Check which actuators can be enabled
|
||||
standstill = CS.vEgo <= max(self.CP.minSteerSpeed, MIN_LATERAL_CONTROL_SPEED) or CS.standstill
|
||||
CC.latActive = (self.active or self.FPCC.alwaysOnLateral) and signal_check and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \
|
||||
(not standstill or self.joystick_mode) and not self.openpilot_crashed
|
||||
(not standstill or self.joystick_mode) and not self.openpilot_crashed and \
|
||||
min_steer_speed_check
|
||||
CC.longActive = self.enabled and not self.events.contains(ET.OVERRIDE_LONGITUDINAL) and self.CP.openpilotLongitudinalControl and not self.openpilot_crashed
|
||||
|
||||
actuators = CC.actuators
|
||||
@@ -977,7 +968,7 @@ class Controls:
|
||||
good_speed = CS.vEgo > 5
|
||||
max_torque = abs(self.last_actuators.steer) > 0.99
|
||||
if undershooting and turning and good_speed and max_torque and not self.random_event_triggered:
|
||||
if self.sm.frame % 10000 == 0 and self.random_events:
|
||||
if self.sm.frame % 10000 == 0:
|
||||
lac_log.active and self.events.add(EventName.firefoxSteerSaturated)
|
||||
self.params_memory.put_int("CurrentRandomEvent", 1)
|
||||
self.random_event_triggered = True
|
||||
@@ -1127,6 +1118,7 @@ class Controls:
|
||||
controlsState.forceDecel = bool(force_decel)
|
||||
controlsState.canErrorCounter = self.card.can_rcv_cum_timeout_counter
|
||||
controlsState.experimentalMode = self.experimental_mode
|
||||
self.frogpilot_variables.experimentalMode = self.experimental_mode
|
||||
|
||||
lat_tuning = self.CP.lateralTuning.which()
|
||||
if self.joystick_mode:
|
||||
@@ -1219,6 +1211,7 @@ class Controls:
|
||||
|
||||
def update_frogpilot_params(self):
|
||||
self.frogpilot_variables.conditional_experimental_mode = self.params.get_bool("ConditionalExperimental")
|
||||
self.frogpilot_variables.CSLC = self.params.get_bool("CSLCEnabled")
|
||||
|
||||
custom_alerts = self.params.get_bool("CustomAlerts")
|
||||
self.green_light_alert = custom_alerts and self.params.get_bool("GreenLightAlert")
|
||||
@@ -1246,6 +1239,7 @@ class Controls:
|
||||
|
||||
longitudinal_tune = self.params.get_bool("LongitudinalTune")
|
||||
self.frogpilot_variables.sport_plus = longitudinal_tune and self.params.get_int("AccelerationProfile") == 3
|
||||
self.frogpilot_variables.traffic_mode = longitudinal_tune and self.params.get_bool("TrafficMode")
|
||||
|
||||
self.lane_detection = self.params.get_bool("LaneDetection") and self.params.get_bool("NudgelessLaneChange")
|
||||
self.lane_detection_width = self.params.get_int("LaneDetectionWidth") * (1 if self.is_metric else CV.FOOT_TO_METER) / 10 if self.lane_detection else 0
|
||||
@@ -1257,6 +1251,10 @@ class Controls:
|
||||
self.pause_lateral_on_signal = self.params.get_int("PauseLateralOnSignal") * (CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS) if quality_of_life else 0
|
||||
self.frogpilot_variables.reverse_cruise_increase = quality_of_life and self.params.get_bool("ReverseCruise")
|
||||
self.frogpilot_variables.set_speed_offset = self.params.get_int("SetSpeedOffset") * (1 if self.is_metric else CV.MPH_TO_KPH) if quality_of_life else 0
|
||||
#MinSteerSpeedStandard, convert to MS
|
||||
self.min_steer_speed_standard = self.params.get_int("MinSteerSpeedStandard") * (CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS) if quality_of_life else 0
|
||||
#MinSteerSpeedEngage, convert to MS
|
||||
self.min_steer_speed_engage = self.params.get_int("MinSteerSpeedEngage") * (CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS) if quality_of_life else 0
|
||||
|
||||
self.random_events = self.params.get_bool("RandomEvents")
|
||||
self.frogpilot_variables.use_ev_tables = self.params.get_bool("EVTable")
|
||||
|
||||
@@ -7,7 +7,7 @@ LaneChangeState = log.LaneChangeState
|
||||
LaneChangeDirection = log.LaneChangeDirection
|
||||
TurnDirection = log.Desire
|
||||
|
||||
LANE_CHANGE_SPEED_MIN = 20 * CV.MPH_TO_MS
|
||||
LANE_CHANGE_SPEED_MIN = 10 * CV.KPH_TO_MS
|
||||
LANE_CHANGE_TIME_MAX = 10.
|
||||
|
||||
DESIRES = {
|
||||
|
||||
@@ -57,7 +57,7 @@ class VCruiseHelper:
|
||||
self.v_cruise_kph_last = self.v_cruise_kph
|
||||
|
||||
if CS.cruiseState.available:
|
||||
if not self.CP.pcmCruise:
|
||||
if not self.CP.pcmCruise or frogpilot_variables.CSLC:
|
||||
# if stock cruise is completely disabled, then we can use our own set speed logic
|
||||
self._update_v_cruise_non_pcm(CS, enabled, is_metric, speed_limit_changed, frogpilot_variables)
|
||||
self.v_cruise_cluster_kph = self.v_cruise_kph
|
||||
@@ -152,7 +152,7 @@ class VCruiseHelper:
|
||||
|
||||
def initialize_v_cruise(self, CS, experimental_mode: bool, desired_speed_limit, frogpilot_variables) -> None:
|
||||
# initializing is handled by the PCM
|
||||
if self.CP.pcmCruise:
|
||||
if self.CP.pcmCruise and not frogpilot_variables.CSLC:
|
||||
return
|
||||
|
||||
if frogpilot_variables.conditional_experimental_mode:
|
||||
@@ -160,6 +160,21 @@ class VCruiseHelper:
|
||||
else:
|
||||
initial = V_CRUISE_INITIAL_EXPERIMENTAL_MODE if experimental_mode else V_CRUISE_INITIAL
|
||||
|
||||
# CSLC resume/set logic
|
||||
if frogpilot_variables.CSLC:
|
||||
if frogpilot_variables.prev_button == ButtonType.resumeCruise and self.v_cruise_kph_last < 250:
|
||||
self.v_cruise_kph = self.v_cruise_kph_last
|
||||
else:
|
||||
# Initial set speed
|
||||
if desired_speed_limit != 0 and frogpilot_variables.set_speed_limit:
|
||||
# If there's a known speed limit and the corresponding FP toggle is set, push it to the car
|
||||
self.v_cruise_kph = int(round(desired_speed_limit * CV.MS_TO_KPH))
|
||||
else:
|
||||
# Use fixed initial set speed from mode etc.
|
||||
self.v_cruise_kph = int(round(clip(CS.vEgo * CV.MS_TO_KPH, initial, V_CRUISE_MAX)))
|
||||
self.v_cruise_cluster_kph = self.v_cruise_kph
|
||||
return
|
||||
|
||||
# 250kph or above probably means we never had a set speed
|
||||
if any(b.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for b in CS.buttonEvents) and self.v_cruise_kph_last < 250:
|
||||
self.v_cruise_kph = self.v_cruise_kph_last
|
||||
@@ -167,7 +182,7 @@ class VCruiseHelper:
|
||||
# Initial set speed
|
||||
if desired_speed_limit != 0 and frogpilot_variables.set_speed_limit:
|
||||
# If there's a known speed limit and the corresponding FP toggle is set, push it to the car
|
||||
self.v_cruise_kph = desired_speed_limit * CV.MS_TO_KPH
|
||||
self.v_cruise_kph = int(round(desired_speed_limit * CV.MS_TO_KPH))
|
||||
else:
|
||||
# Use fixed initial set speed from mode etc.
|
||||
self.v_cruise_kph = int(round(clip(CS.vEgo * CV.MS_TO_KPH, initial, V_CRUISE_MAX)))
|
||||
|
||||
@@ -238,8 +238,11 @@ def below_engage_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.
|
||||
|
||||
|
||||
def below_steer_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
|
||||
params = Params()
|
||||
quality_of_life = params.get_bool("QOLControls")
|
||||
min_steer_speed_standard = params.get_int("MinSteerSpeedStandard") * (CV.KPH_TO_MS if metric else CV.MPH_TO_MS) if quality_of_life else 0
|
||||
return Alert(
|
||||
f"Steer Unavailable Below {get_display_speed(CP.minSteerSpeed, metric)}",
|
||||
f"Steer Unavailable Below {get_display_speed(max(CP.minSteerSpeed,min_steer_speed_standard), metric)}",
|
||||
"",
|
||||
AlertStatus.userPrompt, AlertSize.small,
|
||||
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.prompt, 0.4)
|
||||
@@ -748,7 +751,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
|
||||
},
|
||||
|
||||
EventName.noGps: {
|
||||
ET.PERMANENT: no_gps_alert,
|
||||
#ET.PERMANENT: no_gps_alert,
|
||||
},
|
||||
|
||||
EventName.soundsUnavailable: {
|
||||
@@ -1128,10 +1131,10 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
|
||||
|
||||
EventName.yourFrogTriedToKillMe: {
|
||||
ET.PERMANENT: Alert(
|
||||
"Your frog tried to kill me...",
|
||||
"😡",
|
||||
AlertStatus.frogpilot, AlertSize.mid,
|
||||
Priority.MID, VisualAlert.none, AudibleAlert.angry, 5.),
|
||||
"Your frog tried to kill me",
|
||||
"😠",
|
||||
AlertStatus.frogpilot, AlertSize.small,
|
||||
Priority.MID, VisualAlert.none, AudibleAlert.angry, 3.),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -327,10 +327,10 @@ class LongitudinalMpc:
|
||||
lead_xv = np.column_stack((x_lead_traj, v_lead_traj))
|
||||
return lead_xv
|
||||
|
||||
def process_lead(self, lead, increased_stopping_distance):
|
||||
def process_lead(self, lead, frogpilot_planner):
|
||||
v_ego = self.x0[1]
|
||||
if lead is not None and lead.status:
|
||||
x_lead = lead.dRel - increased_stopping_distance
|
||||
x_lead = lead.dRel - (frogpilot_planner.increased_stopping_distance if not frogpilot_planner.traffic_mode_active else 0)
|
||||
v_lead = lead.vLead
|
||||
a_lead = lead.aLeadK
|
||||
a_lead_tau = lead.aLeadTau
|
||||
@@ -357,13 +357,17 @@ class LongitudinalMpc:
|
||||
self.max_a = max_a
|
||||
|
||||
def update(self, radarstate, v_cruise, x, v, a, j, frogpilot_planner, personality=log.LongitudinalPersonality.standard):
|
||||
t_follow = get_T_FOLLOW(frogpilot_planner.custom_personalities, frogpilot_planner.aggressive_follow, frogpilot_planner.standard_follow, frogpilot_planner.relaxed_follow, personality)
|
||||
if frogpilot_planner.traffic_mode_active:
|
||||
t_follow = frogpilot_planner.traffic_mode_t_follow
|
||||
else:
|
||||
t_follow = get_T_FOLLOW(frogpilot_planner.custom_personalities, frogpilot_planner.aggressive_follow, frogpilot_planner.standard_follow, frogpilot_planner.relaxed_follow, personality)
|
||||
|
||||
self.t_follow = t_follow
|
||||
v_ego = self.x0[1]
|
||||
self.status = radarstate.leadOne.status or radarstate.leadTwo.status
|
||||
|
||||
lead_xv_0 = self.process_lead(radarstate.leadOne, frogpilot_planner.increased_stopping_distance)
|
||||
lead_xv_1 = self.process_lead(radarstate.leadTwo, frogpilot_planner.increased_stopping_distance)
|
||||
lead_xv_0 = self.process_lead(radarstate.leadOne, frogpilot_planner)
|
||||
lead_xv_1 = self.process_lead(radarstate.leadTwo, frogpilot_planner)
|
||||
|
||||
# Offset by FrogAi for FrogPilot for a more natural takeoff with a lead
|
||||
if frogpilot_planner.aggressive_acceleration:
|
||||
|
||||
@@ -24,8 +24,8 @@ A_CRUISE_MIN = -1.2
|
||||
A_CRUISE_MAX_VALS = [1.6, 1.2, 0.8, 0.6]
|
||||
A_CRUISE_MAX_BP = [0., 10.0, 25., 40.]
|
||||
|
||||
ACCEL_MAX_PLUS = [ACCEL_MAX, 4.0]
|
||||
ACCEL_MAX_PLUS_BP = [0., CRUISING_SPEED]
|
||||
ACCEL_MAX_PLUS = [ACCEL_MAX, 2.5, 3.0, 3.5, 4.0]
|
||||
ACCEL_MAX_PLUS_BP = [0., CRUISING_SPEED / 4, CRUISING_SPEED / 3, CRUISING_SPEED / 2, CRUISING_SPEED]
|
||||
|
||||
# Lookup table for turns
|
||||
_A_TOTAL_MAX_V = [1.7, 3.2]
|
||||
|
||||
|
Before Width: | Height: | Size: 155 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 86 KiB |