Permalink
Browse files

openpilot v0.3.8.2 release

  • Loading branch information...
Vehicle Researcher
Vehicle Researcher committed Oct 31, 2017
1 parent 4830358 commit 187a70f760b4b1cd463619a161e6a929fc86e1b4
Showing with 1,934 additions and 579 deletions.
  1. +1 −1 Dockerfile.openpilot
  2. +6 −3 Makefile
  3. +13 −3 README.md
  4. +6 −0 RELEASES.md
  5. +11 −4 cereal/Makefile
  6. +15 −3 cereal/car.capnp
  7. +59 −0 cereal/log.capnp
  8. +11 −0 common/dbc.py
  9. +10 −39 common/fingerprints.py
  10. +4 −1 common/params.py
  11. +1 −1 opendbc
  12. +1 −1 panda
  13. +7 −9 selfdrive/boardd/Makefile
  14. +36 −9 selfdrive/boardd/boardd.cc
  15. +39 −2 selfdrive/boardd/boardd.py
  16. +0 −6 selfdrive/can/Makefile
  17. +2 −0 selfdrive/can/common.h
  18. +5 −2 selfdrive/can/dbc_template.cc
  19. +33 −19 selfdrive/can/parser.cc
  20. +90 −47 selfdrive/can/parser.py
  21. +9 −4 selfdrive/can/process_dbc.py
  22. +55 −3 selfdrive/car/__init__.py
  23. +9 −13 selfdrive/car/honda/carcontroller.py
  24. +31 −8 selfdrive/car/honda/carstate.py
  25. +27 −39 selfdrive/car/honda/interface.py
  26. +34 −0 selfdrive/car/honda/values.py
  27. 0 selfdrive/car/toyota/__init__.py
  28. +236 −0 selfdrive/car/toyota/carcontroller.py
  29. +187 −0 selfdrive/car/toyota/carstate.py
  30. +246 −0 selfdrive/car/toyota/interface.py
  31. +83 −0 selfdrive/car/toyota/toyotacan.py
  32. +11 −7 selfdrive/common/cereal.mk
  33. +3 −1 selfdrive/common/modeldata.h
  34. +1 −1 selfdrive/common/swaglog.c
  35. +1 −1 selfdrive/common/version.h
  36. +1 −1 selfdrive/config.py
  37. +62 −35 selfdrive/controls/controlsd.py
  38. +19 −5 selfdrive/controls/lib/alertmanager.py
  39. +6 −6 selfdrive/controls/lib/fcw.py
  40. +6 −4 selfdrive/controls/lib/latcontrol.py
  41. +2 −2 selfdrive/controls/lib/latcontrol_helpers.py
  42. +30 −12 selfdrive/controls/lib/lateral_mpc/Makefile
  43. +3 −2 selfdrive/controls/lib/lateral_mpc/generator.cpp
  44. +1 −2 selfdrive/controls/lib/lateral_mpc/libmpc_py.py
  45. +8 −6 selfdrive/controls/lib/lateral_mpc/mpc.c
  46. +1 −1 selfdrive/controls/lib/lateral_mpc/mpc_export/acado_common.h
  47. +99 −99 selfdrive/controls/lib/lateral_mpc/mpc_export/acado_integrator.c
  48. +1 −1 selfdrive/controls/lib/lateral_mpc/mpc_export/acado_qpoases_interface.hpp
  49. +6 −6 selfdrive/controls/lib/lateral_mpc/mpc_export/acado_solver.c
  50. +11 −10 selfdrive/controls/lib/longcontrol.py
  51. +8 −6 selfdrive/controls/lib/pid.py
  52. +6 −4 selfdrive/controls/lib/radar_helpers.py
  53. +15 −5 selfdrive/controls/radard.py
  54. +12 −1 selfdrive/debug/dump.py
  55. +1 −1 selfdrive/logcatd/Makefile
  56. BIN selfdrive/loggerd/loggerd
  57. +142 −66 selfdrive/manager.py
  58. +13 −0 selfdrive/pandad.py
  59. +1 −1 selfdrive/proclogd/Makefile
  60. +6 −5 selfdrive/radar/nidec/interface.py
  61. 0 selfdrive/radar/toyota/__init__.py
  62. +81 −0 selfdrive/radar/toyota/interface.py
  63. BIN selfdrive/sensord/gpsd
  64. BIN selfdrive/sensord/sensord
  65. +21 −18 selfdrive/test/plant/plant.py
  66. +6 −3 selfdrive/test/tests/plant/test_longitudinal.py
  67. +3 −3 selfdrive/tombstoned.py
  68. +51 −47 selfdrive/ui/ui.c
  69. +29 −0 selfdrive/updated.py
  70. BIN selfdrive/visiond/visiond
@@ -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
@@ -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

@@ -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.

@@ -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
------
@@ -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
@@ -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
@@ -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)

@@ -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:
@@ -51,6 +51,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
modelCommIssue @27;
brakeHold @28;
parkBrake @29;
manualRestart @30;
lowSpeedLockout @31;
}
}

@@ -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
@@ -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

@@ -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;
@@ -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
@@ -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?
}

@@ -36,6 +36,7 @@ struct InitData {
pandaInfo @8 :PandaInfo;

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

enum DeviceType {
unknown @0;
@@ -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;
@@ -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 {
@@ -370,6 +388,7 @@ struct ModelData {
leftLane @2 :PathData;
rightLane @3 :PathData;
lead @4 :LeadData;
leadNew @6 :List(Float32);

settings @5 :ModelSettings;

@@ -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;
@@ -467,6 +488,12 @@ struct Plan {
x @0 :List(Float32);
y @1 :List(Float32);
}

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

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

struct MeasurementReport {
@@ -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;
@@ -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 {
@@ -1234,5 +1292,6 @@ struct Event {
ubloxGnss @34 :UbloxGnss;
clocks @35 :Clocks;
liveMpc @36 :LiveMpcData;
liveLongitudinalMpc @37 :LiveLongitudinalMpcData;
}
}
@@ -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)
@@ -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.
@@ -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)
Oops, something went wrong.

0 comments on commit 187a70f

Please sign in to comment.