Skip to content

Commit

Permalink
Squashed 'cereal/' changes from 6511990..12aad06
Browse files Browse the repository at this point in the history
12aad06 no more c capnp
0050e0a stockFcw event
2c325ed gasPressed event
8573a24 don't duplicate ordinals
3f384ef add carState.steerWarning and carState.steerError
8b347b0 add repeated warning2
3adb899 add sharpness metric
65af436 Add relayMalfunction alert
442e914 add preview driver flag
c8e5db8 Add comment to faulttype
975a633 Add all panda fault types to health
93ccbcb UiLayoutState: add mockEngaged for onboarding
9dbbb54 UiLayoutState: add 'none' app
c820f83 Add offroadLayout service
e370f79 Add the laneChangeBlocked Event (#40)
35040fe Update service documentation (#39)
8f13dfc Additional car params auto-detection in support of VW (#38)
22986de add speedTooHigh alert
f515e4d Add invalid lkas setting alert
5908762 gnustl_shared is only for android
b0c746b solve by renaming event name instead of service
df82a53 the service is called androidLogEntry

git-subtree-dir: cereal
git-subtree-split: 12aad06
  • Loading branch information
Vehicle Researcher committed May 9, 2020
1 parent 29f108d commit 13a08ca
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 24 deletions.
8 changes: 1 addition & 7 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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(
Expand Down
32 changes: 24 additions & 8 deletions car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -309,6 +317,7 @@ struct CarControl {
chimeWarning2 @5;
chimeWarningRepeat @6;
chimePrompt @7;
chimeWarning2Repeat @8;
}
}
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
}
33 changes: 28 additions & 5 deletions log.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -835,7 +855,7 @@ struct LiveLocationKalman {
gpsTimeOfWeek @14 :Float64;
status @15 :Status;
unixTimestampMillis @16 :Int64;

enum Status {
uninitialized @0;
uncalibrated @1;
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -1879,6 +1901,7 @@ struct DMonitoringState {
awarenessPassive @12 :Float32;
isLowStd @13 :Bool;
hiStdCount @14 :UInt32;
isPreview @15 :Bool;
}

struct Boot {
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion messaging/messaging_pyx_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
19 changes: 16 additions & 3 deletions service_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 13a08ca

Please sign in to comment.