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>
pull/1101/head
Andrew Valish 5 years ago committed by GitHub
parent 3064b35ca4
commit 45718d9294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      apk/ai.comma.plus.offroad.apk
  2. 1
      common/params.py
  3. 4
      selfdrive/controls/lib/pathplanner.py
  4. 2
      selfdrive/manager.py

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:7a1c034720cf6ef0d4bcf4b379f74e21a6c5ca46188e931d0271b2f8ddbd85d7 oid sha256:f1914296d2285d918a86e8264e46ce38d01b7082ddbd7a2e5ca4096439433e18
size 13643317 size 13644580

@ -81,6 +81,7 @@ keys = {
"LiveParameters": [TxType.PERSISTENT], "LiveParameters": [TxType.PERSISTENT],
"LongitudinalControl": [TxType.PERSISTENT], "LongitudinalControl": [TxType.PERSISTENT],
"OpenpilotEnabledToggle": [TxType.PERSISTENT], "OpenpilotEnabledToggle": [TxType.PERSISTENT],
"LaneChangeEnabled": [TxType.PERSISTENT],
"PandaFirmware": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT], "PandaFirmware": [TxType.CLEAR_ON_MANAGER_START, TxType.CLEAR_ON_PANDA_DISCONNECT],
"PandaFirmwareHex": [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], "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.drive_helpers import MPC_COST_LAT
from selfdrive.controls.lib.lane_planner import LanePlanner from selfdrive.controls.lib.lane_planner import LanePlanner
from selfdrive.config import Conversions as CV from selfdrive.config import Conversions as CV
from common.params import Params
import cereal.messaging as messaging import cereal.messaging as messaging
from cereal import log from cereal import log
@ -53,6 +54,7 @@ class PathPlanner():
self.setup_mpc() self.setup_mpc()
self.solution_invalid_cnt = 0 self.solution_invalid_cnt = 0
self.lane_change_enabled = Params().get('LaneChangeEnabled') == b'1'
self.lane_change_state = LaneChangeState.off self.lane_change_state = LaneChangeState.off
self.lane_change_direction = LaneChangeDirection.none self.lane_change_direction = LaneChangeDirection.none
self.lane_change_timer = 0.0 self.lane_change_timer = 0.0
@ -97,7 +99,7 @@ class PathPlanner():
elif sm['carState'].rightBlinker: elif sm['carState'].rightBlinker:
self.lane_change_direction = LaneChangeDirection.right 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_state = LaneChangeState.off
self.lane_change_direction = LaneChangeDirection.none self.lane_change_direction = LaneChangeDirection.none
else: else:

@ -502,6 +502,8 @@ def main():
params.put("LastUpdateTime", t.encode('utf8')) params.put("LastUpdateTime", t.encode('utf8'))
if params.get("OpenpilotEnabledToggle") is None: if params.get("OpenpilotEnabledToggle") is None:
params.put("OpenpilotEnabledToggle", "1") params.put("OpenpilotEnabledToggle", "1")
if params.get("LaneChangeEnabled") is None:
params.put("LaneChangeEnabled", "1")
# is this chffrplus? # is this chffrplus?
if os.getenv("PASSIVE") is not None: if os.getenv("PASSIVE") is not None:

Loading…
Cancel
Save