mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-29 02:43:47 +08:00
carEvent -> onroadEvent (#33432)
old-commit-hash: c481f11833d748a0d12d2ba14003e931d2849135
This commit is contained in:
+5
-3
@@ -5,7 +5,9 @@ $Cxx.namespace("cereal");
|
||||
|
||||
# ******* events causing controls state machine transition *******
|
||||
|
||||
struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
# FIXME: OnroadEvent shouldn't be in car.capnp, but can't immediately
|
||||
# move due to being referenced by structs in this file
|
||||
struct OnroadEvent @0x9b1657f34caf3ad3 {
|
||||
name @0 :EventName;
|
||||
|
||||
# event types
|
||||
@@ -152,7 +154,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
# all speeds in m/s
|
||||
|
||||
struct CarState {
|
||||
events @13 :List(CarEvent);
|
||||
events @13 :List(OnroadEvent);
|
||||
|
||||
# CAN health
|
||||
canValid @26 :Bool; # invalid counter/checksums
|
||||
@@ -281,7 +283,7 @@ struct CarState {
|
||||
}
|
||||
|
||||
# deprecated
|
||||
errorsDEPRECATED @0 :List(CarEvent.EventName);
|
||||
errorsDEPRECATED @0 :List(OnroadEvent.EventName);
|
||||
brakeLightsDEPRECATED @19 :Bool;
|
||||
steeringRateLimitedDEPRECATED @29 :Bool;
|
||||
canMonoTimesDEPRECATED @12: List(UInt64);
|
||||
|
||||
+3
-3
@@ -1149,7 +1149,7 @@ struct LongitudinalPlan @0xe00b5b3eba12876c {
|
||||
radarValidDEPRECATED @28 :Bool;
|
||||
radarCanErrorDEPRECATED @30 :Bool;
|
||||
commIssueDEPRECATED @31 :Bool;
|
||||
eventsDEPRECATED @13 :List(Car.CarEvent);
|
||||
eventsDEPRECATED @13 :List(Car.OnroadEvent);
|
||||
gpsTrajectoryDEPRECATED @12 :GpsTrajectory;
|
||||
gpsPlannerActiveDEPRECATED @19 :Bool;
|
||||
personalityDEPRECATED @36 :LongitudinalPersonality;
|
||||
@@ -2055,7 +2055,7 @@ struct DriverStateDEPRECATED @0xb83c6cc593ed0a00 {
|
||||
}
|
||||
|
||||
struct DriverMonitoringState @0xb83cda094a1da284 {
|
||||
events @0 :List(Car.CarEvent);
|
||||
events @0 :List(Car.OnroadEvent);
|
||||
faceDetected @1 :Bool;
|
||||
isDistracted @2 :Bool;
|
||||
distractedType @17 :UInt32;
|
||||
@@ -2346,7 +2346,7 @@ struct Event {
|
||||
liveTorqueParameters @94 :LiveTorqueParametersData;
|
||||
cameraOdometry @63 :CameraOdometry;
|
||||
thumbnail @66: Thumbnail;
|
||||
onroadEvents @68: List(Car.CarEvent);
|
||||
onroadEvents @68: List(Car.OnroadEvent);
|
||||
carParams @69: Car.CarParams;
|
||||
driverMonitoringState @71: DriverMonitoringState;
|
||||
livePose @129 :LivePose;
|
||||
|
||||
@@ -9,7 +9,7 @@ from openpilot.selfdrive.controls.lib.events import Events
|
||||
|
||||
ButtonType = structs.CarState.ButtonEvent.Type
|
||||
GearShifter = structs.CarState.GearShifter
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
NetworkLocation = structs.CarParams.NetworkLocation
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ from openpilot.selfdrive.controls.lib.events import Events
|
||||
|
||||
REPLAY = "REPLAY" in os.environ
|
||||
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
|
||||
# forward
|
||||
carlog.addHandler(ForwardingHandler(cloudlog))
|
||||
|
||||
@@ -29,7 +29,7 @@ from openpilot.tools.lib.route import SegmentName
|
||||
|
||||
from panda.tests.libpanda import libpanda_py
|
||||
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
PandaType = log.PandaState.PandaType
|
||||
SafetyModel = car.CarParams.SafetyModel
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ PandaType = log.PandaState.PandaType
|
||||
Desire = log.Desire
|
||||
LaneChangeState = log.LaneChangeState
|
||||
LaneChangeDirection = log.LaneChangeDirection
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
ButtonType = car.CarState.ButtonEvent.Type
|
||||
SafetyModel = car.CarParams.SafetyModel
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from openpilot.common.numpy_fast import clip
|
||||
from openpilot.common.realtime import DT_CTRL
|
||||
from openpilot.system.version import get_build_metadata
|
||||
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
|
||||
# WARNING: this value was determined based on the model's training distribution,
|
||||
# model predictions above this speed can be unpredictable
|
||||
|
||||
@@ -16,7 +16,7 @@ AlertSize = log.SelfdriveState.AlertSize
|
||||
AlertStatus = log.SelfdriveState.AlertStatus
|
||||
VisualAlert = car.CarControl.HUDControl.VisualAlert
|
||||
AudibleAlert = car.CarControl.HUDControl.AudibleAlert
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
|
||||
|
||||
# Alert priorities
|
||||
@@ -98,7 +98,7 @@ class Events:
|
||||
def to_msg(self):
|
||||
ret = []
|
||||
for event_name in self.events:
|
||||
event = car.CarEvent.new_message()
|
||||
event = car.OnroadEvent.new_message()
|
||||
event.name = event_name
|
||||
for event_type in EVENTS.get(event_name, {}):
|
||||
setattr(event, event_type, True)
|
||||
|
||||
@@ -38,7 +38,7 @@ class TestAlerts:
|
||||
|
||||
def test_events_defined(self):
|
||||
# Ensure all events in capnp schema are defined in events.py
|
||||
events = car.CarEvent.EventName.schema.enumerants
|
||||
events = car.OnroadEvent.EventName.schema.enumerants
|
||||
|
||||
for name, e in events.items():
|
||||
if not name.endswith("DEPRECATED"):
|
||||
|
||||
@@ -11,7 +11,7 @@ from openpilot.selfdrive.pandad.pandad_api_impl import can_list_to_can_capnp
|
||||
from openpilot.selfdrive.controls.lib.events import EVENT_NAME
|
||||
from openpilot.system.manager.process_config import managed_processes
|
||||
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
Ecu = car.CarParams.Ecu
|
||||
|
||||
COROLLA_FW_VERSIONS = [
|
||||
|
||||
@@ -10,7 +10,7 @@ from openpilot.selfdrive.controls.lib.events import ET, Events
|
||||
from openpilot.selfdrive.controls.lib.alertmanager import AlertManager
|
||||
from openpilot.system.manager.process_config import managed_processes
|
||||
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
|
||||
def randperc() -> float:
|
||||
return 100. * random.random()
|
||||
|
||||
@@ -9,7 +9,7 @@ from openpilot.common.filter_simple import FirstOrderFilter
|
||||
from openpilot.common.stat_live import RunningStatFilter
|
||||
from openpilot.common.transformations.camera import DEVICE_CAMERAS
|
||||
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
|
||||
# ******************************************************************************************
|
||||
# NOTE: To fork maintainers.
|
||||
|
||||
@@ -4,7 +4,7 @@ from cereal import car, log
|
||||
from openpilot.common.realtime import DT_DMON
|
||||
from openpilot.selfdrive.monitoring.helpers import DriverMonitoring, DRIVER_MONITOR_SETTINGS
|
||||
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
dm_settings = DRIVER_MONITOR_SETTINGS()
|
||||
|
||||
TEST_TIMESPAN = 120 # seconds
|
||||
|
||||
@@ -461,7 +461,7 @@ def controlsd_config_callback(params, cfg, lr):
|
||||
if initialized:
|
||||
break
|
||||
elif msg.which() == "onroadEvents":
|
||||
initialized = car.CarEvent.EventName.controlsInitializing not in [e.name for e in msg.onroadEvents]
|
||||
initialized = car.OnroadEvent.EventName.controlsInitializing not in [e.name for e in msg.onroadEvents]
|
||||
|
||||
assert controlsState is not None and initialized, "controlsState never initialized"
|
||||
params.put("ReplayControlsState", controlsState.as_builder().to_bytes())
|
||||
|
||||
@@ -419,7 +419,7 @@ class TestOnroad:
|
||||
if msg.which() == "selfdriveState":
|
||||
startup_alert = msg.selfdriveState.alertText1
|
||||
break
|
||||
expected = EVENTS[car.CarEvent.EventName.startup][ET.PERMANENT].alert_text_1
|
||||
expected = EVENTS[car.OnroadEvent.EventName.startup][ET.PERMANENT].alert_text_1
|
||||
assert startup_alert == expected, "wrong startup alert"
|
||||
|
||||
def test_engagable(self):
|
||||
|
||||
@@ -9,7 +9,7 @@ from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.common.timeout import Timeout
|
||||
from openpilot.selfdrive.test.helpers import set_params_enabled
|
||||
|
||||
EventName = car.CarEvent.EventName
|
||||
EventName = car.OnroadEvent.EventName
|
||||
|
||||
|
||||
@pytest.mark.tici
|
||||
|
||||
Reference in New Issue
Block a user