mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-02 06:03:43 +08:00
@@ -17,6 +17,7 @@ from opendbc.car.carlog import carlog
|
||||
from opendbc.car.fw_versions import ObdCallback
|
||||
from opendbc.car.car_helpers import get_car, interfaces
|
||||
from opendbc.car.interfaces import CarInterfaceBase, RadarInterfaceBase
|
||||
from opendbc.safety import ALTERNATIVE_EXPERIENCE
|
||||
from openpilot.selfdrive.pandad import can_capnp_to_list, can_list_to_can_capnp
|
||||
from openpilot.selfdrive.car.cruise import VCruiseHelper
|
||||
from openpilot.selfdrive.car.car_specific import MockCarState
|
||||
@@ -174,6 +175,9 @@ class Car:
|
||||
# FrogPilot variables
|
||||
self.frogpilot_toggles = get_frogpilot_toggles()
|
||||
|
||||
if self.frogpilot_toggles.always_on_lateral:
|
||||
self.FPCP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.ALWAYS_ON_LATERAL
|
||||
|
||||
fpcp_bytes = self.FPCP.to_bytes()
|
||||
self.params.put("FrogPilotCarParams", fpcp_bytes)
|
||||
self.params.put_nonblocking("FrogPilotCarParamsPersistent", fpcp_bytes)
|
||||
|
||||
@@ -107,7 +107,7 @@ class Controls:
|
||||
|
||||
# Check which actuators can be enabled
|
||||
standstill = abs(CS.vEgo) <= max(self.CP.minSteerSpeed, 0.3) or CS.standstill
|
||||
CC.latActive = self.sm['selfdriveState'].active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \
|
||||
CC.latActive = (self.sm['selfdriveState'].active or self.sm['frogpilotCarState'].alwaysOnLateralEnabled) and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \
|
||||
(not standstill or self.CP.steerAtStandstill) and self.sm['frogpilotPlan'].lateralCheck
|
||||
CC.longActive = CC.enabled and not any(e.overrideLongitudinal for e in self.sm['onroadEvents']) and self.CP.openpilotLongitudinalControl
|
||||
|
||||
|
||||
Binary file not shown.
@@ -436,7 +436,7 @@ class DriverMonitoring:
|
||||
rpyCalib = [0., 0., 0.]
|
||||
else:
|
||||
highway_speed = sm['carState'].vEgo
|
||||
enabled = sm['selfdriveState'].enabled
|
||||
enabled = sm['selfdriveState'].enabled or sm['frogpilotCarState'].alwaysOnLateralEnabled
|
||||
wrong_gear = sm['carState'].gearShifter not in (car.CarState.GearShifter.drive, car.CarState.GearShifter.low)
|
||||
standstill = sm['carState'].standstill
|
||||
driver_engaged = sm['carState'].steeringPressed or sm['carState'].gasPressed
|
||||
|
||||
@@ -552,7 +552,7 @@ class SelfdriveD:
|
||||
CS = self.data_sample()
|
||||
self.update_events(CS)
|
||||
if not self.CP.passive and self.initialized:
|
||||
self.enabled, self.active = self.state_machine.update(self.events, self.frogpilot_events)
|
||||
self.enabled, self.active = self.state_machine.update(self.events, self.frogpilot_events, self.sm['frogpilotCarState'].alwaysOnLateralEnabled)
|
||||
self.update_alerts(CS)
|
||||
|
||||
self.publish_selfdriveState(CS)
|
||||
|
||||
@@ -16,7 +16,7 @@ class StateMachine:
|
||||
self.state = State.disabled
|
||||
self.soft_disable_timer = 0
|
||||
|
||||
def update(self, events: Events, frogpilot_events: Events):
|
||||
def update(self, events: Events, frogpilot_events: Events, alwaysOnLateralEnabled: bool):
|
||||
# decrement the soft disable timer at every step, as it's reset on
|
||||
# entrance in SOFT_DISABLING state
|
||||
self.soft_disable_timer = max(0, self.soft_disable_timer - 1)
|
||||
@@ -94,7 +94,7 @@ class StateMachine:
|
||||
# Check if openpilot is engaged and actuators are enabled
|
||||
enabled = self.state in ENABLED_STATES
|
||||
active = self.state in ACTIVE_STATES
|
||||
if active:
|
||||
if active or alwaysOnLateralEnabled:
|
||||
self.current_alert_types.append(ET.WARNING)
|
||||
return enabled, active
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ void ExperimentalButton::changeMode() {
|
||||
|
||||
void ExperimentalButton::updateState(const UIState &s, const FrogPilotUIState &fs) {
|
||||
const auto cs = (*s.sm)["selfdriveState"].getSelfdriveState();
|
||||
bool eng = cs.getEngageable() || cs.getEnabled();
|
||||
bool eng = cs.getEngageable() || cs.getEnabled() || fs.frogpilot_scene.always_on_lateral_active;
|
||||
if ((cs.getExperimentalMode() != experimental_mode) || (eng != engageable)) {
|
||||
engageable = eng;
|
||||
experimental_mode = cs.getExperimentalMode();
|
||||
|
||||
@@ -97,6 +97,8 @@ void UIState::updateStatus(FrogPilotUIState *fs) {
|
||||
|
||||
if (state == cereal::SelfdriveState::OpenpilotState::PRE_ENABLED || state == cereal::SelfdriveState::OpenpilotState::OVERRIDING) {
|
||||
status = STATUS_OVERRIDE;
|
||||
} else if (frogpilot_scene.always_on_lateral_active) {
|
||||
status = STATUS_ALWAYS_ON_LATERAL_ACTIVE;
|
||||
} else {
|
||||
status = ss.getEnabled() ? STATUS_ENGAGED : STATUS_DISENGAGED;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ typedef enum UIStatus {
|
||||
STATUS_ENGAGED,
|
||||
|
||||
// FrogPilot variables
|
||||
STATUS_ALWAYS_ON_LATERAL_ACTIVE,
|
||||
STATUS_EXPERIMENTAL_MODE_ENABLED,
|
||||
} UIStatus;
|
||||
|
||||
@@ -55,6 +56,7 @@ const QColor bg_colors [] = {
|
||||
[STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1),
|
||||
|
||||
// FrogPilot variables
|
||||
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(0x0a, 0xba, 0xb5, 0xf1),
|
||||
[STATUS_EXPERIMENTAL_MODE_ENABLED] = QColor(0xda, 0x6f, 0x25, 0xf1),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user