Skip to content

Commit

Permalink
openpilot v0.3.8.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Vehicle Researcher committed Oct 31, 2017
1 parent 4830358 commit 187a70f
Show file tree
Hide file tree
Showing 70 changed files with 1,934 additions and 579 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.openpilot
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ COPY ./selfdrive /tmp/openpilot/selfdrive
COPY ./phonelibs /tmp/openpilot/phonelibs
COPY ./pyextra /tmp/openpilot/pyextra

RUN mkdir /tmp/openpilot/selfdrive/test/out
RUN mkdir -p /tmp/openpilot/selfdrive/test/out
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.PHONY: all

# TODO: Add a global build system to openpilot
code_dir := $(shell pwd)

# TODO: Add a global build system

.PHONY: all
all:
cd /data/openpilot/selfdrive && PYTHONPATH=/data/openpilot PREPAREONLY=1 /data/openpilot/selfdrive/manager.py
cd selfdrive && PYTHONPATH=$(code_dir) PREPAREONLY=1 ./manager.py

16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Here are [some](https://www.youtube.com/watch?v=9OwTJFuDI7g) [videos](https://ww
Hardware
------

Right now openpilot supports the [neo research platform](http://github.com/commaai/neo) for vehicle control. We'd like to support other platforms as well.
Right now openpilot supports the [NEO research platform](http://github.com/commaai/neo) and the [EON Dashcam DevKit](https://shop.comma.ai/products/eon-dashcam-devkit). We'd like to support other platforms as well.

Install openpilot on a neo device by entering ``https://openpilot.comma.ai`` during NEOS setup.

Expand All @@ -26,15 +26,25 @@ Supported Cars
- Due to limitations in steering firmware, steering is disabled below 12 mph
- Note that the hatchback model is not supported

- Honda CR-V Touring 2015-2016 (very alpha!)
- Honda CR-V Touring 2015-2016
- Can only be enabled above 25 mph

- Toyota RAV-4 2016+ with TSS-P (alpha!)
- Can only be enabled above 20 mph

In Progress Cars
------

- Toyota Prius 2017

- Probably all TSS-P Toyota

Community Ported Cars
------

- Chevy Volt 2016-2018 Premier with Driver Confidence II

- All 2017 Toyota Prius, Corolla, and RAV4
- Classic Tesla Model S (pre-AP)

Directory structure
------
Expand Down
6 changes: 6 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 0.3.8.2 (2017-10-30)
==========================
* Add alpha support for 2017 Toyota RAV4
* Stay silent if stock system is connected through giraffe
* Minor bug fixes

Version 0.3.7 (2017-09-30)
==========================
* Improved lateral control using model predictive control
Expand Down
15 changes: 11 additions & 4 deletions cereal/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
PWD := $(shell pwd)

SRCS := log.capnp car.capnp

GENS := gen/cpp/car.capnp.c++ gen/cpp/log.capnp.c++


UNAME_M ?= $(shell uname -m)

# only generate C++ for docker tests
Expand All @@ -16,6 +17,12 @@ endif

endif

ifeq ($(UNAME_M),aarch64)
CAPNPC=PATH=$(PWD)/../phonelibs/capnp-cpp/aarch64/bin/:$$PATH capnpc
else
CAPNPC=capnpc
endif

.PHONY: all
all: $(GENS)

Expand All @@ -26,17 +33,17 @@ clean:
gen/c/%.capnp.c: %.capnp
@echo "[ CAPNPC C ] $@"
mkdir -p gen/c/
capnpc '$<' -o c:gen/c/
$(CAPNPC) '$<' -o c:gen/c/

gen/cpp/%.capnp.c++: %.capnp
@echo "[ CAPNPC C++ ] $@"
mkdir -p gen/cpp/
capnpc '$<' -o c++:gen/cpp/
$(CAPNPC) '$<' -o c++:gen/cpp/

gen/java/Car.java gen/java/Log.java: $(SRCS)
@echo "[ CAPNPC java ] $@"
mkdir -p gen/java/
capnpc $^ -o java:gen/java
$(CAPNPC) $^ -o java:gen/java

# c-capnproto needs some empty headers
gen/c/c++.capnp.h gen/c/java.capnp.h:
Expand Down
18 changes: 15 additions & 3 deletions cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
modelCommIssue @27;
brakeHold @28;
parkBrake @29;
manualRestart @30;
lowSpeedLockout @31;
}
}

Expand All @@ -63,6 +65,9 @@ struct CarState {

# car speed
vEgo @1 :Float32; # best estimate of speed
aEgo @16 :Float32; # best estimate of acceleration
vEgoRaw @17 :Float32; # unfiltered speed
standstill @18 :Bool;
wheelSpeeds @2 :WheelSpeeds;

# gas pedal, 0.0-1.0
Expand All @@ -75,6 +80,7 @@ struct CarState {

# steering wheel
steeringAngle @7 :Float32; # deg
steeringRate @15 :Float32; # deg/s
steeringTorque @8 :Float32; # TODO: standardize units
steeringPressed @9 :Bool; # if the user is using the steering wheel

Expand Down Expand Up @@ -242,6 +248,9 @@ struct CarParams {
enableGas @4 :Bool;
enableBrake @5 :Bool;
enableCruise @6 :Bool;
enableCamera @27 :Bool;
enableDsu @28 :Bool; # driving support unit
enableApgs @29 :Bool; # advanced parking guidance system

minEnableSpeed @18 :Float32;
safetyModel @19 :Int16;
Expand All @@ -254,10 +263,11 @@ struct CarParams {
brakeMaxV @25 :List(Float32);

enum SafetyModels {
# from board
default @0;
# does NOT match board setting
noOutput @0;
honda @1;
toyota @2;
elm327 @3;
}

# things about the car in the manual
Expand All @@ -276,7 +286,9 @@ struct CarParams {
# Kp and Ki for the lateral control
steerKp @16 :Float32;
steerKi @17 :Float32;
steerKf @26 :Float32;

steerLimitAlert @30 :Bool;

# TODO: Kp and Ki for long control, perhaps not needed?
}

59 changes: 59 additions & 0 deletions cereal/log.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct InitData {
pandaInfo @8 :PandaInfo;

dirty @9 :Bool;
passive @12 :Bool;

enum DeviceType {
unknown @0;
Expand Down Expand Up @@ -327,8 +328,11 @@ struct Live100Data {
mdMonoTimeDEPRECATED @18 :UInt64;
planMonoTime @28 :UInt64;

state @31 :ControlState;
vEgo @0 :Float32;
vEgoRaw @32 :Float32;
aEgoDEPRECATED @1 :Float32;
longControlState @30 :LongControlState;
vPid @2 :Float32;
vTargetLead @3 :Float32;
upAccelCmd @4 :Float32;
Expand Down Expand Up @@ -356,6 +360,20 @@ struct Live100Data {
awarenessStatus @26 :Float32;

angleOffset @27 :Float32;

enum ControlState {
disabled @0;
preEnabled @1;
enabled @2;
softDisabling @3;
}

enum LongControlState {
off @0;
pid @1;
stopping @2;
starting @3;
}
}

struct LiveEventData {
Expand All @@ -370,6 +388,7 @@ struct ModelData {
leftLane @2 :PathData;
rightLane @3 :PathData;
lead @4 :LeadData;
leadNew @6 :List(Float32);

settings @5 :ModelSettings;

Expand Down Expand Up @@ -454,11 +473,13 @@ struct Plan {
# longitudinal
longitudinalValid @2 :Bool;
vTarget @3 :Float32;
vTargetFuture @14 :Float32;
aTargetMin @4 :Float32;
aTargetMax @5 :Float32;
jerkFactor @6 :Float32;
hasLead @7 :Bool;
fcw @8 :Bool;
longitudinalPlanSource @15 :LongitudinalPlanSource;

# gps trajectory in car frame
gpsTrajectory @12 :GpsTrajectory;
Expand All @@ -467,6 +488,12 @@ struct Plan {
x @0 :List(Float32);
y @1 :List(Float32);
}

enum LongitudinalPlanSource {
cruise @0;
mpc1 @1;
mpc2 @2;
}
}

struct LiveLocationData {
Expand Down Expand Up @@ -1073,6 +1100,7 @@ struct UbloxGnss {
union {
measurementReport @0 :MeasurementReport;
ephemeris @1 :Ephemeris;
ionoData @2 :IonoData;
}

struct MeasurementReport {
Expand Down Expand Up @@ -1175,9 +1203,24 @@ struct UbloxGnss {

transmissionTime @34 :Float64;
fitInterval @35 :Float64;

toc @36 :Float64;
}

struct IonoData {
svHealth @0 :UInt32;
tow @1 :Float64;
gpsWeek @2 :Float64;

ionoAlpha @3 :List(Float64);
ionoBeta @4 :List(Float64);

healthValid @5 :Bool;
ionoCoeffsValid @6 :Bool;
}
}


struct Clocks {
bootTimeNanos @0 :UInt64;
monotonicNanos @1 :UInt64;
Expand All @@ -1191,6 +1234,21 @@ struct LiveMpcData {
y @1 :List(Float32);
psi @2 :List(Float32);
delta @3 :List(Float32);
qpIterations @4 :UInt32;
calculationTime @5 :UInt64;
}

struct LiveLongitudinalMpcData {
xEgo @0 :List(Float32);
vEgo @1 :List(Float32);
aEgo @2 :List(Float32);
xLead @3 :List(Float32);
vLead @4 :List(Float32);
aLead @5 :List(Float32);
aLeadTau @6 :Float32; # lead accel time constant
qpIterations @7 :UInt32;
mpcId @8 :UInt32;
calculationTime @9 :UInt64;
}

struct Event {
Expand Down Expand Up @@ -1234,5 +1292,6 @@ struct Event {
ubloxGnss @34 :UbloxGnss;
clocks @35 :Clocks;
liveMpc @36 :LiveMpcData;
liveLongitudinalMpc @37 :LiveLongitudinalMpcData;
}
}
11 changes: 11 additions & 0 deletions common/dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,15 @@ def decode(self, x, arr=None, debug=False):
else:
out[arr.index(s[0])] = ival
return name, out


def get_signals(self, msg):
return [sgs.name for sgs in self.msgs[msg][1]]

if __name__ == "__main__":
import sys
import os
from opendbc import DBC_PATH

dbc_test = dbc(os.path.join(DBC_PATH, sys.argv[1]))
print dbc_test.get_signals(0xe4)
49 changes: 10 additions & 39 deletions common/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@
# sent messages
0xe4: 5, 0x1fa: 8, 0x200: 3, 0x30c: 8, 0x33d: 5, 0x35e: 8, 0x39f: 8,
},
"HONDA ACCORD 2016 TOURING": {
1024L: 5, 929L: 8, 1027L: 5, 773L: 7, 1601L: 8, 777L: 8, 1036L: 8, 398L: 3, 1039L: 8, 401L: 8, 145L: 8, 1424L: 5, 660L: 8, 661L: 4, 918L: 7, 985L: 3, 923L: 2, 542L: 7, 927L: 8, 800L: 8, 545L: 4, 420L: 8, 422L: 8, 808L: 8, 426L: 8, 1029L: 8, 432L: 7, 57L: 3, 316L: 8, 829L: 5, 1600L: 5, 1089L: 8, 1057L: 5, 780L: 8, 1088L: 8, 464L: 8, 1108L: 8, 597L: 8, 342L: 6, 983L: 8, 344L: 8, 804L: 8, 476L: 4, 1296L: 3, 891L: 8, 1125L: 8, 487L: 4, 892L: 8, 490L: 8, 871L: 8, 1064L: 7, 882L: 2, 884L: 8, 506L: 8, 507L: 1, 380L: 8, 1365L: 5
},
"HONDA CR-V 2016 TOURING": {
57L: 3, 145L: 8, 316L: 8, 340L: 8, 342L: 6, 344L: 8, 380L: 8, 398L: 3, 399L: 6, 401L: 8, 420L: 8, 422L: 8, 426L: 8, 432L: 7, 464L: 8, 474L: 5, 476L: 4, 487L: 4, 490L: 8, 493L: 3, 507L: 1, 542L: 7, 545L: 4, 597L: 8, 660L: 8, 661L: 4, 773L: 7, 777L: 8, 800L: 8, 804L: 8, 808L: 8, 882L: 2, 884L: 7, 888L: 8, 891L: 8, 892L: 8, 923L: 2, 929L: 8, 983L: 8, 985L: 3, 1024L: 5, 1027L: 5, 1029L: 8, 1033L: 5, 1036L: 8, 1039L: 8, 1057L: 5, 1064L: 7, 1108L: 8, 1125L: 8, 1296L: 8, 1365L: 5, 1424L: 5, 1600L: 5, 1601L: 8,
# sent messages
0x194: 4, 0x1fa: 8, 0x30c: 8, 0x33d: 5,
},
"TOYOTA PRIUS 2017": {
896L: 8, 832L: 8, 898L: 8, 899L: 8, 577L: 8, 528L: 8, 529L: 8, 530L: 8, 531L: 8, 532L: 8, 533L: 8, 534L: 8, 535L: 8, 536L: 8, 537L: 8, 538L: 8, 539L: 8, 540L: 8, 541L: 8, 542L: 8, 543L: 8, 544L: 8, 545L: 8, 546L: 8, 547L: 8, 548L: 8, 549L: 8, 550L: 8, 551L: 8, 296L: 6, 553L: 6, 554L: 6, 555L: 6, 556L: 6, 557L: 6, 558L: 6, 559L: 6, 560L: 7, 561L: 8, 562L: 8, 883L: 8, 837L: 8, 833L: 8, 576L: 8, 321L: 4, 834L: 8, 835L: 8, 580L: 8, 581L: 8, 897L: 8, 584L: 8, 1136L: 4, 976L: 8, 977L: 8, 978L: 8, 291L: 7, 881L: 8, 352L: 8, 353L: 7, 867L: 8, 868L: 8, 869L: 8, 1126L: 3, 304L: 7, 880L: 8, 552L: 6, 882L: 8, 979L: 8, 884L: 8, 885L: 8, 836L: 8
}
"TOYOTA RAV4 2017": {
36L: 8, 37L: 8, 170L: 8, 180L: 8, 186L: 4, 426L: 6, 452L: 8, 464L: 8, 466L: 8, 467L: 8, 547L: 8, 548L: 8, 552L: 4, 562L: 4, 608L: 8, 610L: 5, 643L: 7, 705L: 8, 725L: 2, 740L: 5, 800L: 8, 835L: 8, 836L: 8, 849L: 4, 869L: 7, 870L: 7, 871L: 2, 896L: 8, 897L: 8, 900L: 6, 902L: 6, 905L: 8, 911L: 8, 916L: 3, 918L: 7, 921L: 8, 933L: 8, 944L: 8, 945L: 8, 951L: 8, 955L: 4, 956L: 8, 979L: 2, 998L: 5, 999L: 7, 1000L: 8, 1001L: 8, 1008L: 2, 1014L: 8, 1017L: 8, 1041L: 8, 1042L: 8, 1043L: 8, 1044L: 8, 1056L: 8, 1059L: 1, 1114L: 8, 1161L: 8, 1162L: 8, 1163L: 8, 1176L: 8, 1177L: 8, 1178L: 8, 1179L: 8, 1180L: 8, 1181L: 8, 1190L: 8, 1191L: 8, 1192L: 8, 1196L: 8, 1227L: 8, 1228L: 8, 1235L: 8, 1237L: 8, 1263L: 8, 1279L: 8, 1408L: 8, 1409L: 8, 1410L: 8, 1552L: 8, 1553L: 8, 1554L: 8, 1555L: 8, 1556L: 8, 1557L: 8, 1561L: 8, 1562L: 8, 1568L: 8, 1569L: 8, 1570L: 8, 1571L: 8, 1572L: 8, 1584L: 8, 1589L: 8, 1592L: 8, 1593L: 8, 1595L: 8, 1596L: 8, 1597L: 8, 1600L: 8, 1656L: 8, 1664L: 8, 1728L: 8, 1745L: 8, 1779L: 8, 1904L: 8, 1912L: 8, 1990L: 8, 1998L: 8
},
}

# support additional internal only fingerprints
try:
from common.fingerprints_internal import add_additional_fingerprints
add_additional_fingerprints(_FINGERPRINTS)
except ImportError:
pass

def eliminate_incompatible_cars(msg, candidate_cars):
"""Removes cars that could not have sent msg.
Expand All @@ -50,36 +54,3 @@ def all_known_cars():
"""Returns a list of all known car strings."""
return _FINGERPRINTS.keys()

# **** for use live only ****
def fingerprint(logcan):
import selfdrive.messaging as messaging
from cereal import car
from common.realtime import sec_since_boot

if os.getenv("SIMULATOR") is not None or logcan is None:
return ("simulator", None)
elif os.getenv("SIMULATOR2") is not None:
return ("simulator2", None)

print "waiting for fingerprint..."
candidate_cars = all_known_cars()
finger = {}
st = None
while 1:
for a in messaging.drain_sock(logcan, wait_for_one=True):
if st is None:
st = sec_since_boot()
for can in a.can:
if can.src == 0:
finger[can.address] = len(can.dat)
candidate_cars = eliminate_incompatible_cars(can, candidate_cars)

# if we only have one car choice and it's been 100ms since we got our first message, exit
if len(candidate_cars) == 1 and st is not None and (sec_since_boot()-st) > 0.1:
break
elif len(candidate_cars) == 0:
print map(hex, finger.keys())
raise Exception("car doesn't match any fingerprints")

print "fingerprinted", candidate_cars[0]
return (candidate_cars[0], finger)
Loading

0 comments on commit 187a70f

Please sign in to comment.