Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "panda"]
path = panda
url = ../../commaai/panda.git
url = ../../ntegan1/panda.git
[submodule "opendbc"]
path = opendbc
url = ../../commaai/opendbc.git
Expand Down
2 changes: 1 addition & 1 deletion panda
5 changes: 4 additions & 1 deletion selfdrive/car/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from abc import abstractmethod, ABC
from typing import Any, Dict, Optional, Tuple, List, Callable

from panda import ALTERNATIVE_EXPERIENCE
from cereal import car
from common.basedir import BASEDIR
from common.conversions import Conversions as CV
Expand Down Expand Up @@ -250,6 +251,7 @@ def create_common_events(self, cs_out, extra_gears=None, pcm_enable=True, allow_
if cs_out.gearShifter == GearShifter.reverse:
events.add(EventName.reverseGear)
if not cs_out.cruiseState.available:
# main off
events.add(EventName.wrongCarMode)
if cs_out.espDisabled:
events.add(EventName.espDisabled)
Expand Down Expand Up @@ -299,7 +301,8 @@ def create_common_events(self, cs_out, extra_gears=None, pcm_enable=True, allow_
if cs_out.cruiseState.enabled and not self.CS.out.cruiseState.enabled and allow_enable:
events.add(EventName.pcmEnable)
elif not cs_out.cruiseState.enabled:
events.add(EventName.pcmDisable)
if not bool(self.CP.alternativeExperience & ALTERNATIVE_EXPERIENCE.PCM_ALLOW_LKAS_ONLY_MODE):
events.add(EventName.pcmDisable)

return events

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/toyota/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def update(self, CC, CS, now_nanos):
interceptor_gas_cmd = clip(pedal_command, 0., MAX_INTERCEPTOR_GAS)
else:
interceptor_gas_cmd = 0.
pcm_accel_cmd = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX)
pcm_accel_cmd = 0 if not CC.longActive else clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX)

# steer torque
new_steer = int(round(actuators.steer * CarControllerParams.STEER_MAX))
Expand Down
5 changes: 4 additions & 1 deletion selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def __init__(self, sm=None, pm=None, can_sock=None, CI=None):

# set alternative experiences from parameters
self.disengage_on_accelerator = self.params.get_bool("DisengageOnAccelerator")
self.CP.alternativeExperience = 0
self.CP.alternativeExperience = ALTERNATIVE_EXPERIENCE.PCM_ALLOW_LKAS_ONLY_MODE
if not self.disengage_on_accelerator:
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS

Expand Down Expand Up @@ -580,6 +580,9 @@ def state_control(self, CS):
(not standstill or self.joystick_mode)
CC.longActive = self.enabled and not self.events.any(ET.OVERRIDE_LONGITUDINAL) and self.CP.openpilotLongitudinalControl

if bool(self.CP.alternativeExperience & ALTERNATIVE_EXPERIENCE.PCM_ALLOW_LKAS_ONLY_MODE):
CC.longActive = CC.longActive and (CS.cruiseState.enabled)

actuators = CC.actuators
actuators.longControlState = self.LoC.long_control_state

Expand Down