mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 16:33:57 +08:00
Add LaneChangeEnabled param and settings toggle (#1093)
* add LaneChangeEnabled param and settings toggle
* Read lane change toggle in pathplanner.py
Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: 45718d9294
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7a1c034720cf6ef0d4bcf4b379f74e21a6c5ca46188e931d0271b2f8ddbd85d7
|
||||
size 13643317
|
||||
oid sha256:f1914296d2285d918a86e8264e46ce38d01b7082ddbd7a2e5ca4096439433e18
|
||||
size 13644580
|
||||
|
||||
@@ -81,6 +81,7 @@ keys = {
|
||||
"LiveParameters": [TxType.PERSISTENT],
|
||||
"LongitudinalControl": [TxType.PERSISTENT],
|
||||
"OpenpilotEnabledToggle": [TxType.PERSISTENT],
|
||||
"LaneChangeEnabled": [TxType.PERSISTENT],
|
||||
"PandaFirmware": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"PandaFirmwareHex": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
"PandaDongleId": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
|
||||
|
||||
@@ -6,6 +6,7 @@ from selfdrive.controls.lib.lateral_mpc import libmpc_py
|
||||
from selfdrive.controls.lib.drive_helpers import MPC_COST_LAT
|
||||
from selfdrive.controls.lib.lane_planner import LanePlanner
|
||||
from selfdrive.config import Conversions as CV
|
||||
from common.params import Params
|
||||
import cereal.messaging as messaging
|
||||
from cereal import log
|
||||
|
||||
@@ -53,6 +54,7 @@ class PathPlanner():
|
||||
|
||||
self.setup_mpc()
|
||||
self.solution_invalid_cnt = 0
|
||||
self.lane_change_enabled = Params().get('LaneChangeEnabled') == b'1'
|
||||
self.lane_change_state = LaneChangeState.off
|
||||
self.lane_change_direction = LaneChangeDirection.none
|
||||
self.lane_change_timer = 0.0
|
||||
@@ -97,7 +99,7 @@ class PathPlanner():
|
||||
elif sm['carState'].rightBlinker:
|
||||
self.lane_change_direction = LaneChangeDirection.right
|
||||
|
||||
if (not active) or (self.lane_change_timer > LANE_CHANGE_TIME_MAX) or (not one_blinker):
|
||||
if (not active) or (self.lane_change_timer > LANE_CHANGE_TIME_MAX) or (not one_blinker) or (not self.lane_change_enabled):
|
||||
self.lane_change_state = LaneChangeState.off
|
||||
self.lane_change_direction = LaneChangeDirection.none
|
||||
else:
|
||||
|
||||
@@ -502,6 +502,8 @@ def main():
|
||||
params.put("LastUpdateTime", t.encode('utf8'))
|
||||
if params.get("OpenpilotEnabledToggle") is None:
|
||||
params.put("OpenpilotEnabledToggle", "1")
|
||||
if params.get("LaneChangeEnabled") is None:
|
||||
params.put("LaneChangeEnabled", "1")
|
||||
|
||||
# is this chffrplus?
|
||||
if os.getenv("PASSIVE") is not None:
|
||||
|
||||
Reference in New Issue
Block a user