2019-06-14 03:06:15 +08:00
|
|
|
using Cxx = import "./include/c++.capnp";
|
|
|
|
$Cxx.namespace("cereal");
|
|
|
|
|
|
|
|
using Java = import "./include/java.capnp";
|
|
|
|
$Java.package("ai.comma.openpilot.cereal");
|
|
|
|
$Java.outerClassname("Car");
|
|
|
|
|
|
|
|
@0x8e2af1e708af8b8d;
|
|
|
|
|
|
|
|
# ******* events causing controls state machine transition *******
|
|
|
|
|
|
|
|
struct CarEvent @0x9b1657f34caf3ad3 {
|
|
|
|
name @0 :EventName;
|
|
|
|
enable @1 :Bool;
|
|
|
|
noEntry @2 :Bool;
|
|
|
|
warning @3 :Bool;
|
|
|
|
userDisable @4 :Bool;
|
|
|
|
softDisable @5 :Bool;
|
|
|
|
immediateDisable @6 :Bool;
|
|
|
|
preEnable @7 :Bool;
|
|
|
|
permanent @8 :Bool;
|
|
|
|
|
|
|
|
enum EventName @0xbaa8c5d505f727de {
|
|
|
|
# TODO: copy from error list
|
2019-06-15 10:05:45 +08:00
|
|
|
canError @0;
|
2019-06-14 03:06:15 +08:00
|
|
|
steerUnavailable @1;
|
|
|
|
brakeUnavailable @2;
|
|
|
|
gasUnavailable @3;
|
|
|
|
wrongGear @4;
|
|
|
|
doorOpen @5;
|
|
|
|
seatbeltNotLatched @6;
|
|
|
|
espDisabled @7;
|
|
|
|
wrongCarMode @8;
|
|
|
|
steerTempUnavailable @9;
|
|
|
|
reverseGear @10;
|
|
|
|
buttonCancel @11;
|
|
|
|
buttonEnable @12;
|
|
|
|
pedalPressed @13;
|
|
|
|
cruiseDisabled @14;
|
2019-06-17 14:16:48 +08:00
|
|
|
radarCanError @15;
|
2019-06-14 03:06:15 +08:00
|
|
|
dataNeeded @16;
|
|
|
|
speedTooLow @17;
|
|
|
|
outOfSpace @18;
|
|
|
|
overheat @19;
|
|
|
|
calibrationIncomplete @20;
|
|
|
|
calibrationInvalid @21;
|
|
|
|
controlsMismatch @22;
|
|
|
|
pcmEnable @23;
|
|
|
|
pcmDisable @24;
|
|
|
|
noTarget @25;
|
|
|
|
radarFault @26;
|
2019-06-26 09:30:15 +08:00
|
|
|
modelCommIssueDEPRECATED @27;
|
2019-06-14 03:06:15 +08:00
|
|
|
brakeHold @28;
|
|
|
|
parkBrake @29;
|
|
|
|
manualRestart @30;
|
|
|
|
lowSpeedLockout @31;
|
|
|
|
plannerError @32;
|
|
|
|
ipasOverride @33;
|
|
|
|
debugAlert @34;
|
|
|
|
steerTempUnavailableMute @35;
|
|
|
|
resumeRequired @36;
|
|
|
|
preDriverDistracted @37;
|
|
|
|
promptDriverDistracted @38;
|
|
|
|
driverDistracted @39;
|
|
|
|
geofence @40;
|
|
|
|
driverMonitorOn @41;
|
|
|
|
driverMonitorOff @42;
|
|
|
|
preDriverUnresponsive @43;
|
|
|
|
promptDriverUnresponsive @44;
|
|
|
|
driverUnresponsive @45;
|
|
|
|
belowSteerSpeed @46;
|
|
|
|
calibrationProgress @47;
|
|
|
|
lowBattery @48;
|
|
|
|
invalidGiraffeHonda @49;
|
|
|
|
vehicleModelInvalid @50;
|
|
|
|
controlsFailed @51;
|
|
|
|
sensorDataInvalid @52;
|
2019-06-19 07:39:45 +08:00
|
|
|
commIssue @53;
|
2019-07-16 07:07:12 +08:00
|
|
|
tooDistracted @54;
|
2019-07-19 05:36:57 +08:00
|
|
|
posenetInvalid @55;
|
2019-08-06 08:02:57 +08:00
|
|
|
soundsUnavailable @56;
|
2019-09-06 08:28:13 +08:00
|
|
|
preLaneChangeLeft @57;
|
|
|
|
preLaneChangeRight @58;
|
|
|
|
laneChange @59;
|
2019-09-13 03:22:33 +08:00
|
|
|
invalidGiraffeToyota @60;
|
2019-10-05 07:38:19 +08:00
|
|
|
internetConnectivityNeeded @61;
|
2019-06-14 03:06:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# ******* main car state @ 100hz *******
|
|
|
|
# all speeds in m/s
|
|
|
|
|
|
|
|
struct CarState {
|
|
|
|
errorsDEPRECATED @0 :List(CarEvent.EventName);
|
|
|
|
events @13 :List(CarEvent);
|
|
|
|
|
|
|
|
# car speed
|
|
|
|
vEgo @1 :Float32; # best estimate of speed
|
|
|
|
aEgo @16 :Float32; # best estimate of acceleration
|
|
|
|
vEgoRaw @17 :Float32; # unfiltered speed from CAN sensors
|
|
|
|
yawRate @22 :Float32; # best estimate of yaw rate
|
|
|
|
standstill @18 :Bool;
|
|
|
|
wheelSpeeds @2 :WheelSpeeds;
|
|
|
|
|
|
|
|
# gas pedal, 0.0-1.0
|
|
|
|
gas @3 :Float32; # this is user + computer
|
|
|
|
gasPressed @4 :Bool; # this is user pedal only
|
|
|
|
|
|
|
|
# brake pedal, 0.0-1.0
|
|
|
|
brake @5 :Float32; # this is user pedal only
|
|
|
|
brakePressed @6 :Bool; # this is user pedal only
|
|
|
|
brakeLights @19 :Bool;
|
|
|
|
|
|
|
|
# steering wheel
|
|
|
|
steeringAngle @7 :Float32; # deg
|
|
|
|
steeringRate @15 :Float32; # deg/s
|
|
|
|
steeringTorque @8 :Float32; # TODO: standardize units
|
2019-08-09 06:26:20 +08:00
|
|
|
steeringTorqueEps @27 :Float32; # TODO: standardize units
|
2019-06-14 03:06:15 +08:00
|
|
|
steeringPressed @9 :Bool; # if the user is using the steering wheel
|
2019-11-13 09:11:26 +08:00
|
|
|
steeringRateLimited @29 :Bool; # if the torque is limited by the rate limiter
|
2019-06-14 03:06:15 +08:00
|
|
|
|
|
|
|
# cruise state
|
|
|
|
cruiseState @10 :CruiseState;
|
|
|
|
|
|
|
|
# gear
|
|
|
|
gearShifter @14 :GearShifter;
|
|
|
|
|
|
|
|
# button presses
|
|
|
|
buttonEvents @11 :List(ButtonEvent);
|
|
|
|
leftBlinker @20 :Bool;
|
|
|
|
rightBlinker @21 :Bool;
|
|
|
|
genericToggle @23 :Bool;
|
|
|
|
|
|
|
|
# lock info
|
|
|
|
doorOpen @24 :Bool;
|
|
|
|
seatbeltUnlatched @25 :Bool;
|
2019-06-22 07:56:57 +08:00
|
|
|
canValid @26 :Bool;
|
2019-06-14 03:06:15 +08:00
|
|
|
|
2019-10-02 04:58:17 +08:00
|
|
|
# clutch (manual transmission only)
|
|
|
|
clutchPressed @28 :Bool;
|
|
|
|
|
2019-06-14 03:06:15 +08:00
|
|
|
# which packets this state came from
|
|
|
|
canMonoTimes @12: List(UInt64);
|
|
|
|
|
|
|
|
struct WheelSpeeds {
|
|
|
|
# optional wheel speeds
|
|
|
|
fl @0 :Float32;
|
|
|
|
fr @1 :Float32;
|
|
|
|
rl @2 :Float32;
|
|
|
|
rr @3 :Float32;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct CruiseState {
|
|
|
|
enabled @0 :Bool;
|
|
|
|
speed @1 :Float32;
|
|
|
|
available @2 :Bool;
|
|
|
|
speedOffset @3 :Float32;
|
|
|
|
standstill @4 :Bool;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum GearShifter {
|
|
|
|
unknown @0;
|
|
|
|
park @1;
|
|
|
|
drive @2;
|
|
|
|
neutral @3;
|
|
|
|
reverse @4;
|
|
|
|
sport @5;
|
|
|
|
low @6;
|
|
|
|
brake @7;
|
2019-10-04 06:32:53 +08:00
|
|
|
eco @8;
|
|
|
|
manumatic @9;
|
2019-06-14 03:06:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# send on change
|
|
|
|
struct ButtonEvent {
|
|
|
|
pressed @0 :Bool;
|
|
|
|
type @1 :Type;
|
|
|
|
|
|
|
|
enum Type {
|
|
|
|
unknown @0;
|
|
|
|
leftBlinker @1;
|
|
|
|
rightBlinker @2;
|
|
|
|
accelCruise @3;
|
|
|
|
decelCruise @4;
|
|
|
|
cancel @5;
|
|
|
|
altButton1 @6;
|
|
|
|
altButton2 @7;
|
|
|
|
altButton3 @8;
|
2019-10-04 06:32:53 +08:00
|
|
|
setCruise @9;
|
|
|
|
resumeCruise @10;
|
|
|
|
gapAdjustCruise @11;
|
2019-06-14 03:06:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# ******* radar state @ 20hz *******
|
|
|
|
|
|
|
|
struct RadarData @0x888ad6581cf0aacb {
|
|
|
|
errors @0 :List(Error);
|
|
|
|
points @1 :List(RadarPoint);
|
|
|
|
|
|
|
|
# which packets this state came from
|
|
|
|
canMonoTimes @2 :List(UInt64);
|
|
|
|
|
|
|
|
enum Error {
|
2019-06-15 10:05:45 +08:00
|
|
|
canError @0;
|
2019-06-14 03:06:15 +08:00
|
|
|
fault @1;
|
|
|
|
wrongConfig @2;
|
|
|
|
}
|
|
|
|
|
|
|
|
# similar to LiveTracks
|
|
|
|
# is one timestamp valid for all? I think so
|
|
|
|
struct RadarPoint {
|
|
|
|
trackId @0 :UInt64; # no trackId reuse
|
|
|
|
|
|
|
|
# these 3 are the minimum required
|
|
|
|
dRel @1 :Float32; # m from the front bumper of the car
|
|
|
|
yRel @2 :Float32; # m
|
|
|
|
vRel @3 :Float32; # m/s
|
|
|
|
|
|
|
|
# these are optional and valid if they are not NaN
|
|
|
|
aRel @4 :Float32; # m/s^2
|
|
|
|
yvRel @5 :Float32; # m/s
|
|
|
|
|
|
|
|
# some radars flag measurements VS estimates
|
|
|
|
measured @6 :Bool;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# ******* car controls @ 100hz *******
|
|
|
|
|
|
|
|
struct CarControl {
|
|
|
|
# must be true for any actuator commands to work
|
|
|
|
enabled @0 :Bool;
|
|
|
|
active @7 :Bool;
|
|
|
|
|
|
|
|
gasDEPRECATED @1 :Float32;
|
|
|
|
brakeDEPRECATED @2 :Float32;
|
|
|
|
steeringTorqueDEPRECATED @3 :Float32;
|
|
|
|
|
|
|
|
actuators @6 :Actuators;
|
|
|
|
|
|
|
|
cruiseControl @4 :CruiseControl;
|
|
|
|
hudControl @5 :HUDControl;
|
|
|
|
|
|
|
|
struct Actuators {
|
|
|
|
# range from 0.0 - 1.0
|
|
|
|
gas @0: Float32;
|
|
|
|
brake @1: Float32;
|
|
|
|
# range from -1.0 - 1.0
|
|
|
|
steer @2: Float32;
|
|
|
|
steerAngle @3: Float32;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct CruiseControl {
|
|
|
|
cancel @0: Bool;
|
|
|
|
override @1: Bool;
|
|
|
|
speedOverride @2: Float32;
|
|
|
|
accelOverride @3: Float32;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct HUDControl {
|
|
|
|
speedVisible @0: Bool;
|
|
|
|
setSpeed @1: Float32;
|
|
|
|
lanesVisible @2: Bool;
|
|
|
|
leadVisible @3: Bool;
|
|
|
|
visualAlert @4: VisualAlert;
|
|
|
|
audibleAlert @5: AudibleAlert;
|
|
|
|
rightLaneVisible @6: Bool;
|
|
|
|
leftLaneVisible @7: Bool;
|
|
|
|
rightLaneDepart @8: Bool;
|
|
|
|
leftLaneDepart @9: Bool;
|
|
|
|
|
|
|
|
enum VisualAlert {
|
|
|
|
# these are the choices from the Honda
|
|
|
|
# map as good as you can for your car
|
|
|
|
none @0;
|
|
|
|
fcw @1;
|
|
|
|
steerRequired @2;
|
|
|
|
brakePressed @3;
|
|
|
|
wrongGear @4;
|
|
|
|
seatbeltUnbuckled @5;
|
|
|
|
speedTooHigh @6;
|
2019-10-02 05:06:48 +08:00
|
|
|
ldw @7;
|
2019-06-14 03:06:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
enum AudibleAlert {
|
|
|
|
# these are the choices from the Honda
|
|
|
|
# map as good as you can for your car
|
|
|
|
none @0;
|
|
|
|
chimeEngage @1;
|
|
|
|
chimeDisengage @2;
|
|
|
|
chimeError @3;
|
|
|
|
chimeWarning1 @4;
|
|
|
|
chimeWarning2 @5;
|
|
|
|
chimeWarningRepeat @6;
|
|
|
|
chimePrompt @7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# ****** car param ******
|
|
|
|
|
|
|
|
struct CarParams {
|
|
|
|
carName @0 :Text;
|
|
|
|
carFingerprint @1 :Text;
|
|
|
|
|
|
|
|
enableGasInterceptor @2 :Bool;
|
|
|
|
enableCruise @3 :Bool;
|
|
|
|
enableCamera @4 :Bool;
|
|
|
|
enableDsu @5 :Bool; # driving support unit
|
|
|
|
enableApgs @6 :Bool; # advanced parking guidance system
|
|
|
|
|
|
|
|
minEnableSpeed @7 :Float32;
|
|
|
|
minSteerSpeed @8 :Float32;
|
2019-06-28 07:49:27 +08:00
|
|
|
safetyModel @9 :SafetyModel;
|
2019-11-20 12:50:25 +08:00
|
|
|
safetyModelPassive @42 :SafetyModel = silent;
|
2019-06-14 03:06:15 +08:00
|
|
|
safetyParam @10 :Int16;
|
|
|
|
|
|
|
|
steerMaxBP @11 :List(Float32);
|
|
|
|
steerMaxV @12 :List(Float32);
|
|
|
|
gasMaxBP @13 :List(Float32);
|
|
|
|
gasMaxV @14 :List(Float32);
|
|
|
|
brakeMaxBP @15 :List(Float32);
|
|
|
|
brakeMaxV @16 :List(Float32);
|
|
|
|
|
|
|
|
# things about the car in the manual
|
|
|
|
mass @17 :Float32; # [kg] running weight
|
|
|
|
wheelbase @18 :Float32; # [m] distance from rear to front axle
|
|
|
|
centerToFront @19 :Float32; # [m] GC distance to front axle
|
|
|
|
steerRatio @20 :Float32; # [] ratio between front wheels and steering wheel angles
|
|
|
|
steerRatioRear @21 :Float32; # [] rear steering ratio wrt front steering (usually 0)
|
|
|
|
|
|
|
|
# things we can derive
|
|
|
|
rotationalInertia @22 :Float32; # [kg*m2] body rotational inertia
|
|
|
|
tireStiffnessFront @23 :Float32; # [N/rad] front tire coeff of stiff
|
|
|
|
tireStiffnessRear @24 :Float32; # [N/rad] rear tire coeff of stiff
|
|
|
|
|
|
|
|
longitudinalTuning @25 :LongitudinalPIDTuning;
|
|
|
|
lateralTuning :union {
|
|
|
|
pid @26 :LateralPIDTuning;
|
|
|
|
indi @27 :LateralINDITuning;
|
2019-07-25 07:39:26 +08:00
|
|
|
lqr @40 :LateralLQRTuning;
|
2019-06-14 03:06:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
steerLimitAlert @28 :Bool;
|
|
|
|
|
|
|
|
vEgoStopping @29 :Float32; # Speed at which the car goes into stopping state
|
|
|
|
directAccelControl @30 :Bool; # Does the car have direct accel control or just gas/brake
|
|
|
|
stoppingControl @31 :Bool; # Does the car allows full control even at lows speeds when stopping
|
|
|
|
startAccel @32 :Float32; # Required acceleraton to overcome creep braking
|
|
|
|
steerRateCost @33 :Float32; # Lateral MPC cost on steering rate
|
|
|
|
steerControlType @34 :SteerControlType;
|
|
|
|
radarOffCan @35 :Bool; # True when radar objects aren't visible on CAN
|
|
|
|
|
|
|
|
steerActuatorDelay @36 :Float32; # Steering wheel actuator delay in seconds
|
|
|
|
openpilotLongitudinalControl @37 :Bool; # is openpilot doing the longitudinal control?
|
|
|
|
carVin @38 :Text; # VIN number queried during fingerprinting
|
2019-07-24 06:28:04 +08:00
|
|
|
isPandaBlack @39: Bool;
|
2019-09-06 05:10:53 +08:00
|
|
|
dashcamOnly @41: Bool;
|
2019-10-02 04:58:17 +08:00
|
|
|
transmissionType @43 :TransmissionType;
|
2019-11-13 04:43:47 +08:00
|
|
|
carFw @44 :List(CarFw);
|
2019-11-22 15:49:42 +08:00
|
|
|
radarTimeStep @45: Float32; # time delta between radar updates
|
2019-06-14 03:06:15 +08:00
|
|
|
|
|
|
|
struct LateralPIDTuning {
|
|
|
|
kpBP @0 :List(Float32);
|
|
|
|
kpV @1 :List(Float32);
|
|
|
|
kiBP @2 :List(Float32);
|
|
|
|
kiV @3 :List(Float32);
|
|
|
|
kf @4 :Float32;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct LongitudinalPIDTuning {
|
|
|
|
kpBP @0 :List(Float32);
|
|
|
|
kpV @1 :List(Float32);
|
|
|
|
kiBP @2 :List(Float32);
|
|
|
|
kiV @3 :List(Float32);
|
|
|
|
deadzoneBP @4 :List(Float32);
|
|
|
|
deadzoneV @5 :List(Float32);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct LateralINDITuning {
|
|
|
|
outerLoopGain @0 :Float32;
|
|
|
|
innerLoopGain @1 :Float32;
|
|
|
|
timeConstant @2 :Float32;
|
|
|
|
actuatorEffectiveness @3 :Float32;
|
|
|
|
}
|
|
|
|
|
2019-07-25 07:39:26 +08:00
|
|
|
struct LateralLQRTuning {
|
|
|
|
scale @0 :Float32;
|
|
|
|
ki @1 :Float32;
|
|
|
|
dcGain @2 :Float32;
|
|
|
|
|
|
|
|
# State space system
|
|
|
|
a @3 :List(Float32);
|
|
|
|
b @4 :List(Float32);
|
|
|
|
c @5 :List(Float32);
|
|
|
|
|
|
|
|
k @6 :List(Float32); # LQR gain
|
|
|
|
l @7 :List(Float32); # Kalman gain
|
|
|
|
}
|
|
|
|
|
2019-06-28 07:49:27 +08:00
|
|
|
enum SafetyModel {
|
2019-11-20 12:50:25 +08:00
|
|
|
silent @0;
|
2019-06-14 03:06:15 +08:00
|
|
|
honda @1;
|
|
|
|
toyota @2;
|
|
|
|
elm327 @3;
|
|
|
|
gm @4;
|
|
|
|
hondaBosch @5;
|
|
|
|
ford @6;
|
|
|
|
cadillac @7;
|
|
|
|
hyundai @8;
|
|
|
|
chrysler @9;
|
|
|
|
tesla @10;
|
|
|
|
subaru @11;
|
2019-09-09 05:15:48 +08:00
|
|
|
gmPassive @12;
|
2019-09-10 07:03:40 +08:00
|
|
|
mazda @13;
|
|
|
|
nissan @14;
|
2019-10-03 05:50:59 +08:00
|
|
|
volkswagen @15;
|
2019-10-03 04:41:45 +08:00
|
|
|
toyotaIpas @16;
|
|
|
|
allOutput @17;
|
|
|
|
gmAscm @18;
|
2019-11-20 12:50:25 +08:00
|
|
|
noOutput @19; # like silent but with silent CAN TXs
|
2019-06-14 03:06:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
enum SteerControlType {
|
|
|
|
torque @0;
|
|
|
|
angle @1;
|
|
|
|
}
|
2019-10-02 04:58:17 +08:00
|
|
|
|
|
|
|
enum TransmissionType {
|
|
|
|
unknown @0;
|
|
|
|
automatic @1;
|
|
|
|
manual @2;
|
|
|
|
}
|
2019-11-13 04:43:47 +08:00
|
|
|
|
|
|
|
struct CarFw {
|
|
|
|
ecu @0 :Ecu;
|
|
|
|
fwVersion @1 :Text;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Ecu {
|
|
|
|
eps @0;
|
|
|
|
esp @1;
|
|
|
|
fwdRadar @2;
|
|
|
|
fwdCamera @3;
|
|
|
|
}
|
2019-06-14 03:06:15 +08:00
|
|
|
}
|