From b40406fbd659d5837ede265e4757edf2d5a3dca7 Mon Sep 17 00:00:00 2001 From: Vehicle Researcher Date: Fri, 8 May 2020 11:03:22 -0700 Subject: [PATCH] Squashed 'cereal/' changes from 65119906..12aad06e 12aad06e no more c capnp 0050e0ac stockFcw event 2c325ed3 gasPressed event 8573a24d don't duplicate ordinals 3f384efa add carState.steerWarning and carState.steerError 8b347b0a add repeated warning2 3adb8991 add sharpness metric 65af4368 Add relayMalfunction alert 442e914d add preview driver flag c8e5db83 Add comment to faulttype 975a633b Add all panda fault types to health 93ccbcb7 UiLayoutState: add mockEngaged for onboarding 9dbbb545 UiLayoutState: add 'none' app c820f83d Add offroadLayout service e370f795 Add the laneChangeBlocked Event (#40) 35040fe6 Update service documentation (#39) 8f13dfca Additional car params auto-detection in support of VW (#38) 22986de4 add speedTooHigh alert f515e4db Add invalid lkas setting alert 59087620 gnustl_shared is only for android b0c746b1 solve by renaming event name instead of service df82a53c the service is called androidLogEntry git-subtree-dir: cereal git-subtree-split: 12aad06e12f249e57abda1664fb0c85e484a0c5d --- SConscript | 8 +------- car.capnp | 32 +++++++++++++++++++++++-------- log.capnp | 33 +++++++++++++++++++++++++++----- messaging/messaging_pyx_setup.py | 3 ++- service_list.yaml | 19 +++++++++++++++--- 5 files changed, 71 insertions(+), 24 deletions(-) diff --git a/SConscript b/SConscript index e0c1b2b52c16a4..ed63c1717b797f 100644 --- a/SConscript +++ b/SConscript @@ -5,10 +5,6 @@ messaging_dir = Dir('messaging') # TODO: remove src-prefix and cereal from command string. can we set working directory? env.Command(["gen/c/include/c++.capnp.h", "gen/c/include/java.capnp.h"], [], "mkdir -p " + gen_dir.path + "/c/include && touch $TARGETS") -env.Command( - ['gen/c/car.capnp.c', 'gen/c/log.capnp.c', 'gen/c/car.capnp.h', 'gen/c/log.capnp.h'], - ['car.capnp', 'log.capnp'], - 'capnpc $SOURCES --src-prefix=cereal -o c:' + gen_dir.path + '/c/') env.Command( ['gen/cpp/car.capnp.c++', 'gen/cpp/log.capnp.c++', 'gen/cpp/car.capnp.h', 'gen/cpp/log.capnp.h'], ['car.capnp', 'log.capnp'], @@ -22,14 +18,12 @@ if shutil.which('capnpc-java'): # TODO: remove non shared cereal and messaging cereal_objects = env.SharedObject([ - 'gen/c/car.capnp.c', - 'gen/c/log.capnp.c', 'gen/cpp/car.capnp.c++', 'gen/cpp/log.capnp.c++', ]) env.Library('cereal', cereal_objects) -env.SharedLibrary('cereal_shared', cereal_objects, LIBS=["capnp_c"]) +env.SharedLibrary('cereal_shared', cereal_objects) cereal_dir = Dir('.') services_h = env.Command( diff --git a/car.capnp b/car.capnp index 695f4a91bc47fd..3ef7117384c311 100644 --- a/car.capnp +++ b/car.capnp @@ -91,6 +91,12 @@ struct CarEvent @0x9b1657f34caf3ad3 { carUnrecognized @66; radarCommIssue @67; driverMonitorLowAcc @68; + invalidLkasSetting @69; + speedTooHigh @70; + laneChangeBlocked @71; + relayMalfunction @72; + gasPressed @73; + stockFcw @74; } } @@ -119,12 +125,14 @@ struct CarState { brakeLights @19 :Bool; # steering wheel - steeringAngle @7 :Float32; # deg - steeringRate @15 :Float32; # deg/s - steeringTorque @8 :Float32; # TODO: standardize units + steeringAngle @7 :Float32; # deg + steeringRate @15 :Float32; # deg/s + steeringTorque @8 :Float32; # TODO: standardize units steeringTorqueEps @27 :Float32; # TODO: standardize units - steeringPressed @9 :Bool; # if the user is using the steering wheel - steeringRateLimited @29 :Bool; # if the torque is limited by the rate limiter + steeringPressed @9 :Bool; # if the user is using the steering wheel + steeringRateLimited @29 :Bool; # if the torque is limited by the rate limiter + steerWarning @35 :Bool; # temporary steer unavailble + steerError @36 :Bool; # permanent steer error stockAeb @30 :Bool; stockFcw @31 :Bool; espDisabled @32 :Bool; @@ -151,7 +159,7 @@ struct CarState { # which packets this state came from canMonoTimes @12: List(UInt64); - + # blindspot sensors leftBlindspot @33 :Bool; # Is there something blocking the left lane change rightBlindspot @34 :Bool; # Is there something blocking the right lane change @@ -309,6 +317,7 @@ struct CarControl { chimeWarning2 @5; chimeWarningRepeat @6; chimePrompt @7; + chimeWarning2Repeat @8; } } } @@ -379,6 +388,7 @@ struct CarParams { radarTimeStep @45: Float32 = 0.05; # time delta between radar updates, 20Hz is very standard communityFeature @46: Bool; # true if a community maintained feature is detected fingerprintSource @49: FingerprintSource; + networkLocation @50 :NetworkLocation; # Where Panda/C2 is integrated into the car's CAN network struct LateralParams { torqueBP @0 :List(Int32); @@ -456,8 +466,9 @@ struct CarParams { enum TransmissionType { unknown @0; - automatic @1; - manual @2; + automatic @1; # Traditional auto, including DSG + manual @2; # True "stick shift" only + direct @3; # Electric vehicle or other direct drive } struct CarFw { @@ -496,4 +507,9 @@ struct CarParams { fw @1; fixed @2; } + + enum NetworkLocation { + fwdCamera @0; # Standard/default integration at LKAS camera + gateway @1; # Integration at vehicle's CAN gateway + } } diff --git a/log.capnp b/log.capnp index e825b00861d9e1..3744c46126f7fb 100644 --- a/log.capnp +++ b/log.capnp @@ -129,6 +129,7 @@ struct FrameData { gainFrac @15 :Float32; focusVal @16 :List(Int16); focusConf @17 :List(UInt8); + sharpnessScore @18 :List(UInt16); frameType @7 :FrameType; timestampSof @8 :UInt64; @@ -352,6 +353,25 @@ struct HealthData { enum FaultType { relayMalfunction @0; + unusedInterruptHandled @1; + interruptRateCan1 @2; + interruptRateCan2 @3; + interruptRateCan3 @4; + interruptRateTach @5; + interruptRateGmlan @6; + interruptRateInterrupts @7; + interruptRateSpiDma @8; + interruptRateSpiCs @9; + interruptRateUart1 @10; + interruptRateUart2 @11; + interruptRateUart3 @12; + interruptRateUart5 @13; + interruptRateUartDma @14; + interruptRateUsb @15; + interruptRateTim1 @16; + interruptRateTim3 @17; + registerDivergent @18; + # Update max fault type in boardd when adding faults } enum HwType { @@ -805,7 +825,7 @@ struct PathPlan { struct LiveLocationKalman { - # More info on reference frames: + # More info on reference frames: # https://github.com/commaai/openpilot/tree/master/common/transformations positionECEF @0 : Measurement; @@ -821,10 +841,10 @@ struct LiveLocationKalman { orientationECEF @6 : Measurement; orientationNED @7 : Measurement; angularVelocityDevice @8 : Measurement; - + # orientationNEDCalibrated transforms to rot matrix: NED_from_calibrated orientationNEDCalibrated @9 : Measurement; - + # Calibrated frame is simply device frame # aligned with the vehicle velocityCalibrated @10 : Measurement; @@ -835,7 +855,7 @@ struct LiveLocationKalman { gpsTimeOfWeek @14 :Float64; status @15 :Status; unixTimestampMillis @16 :Int64; - + enum Status { uninitialized @0; uncalibrated @1; @@ -1775,12 +1795,14 @@ struct UiLayoutState { activeApp @0 :App; sidebarCollapsed @1 :Bool; mapEnabled @2 :Bool; + mockEngaged @3 :Bool; enum App { home @0; music @1; nav @2; settings @3; + none @4; } } @@ -1879,6 +1901,7 @@ struct DMonitoringState { awarenessPassive @12 :Float32; isLowStd @13 :Bool; hiStdCount @14 :UInt32; + isPreview @15 :Bool; } struct Boot { @@ -1971,7 +1994,7 @@ struct Event { sendcan @17 :List(CanData); logMessage @18 :Text; liveCalibration @19 :LiveCalibrationData; - androidLogEntry @20 :AndroidLogEntry; + androidLog @20 :AndroidLogEntry; gpsLocation @21 :GpsLocationData; carState @22 :Car.CarState; carControl @23 :Car.CarControl; diff --git a/messaging/messaging_pyx_setup.py b/messaging/messaging_pyx_setup.py index a763d89f862586..f5962d0c2b2310 100644 --- a/messaging/messaging_pyx_setup.py +++ b/messaging/messaging_pyx_setup.py @@ -34,7 +34,8 @@ def get_ext_filename(self, ext_name): libraries = ['zmq'] ARCH = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() # pylint: disable=unexpected-keyword-arg -if ARCH == "aarch64": +if ARCH == "aarch64" and os.path.isdir("/system"): + # android extra_compile_args += ["-Wno-deprecated-register"] libraries += ['gnustl_shared'] diff --git a/service_list.yaml b/service_list.yaml index 960cd44f5587db..e56ed57abe22c6 100644 --- a/service_list.yaml +++ b/service_list.yaml @@ -76,6 +76,7 @@ carEvents: [8070, true, 1., 1] carParams: [8071, true, 0.02, 1] frontFrame: [8072, true, 10.] dMonitoringState: [8073, true, 5., 1] +offroadLayout: [8074, false, 0.] testModel: [8040, false, 0.] testLiveLocation: [8045, false, 0.] @@ -103,19 +104,31 @@ testJoystick: [8056, false, 0.] # gpsd -- publishes EON's gps # publishes: gpsNMEA -# visiond -- talks to the cameras, runs the model, saves the videos -# publishes: frame, model, driverMonitoring, cameraOdometry, thumbnail +# camerad -- publishes camera frames +# publishes: frame, frontFrame, thumbnail +# subscribes: driverState + +# dmonitoringmodeld -- runs face detection on camera frames +# publishes: driverState # **** stateful data transformers **** +# modeld -- runs & publishes the model +# publishes: model, cameraOdometry +# subscribes: liveCalibration, pathPlan + # plannerd -- decides where to drive the car # subscribes: carState, model, radarState, controlsState, liveParameters # publishes: plan, pathPlan, liveMpc, liveLongitudinalMpc # controlsd -- drives the car by sending CAN messages to panda -# subscribes: can, thermal, health, plan, pathPlan, driverMonitoring, liveCalibration +# subscribes: can, thermal, health, plan, pathPlan, dMonitoringState, liveCalibration, model # publishes: carState, carControl, sendcan, controlsState, carEvents, carParams +# dmonitoringd -- processes driver monitoring data and publishes driver awareness +# subscribes: driverState, liveCalibration, carState, model, gpsLocation +# publishes: dMonitoringState + # radard -- processes the radar and vision data # subscribes: can, controlsState, model, liveParameters # publishes: radarState, liveTracks