Merge pull request #188 from commaai/devel

0.4.2
pull/191/merge
George Hotz 7 years ago committed by GitHub
commit affc00df1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      README.md
  2. 9
      RELEASES.md
  3. 4
      SAFETY.md
  4. 2
      common/dbc.py
  5. 12
      common/fingerprints.py
  6. 1
      common/kalman/ekf.py
  7. 2
      common/params.py
  8. 1
      common/realtime.py
  9. 221
      opendbc/acura_rdx_2018_can_generated.dbc
  10. 21
      opendbc/generator/honda/acura_rdx_2018_can.dbc
  11. 4
      opendbc/generator/toyota/_toyota_2017.dbc
  12. 30
      opendbc/generator/toyota/lexus_rx_hybrid_2017_pt.dbc
  13. 2
      opendbc/generator/toyota/toyota_rav4_hybrid_2017_pt.dbc
  14. 210
      opendbc/lexus_rx_hybrid_2017_pt_generated.dbc
  15. 4
      opendbc/toyota_corolla_2017_pt_generated.dbc
  16. 4
      opendbc/toyota_prius_2017_pt_generated.dbc
  17. 4
      opendbc/toyota_rav4_2017_pt_generated.dbc
  18. 6
      opendbc/toyota_rav4_hybrid_2017_pt_generated.dbc
  19. 2
      panda/VERSION
  20. 16
      selfdrive/boardd/boardd.cc
  21. 2
      selfdrive/can/common.h
  22. 5
      selfdrive/can/libdbc_py.py
  23. 129
      selfdrive/can/packer.cc
  24. 30
      selfdrive/can/packer.py
  25. 60
      selfdrive/can/parser.cc
  26. 9
      selfdrive/can/parser.py
  27. 17
      selfdrive/can/process_dbc.py
  28. 6
      selfdrive/car/__init__.py
  29. 6
      selfdrive/car/honda/carcontroller.py
  30. 24
      selfdrive/car/honda/carstate.py
  31. 7
      selfdrive/car/honda/hondacan.py
  32. 16
      selfdrive/car/honda/interface.py
  33. 1
      selfdrive/car/honda/radar_interface.py
  34. 6
      selfdrive/car/mock/interface.py
  35. 7
      selfdrive/car/toyota/carcontroller.py
  36. 6
      selfdrive/car/toyota/carstate.py
  37. 38
      selfdrive/car/toyota/interface.py
  38. 4
      selfdrive/car/toyota/radar_interface.py
  39. 22
      selfdrive/car/toyota/toyotacan.py
  40. 74
      selfdrive/car/toyota/values.py
  41. 2
      selfdrive/common/version.h
  42. 2
      selfdrive/controls/controlsd.py
  43. 2
      selfdrive/controls/lib/latcontrol.py
  44. 2
      selfdrive/controls/lib/longcontrol.py
  45. 1
      selfdrive/controls/lib/planner.py
  46. 1
      selfdrive/controls/lib/radar_helpers.py
  47. 4
      selfdrive/controls/radard.py
  48. 1
      selfdrive/debug/can_printer.py
  49. 3
      selfdrive/debug/get_fingerprint.py
  50. 2
      selfdrive/debug/getframes/getframes.py
  51. 92
      selfdrive/debug/test_carcontroller.py
  52. 52
      selfdrive/debug/test_carstate.py
  53. BIN
      selfdrive/loggerd/loggerd
  54. 24
      selfdrive/manager.py
  55. 1
      selfdrive/registration.py
  56. BIN
      selfdrive/sensord/gpsd
  57. BIN
      selfdrive/sensord/sensord
  58. 3
      selfdrive/test/plant/maneuver.py
  59. 2
      selfdrive/test/plant/maneuverplots.py
  60. 11
      selfdrive/test/plant/plant.py
  61. 1
      selfdrive/test/test_openpilot.py
  62. BIN
      selfdrive/visiond/visiond

@ -32,6 +32,9 @@ Supported Cars
- Honda Odyssey 2018 with Honda Sensing (alpha!) - Honda Odyssey 2018 with Honda Sensing (alpha!)
- Can only be enabled above 25 mph - Can only be enabled above 25 mph
- Acura RDX 2018 with AcuraWatch Plus (alpha!)
- Can only be enabled above 25 mph
- Toyota RAV-4 2016+ non-hybrid with TSS-P - Toyota RAV-4 2016+ non-hybrid with TSS-P
- By default it uses stock Toyota ACC for longitudinal control - By default it uses stock Toyota ACC for longitudinal control
- openpilot longitudinal control available after unplugging the [Driving Support ECU](https://community.comma.ai/wiki/index.php/Toyota#Rav4_.28for_openpilot.29) and can be enabled above 20 mph - openpilot longitudinal control available after unplugging the [Driving Support ECU](https://community.comma.ai/wiki/index.php/Toyota#Rav4_.28for_openpilot.29) and can be enabled above 20 mph
@ -49,11 +52,18 @@ Supported Cars
- By default it uses stock Toyota ACC for longitudinal control - By default it uses stock Toyota ACC for longitudinal control
- openpilot longitudinal control available after unplugging the [Driving Support ECU](https://community.comma.ai/wiki/index.php/Toyota#Corolla_.28for_openpilot.29) and can be enabled above 20 mph - openpilot longitudinal control available after unplugging the [Driving Support ECU](https://community.comma.ai/wiki/index.php/Toyota#Corolla_.28for_openpilot.29) and can be enabled above 20 mph
- Lexus RX 2017 hybrid (alpha!)
- By default it uses stock Lexus ACC for longitudinal control
- openpilot longitudinal control available after unplugging the [Driving Support ECU](https://community.comma.ai/wiki/index.php/Toyota#Lexus_RX_hybrid)
In Progress Cars In Progress Cars
------ ------
- Probably all TSS-P Toyota with Steering Assist. - All TSS-P Toyota with Steering Assist.
- 'Full Speed Range Dynamic Radar Cruise Control' is required to enable stop-and-go. Only the Prius, Camry and C-HR have this option. - 'Full Speed Range Dynamic Radar Cruise Control' is required to enable stop-and-go. Only the Prius, Camry and C-HR have this option.
- Even though the Tundra, Sequoia and the Land Cruiser have TSS-P, they don't have Steering Assist and are not supported. - Even though the Tundra, Sequoia and the Land Cruiser have TSS-P, they don't have Steering Assist and are not supported.
- All LSS-P Lexus with Steering Assist or Lane Keep Assist.
- 'All-Speed Range Dynamic Radar Cruise Control' is required to enable stop-and-go. Only the GS, GSH, GS, F, RX, RXH, LX, NX, NXH, LC, LCH, LS, LSH have this option.
- Even though the LX have TSS-P, it does not have Steering Assist and is not supported.
Community WIP Cars Community WIP Cars
------ ------
@ -64,8 +74,6 @@ Community WIP Cars
- [Honda Pilot 2017 with Honda Sensing](https://github.com/commaai/openpilot/pull/161) - [Honda Pilot 2017 with Honda Sensing](https://github.com/commaai/openpilot/pull/161)
- [Acura RDX 2018 with AcuraWatch Plus](https://github.com/commaai/openpilot/pull/162)
Directory structure Directory structure
------ ------

@ -1,8 +1,17 @@
Version 0.4.2 (2018-02-05)
==========================
* Add alpha support for 2017 Lexus RX Hybrid
* Add alpha support for 2018 ACURA RDX
* Updated fingerprint to include Toyota Rav4 SE and Prius Prime
* Bugfixes for Acura ILX and Honda Odyssey
Version 0.4.1 (2018-01-30) Version 0.4.1 (2018-01-30)
========================== ==========================
* Add alpha support for 2017 Toyota Corolla * Add alpha support for 2017 Toyota Corolla
* Add alpha support for 2018 Honda Odyssey with Honda Sensing
* Add alpha support for Grey Panda * Add alpha support for Grey Panda
* Refactored car abstraction layer to make car ports easier * Refactored car abstraction layer to make car ports easier
* Increased steering torque limit on Honda CR-V by 30%
Version 0.4.0.2 (2018-01-18) Version 0.4.0.2 (2018-01-18)
========================== ==========================

@ -42,7 +42,7 @@ Honda/Acura
- Honda CAN uses both a counter and a checksum to ensure integrity and prevent - Honda CAN uses both a counter and a checksum to ensure integrity and prevent
replay of the same message. replay of the same message.
Toyota Toyota/Lexus
------ ------
- While the system is engaged, gas, brake and steer limits are subject to the same limits used by - While the system is engaged, gas, brake and steer limits are subject to the same limits used by
@ -59,7 +59,7 @@ Toyota
software to a value of -1500 and 1500. In addition, the vehicle EPS unit will not respond to software to a value of -1500 and 1500. In addition, the vehicle EPS unit will not respond to
commands outside these limits. A steering torque rate limit is enforced by the board and in commands outside these limits. A steering torque rate limit is enforced by the board and in
software so that the commanded steering torque must rise from 0 to max value no faster than software so that the commanded steering torque must rise from 0 to max value no faster than
1.5s. Commanded steering torque is limited by the board and in software to be no more than 500 1.5s. Commanded steering torque is limited by the board and in software to be no more than 350
units above the actual EPS generated motor torque to ensure limited differences between units above the actual EPS generated motor torque to ensure limited differences between
commanded and actual torques. commanded and actual torques.

@ -214,8 +214,6 @@ class dbc(object):
return [sgs.name for sgs in self.msgs[msg][1]] return [sgs.name for sgs in self.msgs[msg][1]]
if __name__ == "__main__": if __name__ == "__main__":
import sys
import os
from opendbc import DBC_PATH from opendbc import DBC_PATH
dbc_test = dbc(os.path.join(DBC_PATH, sys.argv[1])) dbc_test = dbc(os.path.join(DBC_PATH, sys.argv[1]))

@ -3,6 +3,7 @@ class HONDA:
ACURA_ILX = "ACURA ILX 2016 ACURAWATCH PLUS" ACURA_ILX = "ACURA ILX 2016 ACURAWATCH PLUS"
CRV = "HONDA CR-V 2016 TOURING" CRV = "HONDA CR-V 2016 TOURING"
ODYSSEY = "HONDA ODYSSEY 2018 EX-L" ODYSSEY = "HONDA ODYSSEY 2018 EX-L"
ACURA_RDX = "ACURA RDX 2018 ACURAWATCH PLUS"
class TOYOTA: class TOYOTA:
@ -10,6 +11,7 @@ class TOYOTA:
RAV4H = "TOYOTA RAV4 2017 HYBRID" RAV4H = "TOYOTA RAV4 2017 HYBRID"
RAV4 = "TOYOTA RAV4 2017" RAV4 = "TOYOTA RAV4 2017"
COROLLA = "TOYOTA COROLLA 2017" COROLLA = "TOYOTA COROLLA 2017"
LEXUS_RXH = "LEXUS RX HYBRID 2017"
_FINGERPRINTS = { _FINGERPRINTS = {
@ -18,6 +20,9 @@ _FINGERPRINTS = {
# sent messages # sent messages
0xe4: 5, 0x1fa: 8, 0x200: 3, 0x30c: 8, 0x33d: 5, 0xe4: 5, 0x1fa: 8, 0x200: 3, 0x30c: 8, 0x33d: 5,
}, },
HONDA.ACURA_RDX: {
57L: 3, 145L: 8, 229L: 4, 308L: 5, 316L: 8, 342L: 6, 344L: 8, 380L: 8, 392L: 6, 398L: 3, 399L: 6, 404L: 4, 420L: 8, 422L: 8, 426L: 8, 432L: 7, 464L: 8, 474L: 5, 476L: 4, 487L: 4, 490L: 8, 506L: 8, 542L: 7, 545L: 4, 597L: 8, 660L: 8, 773L: 7, 777L: 8, 780L: 8, 800L: 8, 804L: 8, 808L: 8, 819L: 7, 821L: 5, 829L: 5, 882L: 2, 884L: 7, 887L: 8, 888L: 8, 892L: 8, 923L: 2, 929L: 4, 963L: 8, 965L: 8, 966L: 8, 967L: 8, 983L: 8, 985L: 3, 1024L: 5, 1027L: 5, 1029L: 8, 1033L: 5, 1034L: 5, 1036L: 8, 1039L: 8, 1057L: 5, 1064L: 7, 1108L: 8, 1365L: 5, 1424L: 5, 1729L: 1
},
HONDA.CIVIC: { HONDA.CIVIC: {
1024L: 5, 513L: 5, 1027L: 5, 1029L: 8, 777L: 8, 1036L: 8, 1039L: 8, 1424L: 5, 401L: 8, 148L: 8, 662L: 4, 985L: 3, 795L: 8, 773L: 7, 800L: 8, 545L: 6, 420L: 8, 806L: 8, 808L: 8, 1322L: 5, 427L: 3, 428L: 8, 304L: 8, 432L: 7, 57L: 3, 450L: 8, 929L: 8, 330L: 8, 1302L: 8, 464L: 8, 1361L: 5, 1108L: 8, 597L: 8, 470L: 2, 344L: 8, 804L: 8, 399L: 7, 476L: 7, 1633L: 8, 487L: 4, 892L: 8, 490L: 8, 493L: 5, 884L: 8, 891L: 8, 380L: 8, 1365L: 5, 1024L: 5, 513L: 5, 1027L: 5, 1029L: 8, 777L: 8, 1036L: 8, 1039L: 8, 1424L: 5, 401L: 8, 148L: 8, 662L: 4, 985L: 3, 795L: 8, 773L: 7, 800L: 8, 545L: 6, 420L: 8, 806L: 8, 808L: 8, 1322L: 5, 427L: 3, 428L: 8, 304L: 8, 432L: 7, 57L: 3, 450L: 8, 929L: 8, 330L: 8, 1302L: 8, 464L: 8, 1361L: 5, 1108L: 8, 597L: 8, 470L: 2, 344L: 8, 804L: 8, 399L: 7, 476L: 7, 1633L: 8, 487L: 4, 892L: 8, 490L: 8, 493L: 5, 884L: 8, 891L: 8, 380L: 8, 1365L: 5,
# sent messages # sent messages
@ -32,10 +37,10 @@ _FINGERPRINTS = {
57L: 3, 148L: 8, 228L: 5, 229L: 4, 316L: 8, 342L: 6, 344L: 8, 380L: 8, 399L: 7, 411L: 5, 419L: 8, 420L: 8, 427L: 3, 432L: 7, 450L: 8, 463L: 8, 464L: 8, 476L: 4, 490L: 8, 506L: 8, 542L: 7, 545L: 6, 597L: 8, 662L: 4, 773L: 7, 777L: 8, 780L: 8, 795L: 8, 800L: 8, 804L: 8, 806L: 8, 808L: 8, 817L: 4, 819L: 7, 821L: 5, 825L: 4, 829L: 5, 837L: 5, 856L: 7, 862L: 8, 871L: 8, 881L: 8, 882L: 4, 884L: 8, 891L: 8, 892L: 8, 905L: 8, 923L: 2, 927L: 8, 929L: 8, 963L: 8, 965L: 8, 966L: 8, 967L: 8, 983L: 8, 985L: 3, 1029L: 8, 1036L: 8, 1052L: 8, 1064L: 7, 1088L: 8, 1089L: 8, 1092L: 1, 1108L: 8, 1110L: 8, 1125L: 8, 1296L: 8, 1302L: 8, 1600L: 5, 1601L: 8, 1612L: 5, 1613L: 5, 1614L: 5, 1615L: 8, 1616L: 5, 1619L: 5, 1623L: 5, 1668L: 5 57L: 3, 148L: 8, 228L: 5, 229L: 4, 316L: 8, 342L: 6, 344L: 8, 380L: 8, 399L: 7, 411L: 5, 419L: 8, 420L: 8, 427L: 3, 432L: 7, 450L: 8, 463L: 8, 464L: 8, 476L: 4, 490L: 8, 506L: 8, 542L: 7, 545L: 6, 597L: 8, 662L: 4, 773L: 7, 777L: 8, 780L: 8, 795L: 8, 800L: 8, 804L: 8, 806L: 8, 808L: 8, 817L: 4, 819L: 7, 821L: 5, 825L: 4, 829L: 5, 837L: 5, 856L: 7, 862L: 8, 871L: 8, 881L: 8, 882L: 4, 884L: 8, 891L: 8, 892L: 8, 905L: 8, 923L: 2, 927L: 8, 929L: 8, 963L: 8, 965L: 8, 966L: 8, 967L: 8, 983L: 8, 985L: 3, 1029L: 8, 1036L: 8, 1052L: 8, 1064L: 7, 1088L: 8, 1089L: 8, 1092L: 1, 1108L: 8, 1110L: 8, 1125L: 8, 1296L: 8, 1302L: 8, 1600L: 5, 1601L: 8, 1612L: 5, 1613L: 5, 1614L: 5, 1615L: 8, 1616L: 5, 1619L: 5, 1623L: 5, 1668L: 5
}, },
TOYOTA.RAV4: { TOYOTA.RAV4: {
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 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, 1005L: 2, 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, 1264L: 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
}, },
TOYOTA.RAV4H: { TOYOTA.RAV4H: {
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: 8, 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, 581L: 5, 296: 8, 552L: 8, 560L: 7, 552L: 4, 713L: 8, 550L: 8, 608L: 8, 37L: 8, 36L: 8, 950L: 8, 1198L: 8, 1197L: 8, 1199L: 8, 1212L: 8, 953L: 3, 1264L: 8, 1184L: 8, 1005L: 2, 1185L: 8, 1232L: 8, 1186L: 8 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: 8, 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, 581L: 5, 296: 8, 560L: 7, 713L: 8, 550L: 8, 608L: 8, 37L: 8, 36L: 8, 950L: 8, 1198L: 8, 1197L: 8, 1199L: 8, 1212L: 8, 953L: 3, 1264L: 8, 1184L: 8, 1005L: 2, 1185L: 8, 1232L: 8, 1186L: 8
}, },
TOYOTA.PRIUS: [{ TOYOTA.PRIUS: [{
36L: 8, 37L: 8, 166L: 8, 170L: 8, 180L: 8, 295L: 8, 296L: 8, 426L: 6, 452L: 8, 466L: 8, 467L: 8, 550L: 8, 552L: 4, 560L: 7, 562L: 6, 581L: 5, 608L: 8, 610L: 8, 614L: 8, 643L: 7, 658L: 8, 713L: 8, 740L: 5, 742L: 8, 743L: 8, 800L: 8, 810L: 2, 814L: 8, 829L: 2, 830L: 7, 835L: 8, 836L: 8, 863L: 8, 869L: 7, 870L: 7, 871L: 2, 898L: 8, 900L: 6, 902L: 6, 905L: 8, 918L: 8, 921L: 8, 933L: 8, 944L: 8, 945L: 8, 950L: 8, 951L: 8, 953L: 8, 955L: 8, 956L: 8, 971L: 7, 975L: 5, 993L: 8, 998L: 5, 999L: 7, 1000L: 8, 1001L: 8, 1014L: 8, 1017L: 8, 1020L: 8, 1041L: 8, 1042L: 8, 1044L: 8, 1056L: 8, 1057L: 8, 1059L: 1, 1071L: 8, 1077L: 8, 1082L: 8, 1083L: 8, 1084L: 8, 1085L: 8, 1086L: 8, 1114L: 8, 1132L: 8, 1161L: 8, 1162L: 8, 1163L: 8, 1175L: 8, 1227L: 8, 1228L: 8, 1235L: 8, 1237L: 8, 1279L: 8, 1552L: 8, 1553L: 8, 1556L: 8, 1557L: 8, 1568L: 8, 1570L: 8, 1571L: 8, 1572L: 8, 1595L: 8, 1777L: 8, 1779L: 8, 1904L: 8, 1912L: 8, 1990L: 8, 1998L: 8 36L: 8, 37L: 8, 166L: 8, 170L: 8, 180L: 8, 295L: 8, 296L: 8, 426L: 6, 452L: 8, 466L: 8, 467L: 8, 550L: 8, 552L: 4, 560L: 7, 562L: 6, 581L: 5, 608L: 8, 610L: 8, 614L: 8, 643L: 7, 658L: 8, 713L: 8, 740L: 5, 742L: 8, 743L: 8, 800L: 8, 810L: 2, 814L: 8, 829L: 2, 830L: 7, 835L: 8, 836L: 8, 863L: 8, 869L: 7, 870L: 7, 871L: 2, 898L: 8, 900L: 6, 902L: 6, 905L: 8, 918L: 8, 921L: 8, 933L: 8, 944L: 8, 945L: 8, 950L: 8, 951L: 8, 953L: 8, 955L: 8, 956L: 8, 971L: 7, 975L: 5, 993L: 8, 998L: 5, 999L: 7, 1000L: 8, 1001L: 8, 1014L: 8, 1017L: 8, 1020L: 8, 1041L: 8, 1042L: 8, 1044L: 8, 1056L: 8, 1057L: 8, 1059L: 1, 1071L: 8, 1077L: 8, 1082L: 8, 1083L: 8, 1084L: 8, 1085L: 8, 1086L: 8, 1114L: 8, 1132L: 8, 1161L: 8, 1162L: 8, 1163L: 8, 1175L: 8, 1227L: 8, 1228L: 8, 1235L: 8, 1237L: 8, 1279L: 8, 1552L: 8, 1553L: 8, 1556L: 8, 1557L: 8, 1568L: 8, 1570L: 8, 1571L: 8, 1572L: 8, 1595L: 8, 1777L: 8, 1779L: 8, 1904L: 8, 1912L: 8, 1990L: 8, 1998L: 8
@ -52,6 +57,9 @@ _FINGERPRINTS = {
TOYOTA.COROLLA: { TOYOTA.COROLLA: {
36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 547: 8, 548: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 2, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 4, 956: 8, 979: 2, 992: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1196: 8, 1227: 8, 1235: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1596: 8, 1597: 8, 1600: 8, 1664: 8, 1728: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8 36: 8, 37: 8, 170: 8, 180: 8, 186: 4, 426: 6, 452: 8, 464: 8, 466: 8, 467: 8, 547: 8, 548: 8, 552: 4, 608: 8, 610: 5, 643: 7, 705: 8, 740: 5, 800: 8, 835: 8, 836: 8, 849: 4, 869: 7, 870: 7, 871: 2, 896: 8, 897: 8, 900: 6, 902: 6, 905: 8, 911: 8, 916: 2, 921: 8, 933: 8, 944: 8, 945: 8, 951: 8, 955: 4, 956: 8, 979: 2, 992: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1017: 8, 1041: 8, 1042: 8, 1043: 8, 1044: 8, 1056: 8, 1059: 1, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1196: 8, 1227: 8, 1235: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1561: 8, 1562: 8, 1568: 8, 1569: 8, 1570: 8, 1571: 8, 1572: 8, 1584: 8, 1589: 8, 1592: 8, 1596: 8, 1597: 8, 1600: 8, 1664: 8, 1728: 8, 1779: 8, 1904: 8, 1912: 8, 1990: 8, 1998: 8
}, },
TOYOTA.LEXUS_RXH: {
36: 8, 37: 8, 166: 8, 170: 8, 180: 8, 295: 8, 296: 8, 426: 6, 452: 8, 466: 8, 467: 8, 550: 8, 552: 4, 560: 7, 562: 6, 581: 5, 608: 8, 610: 5, 643: 7, 658: 8, 713: 8, 740: 5, 742: 8, 743: 8, 800: 8, 810: 2, 812: 3, 814: 8, 830: 7, 835: 8, 836: 8, 845: 5, 863: 8, 869: 7, 870: 7, 871: 2, 898: 8, 900: 6, 902: 6, 905: 8, 913: 8, 918: 8, 921: 8, 933: 8, 944: 8, 945: 8, 950: 8, 951: 8, 953: 8, 955: 8, 956: 8, 971: 7, 975: 6, 993: 8, 998: 5, 999: 7, 1000: 8, 1001: 8, 1005: 2, 1014: 8, 1017: 8, 1020: 8, 1041: 8, 1042: 8, 1044: 8, 1056: 8, 1059: 1, 1063: 8, 1071: 8, 1077: 8, 1082: 8, 1114: 8, 1161: 8, 1162: 8, 1163: 8, 1164: 8, 1165: 8, 1166: 8, 1167: 8, 1227: 8, 1228: 8, 1235: 8, 1237: 8, 1264: 8, 1279: 8, 1552: 8, 1553: 8, 1556: 8, 1557: 8, 1568: 8, 1570: 8, 1571: 8, 1572: 8, 1575: 8, 1595: 8, 1777: 8, 1779: 8, 1808: 8, 1810: 8, 1816: 8, 1818: 8, 1840: 8, 1848: 8, 1904: 8, 1912: 8, 1940: 8, 1941: 8, 1948: 8, 1949: 8, 1952: 8, 1956: 8, 1960: 8, 1964: 8, 1986: 8, 1990: 8, 1994: 8, 1998: 8, 2004: 8, 2012: 8
},
} }
# support additional internal only fingerprints # support additional internal only fingerprints

@ -1,6 +1,5 @@
import abc import abc
import numpy as np import numpy as np
import numpy.matlib
# The EKF class contains the framework for an Extended Kalman Filter, but must be subclassed to use. # The EKF class contains the framework for an Extended Kalman Filter, but must be subclassed to use.
# A subclass must implement: # A subclass must implement:
# 1) calc_transfer_fun(); see bottom of file for more info. # 1) calc_transfer_fun(); see bottom of file for more info.

@ -227,7 +227,7 @@ class DBWriter(DBAccessor):
data_path = self._data_path() data_path = self._data_path()
try: try:
old_data_path = os.path.join(self._path, os.readlink(data_path)) old_data_path = os.path.join(self._path, os.readlink(data_path))
except (OSError, IOError) as e: except (OSError, IOError):
# NOTE(mgraczyk): If other DB implementations have bugs, this could cause # NOTE(mgraczyk): If other DB implementations have bugs, this could cause
# copies to be left behind, but we still want to overwrite. # copies to be left behind, but we still want to overwrite.
pass pass

@ -1,7 +1,6 @@
"""Utilities for reading real time clocks and keeping soft real time constraints.""" """Utilities for reading real time clocks and keeping soft real time constraints."""
import os import os
import time import time
import ctypes
import platform import platform
import threading import threading
import subprocess import subprocess

@ -1,9 +1,47 @@
CM_ "AUTOGENERATED FILE, DO NOT EDIT" CM_ "AUTOGENERATED FILE, DO NOT EDIT"
BO_ 342 STEERING_SENSORS: 6 EPS CM_ "Imported file _honda_2017.dbc starts here"
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON VERSION ""
SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_
CAT_
FILTER
BA_DEF_DEF_
EV_DATA_
ENVVAR_DATA_
SGTYPE_
SGTYPE_VAL_
BA_DEF_SGTYPE_
BA_SGTYPE_
SIG_TYPE_REF_
VAL_TABLE_
SIG_GROUP_
SIG_VALTYPE_
SIGTYPE_VALTYPE_
BO_TX_BU_
BA_DEF_REL_
BA_REL_
BA_DEF_DEF_REL_
BU_SG_REL_
BU_EV_REL_
BU_BO_REL_
SG_MUL_VAL_
BU_: EBCM ADAS PCM EPS VSA SCM BDY XXX EPB EON
BO_ 344 ENGINE_DATA: 8 PCM
SG_ XMISSION_SPEED : 7|16@0+ (0.002759506,0) [0|70] "m/s" EON
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON
SG_ XMISSION_SPEED2 : 39|16@0+ (0.002759506,0) [0|70] "m/s" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX
BO_ 380 POWERTRAIN_DATA: 8 PCM BO_ 380 POWERTRAIN_DATA: 8 PCM
SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON
@ -16,8 +54,175 @@ BO_ 380 POWERTRAIN_DATA: 8 PCM
SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON
SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "rpm" EON SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "rpm" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
BO_ 432 STANDSTILL: 7 VSA
SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON
SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON
SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON
SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON
BO_ 464 WHEEL_SPEEDS: 8 VSA
SG_ WHEEL_SPEED_FL : 7|15@0+ (0.01,0) [0|250] "kph" EON
SG_ WHEEL_SPEED_FR : 8|15@0+ (0.01,0) [0|250] "kph" EON
SG_ WHEEL_SPEED_RL : 25|15@0+ (0.01,0) [0|250] "kph" EON
SG_ WHEEL_SPEED_RR : 42|15@0+ (0.01,0) [0|250] "kph" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
BO_ 490 VEHICLE_DYNAMICS: 8 VSA
SG_ LONG_ACCEL : 23|16@0- (0.0015384,0) [-20|20] "m/s2" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
BO_ 506 BRAKE_COMMAND: 8 ADAS
SG_ COMPUTER_BRAKE : 7|10@0+ (0.003906248,0) [0|1] "" EBCM
SG_ ZEROS_BOH : 13|5@0+ (1,0) [0|1] "" EBCM
SG_ COMPUTER_BRAKE_REQUEST : 8|1@0+ (1,0) [0|1] "" EBCM
SG_ CRUISE_BOH2 : 23|3@0+ (1,0) [0|1] "" EBCM
SG_ CRUISE_OVERRIDE : 20|1@0+ (1,0) [0|1] "" EBCM
SG_ CRUISE_BOH3 : 19|1@0+ (1,0) [0|1] "" EBCM
SG_ CRUISE_FAULT_CMD : 18|1@0+ (1,0) [0|1] "" EBCM
SG_ CRUISE_CANCEL_CMD : 17|1@0+ (1,0) [0|1] "" EBCM
SG_ COMPUTER_BRAKE_REQUEST_2 : 16|1@0+ (1,0) [0|1] "" EBCM
SG_ SET_ME_0X80 : 31|8@0+ (1,0) [0|1] "" EBCM
SG_ BRAKE_LIGHTS : 39|1@0+ (1,0) [0|1] "" EBCM
SG_ CRUISE_STATES : 38|7@0+ (1,0) [0|1] "" EBCM
SG_ CHIME : 47|3@0+ (1,0) [0|7] "" EBCM
SG_ ZEROS_BOH6 : 44|1@0+ (1,0) [0|1] "" EBCM
SG_ FCW : 43|2@0+ (1,0) [0|3] "" EBCM
SG_ ZEROS_BOH4 : 55|8@0+ (1,0) [0|0] "" EBCM
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EBCM
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EBCM
BO_ 512 GAS_COMMAND: 3 EON
SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR
SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" INTERCEPTOR
SG_ CHECKSUM : 19|4@0+ (1,0) [0|3] "" INTERCEPTOR
BO_ 513 GAS_SENSOR: 5 INTERCEPTOR
SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON
SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 35|4@0+ (1,0) [0|3] "" EON
BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA
SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" EON
SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" EON
SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" EON
SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" EON
SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" EON
SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 773 SEATBELT_STATUS: 7 BDY
SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" EON
SG_ SEATBELT_PASS_UNLATCHED : 10|1@0+ (1,0) [0|1] "" EON
SG_ SEATBELT_PASS_LATCHED : 11|1@0+ (1,0) [0|1] "" EON
SG_ SEATBELT_DRIVER_UNLATCHED : 12|1@0+ (1,0) [0|1] "" EON
SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" EON
SG_ PASS_AIRBAG_OFF : 14|1@0+ (1,0) [0|1] "" EON
SG_ PASS_AIRBAG_ON : 15|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON
BO_ 777 LOCK_STATUS: 8 XXX
SG_ DOORS_UNLOCKED : 54|1@0+ (1,0) [0|1] "" EON
SG_ DOORS_LOCKED : 55|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
BO_ 780 ACC_HUD: 8 ADAS
SG_ PCM_SPEED : 7|16@0+ (0.002759506,0) [0|100] "m/s" BDY
SG_ PCM_GAS : 23|7@0+ (1,0) [0|127] "" BDY
SG_ ZEROS_BOH : 16|1@0+ (1,0) [0|255] "" BDY
SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY
SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY
SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY
SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY
SG_ FCM_OFF : 36|1@0+ (1,0) [0|1] "" BDY
SG_ BOH_2 : 35|1@0+ (1,0) [0|1] "" BDY
SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY
SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY
SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY
SG_ SET_ME_X03 : 47|2@0+ (1,0) [0|3] "" BDY
SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY
SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY
SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY
SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY
SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY
SG_ HUD_DISTANCE_3 : 52|1@0+ (1,0) [0|1] "" BDY
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY
BO_ 804 CRUISE: 8 PCM
SG_ HUD_SPEED_KPH : 7|8@0+ (1,0) [0|255] "kph" EON
SG_ HUD_SPEED_MPH : 15|8@0+ (1,0) [0|255] "mph" EON
SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" EON
SG_ CRUISE_SPEED_PCM : 39|8@0+ (1,0) [0|255] "" EON
SG_ BOH2 : 47|8@0- (1,0) [0|255] "" EON
SG_ BOH3 : 55|8@0+ (1,0) [0|255] "" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
BO_ 829 LKAS_HUD: 5 ADAS
SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY
SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY
SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY
SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY
SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY
SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY
SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY
SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY
SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY
SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY
SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY
SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY
SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY
SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY
SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY
SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY
SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY
SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" BDY
BO_ 892 CRUISE_PARAMS: 8 PCM
SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
BO_ 1029 DOORS_STATUS: 8 BDY
SG_ DOOR_OPEN_FL : 37|1@0+ (1,0) [0|1] "" EON
SG_ DOOR_OPEN_FR : 38|1@0+ (1,0) [0|1] "" EON
SG_ DOOR_OPEN_RL : 39|1@0+ (1,0) [0|1] "" EON
SG_ DOOR_OPEN_RR : 40|1@0+ (1,0) [0|1] "" EON
SG_ TRUNK_OPEN : 41|1@0+ (1,0) [0|1] "" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON
CM_ SG_ 490 LONG_ACCEL "wheel speed derivative, noisy and zero snapping";
CM_ SG_ 773 PASS_AIRBAG_ON "Might just be indicator light";
CM_ SG_ 773 PASS_AIRBAG_OFF "Might just be indicator light";
CM_ SG_ 780 CRUISE_SPEED "255 = no speed";
CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed";
CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc...";
VAL_ 506 FCW 3 "fcw" 2 "fcw" 1 "fcw" 0 "no_fcw" ;
VAL_ 506 CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime" ;
VAL_ 780 CRUISE_SPEED 255 "no_speed" 252 "stopped" ;
VAL_ 780 HUD_LEAD 3 "acc_off" 2 "solid_car" 1 "dashed_car" 0 "no_car" ;
VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ;
CM_ "acura_rdx_2018_can.dbc starts here"
BO_ 342 STEERING_SENSORS: 6 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON
BO_ 392 GEARBOX: 6 XXX BO_ 392 GEARBOX: 6 XXX
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" XXX
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" XXX SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" XXX
@ -48,13 +253,13 @@ BO_ 420 VSA_STATUS: 8 VSA
BO_ 422 SCM_BUTTONS: 8 SCM BO_ 422 SCM_BUTTONS: 8 SCM
SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON
SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON
SG_ PARKING_BREAK_LIGHT : 2|1@0+ (1,0) [0|1] "" EON SG_ PARKING_BRAKE_LIGHT : 2|1@0+ (1,0) [0|1] "" EON
SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON
SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 487 XXX_9: 4 VSA BO_ 487 BRAKE_PRESSURE: 4 VSA
SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" EON SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" EON
SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" EON SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" EON
SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EON SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EON
@ -67,7 +272,7 @@ BO_ 660 SCM_FEEDBACK: 8 SCM
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
CM_ SG_ 422 PARKING_BREAK_LIGHT "Believe this is just the dash light for the parking break"; CM_ SG_ 422 PARKING_BRAKE_LIGHT "Believe this is just the dash light for the parking break";
VAL_ 392 GEAR_SHIFTER 0 "S" 1 "P" 2 "R" 4 "N" 8 "D" ; VAL_ 392 GEAR_SHIFTER 0 "S" 1 "P" 2 "R" 4 "N" 8 "D" ;
VAL_ 392 GEAR 26 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 392 GEAR 26 "S" 4 "D" 3 "N" 2 "R" 1 "P" ;
VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ;

@ -1,22 +1,11 @@
CM_ "IMPORT _honda_2017.dbc"
BO_ 342 STEERING_SENSORS: 6 EPS BO_ 342 STEERING_SENSORS: 6 EPS
SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON
SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON SG_ STEER_ANGLE_RATE : 23|16@0- (1,0) [-3000|3000] "deg/s" EON
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" EON
BO_ 380 POWERTRAIN_DATA: 8 PCM
SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON
SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON
SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON
SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "rpm" EON
SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "rpm" EON
SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "rpm" EON
SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "rpm" EON
SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON
SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "rpm" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 392 GEARBOX: 6 XXX BO_ 392 GEARBOX: 6 XXX
SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" XXX SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" XXX
SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" XXX SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" XXX
@ -47,13 +36,13 @@ BO_ 420 VSA_STATUS: 8 VSA
BO_ 422 SCM_BUTTONS: 8 SCM BO_ 422 SCM_BUTTONS: 8 SCM
SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON
SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON SG_ LIGHTS_SETTING : 1|2@0+ (1,0) [0|3] "" EON
SG_ PARKING_BREAK_LIGHT : 2|1@0+ (1,0) [0|1] "" EON SG_ PARKING_BRAKE_LIGHT : 2|1@0+ (1,0) [0|1] "" EON
SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON SG_ MAIN_ON : 47|1@0+ (1,0) [0|1] "" EON
SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON SG_ CRUISE_SETTING : 43|2@0+ (1,0) [0|3] "" EON
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
BO_ 487 XXX_9: 4 VSA BO_ 487 BRAKE_PRESSURE: 4 VSA
SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" EON SG_ BRAKE_PRESSURE1 : 7|10@0+ (0.015625,-103) [0|1000] "" EON
SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" EON SG_ BRAKE_PRESSURE2 : 9|10@0+ (0.015625,-103) [0|1000] "" EON
SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EON SG_ COUNTER : 29|2@0+ (1,0) [0|15] "" EON
@ -66,7 +55,7 @@ BO_ 660 SCM_FEEDBACK: 8 SCM
SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON
SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON
CM_ SG_ 422 PARKING_BREAK_LIGHT "Believe this is just the dash light for the parking break"; CM_ SG_ 422 PARKING_BRAKE_LIGHT "Believe this is just the dash light for the parking break";
VAL_ 392 GEAR_SHIFTER 0 "S" 1 "P" 2 "R" 4 "N" 8 "D" ; VAL_ 392 GEAR_SHIFTER 0 "S" 1 "P" 2 "R" 4 "N" 8 "D" ;
VAL_ 392 GEAR 26 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; VAL_ 392 GEAR 26 "S" 4 "D" 3 "N" 2 "R" 1 "P" ;
VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; VAL_ 422 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ;

@ -80,13 +80,13 @@ BO_ 614 STEERING_IPAS: 8 IPAS
BO_ 643 PRE_COLLISION: 8 XXX BO_ 643 PRE_COLLISION: 8 XXX
BO_ 740 STEERING_LKA: 8 XXX BO_ 740 STEERING_LKA: 5 XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX
SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
BO_ 742 LEAD_INFO: 8 DSU BO_ 742 LEAD_INFO: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU

@ -0,0 +1,30 @@
CM_ "IMPORT _toyota_2017.dbc"
BO_ 550 BRAKE_MODULE: 8 XXX
SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX
SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX
SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX
BO_ 581 GAS_PEDAL: 5 XXX
SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX
BO_ 608 STEER_TORQUE_SENSOR: 8 XXX
SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX
SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX
SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 610 EPS_STATUS: 5 EPS
SG_ STATE : 3|4@0+ (1,0) [0|15] "" XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
BO_ 956 GEAR_PACKET: 8 XXX
SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX
CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force";
CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8";
CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered";
VAL_ 610 STATE 5 "override" 3 "enabled" 1 "disabled";
VAL_ 610 LKA_STATE 50 "temporary_fault";
VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P";

@ -5,7 +5,7 @@ BO_ 550 BRAKE_MODULE: 8 XXX
SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX
SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX
BO_ 581 GAS_PEDAL: 8 XXX BO_ 581 GAS_PEDAL: 5 XXX
SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX
BO_ 608 STEER_TORQUE_SENSOR: 8 XXX BO_ 608 STEER_TORQUE_SENSOR: 8 XXX

@ -0,0 +1,210 @@
CM_ "AUTOGENERATED FILE, DO NOT EDIT"
CM_ "Imported file _toyota_2017.dbc starts here"
VERSION ""
NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_
CAT_
FILTER
BA_DEF_DEF_
EV_DATA_
ENVVAR_DATA_
SGTYPE_
SGTYPE_VAL_
BA_DEF_SGTYPE_
BA_SGTYPE_
SIG_TYPE_REF_
VAL_TABLE_
SIG_GROUP_
SIG_VALTYPE_
SIGTYPE_VALTYPE_
BO_TX_BU_
BA_DEF_REL_
BA_REL_
BA_DEF_DEF_REL_
BU_SG_REL_
BU_EV_REL_
BU_BO_REL_
SG_MUL_VAL_
BS_:
BU_: XXX DSU HCU EPS IPAS
BO_ 36 KINEMATICS: 8 XXX
SG_ ACCEL_Y : 33|10@0+ (1,-512) [0|65535] "" XXX
SG_ YAW_RATE : 1|10@0+ (1,-512) [0|65535] "" XXX
SG_ STEERING_TORQUE : 17|10@0+ (1,-512) [0|65535] "" XXX
BO_ 166 BRAKE: 8 XXX
SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX
SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX
BO_ 170 WHEEL_SPEEDS: 8 XXX
SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "kph" XXX
SG_ WHEEL_SPEED_FL : 23|16@0+ (0.01,-67.67) [0|250] "kph" XXX
SG_ WHEEL_SPEED_RR : 39|16@0+ (0.01,-67.67) [0|250] "kph" XXX
SG_ WHEEL_SPEED_RL : 55|16@0+ (0.01,-67.67) [0|250] "kph" XXX
BO_ 180 SPEED: 8 XXX
SG_ ENCODER : 39|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
SG_ SPEED : 47|16@0+ (0.01,0) [0|250] "kph" XXX
BO_ 466 PCM_CRUISE: 8 XXX
SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX
SG_ STANDSTILL_ON : 12|1@0+ (1,0) [0|1] "" XXX
SG_ ACCEL_NET : 23|16@0- (0.001,0) [-20|20] "m/s2" XXX
SG_ CRUISE_STATE : 55|4@0+ (1,0) [0|15] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 552 ACCELEROMETER: 8 XXX
SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "" XXX
SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s2" XXX
BO_ 560 BRAKE_MODULE2: 7 XXX
SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX
BO_ 614 STEERING_IPAS: 8 IPAS
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
SG_ ANGLE : 3|12@0- (1,0) [0|16777215] "" XXX
SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX
SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX
SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX
SG_ SET_ME_X00 : 55|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 643 PRE_COLLISION: 8 XXX
BO_ 740 STEERING_LKA: 5 XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX
SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
BO_ 742 LEAD_INFO: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU
SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU
SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU
BO_ 835 ACC_CONTROL: 8 DSU
SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s2" HCU
BO_ 1556 STEERING_LEVERS: 8 XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
BO_ 37 STEER_ANGLE_SENSOR: 8 XXX
SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX
SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX
SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX
BO_ 467 PCM_CRUISE_2: 8 XXX
SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX
SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "kph" XXX
SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "kph" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 921 PCM_CRUISE_SM: 8 XXX
SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX
SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX
SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX
BO_ 951 ESP_CONTROL: 8 ESP
SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX
SG_ BRAKE_LIGHTS_ACC : 18|1@0+ (1,0) [0|1] "" XXX
BO_ 1041 ACC_HUD: 8 DSU
SG_ FCW : 4|1@0+ (1,0) [0|1] "" XXX
BO_ 1042 LKAS_HUD: 8 XXX
SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX
SG_ RIGHT_LINE : 3|2@0+ (1,0) [0|3] "" XXX
SG_ LEFT_LINE : 5|2@0+ (1,0) [0|3] "" XXX
SG_ SET_ME_1 : 7|2@0+ (1,0) [0|3] "" XXX
SG_ LDA_ALERT : 9|2@0+ (1,0) [0|3] "" XXX
SG_ TWO_BEEPS : 12|1@0+ (1,0) [0|1] "" XXX
SG_ ADJUSTING_CAMERA : 13|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_MALFUNCTION : 15|1@0+ (1,0) [0|1] "" XXX
SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX
BO_ 1553 UI_SEETING: 8 XXX
SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX
BO_ 1568 SEATS_DOORS: 8 XXX
SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_RR : 43|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_FR : 44|1@0+ (1,0) [0|1] "" XXX
BO_ 1570 LIGHT_STALK: 8 SCM
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
CM_ SG_ 36 ACCEL_Y "unit is tbd";
CM_ SG_ 36 YAW_RATE "verify";
CM_ SG_ 36 STEERING_TORQUE "does not seem the steer torque, tbd";
CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors";
CM_ SG_ 560 BRAKE_PRESSED "another brake pressed?";
CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel";
CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque";
CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value";
CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active";
CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set";
CM_ SG_ 37 STEER_RATE "factor is tbd";
CM_ SG_ 467 SET_SPEED "43 kph are shown as 28mph, so conversion isnt perfect";
CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph";
CM_ SG_ 921 UI_SET_SPEED "set speed shown in UI with user set unit";
CM_ SG_ 1042 SET_ME_1 "unclear what this is, but it's always 1 in drive traces";
CM_ SG_ 1042 REPEATED_BEEPS "recommended for fcw and other important alerts";
VAL_ 466 CRUISE_STATE 8 "active" 7 "standstill" 1 "off" ;
VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok" ;
VAL_ 614 STATE 3 "enabled" 1 "disabled";
VAL_ 614 DIRECTION_CMD 3 "right" 2 "center" 1 "left";
VAL_ 1553 UNITS 1 "km" 2 "miles";
VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left" ;
VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none";
VAL_ 1042 BARRIERS 3 "both" 2 "right" 1 "left" 0 "none";
VAL_ 1042 RIGHT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none";
VAL_ 1042 LEFT_LINE 3 "orange" 2 "double" 1 "solid" 0 "none";
VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted";
CM_ "CHFFR_METRIC 37 STEER_ANGLE STEER_ANGLE 0.36 180";
CM_ "lexus_rx_hybrid_2017_pt.dbc starts here"
BO_ 550 BRAKE_MODULE: 8 XXX
SG_ BRAKE_PRESSURE : 0|9@0+ (1,0) [0|511] "" XXX
SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX
SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX
BO_ 581 GAS_PEDAL: 5 XXX
SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX
BO_ 608 STEER_TORQUE_SENSOR: 8 XXX
SG_ STEER_TORQUE_EPS : 47|16@0- (0.73,0) [-20000|20000] "" XXX
SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX
SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 610 EPS_STATUS: 5 EPS
SG_ STATE : 3|4@0+ (1,0) [0|15] "" XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
BO_ 956 GEAR_PACKET: 8 XXX
SG_ GEAR : 13|6@0+ (1,0) [0|63] "" XXX
CM_ SG_ 550 BRAKE_PRESSURE "seems prop to pedal force";
CM_ SG_ 550 BRAKE_POSITION "seems proportional to pedal displacement, unclear the max value of 0x1c8";
CM_ SG_ 581 GAS_PEDAL "it seems slightly filtered";
VAL_ 610 STATE 5 "override" 3 "enabled" 1 "disabled";
VAL_ 610 LKA_STATE 50 "temporary_fault";
VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P";

@ -82,13 +82,13 @@ BO_ 614 STEERING_IPAS: 8 IPAS
BO_ 643 PRE_COLLISION: 8 XXX BO_ 643 PRE_COLLISION: 8 XXX
BO_ 740 STEERING_LKA: 8 XXX BO_ 740 STEERING_LKA: 5 XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX
SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
BO_ 742 LEAD_INFO: 8 DSU BO_ 742 LEAD_INFO: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU

@ -82,13 +82,13 @@ BO_ 614 STEERING_IPAS: 8 IPAS
BO_ 643 PRE_COLLISION: 8 XXX BO_ 643 PRE_COLLISION: 8 XXX
BO_ 740 STEERING_LKA: 8 XXX BO_ 740 STEERING_LKA: 5 XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX
SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
BO_ 742 LEAD_INFO: 8 DSU BO_ 742 LEAD_INFO: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU

@ -82,13 +82,13 @@ BO_ 614 STEERING_IPAS: 8 IPAS
BO_ 643 PRE_COLLISION: 8 XXX BO_ 643 PRE_COLLISION: 8 XXX
BO_ 740 STEERING_LKA: 8 XXX BO_ 740 STEERING_LKA: 5 XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX
SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
BO_ 742 LEAD_INFO: 8 DSU BO_ 742 LEAD_INFO: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU

@ -82,13 +82,13 @@ BO_ 614 STEERING_IPAS: 8 IPAS
BO_ 643 PRE_COLLISION: 8 XXX BO_ 643 PRE_COLLISION: 8 XXX
BO_ 740 STEERING_LKA: 8 XXX BO_ 740 STEERING_LKA: 5 XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX
SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX
SG_ CHECKSUM : 39|8@0+ (1,0) [0|255] "" XXX
BO_ 742 LEAD_INFO: 8 DSU BO_ 742 LEAD_INFO: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU
@ -185,7 +185,7 @@ BO_ 550 BRAKE_MODULE: 8 XXX
SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX SG_ BRAKE_POSITION : 16|9@0+ (1,0) [0|511] "" XXX
SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX SG_ BRAKE_PRESSED : 37|1@0+ (1,0) [0|1] "" XXX
BO_ 581 GAS_PEDAL: 8 XXX BO_ 581 GAS_PEDAL: 5 XXX
SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX SG_ GAS_PEDAL : 23|8@0+ (0.005,0) [0|1] "" XXX
BO_ 608 STEER_TORQUE_SENSOR: 8 XXX BO_ 608 STEER_TORQUE_SENSOR: 8 XXX

@ -1 +1 @@
v1.0.6 v1.0.7

@ -451,6 +451,7 @@ void _pigeon_send(const char *dat, int len) {
memcpy(&a[1], &dat[i], ll); memcpy(&a[1], &dat[i], ll);
pthread_mutex_lock(&usb_lock); pthread_mutex_lock(&usb_lock);
err = libusb_bulk_transfer(dev_handle, 2, a, ll+1, &sent, TIMEOUT); err = libusb_bulk_transfer(dev_handle, 2, a, ll+1, &sent, TIMEOUT);
if (err < 0) { handle_usb_issue(err, __func__); }
assert(err == 0); assert(err == 0);
assert(sent == ll+1); assert(sent == ll+1);
//hexdump(a, ll+1); //hexdump(a, ll+1);
@ -460,20 +461,24 @@ void _pigeon_send(const char *dat, int len) {
void pigeon_set_power(int power) { void pigeon_set_power(int power) {
pthread_mutex_lock(&usb_lock); pthread_mutex_lock(&usb_lock);
libusb_control_transfer(dev_handle, 0xc0, 0xd9, power, 0, NULL, 0, TIMEOUT); int err = libusb_control_transfer(dev_handle, 0xc0, 0xd9, power, 0, NULL, 0, TIMEOUT);
if (err < 0) { handle_usb_issue(err, __func__); }
pthread_mutex_unlock(&usb_lock); pthread_mutex_unlock(&usb_lock);
} }
void pigeon_set_baud(int baud) { void pigeon_set_baud(int baud) {
int err;
pthread_mutex_lock(&usb_lock); pthread_mutex_lock(&usb_lock);
libusb_control_transfer(dev_handle, 0xc0, 0xe2, 1, 0, NULL, 0, TIMEOUT); err = libusb_control_transfer(dev_handle, 0xc0, 0xe2, 1, 0, NULL, 0, TIMEOUT);
libusb_control_transfer(dev_handle, 0xc0, 0xe4, 1, baud/300, NULL, 0, TIMEOUT); if (err < 0) { handle_usb_issue(err, __func__); }
err = libusb_control_transfer(dev_handle, 0xc0, 0xe4, 1, baud/300, NULL, 0, TIMEOUT);
if (err < 0) { handle_usb_issue(err, __func__); }
pthread_mutex_unlock(&usb_lock); pthread_mutex_unlock(&usb_lock);
} }
void pigeon_init() { void pigeon_init() {
usleep(1000*1000); usleep(1000*1000);
LOGW("pigeon start"); LOGW("grey panda start");
// power off pigeon // power off pigeon
pigeon_set_power(0); pigeon_set_power(0);
@ -513,7 +518,7 @@ void pigeon_init() {
pigeon_send("\xB5\x62\x06\x01\x03\x00\x01\x07\x01\x13\x51"); pigeon_send("\xB5\x62\x06\x01\x03\x00\x01\x07\x01\x13\x51");
pigeon_send("\xB5\x62\x06\x01\x03\x00\x02\x15\x01\x22\x70"); pigeon_send("\xB5\x62\x06\x01\x03\x00\x02\x15\x01\x22\x70");
LOGW("pigeon is ready to fly"); LOGW("grey panda is ready to fly");
} }
@ -551,6 +556,7 @@ void *pigeon_thread(void *crap) {
while (alen < 0xfc0) { while (alen < 0xfc0) {
pthread_mutex_lock(&usb_lock); pthread_mutex_lock(&usb_lock);
int len = libusb_control_transfer(dev_handle, 0xc0, 0xe0, 1, 0, dat+alen, 0x40, TIMEOUT); int len = libusb_control_transfer(dev_handle, 0xc0, 0xe0, 1, 0, dat+alen, 0x40, TIMEOUT);
if (len < 0) { handle_usb_issue(len, __func__); }
pthread_mutex_unlock(&usb_lock); pthread_mutex_unlock(&usb_lock);
if (len <= 0) break; if (len <= 0) break;

@ -8,6 +8,8 @@
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0])) #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
unsigned int honda_checksum(unsigned int address, uint64_t d, int l);
unsigned int toyota_checksum(unsigned int address, uint64_t d, int l);
struct SignalPackValue { struct SignalPackValue {
const char* name; const char* name;

@ -67,7 +67,7 @@ typedef struct {
void* can_init(int bus, const char* dbc_name, void* can_init(int bus, const char* dbc_name,
size_t num_message_options, const MessageParseOptions* message_options, size_t num_message_options, const MessageParseOptions* message_options,
size_t num_signal_options, const SignalParseOptions* signal_options); size_t num_signal_options, const SignalParseOptions* signal_options, bool sendcan);
void can_update(void* can, uint64_t sec, bool wait); void can_update(void* can, uint64_t sec, bool wait);
@ -77,8 +77,7 @@ const DBC* dbc_lookup(const char* dbc_name);
void* canpack_init(const char* dbc_name); void* canpack_init(const char* dbc_name);
uint64_t canpack_pack(void* inst, uint32_t address, size_t num_vals, const SignalPackValue *vals); uint64_t canpack_pack(void* inst, uint32_t address, size_t num_vals, const SignalPackValue *vals, int counter);
""") """)
libdbc = ffi.dlopen(libdbc_fn) libdbc = ffi.dlopen(libdbc_fn)

@ -5,6 +5,7 @@
#include <utility> #include <utility>
#include <algorithm> #include <algorithm>
#include <map> #include <map>
#include <cmath>
#include "common.h" #include "common.h"
@ -12,70 +13,104 @@
namespace { namespace {
class CANPacker { uint64_t set_value(uint64_t ret, Signal sig, int64_t ival){
public: uint64_t mask = ((1ULL << sig.b2)-1) << sig.bo;
CANPacker(const std::string& dbc_name) { uint64_t dat = (ival & ((1ULL << sig.b2)-1)) << sig.bo;
dbc = dbc_lookup(dbc_name); ret &= ~mask;
assert(dbc); ret |= dat;
return ret;
for (int i=0; i<dbc->num_msgs; i++) { }
const Msg* msg = &dbc->msgs[i];
for (int j=0; j<msg->num_sigs; j++) { class CANPacker {
const Signal* sig = &msg->sigs[j]; public:
signal_lookup[std::make_pair(msg->address, std::string(sig->name))] = *sig; CANPacker(const std::string& dbc_name) {
dbc = dbc_lookup(dbc_name);
assert(dbc);
for (int i=0; i<dbc->num_msgs; i++) {
const Msg* msg = &dbc->msgs[i];
message_lookup[msg->address] = *msg;
for (int j=0; j<msg->num_sigs; j++) {
const Signal* sig = &msg->sigs[j];
signal_lookup[std::make_pair(msg->address, std::string(sig->name))] = *sig;
}
} }
} }
}
uint64_t pack(uint32_t address, const std::vector<SignalPackValue> &signals) { uint64_t pack(uint32_t address, const std::vector<SignalPackValue> &signals, int counter) {
uint64_t ret = 0; uint64_t ret = 0;
for (const auto& sigval : signals) { for (const auto& sigval : signals) {
std::string name = std::string(sigval.name); std::string name = std::string(sigval.name);
double value = sigval.value; double value = sigval.value;
auto sig_it = signal_lookup.find(std::make_pair(address, name));
if (sig_it == signal_lookup.end()) {
WARN("undefined signal %s - %d\n", name.c_str(), address);
continue;
}
auto sig = sig_it->second;
int64_t ival = (int64_t)(round((value - sig.offset) / sig.factor));
if (ival < 0) {
ival = (1ULL << sig.b2) + ival;
}
ret = set_value(ret, sig, ival);
}
if (counter >= 0){
auto sig_it = signal_lookup.find(std::make_pair(address, "COUNTER"));
if (sig_it == signal_lookup.end()) {
WARN("COUNTER not defined\n");
return ret;
}
auto sig = sig_it->second;
auto sig_it = signal_lookup.find(make_pair(address, name)); if (sig.type != SignalType::HONDA_COUNTER){
if (sig_it == signal_lookup.end()) { WARN("COUNTER signal type not valid\n");
WARN("undefined signal %s", name.c_str()); }
continue;
ret = set_value(ret, sig, counter);
} }
auto sig = sig_it->second;
int64_t ival = (int64_t)((value - sig.offset) / sig.factor); auto sig_it = signal_lookup.find(std::make_pair(address, "CHECKSUM"));
if (ival < 0) { if (sig_it != signal_lookup.end()) {
WARN("signed pack unsupported right now"); auto sig = sig_it->second;
continue; if (sig.type == SignalType::HONDA_CHECKSUM){
unsigned int chksm = honda_checksum(address, ret, message_lookup[address].size);
ret = set_value(ret, sig, chksm);
}
else if (sig.type == SignalType::TOYOTA_CHECKSUM){
unsigned int chksm = toyota_checksum(address, ret, message_lookup[address].size);
ret = set_value(ret, sig, chksm);
} else {
WARN("CHECKSUM signal type not valid\n");
}
} }
uint64_t mask = ((1ULL << sig.b2)-1) << sig.bo; return ret;
uint64_t dat = (ival & ((1ULL << sig.b2)-1)) << sig.bo;
ret &= ~mask;
ret |= dat;
} }
return ret;
}
private: private:
const DBC *dbc = NULL; const DBC *dbc = NULL;
std::map<std::pair<uint32_t, std::string>, Signal> signal_lookup; std::map<std::pair<uint32_t, std::string>, Signal> signal_lookup;
}; std::map<uint32_t, Msg> message_lookup;
};
} }
extern "C" { extern "C" {
void* canpack_init(const char* dbc_name) {
CANPacker *ret = new CANPacker(std::string(dbc_name));
return (void*)ret;
}
void* canpack_init(const char* dbc_name) { uint64_t canpack_pack(void* inst, uint32_t address, size_t num_vals, const SignalPackValue *vals, int counter, bool checksum) {
CANPacker *ret = new CANPacker(std::string(dbc_name)); CANPacker *cp = (CANPacker*)inst;
return (void*)ret;
}
uint64_t canpack_pack(void* inst, uint32_t address, size_t num_vals, const SignalPackValue *vals) {
CANPacker *cp = (CANPacker*)inst;
return cp->pack(address, std::vector<SignalPackValue>(vals, vals+num_vals)); return cp->pack(address, std::vector<SignalPackValue>(vals, vals+num_vals), counter);
} }
} }

@ -1,13 +1,26 @@
import struct import struct
import numbers
from selfdrive.can.libdbc_py import libdbc, ffi from selfdrive.can.libdbc_py import libdbc, ffi
class CANPacker(object): class CANPacker(object):
def __init__(self, dbc_name): def __init__(self, dbc_name):
self.packer = libdbc.canpack_init(dbc_name) self.packer = libdbc.canpack_init(dbc_name)
self.dbc = libdbc.dbc_lookup(dbc_name)
self.sig_names = {} self.sig_names = {}
self.name_to_address_and_size = {}
self.address_to_size = {}
def pack(self, addr, values): num_msgs = self.dbc[0].num_msgs
for i in range(num_msgs):
msg = self.dbc[0].msgs[i]
name = ffi.string(msg.name)
address = msg.address
self.name_to_address_and_size[name] = (address, msg.size)
self.address_to_size[address] = msg.size
def pack(self, addr, values, counter):
# values: [(signal_name, signal_value)] # values: [(signal_name, signal_value)]
values_thing = [] values_thing = []
@ -22,10 +35,19 @@ class CANPacker(object):
values_c = ffi.new("SignalPackValue[]", values_thing) values_c = ffi.new("SignalPackValue[]", values_thing)
return libdbc.canpack_pack(self.packer, addr, len(values_thing), values_c) return libdbc.canpack_pack(self.packer, addr, len(values_thing), values_c, counter)
def pack_bytes(self, addr, values, counter=-1):
if isinstance(addr, numbers.Number):
size = self.address_to_size[addr]
else:
addr, size = self.name_to_address_and_size[addr]
r = struct.pack(">Q", self.pack(addr, values, counter))
return addr, r[:size]
def pack_bytes(self, addr, values): def make_can_msg(self, addr, bus, values, counter=-1):
return struct.pack(">Q", self.pack(addr, values)) addr, msg = self.pack_bytes(addr, values, counter)
return [addr, 0, msg, bus]
if __name__ == "__main__": if __name__ == "__main__":

@ -27,19 +27,6 @@
#define MAX_BAD_COUNTER 5 #define MAX_BAD_COUNTER 5
namespace {
uint64_t read_u64_be(const uint8_t* v) {
return (((uint64_t)v[0] << 56)
| ((uint64_t)v[1] << 48)
| ((uint64_t)v[2] << 40)
| ((uint64_t)v[3] << 32)
| ((uint64_t)v[4] << 24)
| ((uint64_t)v[5] << 16)
| ((uint64_t)v[6] << 8)
| (uint64_t)v[7]);
}
unsigned int honda_checksum(unsigned int address, uint64_t d, int l) { unsigned int honda_checksum(unsigned int address, uint64_t d, int l) {
d >>= ((8-l)*8); // remove padding d >>= ((8-l)*8); // remove padding
d >>= 4; // remove checksum d >>= 4; // remove checksum
@ -60,10 +47,24 @@ unsigned int toyota_checksum(unsigned int address, uint64_t d, int l) {
unsigned int s = l; unsigned int s = l;
while (address) { s += address & 0xff; address >>= 8; } while (address) { s += address & 0xff; address >>= 8; }
while (d) { s += d & 0xff; d >>= 8; } while (d) { s += d & 0xff; d >>= 8; }
return s & 0xFF; return s & 0xFF;
} }
namespace {
uint64_t read_u64_be(const uint8_t* v) {
return (((uint64_t)v[0] << 56)
| ((uint64_t)v[1] << 48)
| ((uint64_t)v[2] << 40)
| ((uint64_t)v[3] << 32)
| ((uint64_t)v[4] << 24)
| ((uint64_t)v[5] << 16)
| ((uint64_t)v[6] << 8)
| (uint64_t)v[7]);
}
struct MessageState { struct MessageState {
uint32_t address; uint32_t address;
unsigned int size; unsigned int size;
@ -99,7 +100,7 @@ struct MessageState {
return false; return false;
} }
} else if (sig.type == SignalType::TOYOTA_CHECKSUM) { } else if (sig.type == SignalType::TOYOTA_CHECKSUM) {
// DEBUG("CHECKSUM %d %d %018llX - %lld vs %d\n", address, size, dat, tmp, toyota_checksum(address, dat, size)); // INFO("CHECKSUM %d %d %018llX - %lld vs %d\n", address, size, dat, tmp, toyota_checksum(address, dat, size));
if (toyota_checksum(address, dat, size) != tmp) { if (toyota_checksum(address, dat, size) != tmp) {
INFO("%X CHECKSUM FAIL\n", address); INFO("%X CHECKSUM FAIL\n", address);
@ -140,13 +141,19 @@ class CANParser {
public: public:
CANParser(int abus, const std::string& dbc_name, CANParser(int abus, const std::string& dbc_name,
const std::vector<MessageParseOptions> &options, const std::vector<MessageParseOptions> &options,
const std::vector<SignalParseOptions> &sigoptions) const std::vector<SignalParseOptions> &sigoptions,
bool sendcan)
: bus(abus) { : bus(abus) {
// connect to can on 8006 // connect to can on 8006
context = zmq_ctx_new(); context = zmq_ctx_new();
subscriber = zmq_socket(context, ZMQ_SUB); subscriber = zmq_socket(context, ZMQ_SUB);
zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, "", 0); zmq_setsockopt(subscriber, ZMQ_SUBSCRIBE, "", 0);
zmq_connect(subscriber, "tcp://127.0.0.1:8006");
if (sendcan) {
zmq_connect(subscriber, "tcp://127.0.0.1:8017");
} else {
zmq_connect(subscriber, "tcp://127.0.0.1:8006");
}
dbc = dbc_lookup(dbc_name); dbc = dbc_lookup(dbc_name);
assert(dbc); assert(dbc);
@ -274,7 +281,7 @@ class CANParser {
// extract the messages // extract the messages
capnp::FlatArrayMessageReader cmsg(amsg); capnp::FlatArrayMessageReader cmsg(amsg);
cereal::Event::Reader event = cmsg.getRoot<cereal::Event>(); cereal::Event::Reader event = cmsg.getRoot<cereal::Event>();
auto cans = event.getCan(); auto cans = event.getCan();
UpdateCans(sec, cans); UpdateCans(sec, cans);
@ -290,7 +297,7 @@ class CANParser {
for (const auto& kv : message_states) { for (const auto& kv : message_states) {
const auto& state = kv.second; const auto& state = kv.second;
if (sec != 0 && state.seen != sec) continue; if (sec != 0 && state.seen != sec) continue;
for (int i=0; i<state.parse_sigs.size(); i++) { for (int i=0; i<state.parse_sigs.size(); i++) {
const Signal &sig = state.parse_sigs[i]; const Signal &sig = state.parse_sigs[i];
ret.push_back((SignalValue){ ret.push_back((SignalValue){
@ -322,13 +329,14 @@ class CANParser {
extern "C" { extern "C" {
void* can_init(int bus, const char* dbc_name, void* can_init(int bus, const char* dbc_name,
size_t num_message_options, const MessageParseOptions* message_options, size_t num_message_options, const MessageParseOptions* message_options,
size_t num_signal_options, const SignalParseOptions* signal_options) { size_t num_signal_options, const SignalParseOptions* signal_options,
bool sendcan) {
CANParser* ret = new CANParser(bus, std::string(dbc_name), CANParser* ret = new CANParser(bus, std::string(dbc_name),
(message_options ? std::vector<MessageParseOptions>(message_options, message_options+num_message_options) (message_options ? std::vector<MessageParseOptions>(message_options, message_options+num_message_options)
: std::vector<MessageParseOptions>{}), : std::vector<MessageParseOptions>{}),
(signal_options ? std::vector<SignalParseOptions>(signal_options, signal_options+num_signal_options) (signal_options ? std::vector<SignalParseOptions>(signal_options, signal_options+num_signal_options)
: std::vector<SignalParseOptions>{})); : std::vector<SignalParseOptions>{}), sendcan);
return (void*)ret; return (void*)ret;
} }
@ -376,7 +384,7 @@ int main(int argc, char** argv) {
{0x30c, 0}, {0x30c, 0},
}, },
std::vector<SignalParseOptions>{ std::vector<SignalParseOptions>{
// sig_name, sig_address, default // sig_name, sig_address, default
{0x158, "XMISSION_SPEED", 0}, {0x158, "XMISSION_SPEED", 0},
{0x1d0, "WHEEL_SPEED_FL", 0}, {0x1d0, "WHEEL_SPEED_FL", 0},
{0x1d0, "WHEEL_SPEED_FR", 0}, {0x1d0, "WHEEL_SPEED_FR", 0},

@ -1,4 +1,3 @@
import os
import time import time
from collections import defaultdict from collections import defaultdict
import numbers import numbers
@ -6,7 +5,7 @@ import numbers
from selfdrive.can.libdbc_py import libdbc, ffi from selfdrive.can.libdbc_py import libdbc, ffi
class CANParser(object): class CANParser(object):
def __init__(self, dbc_name, signals, checks=[], bus=0): def __init__(self, dbc_name, signals, checks=[], bus=0, sendcan=False):
self.can_valid = True self.can_valid = True
self.vl = defaultdict(dict) self.vl = defaultdict(dict)
self.ts = defaultdict(dict) self.ts = defaultdict(dict)
@ -56,12 +55,12 @@ class CANParser(object):
message_options_c = ffi.new("MessageParseOptions[]", [ message_options_c = ffi.new("MessageParseOptions[]", [
{ {
'address': address, 'address': msg_address,
'check_frequency': freq, 'check_frequency': freq,
} for address, freq in message_options.iteritems()]) } for msg_address, freq in message_options.iteritems()])
self.can = libdbc.can_init(bus, dbc_name, len(message_options_c), message_options_c, self.can = libdbc.can_init(bus, dbc_name, len(message_options_c), message_options_c,
len(signal_options_c), signal_options_c) len(signal_options_c), signal_options_c, sendcan)
self.p_can_valid = ffi.new("bool*") self.p_can_valid = ffi.new("bool*")

@ -26,11 +26,28 @@ msgs = [(address, msg_name, msg_size, sorted(msg_sigs, key=lambda s: s.name not
if can_dbc.name.startswith("honda") or can_dbc.name.startswith("acura"): if can_dbc.name.startswith("honda") or can_dbc.name.startswith("acura"):
checksum_type = "honda" checksum_type = "honda"
checksum_size = 4
elif can_dbc.name.startswith("toyota"): elif can_dbc.name.startswith("toyota"):
checksum_type = "toyota" checksum_type = "toyota"
checksum_size = 8
else: else:
checksum_type = None checksum_type = None
for address, msg_name, msg_size, sigs in msgs:
for sig in sigs:
if checksum_type is not None and sig.name == "CHECKSUM":
if sig.size != checksum_size:
sys.exit("CHECKSUM is not %d bits longs %s" % (checksum_size, msg_name))
if checksum_type == "honda" and sig.start_bit % 8 != 3:
sys.exit("CHECKSUM starts at wrong bit %s" % msg_name)
if checksum_type == "toyota" and sig.start_bit % 8 != 7:
sys.exit("CHECKSUM starts at wrong bit %s" % msg_name)
if checksum_type == "honda" and sig.name == "COUNTER":
if sig.size != 2:
sys.exit("COUNTER is not 2 bits longs %s" % msg_name)
if sig.start_bit % 8 != 5:
sys.exit("COUNTER starts at wrong bit %s" % msg_name)
# Fail on duplicate messgae names # Fail on duplicate messgae names
c = Counter([msg_name for address, msg_name, msg_size, sigs in msgs]) c = Counter([msg_name for address, msg_name, msg_size, sigs in msgs])

@ -1,5 +1,4 @@
import os import os
from cereal import car
from common.realtime import sec_since_boot from common.realtime import sec_since_boot
from common.fingerprints import eliminate_incompatible_cars, all_known_cars from common.fingerprints import eliminate_incompatible_cars, all_known_cars
@ -27,11 +26,13 @@ interfaces = {
HONDA.ACURA_ILX: HondaInterface, HONDA.ACURA_ILX: HondaInterface,
HONDA.CRV: HondaInterface, HONDA.CRV: HondaInterface,
HONDA.ODYSSEY: HondaInterface, HONDA.ODYSSEY: HondaInterface,
HONDA.ACURA_RDX: HondaInterface,
TOYOTA.PRIUS: ToyotaInterface, TOYOTA.PRIUS: ToyotaInterface,
TOYOTA.RAV4: ToyotaInterface, TOYOTA.RAV4: ToyotaInterface,
TOYOTA.RAV4H: ToyotaInterface, TOYOTA.RAV4H: ToyotaInterface,
TOYOTA.COROLLA: ToyotaInterface, TOYOTA.COROLLA: ToyotaInterface,
TOYOTA.LEXUS_RXH: ToyotaInterface,
"simulator2": Sim2Interface, "simulator2": Sim2Interface,
"mock": MockInterface "mock": MockInterface
@ -62,7 +63,8 @@ def fingerprint(logcan, timeout):
# message has elapsed, exit. Toyota needs higher time_fingerprint, since DSU does not # message has elapsed, exit. Toyota needs higher time_fingerprint, since DSU does not
# broadcast immediately # broadcast immediately
if len(candidate_cars) == 1 and st is not None: if len(candidate_cars) == 1 and st is not None:
time_fingerprint = 1.0 if "TOYOTA" in candidate_cars[0] else 0.1 # TODO: better way to decide to wait more if Toyota
time_fingerprint = 1.0 if ("TOYOTA" in candidate_cars[0] or "LEXUS" in candidate_cars[0]) else 0.1
if (ts-st) > time_fingerprint: if (ts-st) > time_fingerprint:
break break

@ -2,7 +2,6 @@ from collections import namedtuple
import os import os
from selfdrive.boardd.boardd import can_list_to_can_capnp from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.controls.lib.drive_helpers import rate_limit from selfdrive.controls.lib.drive_helpers import rate_limit
from common.realtime import sec_since_boot
from common.numpy_fast import clip from common.numpy_fast import clip
from . import hondacan from . import hondacan
from .values import AH from .values import AH
@ -115,13 +114,12 @@ class CarController(object):
# **** process the car messages **** # **** process the car messages ****
# *** compute control surfaces *** # *** compute control surfaces ***
tt = sec_since_boot()
GAS_MAX = 1004 GAS_MAX = 1004
BRAKE_MAX = 1024/4 BRAKE_MAX = 1024/4
if CS.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY): if CS.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY):
is_fw_modified = os.getenv("DONGLE_ID") in ['b0f5a01cf604185c'] is_fw_modified = os.getenv("DONGLE_ID") in ['99c94dc769b5d96e']
STEER_MAX = 0x1FFF if is_fw_modified else 0x1000 STEER_MAX = 0x1FFF if is_fw_modified else 0x1000
elif CS.crv: elif CS.CP.carFingerprint in (CAR.CRV, CAR.ACURA_RDX):
STEER_MAX = 0x3e8 # CR-V only uses 12-bits and requires a lower value (max value from energee) STEER_MAX = 0x3e8 # CR-V only uses 12-bits and requires a lower value (max value from energee)
else: else:
STEER_MAX = 0xF00 STEER_MAX = 0xF00

@ -1,7 +1,5 @@
import os import os
from cereal import car
from common.numpy_fast import interp from common.numpy_fast import interp
import selfdrive.messaging as messaging
from selfdrive.can.parser import CANParser from selfdrive.can.parser import CANParser
from selfdrive.config import Conversions as CV from selfdrive.config import Conversions as CV
from common.kalman.simple_kalman import KF1D from common.kalman.simple_kalman import KF1D
@ -23,7 +21,7 @@ def parse_gear_shifter(can_gear_shifter, car_fingerprint):
return "drive" return "drive"
elif can_gear_shifter == 0xa: elif can_gear_shifter == 0xa:
return "sport" return "sport"
elif car_fingerprint in (CAR.CIVIC, CAR.CRV): elif car_fingerprint in (CAR.CIVIC, CAR.CRV, CAR.ACURA_RDX):
if can_gear_shifter == 0x4: if can_gear_shifter == 0x4:
return "neutral" return "neutral"
elif can_gear_shifter == 0x8: elif can_gear_shifter == 0x8:
@ -115,10 +113,12 @@ def get_can_signals(CP):
elif CP.carFingerprint == CAR.CRV: elif CP.carFingerprint == CAR.CRV:
dbc_f = 'honda_crv_touring_2016_can_generated.dbc' dbc_f = 'honda_crv_touring_2016_can_generated.dbc'
signals += [("MAIN_ON", "SCM_BUTTONS", 0)] signals += [("MAIN_ON", "SCM_BUTTONS", 0)]
elif CP.carFingerprint == CAR.ACURA_RDX:
dbc_f = 'acura_rdx_2018_can_generated.dbc'
signals += [("MAIN_ON", "SCM_BUTTONS", 0)]
elif CP.carFingerprint == CAR.ODYSSEY: elif CP.carFingerprint == CAR.ODYSSEY:
dbc_f = 'honda_odyssey_exl_2018_generated.dbc' dbc_f = 'honda_odyssey_exl_2018_generated.dbc'
signals += [("CAR_GAS", "GAS_PEDAL_2", 0), signals += [("MAIN_ON", "SCM_FEEDBACK", 0),
("MAIN_ON", "SCM_FEEDBACK", 0),
("EPB_STATE", "EPB_STATUS", 0), ("EPB_STATE", "EPB_STATUS", 0),
("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0)] ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0)]
checks += [("EPB_STATUS", 50)] checks += [("EPB_STATUS", 50)]
@ -235,6 +235,7 @@ class CarState(object):
else: else:
self.park_brake = 0 # TODO self.park_brake = 0 # TODO
self.brake_hold = 0 # TODO self.brake_hold = 0 # TODO
self.main_on = cp.vl["SCM_BUTTONS"]['MAIN_ON'] self.main_on = cp.vl["SCM_BUTTONS"]['MAIN_ON']
self.cruise_speed_offset = calc_cruise_offset(cp.vl["CRUISE_PARAMS"]['CRUISE_SPEED_OFFSET'], self.v_ego) self.cruise_speed_offset = calc_cruise_offset(cp.vl["CRUISE_PARAMS"]['CRUISE_SPEED_OFFSET'], self.v_ego)
@ -242,12 +243,16 @@ class CarState(object):
self.pedal_gas = cp.vl["POWERTRAIN_DATA"]['PEDAL_GAS'] self.pedal_gas = cp.vl["POWERTRAIN_DATA"]['PEDAL_GAS']
# crv doesn't include cruise control # crv doesn't include cruise control
if self.CP.carFingerprint != CAR.CRV: if self.CP.carFingerprint in (CAR.CRV, CAR.ODYSSEY, CAR.ACURA_RDX):
self.car_gas = cp.vl["GAS_PEDAL_2"]['CAR_GAS']
else:
self.car_gas = self.pedal_gas self.car_gas = self.pedal_gas
else:
self.car_gas = cp.vl["GAS_PEDAL_2"]['CAR_GAS']
self.steer_override = abs(cp.vl["STEER_STATUS"]['STEER_TORQUE_SENSOR']) > 1200 #rdx has different steer override threshold
if self.CP.carFingerprint in (CAR.ACURA_RDX):
self.steer_override = abs(cp.vl["STEER_STATUS"]['STEER_TORQUE_SENSOR']) > 400
else:
self.steer_override = abs(cp.vl["STEER_STATUS"]['STEER_TORQUE_SENSOR']) > 1200
self.steer_torque_driver = cp.vl["STEER_STATUS"]['STEER_TORQUE_SENSOR'] self.steer_torque_driver = cp.vl["STEER_STATUS"]['STEER_TORQUE_SENSOR']
# brake switch has shown some single time step noise, so only considered when # brake switch has shown some single time step noise, so only considered when
@ -270,7 +275,6 @@ class CarState(object):
if __name__ == '__main__': if __name__ == '__main__':
import zmq import zmq
import time import time
from selfdrive.services import service_list
context = zmq.Context() context = zmq.Context()
class CarParams(object): class CarParams(object):

@ -49,11 +49,10 @@ def create_gas_command(gas_amount, idx):
msg = struct.pack("!H", gas_amount) msg = struct.pack("!H", gas_amount)
return make_can_msg(0x200, msg, idx, 0) return make_can_msg(0x200, msg, idx, 0)
def create_steering_control(apply_steer, car_fingerprint, idx): def create_steering_control(apply_steer, car_fingerprint, idx):
"""Creates a CAN message for the Honda DBC STEERING_CONTROL.""" """Creates a CAN message for the Honda DBC STEERING_CONTROL."""
commands = [] commands = []
if car_fingerprint == CAR.CRV: if car_fingerprint in (CAR.CRV, CAR.ACURA_RDX):
msg_0x194 = struct.pack("!h", apply_steer << 4) + ("\x80" if apply_steer != 0 else "\x00") msg_0x194 = struct.pack("!h", apply_steer << 4) + ("\x80" if apply_steer != 0 else "\x00")
commands.append(make_can_msg(0x194, msg_0x194, idx, 0)) commands.append(make_can_msg(0x194, msg_0x194, idx, 0))
else: else:
@ -80,7 +79,6 @@ def create_ui_commands(pcm_speed, hud, car_fingerprint, idx):
commands.append(make_can_msg(0x39f, msg_0x39f, idx, 0)) commands.append(make_can_msg(0x39f, msg_0x39f, idx, 0))
return commands return commands
def create_radar_commands(v_ego, car_fingerprint, idx): def create_radar_commands(v_ego, car_fingerprint, idx):
"""Creates an iterable of CAN messages for the radar system.""" """Creates an iterable of CAN messages for the radar system."""
commands = [] commands = []
@ -97,6 +95,9 @@ def create_radar_commands(v_ego, car_fingerprint, idx):
elif car_fingerprint == CAR.CRV: elif car_fingerprint == CAR.CRV:
msg_0x301 = "\x00\x00\x50\x02\x51\x00\x00" msg_0x301 = "\x00\x00\x50\x02\x51\x00\x00"
commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) commands.append(make_can_msg(0x300, msg_0x300, idx, 1))
elif car_fingerprint == CAR.ACURA_RDX:
msg_0x301 = "\x0f\x57\x4f\x02\x5a\x00\x00"
commands.append(make_can_msg(0x300, msg_0x300, idx, 1))
elif car_fingerprint == CAR.ODYSSEY: elif car_fingerprint == CAR.ODYSSEY:
msg_0x301 = "\x00\x00\x56\x02\x55\x00\x00" msg_0x301 = "\x00\x00\x56\x02\x55\x00\x00"
commands.append(make_can_msg(0x300, msg_0x300, idx, 1)) commands.append(make_can_msg(0x300, msg_0x300, idx, 1))

@ -158,7 +158,7 @@ class CarInterface(object):
ret.centerToFront = centerToFront_civic ret.centerToFront = centerToFront_civic
ret.steerRatio = 13.0 ret.steerRatio = 13.0
# Civic at comma has modified steering FW, so different tuning for the Neo in that car # Civic at comma has modified steering FW, so different tuning for the Neo in that car
is_fw_modified = os.getenv("DONGLE_ID") in ['b0f5a01cf604185c'] is_fw_modified = os.getenv("DONGLE_ID") in ['99c94dc769b5d96e']
ret.steerKp, ret.steerKi = [0.4, 0.12] if is_fw_modified else [0.8, 0.24] ret.steerKp, ret.steerKi = [0.4, 0.12] if is_fw_modified else [0.8, 0.24]
ret.longitudinalKpBP = [0., 5., 35.] ret.longitudinalKpBP = [0., 5., 35.]
@ -172,7 +172,7 @@ class CarInterface(object):
ret.centerToFront = ret.wheelbase * 0.37 ret.centerToFront = ret.wheelbase * 0.37
ret.steerRatio = 15.3 ret.steerRatio = 15.3
# Acura at comma has modified steering FW, so different tuning for the Neo in that car # Acura at comma has modified steering FW, so different tuning for the Neo in that car
is_fw_modified = os.getenv("DONGLE_ID") in ['cb38263377b873ee'] is_fw_modified = os.getenv("DONGLE_ID") in ['85a6c74d4ad9c310']
ret.steerKp, ret.steerKi = [0.4, 0.12] if is_fw_modified else [0.8, 0.24] ret.steerKp, ret.steerKi = [0.4, 0.12] if is_fw_modified else [0.8, 0.24]
ret.longitudinalKpBP = [0., 5., 35.] ret.longitudinalKpBP = [0., 5., 35.]
@ -191,6 +191,18 @@ class CarInterface(object):
ret.longitudinalKpV = [1.2, 0.8, 0.5] ret.longitudinalKpV = [1.2, 0.8, 0.5]
ret.longitudinalKiBP = [0., 35.] ret.longitudinalKiBP = [0., 35.]
ret.longitudinalKiV = [0.18, 0.12] ret.longitudinalKiV = [0.18, 0.12]
elif candidate == CAR.ACURA_RDX:
stop_and_go = False
ret.mass = 3935./2.205 + std_cargo
ret.wheelbase = 2.68
ret.centerToFront = ret.wheelbase * 0.38
ret.steerRatio = 15.0
ret.steerKp, ret.steerKi = 0.8, 0.24
ret.longitudinalKpBP = [0., 5., 35.]
ret.longitudinalKpV = [1.2, 0.8, 0.5]
ret.longitudinalKiBP = [0., 35.]
ret.longitudinalKiV = [0.18, 0.12]
elif candidate == CAR.ODYSSEY: elif candidate == CAR.ODYSSEY:
stop_and_go = False stop_and_go = False
ret.mass = 4354./2.205 + std_cargo ret.mass = 4354./2.205 + std_cargo

@ -1,6 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import numpy as np
from selfdrive.can.parser import CANParser from selfdrive.can.parser import CANParser

@ -1,14 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
import os
import time
import zmq import zmq
from common.realtime import sec_since_boot
import common.numpy_fast as np
from cereal import car from cereal import car
from selfdrive.config import Conversions as CV from selfdrive.config import Conversions as CV
from selfdrive.services import service_list from selfdrive.services import service_list
import selfdrive.messaging as messaging import selfdrive.messaging as messaging
from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event
# mocked car interface to work with chffrplus # mocked car interface to work with chffrplus
TS = 0.01 # 100Hz TS = 0.01 # 100Hz
@ -110,7 +105,6 @@ class CarInterface(object):
ret.steeringAngle = curvature * self.CP.steerRatio * self.CP.wheelbase * CV.RAD_TO_DEG ret.steeringAngle = curvature * self.CP.steerRatio * self.CP.wheelbase * CV.RAD_TO_DEG
events = [] events = []
#events.append(create_event('passive', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE]))
ret.events = events ret.events = events
return ret.as_reader() return ret.as_reader()

@ -1,14 +1,10 @@
from common.numpy_fast import clip, interp from common.numpy_fast import clip
from common.realtime import sec_since_boot
from selfdrive.boardd.boardd import can_list_to_can_capnp from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.controls.lib.drive_helpers import rate_limit
from selfdrive.car.toyota.toyotacan import make_can_msg, create_video_target,\ from selfdrive.car.toyota.toyotacan import make_can_msg, create_video_target,\
create_steer_command, create_ui_command, \ create_steer_command, create_ui_command, \
create_ipas_steer_command, create_accel_command, \ create_ipas_steer_command, create_accel_command, \
create_fcw_command create_fcw_command
from selfdrive.car.toyota.values import ECU, STATIC_MSGS from selfdrive.car.toyota.values import ECU, STATIC_MSGS
from common.fingerprints import TOYOTA as CAR
ACCEL_HYST_GAP = 0.02 # don't change accel command for small oscilalitons within this value ACCEL_HYST_GAP = 0.02 # don't change accel command for small oscilalitons within this value
ACCEL_MAX = 1500 # 1.5 m/s2 ACCEL_MAX = 1500 # 1.5 m/s2
@ -82,7 +78,6 @@ class CarController(object):
pcm_cancel_cmd, hud_alert, audible_alert): pcm_cancel_cmd, hud_alert, audible_alert):
# *** compute control surfaces *** # *** compute control surfaces ***
ts = sec_since_boot()
# steer torque is converted back to CAN reference (positive when steering right) # steer torque is converted back to CAN reference (positive when steering right)
apply_accel = actuators.gas - actuators.brake apply_accel = actuators.gas - actuators.brake

@ -1,5 +1,4 @@
import os import os
import selfdrive.messaging as messaging
from common.fingerprints import TOYOTA as CAR from common.fingerprints import TOYOTA as CAR
from selfdrive.can.parser import CANParser from selfdrive.can.parser import CANParser
from selfdrive.config import Conversions as CV from selfdrive.config import Conversions as CV
@ -20,7 +19,8 @@ def parse_gear_shifter(can_gear, car_fingerprint):
return "drive" return "drive"
elif can_gear == 0x4: elif can_gear == 0x4:
return "brake" return "brake"
elif car_fingerprint in [CAR.RAV4, CAR.RAV4H, CAR.COROLLA]: elif car_fingerprint in [CAR.RAV4, CAR.RAV4H,
CAR.LEXUS_RXH, CAR.COROLLA]:
if can_gear == 0x20: if can_gear == 0x20:
return "park" return "park"
elif can_gear == 0x10: elif can_gear == 0x10:
@ -45,6 +45,8 @@ def get_can_parser(CP):
dbc_f = 'toyota_rav4_2017_pt_generated.dbc' dbc_f = 'toyota_rav4_2017_pt_generated.dbc'
elif CP.carFingerprint == CAR.COROLLA: elif CP.carFingerprint == CAR.COROLLA:
dbc_f = 'toyota_corolla_2017_pt_generated.dbc' dbc_f = 'toyota_corolla_2017_pt_generated.dbc'
elif CP.carFingerprint == CAR.LEXUS_RXH:
dbc_f = 'lexus_rx_hybrid_2017_pt_generated.dbc'
signals = [ signals = [
# sig_name, sig_address, default # sig_name, sig_address, default

@ -1,11 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import os
from common.realtime import sec_since_boot from common.realtime import sec_since_boot
import common.numpy_fast as np
from cereal import car from cereal import car
from selfdrive.config import Conversions as CV from selfdrive.config import Conversions as CV
from selfdrive.services import service_list
import selfdrive.messaging as messaging
from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event
from selfdrive.controls.lib.vehicle_model import VehicleModel from selfdrive.controls.lib.vehicle_model import VehicleModel
from selfdrive.car.toyota.carstate import CarState, get_can_parser from selfdrive.car.toyota.carstate import CarState, get_can_parser
@ -79,34 +75,44 @@ class CarInterface(object):
if candidate == CAR.PRIUS: if candidate == CAR.PRIUS:
ret.safetyParam = 66 # see conversion factor for STEER_TORQUE_EPS in dbc file ret.safetyParam = 66 # see conversion factor for STEER_TORQUE_EPS in dbc file
ret.wheelbase = 2.70 ret.wheelbase = 2.70
ret.steerRatio = 14.5 #TODO: find exact value for Prius ret.steerRatio = 14.5 # TODO: find exact value for Prius
ret.mass = 3045./2.205 + std_cargo ret.mass = 3045./2.205 + std_cargo
ret.steerKp, ret.steerKi = 0.6, 0.05
ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594
ret.steerRateCost = 2.
elif candidate in [CAR.RAV4, CAR.RAV4H]: elif candidate in [CAR.RAV4, CAR.RAV4H]:
ret.safetyParam = 73 # see conversion factor for STEER_TORQUE_EPS in dbc file ret.safetyParam = 73 # see conversion factor for STEER_TORQUE_EPS in dbc file
ret.wheelbase = 2.65 ret.wheelbase = 2.65
ret.steerRatio = 14.5 # Rav4 2017 ret.steerRatio = 14.5 # Rav4 2017
ret.mass = 3650./2.205 + std_cargo # mean between normal and hybrid ret.mass = 3650./2.205 + std_cargo # mean between normal and hybrid
ret.steerKp, ret.steerKi = 0.6, 0.05
ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594
ret.steerRateCost = 1.
elif candidate == CAR.COROLLA: elif candidate == CAR.COROLLA:
ret.safetyParam = 100 # see conversion factor for STEER_TORQUE_EPS in dbc file ret.safetyParam = 100 # see conversion factor for STEER_TORQUE_EPS in dbc file
ret.wheelbase = 2.70 ret.wheelbase = 2.70
ret.steerRatio = 17.8 ret.steerRatio = 17.8
ret.mass = 2860./2.205 + std_cargo # mean between normal and hybrid ret.mass = 2860./2.205 + std_cargo # mean between normal and hybrid
ret.centerToFront = ret.wheelbase * 0.44
if candidate == CAR.COROLLA:
ret.steerKp, ret.steerKi = 0.2, 0.05 ret.steerKp, ret.steerKi = 0.2, 0.05
ret.steerKf = 0.00003 # full torque for 20 deg at 80mph means 0.00007818594 ret.steerKf = 0.00003 # full torque for 20 deg at 80mph means 0.00007818594
else: ret.steerRateCost = 1.
ret.steerKp, ret.steerKi = 0.6, 0.05 elif candidate == CAR.LEXUS_RXH:
ret.safetyParam = 100 # see conversion factor for STEER_TORQUE_EPS in dbc file
ret.wheelbase = 2.79
ret.steerRatio = 16. # official specs say 14.8, but it does not seem right
ret.mass = 4481./2.205 + std_cargo # mean between min and max
ret.steerKp, ret.steerKi = 0.6, 0.1
ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594 ret.steerKf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594
ret.steerRateCost = .8
ret.centerToFront = ret.wheelbase * 0.44
ret.longPidDeadzoneBP = [0., 9.] ret.longPidDeadzoneBP = [0., 9.]
ret.longPidDeadzoneV = [0., .15] ret.longPidDeadzoneV = [0., .15]
# min speed to enable ACC. if car can do stop and go, then set enabling speed # min speed to enable ACC. if car can do stop and go, then set enabling speed
# to a negative value, so it won't matter. # to a negative value, so it won't matter.
if candidate in [CAR.PRIUS, CAR.RAV4H]: # rav4 hybrid can do stop and go if candidate in [CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH]: # rav4 hybrid can do stop and go
ret.minEnableSpeed = -1. ret.minEnableSpeed = -1.
elif candidate in [CAR.RAV4, CAR.COROLLA]: # TODO: hack ICE to do stop and go elif candidate in [CAR.RAV4, CAR.COROLLA]: # TODO: hack ICE to do stop and go
ret.minEnableSpeed = 19. * CV.MPH_TO_MS ret.minEnableSpeed = 19. * CV.MPH_TO_MS
@ -154,17 +160,11 @@ class CarInterface(object):
ret.longitudinalKiBP = [0., 35.] ret.longitudinalKiBP = [0., 35.]
ret.longitudinalKiV = [0.54, 0.36] ret.longitudinalKiV = [0.54, 0.36]
if candidate in [CAR.PRIUS]:
ret.steerRateCost = 2.
elif candidate in [CAR.RAV4, CAR.RAV4H, CAR.COROLLA]:
ret.steerRateCost = 1.
return ret return ret
# returns a car.CarState # returns a car.CarState
def update(self, c): def update(self, c):
# ******************* do can recv ******************* # ******************* do can recv *******************
can_pub_main = []
canMonoTimes = [] canMonoTimes = []
self.cp.update(int(sec_since_boot() * 1e9), False) self.cp.update(int(sec_since_boot() * 1e9), False)
@ -189,7 +189,7 @@ class CarInterface(object):
ret.gearShifter = self.CS.gear_shifter ret.gearShifter = self.CS.gear_shifter
# gas pedal # gas pedal
ret.gas = self.CS.car_gas / 256.0 ret.gas = self.CS.car_gas
ret.gasPressed = self.CS.pedal_gas > 0 ret.gasPressed = self.CS.pedal_gas > 0
# brake pedal # brake pedal

@ -1,6 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import numpy as np
from selfdrive.can.parser import CANParser from selfdrive.can.parser import CANParser
from cereal import car from cereal import car
from common.realtime import sec_since_boot from common.realtime import sec_since_boot
@ -14,7 +13,6 @@ RADAR_MSGS = range(0x210, 0x220)
def _create_radard_can_parser(): def _create_radard_can_parser():
dbc_f = 'toyota_prius_2017_adas.dbc' dbc_f = 'toyota_prius_2017_adas.dbc'
msg_n = len(RADAR_MSGS) msg_n = len(RADAR_MSGS)
msg_last = RADAR_MSGS[-1]
signals = zip(['LONG_DIST'] * msg_n + ['NEW_TRACK'] * msg_n + ['LAT_DIST'] * msg_n + signals = zip(['LONG_DIST'] * msg_n + ['NEW_TRACK'] * msg_n + ['LAT_DIST'] * msg_n +
['REL_SPEED'] * msg_n + ['VALID'] * msg_n, ['REL_SPEED'] * msg_n + ['VALID'] * msg_n,
RADAR_MSGS * 5, RADAR_MSGS * 5,
@ -45,7 +43,7 @@ class RadarInterface(object):
while 1: while 1:
tm = int(sec_since_boot() * 1e9) tm = int(sec_since_boot() * 1e9)
updated_messages.update(self.rcp.update(tm, True)) updated_messages.update(self.rcp.update(tm, True))
# TODO: use msg_last # TODO: do not hardcode last msg
if 0x21f in updated_messages: if 0x21f in updated_messages:
break break

@ -1,6 +1,4 @@
import struct import struct
import common.numpy_fast as np
from selfdrive.config import Conversions as CV
# *** Toyota specific *** # *** Toyota specific ***
@ -9,21 +7,21 @@ def fix(msg, addr):
checksum = 0 checksum = 0
idh = (addr & 0xff00) >> 8 idh = (addr & 0xff00) >> 8
idl = (addr & 0xff) idl = (addr & 0xff)
checksum = idh + idl + len(msg) + 1 checksum = idh + idl + len(msg) + 1
for d_byte in msg: for d_byte in msg:
checksum += ord(d_byte) checksum += ord(d_byte)
#return msg + chr(checksum & 0xFF) #return msg + chr(checksum & 0xFF)
return msg + struct.pack("B", checksum & 0xFF) return msg + struct.pack("B", checksum & 0xFF)
def make_can_msg(addr, dat, alt, cks=False): def make_can_msg(addr, dat, alt, cks=False):
if cks: if cks:
dat = fix(dat, addr) dat = fix(dat, addr)
return [addr, 0, dat, alt] return [addr, 0, dat, alt]
def create_video_target(frame, addr): def create_video_target(frame, addr):
counter = frame & 0xff counter = frame & 0xff
msg = struct.pack("!BBBBBBB", counter, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00) msg = struct.pack("!BBBBBBB", counter, 0x03, 0xff, 0x00, 0x00, 0x00, 0x00)
@ -42,7 +40,7 @@ def create_ipas_steer_command(steer):
move = 0x40 move = 0x40
mode = 0x30 if steer else 0x10 mode = 0x30 if steer else 0x10
steer_h = (steer & 0xF00) >> 8 steer_h = (steer & 0xF00) >> 8
steer_l = steer & 0xff steer_l = steer & 0xff
@ -56,11 +54,11 @@ def create_steer_command(steer, raw_cnt):
counter = ((raw_cnt & 0x3f) << 1) | 0x80 counter = ((raw_cnt & 0x3f) << 1) | 0x80
if steer != 0: if steer != 0:
counter |= 1 counter |= 1
# hud # hud
# 00 => Regular # 00 => Regular
# 40 => Actively Steering (with beep) # 40 => Actively Steering (with beep)
# 80 => Actively Steering (without beep) # 80 => Actively Steering (without beep)
hud = 0x00 hud = 0x00
msg = struct.pack("!BhB", counter, steer, hud) msg = struct.pack("!BhB", counter, steer, hud)
@ -86,6 +84,6 @@ def create_fcw_command(fcw):
def create_ui_command(steer, sound1, sound2): def create_ui_command(steer, sound1, sound2):
msg = struct.pack("!BBBBBBBB", 0x54, 0x04 + steer + (sound2<<4), 0x0C, 0x00, msg = struct.pack("!BBBBBBBB", 0x54, 0x04 + steer + (sound2<<4), 0x0C, 0x00,
sound1, 0x2C, 0x38, 0x02) sound1, 0x2C, 0x38, 0x02)
return make_can_msg(0x412, msg, 0, False) return make_can_msg(0x412, msg, 0, False)

@ -7,48 +7,48 @@ class ECU:
# addr: (ecu, cars, bus, 1/freq*100, vl) # addr: (ecu, cars, bus, 1/freq*100, vl)
STATIC_MSGS = [(0x141, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 2, '\x00\x00\x00\x46'), STATIC_MSGS = [(0x141, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 2, '\x00\x00\x00\x46'),
(0x128, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 3, '\xf4\x01\x90\x83\x00\x37'), (0x128, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 3, '\xf4\x01\x90\x83\x00\x37'),
(0x292, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 3, '\x00\x00\x00\x00\x00\x00\x00\x9e'), (0x292, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 3, '\x00\x00\x00\x00\x00\x00\x00\x9e'),
(0x283, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 3, '\x00\x00\x00\x00\x00\x00\x8c'), (0x283, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 3, '\x00\x00\x00\x00\x00\x00\x8c'),
(0x2E6, ECU.DSU, (CAR.PRIUS, CAR.RAV4H), 0, 3, '\xff\xf8\x00\x08\x7f\xe0\x00\x4e'), (0x2E6, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, '\xff\xf8\x00\x08\x7f\xe0\x00\x4e'),
(0x2E7, ECU.DSU, (CAR.PRIUS, CAR.RAV4H), 0, 3, '\xa8\x9c\x31\x9c\x00\x00\x00\x02'), (0x2E7, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 3, '\xa8\x9c\x31\x9c\x00\x00\x00\x02'),
(0x240, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), (0x240, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'),
(0x241, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), (0x241, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'),
(0x244, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), (0x244, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'),
(0x245, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'), (0x245, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x10\x01\x00\x10\x01\x00'),
(0x248, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x00\x00\x00\x00\x00\x01'), (0x248, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 5, '\x00\x00\x00\x00\x00\x00\x01'),
(0x344, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 5, '\x00\x00\x01\x00\x00\x00\x00\x50'), (0x344, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 5, '\x00\x00\x01\x00\x00\x00\x00\x50'),
(0x160, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 7, '\x00\x00\x08\x12\x01\x31\x9c\x51'), (0x160, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 7, '\x00\x00\x08\x12\x01\x31\x9c\x51'),
(0x161, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 7, '\x00\x1e\x00\x00\x00\x80\x07'), (0x161, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 7, '\x00\x1e\x00\x00\x00\x80\x07'),
(0x32E, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 20, '\x00\x00\x00\x00\x00\x00\x00\x00'), (0x32E, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 20, '\x00\x00\x00\x00\x00\x00\x00\x00'),
(0x33E, ECU.DSU, (CAR.PRIUS, CAR.RAV4H), 0, 20, '\x0f\xff\x26\x40\x00\x1f\x00'), (0x33E, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 20, '\x0f\xff\x26\x40\x00\x1f\x00'),
(0x365, ECU.DSU, (CAR.PRIUS, CAR.RAV4H), 0, 20, '\x00\x00\x00\x80\x03\x00\x08'), (0x365, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 20, '\x00\x00\x00\x80\x03\x00\x08'),
(0x365, ECU.DSU, (CAR.RAV4, CAR.COROLLA), 0, 20, '\x00\x00\x00\x80\xfc\x00\x08'), (0x365, ECU.DSU, (CAR.RAV4, CAR.COROLLA), 0, 20, '\x00\x00\x00\x80\xfc\x00\x08'),
(0x366, ECU.DSU, (CAR.PRIUS, CAR.RAV4H), 0, 20, '\x00\x00\x4d\x82\x40\x02\x00'), (0x366, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 0, 20, '\x00\x00\x4d\x82\x40\x02\x00'),
(0x366, ECU.DSU, (CAR.RAV4, CAR.COROLLA), 0, 20, '\x00\x72\x07\xff\x09\xfe\x00'), (0x366, ECU.DSU, (CAR.RAV4, CAR.COROLLA), 0, 20, '\x00\x72\x07\xff\x09\xfe\x00'),
(0x367, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 40, '\x06\x00'), (0x367, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 40, '\x06\x00'),
(0x414, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x17\x00'), (0x414, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x17\x00'),
(0x489, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00'), (0x489, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00'),
(0x48a, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00'), (0x48a, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00'),
(0x48b, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x66\x06\x08\x0a\x02\x00\x00\x00'), (0x48b, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x66\x06\x08\x0a\x02\x00\x00\x00'),
(0x4d3, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x1C\x00\x00\x01\x00\x00\x00\x00'), (0x4d3, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x1C\x00\x00\x01\x00\x00\x00\x00'),
(0x130, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 1, 100, '\x00\x00\x00\x00\x00\x00\x38'), (0x130, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 1, 100, '\x00\x00\x00\x00\x00\x00\x38'),
(0x466, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4), 1, 100, '\x20\x20\xAD'), (0x466, ECU.CAM, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4), 1, 100, '\x20\x20\xAD'),
(0x466, ECU.CAM, (CAR.COROLLA), 1, 100, '\x24\x20\xB1'), (0x466, ECU.CAM, (CAR.COROLLA), 1, 100, '\x24\x20\xB1'),
(0x396, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\xBD\x00\x00\x00\x60\x0F\x02\x00'), (0x396, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\xBD\x00\x00\x00\x60\x0F\x02\x00'),
(0x43A, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x84\x00\x00\x00\x00\x00\x00\x00'), (0x43A, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x84\x00\x00\x00\x00\x00\x00\x00'),
(0x43B, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00\x00'), (0x43B, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00\x00'),
(0x497, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00\x00'), (0x497, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x00\x00\x00\x00\x00\x00\x00\x00'),
(0x4CC, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x0D\x00\x00\x00\x00\x00\x00\x00'), (0x4CC, ECU.APGS, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x0D\x00\x00\x00\x00\x00\x00\x00'),
(0x4CB, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.RAV4, CAR.COROLLA), 0, 100, '\x0c\x00\x00\x00\x00\x00\x00\x00'), (0x4CB, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH, CAR.RAV4, CAR.COROLLA), 0, 100, '\x0c\x00\x00\x00\x00\x00\x00\x00'),
(0x470, ECU.DSU, (CAR.PRIUS, CAR.RAV4H), 1, 100, '\x00\x00\x02\x7a'), (0x470, ECU.DSU, (CAR.PRIUS, CAR.RAV4H, CAR.LEXUS_RXH), 1, 100, '\x00\x00\x02\x7a'),
] ]

@ -1 +1 @@
#define COMMA_VERSION "0.4.1-openpilot" #define COMMA_VERSION "0.4.2-openpilot"

@ -73,7 +73,7 @@ def data_sample(CI, CC, thermal, calibration, health, poller, cal_status, overte
overtemp_proc = any(t > 950 for t in overtemp_proc = any(t > 950 for t in
(td.thermal.cpu0, td.thermal.cpu1, td.thermal.cpu2, (td.thermal.cpu0, td.thermal.cpu1, td.thermal.cpu2,
td.thermal.cpu3, td.thermal.mem, td.thermal.gpu)) td.thermal.cpu3, td.thermal.mem, td.thermal.gpu))
overtemp_bat = td.thermal.bat > 50000 # 50c overtemp_bat = td.thermal.bat > 60000 # 60c
overtemp = overtemp_proc or overtemp_bat overtemp = overtemp_proc or overtemp_bat
# under 15% of space free no enable allowed # under 15% of space free no enable allowed

@ -94,9 +94,9 @@ class LatControl(object):
output_steer = 0.0 output_steer = 0.0
self.pid.reset() self.pid.reset()
else: else:
dt = min(cur_time - self.angle_steers_des_time, _DT_MPC + _DT) + _DT # no greater than dt mpc + dt, to prevent too high extraps
# TODO: ideally we should interp, but for tuning reasons we keep the mpc solution # TODO: ideally we should interp, but for tuning reasons we keep the mpc solution
# constant for 0.05s. # constant for 0.05s.
#dt = min(cur_time - self.angle_steers_des_time, _DT_MPC + _DT) + _DT # no greater than dt mpc + dt, to prevent too high extraps
#self.angle_steers_des = self.angle_steers_des_prev + (dt / _DT_MPC) * (self.angle_steers_des_mpc - self.angle_steers_des_prev) #self.angle_steers_des = self.angle_steers_des_prev + (dt / _DT_MPC) * (self.angle_steers_des_mpc - self.angle_steers_des_prev)
self.angle_steers_des = self.angle_steers_des_mpc self.angle_steers_des = self.angle_steers_des_mpc
steers_max = get_steer_max(VM.CP, v_ego) steers_max = get_steer_max(VM.CP, v_ego)

@ -1,6 +1,4 @@
import numpy as np
from common.numpy_fast import clip, interp from common.numpy_fast import clip, interp
from selfdrive.config import Conversions as CV
from selfdrive.controls.lib.pid import PIController from selfdrive.controls.lib.pid import PIController
STOPPING_EGO_SPEED = 0.5 STOPPING_EGO_SPEED = 0.5

@ -7,7 +7,6 @@ import math
from collections import defaultdict from collections import defaultdict
from common.realtime import sec_since_boot from common.realtime import sec_since_boot
from common.params import Params
from common.numpy_fast import interp from common.numpy_fast import interp
import selfdrive.messaging as messaging import selfdrive.messaging as messaging
from selfdrive.swaglog import cloudlog from selfdrive.swaglog import cloudlog

@ -1,6 +1,5 @@
import os import os
import sys import sys
import math
import platform import platform
import numpy as np import numpy as np

@ -1,8 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import os
import zmq import zmq
import numpy as np import numpy as np
import numpy.matlib
import importlib import importlib
from collections import defaultdict from collections import defaultdict
from fastcluster import linkage_vector from fastcluster import linkage_vector
@ -16,7 +14,7 @@ from selfdrive.controls.lib.vehicle_model import VehicleModel
from selfdrive.swaglog import cloudlog from selfdrive.swaglog import cloudlog
from cereal import car from cereal import car
from common.params import Params from common.params import Params
from common.realtime import sec_since_boot, set_realtime_priority, Ratekeeper from common.realtime import set_realtime_priority, Ratekeeper
from common.kalman.ekf import EKF, SimpleSensor from common.kalman.ekf import EKF, SimpleSensor
DEBUG = False DEBUG = False

@ -1,7 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import sys import sys
import struct
from collections import defaultdict from collections import defaultdict
from common.realtime import sec_since_boot from common.realtime import sec_since_boot
import zmq import zmq

@ -19,7 +19,8 @@ msgs = {}
while True: while True:
lc = messaging.recv_sock(logcan, True) lc = messaging.recv_sock(logcan, True)
for c in lc.can: for c in lc.can:
if c.src == 0: # read also msgs sent by EON on CAN bus 0x80
if c.src%0x80 == 0:
msgs[c.address] = len(c.dat) msgs[c.address] = len(c.dat)
fingerprint = ', '.join("%d: %d" % v for v in sorted(msgs.items())) fingerprint = ', '.join("%d: %d" % v for v in sorted(msgs.items()))

@ -1,9 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import time
import subprocess import subprocess
from cffi import FFI from cffi import FFI
import ctypes
import numpy as np import numpy as np

@ -1,92 +0,0 @@
#!/usr/bin/env python
import time
import numpy as np
import zmq
from evdev import InputDevice
from select import select
from cereal import car
from common.realtime import Ratekeeper
import selfdrive.messaging as messaging
from selfdrive.services import service_list
from selfdrive.car import get_car
if __name__ == "__main__":
# ***** connect to joystick *****
# we use a Mad Catz V.1
dev = InputDevice("/dev/input/event8")
print dev
button_values = [0]*7
axis_values = [0.0, 0.0, 0.0]
# ***** connect to car *****
context = zmq.Context()
logcan = messaging.sub_sock(context, service_list['can'].port)
sendcan = messaging.pub_sock(context, service_list['sendcan'].port)
CI, CP = get_car(logcan, sendcan)
CC = car.CarControl.new_message()
rk = Ratekeeper(100)
while 1:
# **** handle joystick ****
r, w, x = select([dev], [], [], 0.0)
if dev in r:
for event in dev.read():
# button event
if event.type == 1:
btn = event.code - 288
if btn >= 0 and btn < 7:
button_values[btn] = int(event.value)
# axis move event
if event.type == 3:
if event.code < 3:
if event.code == 2:
axis_values[event.code] = np.clip((255-int(event.value))/250.0, 0.0, 1.0)
else:
DEADZONE = 5
if event.value-DEADZONE < 128 and event.value+DEADZONE > 128:
event.value = 128
axis_values[event.code] = np.clip((int(event.value)-128)/120.0, -1.0, 1.0)
print axis_values, button_values
# **** handle car ****
CS = CI.update(CC)
#print CS
CC = car.CarControl.new_message()
CC.enabled = True
CC.gas = float(np.clip(-axis_values[1], 0, 1.0))
CC.brake = float(np.clip(axis_values[1], 0, 1.0))
CC.steeringTorque = float(-axis_values[0])
CC.hudControl.speedVisible = bool(button_values[1])
CC.hudControl.lanesVisible = bool(button_values[2])
CC.hudControl.leadVisible = bool(button_values[3])
CC.cruiseControl.override = bool(button_values[0])
CC.cruiseControl.cancel = bool(button_values[-1])
CC.hudControl.setSpeed = float(axis_values[2] * 100.0)
# TODO: test alerts
CC.hudControl.visualAlert = "none"
CC.hudControl.audibleAlert = "none"
#print CC
if not CI.apply(CC):
print "CONTROLS FAILED"
rk.keep_time()

@ -1,52 +0,0 @@
#!/usr/bin/env python
import os
import zmq
from cereal import car
import selfdrive.messaging as messaging
from selfdrive.services import service_list
from selfdrive.car import get_car
def bpressed(CS, btype):
for b in CS.buttonEvents:
if b.type == btype:
return True
return False
def test_loop():
context = zmq.Context()
logcan = messaging.sub_sock(context, service_list['can'].port)
CI, CP = get_car(logcan)
state = 0
states = [
"'seatbeltNotLatched' in CS.errors",
"CS.gasPressed",
"CS.brakePressed",
"CS.steeringPressed",
"bpressed(CS, 'leftBlinker')",
"bpressed(CS, 'rightBlinker')",
"bpressed(CS, 'cancel')",
"bpressed(CS, 'accelCruise')",
"bpressed(CS, 'decelCruise')",
"bpressed(CS, 'altButton1')",
"'doorOpen' in CS.errors",
"False"]
while 1:
CC = car.CarControl.new_message()
# read CAN
CS = CI.update(CC)
while eval(states[state]) == True:
state += 1
print "IN STATE %d: waiting for %s" % (state, states[state])
#print CS
if __name__ == "__main__":
test_loop()

Binary file not shown.

@ -1,8 +1,6 @@
#!/usr/bin/env python2.7 #!/usr/bin/env python2.7
import os import os
import sys import sys
import time
import fcntl import fcntl
import errno import errno
import signal import signal
@ -53,7 +51,6 @@ from common.basedir import BASEDIR
sys.path.append(os.path.join(BASEDIR, "pyextra")) sys.path.append(os.path.join(BASEDIR, "pyextra"))
os.environ['BASEDIR'] = BASEDIR os.environ['BASEDIR'] = BASEDIR
import usb1
import zmq import zmq
from setproctitle import setproctitle from setproctitle import setproctitle
from smbus2 import SMBus from smbus2 import SMBus
@ -250,15 +247,19 @@ def manager_init():
if "-private" in subprocess.check_output(["git", "config", "--get", "remote.origin.url"]): if "-private" in subprocess.check_output(["git", "config", "--get", "remote.origin.url"]):
upstream = "origin/master" upstream = "origin/master"
else: else:
upstream = "origin/release" if 'chffrplus' in version:
upstream = "origin/release"
else:
upstream = "origin/release2"
dirty = subprocess.call(["git", "diff-index", "--quiet", upstream, "--"]) != 0 dirty = subprocess.call(["git", "diff-index", "--quiet", upstream, "--"]) != 0
cloudlog.info("dirty is %d" % dirty) cloudlog.info("dirty is %d" % dirty)
if not dirty: if not dirty:
os.environ['CLEAN'] = '1' os.environ['CLEAN'] = '1'
cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty) cloudlog.bind_global(dongle_id=dongle_id, version=version, dirty=dirty, is_eon=EON)
crash.bind_user(id=dongle_id) crash.bind_user(id=dongle_id)
crash.bind_extra(version=version, dirty=dirty) crash.bind_extra(version=version, dirty=dirty, is_eon=EON)
os.umask(0) os.umask(0)
try: try:
@ -463,7 +464,7 @@ def manager_thread():
if passive and not ignition_seen: if passive and not ignition_seen:
should_start = should_start or passive_starter.update(started_ts, location) should_start = should_start or passive_starter.update(started_ts, location)
# with 2% left, we killall, otherwise the phone is bricked # with 2% left, we killall, otherwise the phone will take a long time to boot
should_start = should_start and avail > 0.02 should_start = should_start and avail > 0.02
# require usb power # require usb power
@ -471,9 +472,10 @@ def manager_thread():
should_start = should_start and accepted_terms and (not do_uninstall) should_start = should_start and accepted_terms and (not do_uninstall)
# if any CPU gets above 107 or the battery gets above 53, kill all processes # if any CPU gets above 107 or the battery gets above 63, kill all processes
# controls will warn with CPU above 95 or battery above 50 # controls will warn with CPU above 95 or battery above 60
if max_temp > 107.0 or msg.thermal.bat >= 53000: if max_temp > 107.0 or msg.thermal.bat >= 63000:
# TODO: Add a better warning when this is happening
should_start = False should_start = False
if should_start: if should_start:
@ -554,7 +556,7 @@ def update_apks():
cloudlog.info("installed apks %s" % (str(installed), )) cloudlog.info("installed apks %s" % (str(installed), ))
for app in installed.iterkeys(): for app in installed.iterkeys():
apk_path = os.path.join(BASEDIR, "apk/"+app+".apk") apk_path = os.path.join(BASEDIR, "apk/"+app+".apk")
if not os.path.exists(apk_path): if not os.path.exists(apk_path):
apk_path = os.path.join(BASEDIR, "apk/external/out/"+app+".apk") apk_path = os.path.join(BASEDIR, "apk/external/out/"+app+".apk")

@ -1,4 +1,3 @@
import os
import json import json
import subprocess import subprocess

Binary file not shown.

Binary file not shown.

@ -1,5 +1,3 @@
import os
from enum import Enum
from maneuverplots import ManeuverPlot from maneuverplots import ManeuverPlot
from plant import Plant from plant import Plant
import numpy as np import numpy as np
@ -31,7 +29,6 @@ class Maneuver(object):
) )
last_live100 = None last_live100 = None
event_queue = sorted(self.cruise_button_presses, key=lambda a: a[1])[::-1]
plot = ManeuverPlot(self.title) plot = ManeuverPlot(self.title)
buttons_sorted = sorted(self.cruise_button_presses, key=lambda a: a[1]) buttons_sorted = sorted(self.cruise_button_presses, key=lambda a: a[1])

@ -63,7 +63,7 @@ class ManeuverPlot(object):
def write_plot(self, path, maneuver_name): def write_plot(self, path, maneuver_name):
title = self.title or maneuver_name # title = self.title or maneuver_name
# TODO: Missing plots from the old one: # TODO: Missing plots from the old one:
# long_control_state # long_control_state
# proportional_gb, intergral_gb # proportional_gb, intergral_gb

@ -11,7 +11,6 @@ from common.realtime import Ratekeeper
from selfdrive.config import Conversions as CV from selfdrive.config import Conversions as CV
import selfdrive.messaging as messaging import selfdrive.messaging as messaging
from selfdrive.services import service_list from selfdrive.services import service_list
from selfdrive.config import CruiseButtons
from selfdrive.car.honda.hondacan import fix from selfdrive.car.honda.hondacan import fix
from common.fingerprints import HONDA as CAR from common.fingerprints import HONDA as CAR
from selfdrive.car.honda.carstate import get_can_signals from selfdrive.car.honda.carstate import get_can_signals
@ -20,7 +19,6 @@ from selfdrive.boardd.boardd import can_capnp_to_can_list, can_list_to_can_capnp
from selfdrive.car.honda.old_can_parser import CANParser from selfdrive.car.honda.old_can_parser import CANParser
from selfdrive.car.honda.interface import CarInterface from selfdrive.car.honda.interface import CarInterface
from cereal import car
from common.dbc import dbc from common.dbc import dbc
honda = dbc(os.path.join(DBC_PATH, "honda_civic_touring_2016_can_generated.dbc")) honda = dbc(os.path.join(DBC_PATH, "honda_civic_touring_2016_can_generated.dbc"))
@ -38,8 +36,7 @@ def car_plant(pos, speed, grade, gas, brake):
speed_base = power_peak/force_peak speed_base = power_peak/force_peak
rolling_res = 0.01 rolling_res = 0.01
g = 9.81 g = 9.81
wheel_r = 0.31 #frontal_area = 2.2 TODO: use it!
frontal_area = 2.2
air_density = 1.225 air_density = 1.225
gas_to_peak_linear_slope = 3.33 gas_to_peak_linear_slope = 3.33
brake_to_peak_linear_slope = 0.3 brake_to_peak_linear_slope = 0.3
@ -191,7 +188,6 @@ class Plant(object):
# ******** run the car ******** # ******** run the car ********
speed, acceleration = car_plant(self.distance_prev, self.speed_prev, grade, gas, brake) speed, acceleration = car_plant(self.distance_prev, self.speed_prev, grade, gas, brake)
standstill = (speed == 0)
distance = self.distance_prev + speed * self.ts distance = self.distance_prev + speed * self.ts
speed = self.speed_prev + self.ts * acceleration speed = self.speed_prev + self.ts * acceleration
if speed <= 0: if speed <= 0:
@ -208,7 +204,6 @@ class Plant(object):
else: else:
d_rel = 200. d_rel = 200.
v_rel = 0. v_rel = 0.
a_rel = 0
lateral_pos_rel = 0. lateral_pos_rel = 0.
# print at 5hz # print at 5hz
@ -312,10 +307,6 @@ class Plant(object):
def plant_thread(rate=100): def plant_thread(rate=100):
plant = Plant(rate) plant = Plant(rate)
while 1: while 1:
if plant.rk.frame%100 >= 20 and plant.rk.frame%100 <= 25:
cruise_buttons = CruiseButtons.RES_ACCEL
else:
cruise_buttons = 0
plant.step() plant.step()
if __name__ == "__main__": if __name__ == "__main__":

@ -4,7 +4,6 @@ os.environ['FAKEUPLOAD'] = "1"
from common.testing import phone_only from common.testing import phone_only
from selfdrive.manager import manager_init, manager_prepare from selfdrive.manager import manager_init, manager_prepare
from selfdrive.manager import start_managed_process, kill_managed_process, get_running from selfdrive.manager import start_managed_process, kill_managed_process, get_running
from selfdrive.config import CruiseButtons
from functools import wraps from functools import wraps
import time import time

Binary file not shown.
Loading…
Cancel
Save