From 6424e07efe833e3a7b27b1df5858a4145d740117 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 17 Jun 2018 01:10:46 -0400 Subject: [PATCH 001/156] limit charge to 67-70% --- selfdrive/manager.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 53372d8916cdc1..a596ec53596be1 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -451,7 +451,13 @@ def manager_thread(): # thermal message now also includes free space msg.thermal.freeSpace = avail with open("/sys/class/power_supply/battery/capacity") as f: - msg.thermal.batteryPercent = int(f.read()) + msg.thermal.batteryPercent = int(f.read()) + #limit charging + if msg.thermal.batteryPercent > 70: + os.system("echo 0 > /sys/class/power_supply/battery/charging_enabled") + + elif msg.thermal.batteryPercent < 67: + os.system("echo 1 > /sys/class/power_supply/battery/charging_enabled") with open("/sys/class/power_supply/battery/status") as f: msg.thermal.batteryStatus = f.read().strip() with open("/sys/class/power_supply/usb/online") as f: @@ -506,7 +512,7 @@ def manager_thread(): should_start = should_start and avail > 0.02 # require usb power - should_start = should_start and msg.thermal.usbOnline + #should_start = should_start and msg.thermal.usbOnline should_start = should_start and accepted_terms and completed_training and (not do_uninstall) From 2bd530845339e526358d11d60b3fe2e9707cdb23 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 17 Jun 2018 01:14:13 -0400 Subject: [PATCH 002/156] syntax fix --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index a596ec53596be1..d25aadde60c846 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -451,7 +451,7 @@ def manager_thread(): # thermal message now also includes free space msg.thermal.freeSpace = avail with open("/sys/class/power_supply/battery/capacity") as f: - msg.thermal.batteryPercent = int(f.read()) + msg.thermal.batteryPercent = int(f.read()) #limit charging if msg.thermal.batteryPercent > 70: os.system("echo 0 > /sys/class/power_supply/battery/charging_enabled") From 7288542fe6030ecaa1e97ec13d33326e53b2e6a2 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 20:52:13 -0400 Subject: [PATCH 003/156] add homeassistant try to have manager run this script --- selfdrive/homeassistant.py | 65 ++++++++++++++++++++++++++++++++++++++ selfdrive/manager.py | 2 ++ 2 files changed, 67 insertions(+) create mode 100755 selfdrive/homeassistant.py diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py new file mode 100755 index 00000000000000..fe0ea3432b7535 --- /dev/null +++ b/selfdrive/homeassistant.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +import zmq +from copy import copy +from selfdrive import messaging +from selfdrive.services import service_list +from cereal import log +from time import sleep +from common.transformations.coordinates import geodetic2ecef +import requests +import os +import subprocess + +def main(gctx=None): + context = zmq.Context() + poller = zmq.Poller() + sock = messaging.sub_sock(context, service_list['liveLocation'].port, poller) + + #initialize the values + latitude = -1 + longitude = -1 + altitude = -1 + speed = -1 + + #the password to get into your homeassistant UI + API_PASSWORD = '894315' + #the url and what you want to call your EON entity. ie, 'https://myhomeassistanturl.com/api/states/eon.chris' + API_URL = 'https://csouershome.duckdns.org/api/states/eon_chris' + + + while 1: + ping = subprocess.call(["ping", "-W", "4", "-c", "1", "csouershome.duckdns.org"]) + if ping: + sleep(15) + continue + print "Transmitting to Home Assistant..." + for sock, event in poller.poll(500): + msg = sock.recv() + evt = log.Event.from_bytes(msg) + + latitude = evt.liveLocation.lat + longitude = evt.liveLocation.lon + altitude = evt.liveLocation.alt + speed = evt.liveLocation.speed + + headers = { + 'x-ha-access': API_PASSWORD + } + + stats = {'latitude': latitude, + 'longitude': longitude, + 'altitude': altitude, + 'speed': speed, + } + data = {'state': 'connected', + 'attributes': stats, + } + r = requests.post(API_URL, headers=headers, json=data) + if r.status_code == requests.codes.ok: + print "Received by Home Assistant" + sleep(3) #sleep until next time to send + else: + continue + +if __name__ == '__main__': + main() diff --git a/selfdrive/manager.py b/selfdrive/manager.py index d25aadde60c846..ccc7bb8bea67d8 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -105,6 +105,7 @@ "orbd": ("selfdrive/orbd", ["./orbd_wrapper.sh"]), "updated": "selfdrive.updated", #"gpsplanner": "selfdrive.controls.gps_plannerd", + "homeassistant": ("selfdrive", ["./homeassistant.py"]), } running = {} @@ -127,6 +128,7 @@ def get_running(): 'ubloxd', 'locationd_dummy', 'updated', + 'homeassistant', ] car_started_processes = [ From 43e59967b58ad75666d13bc2e83ad896e59e927e Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 20:52:13 -0400 Subject: [PATCH 004/156] add homeassistant try to have manager run this script --- selfdrive/homeassistant.py | 65 ++++++++++++++++++++++++++++++++++++++ selfdrive/manager.py | 2 ++ 2 files changed, 67 insertions(+) create mode 100755 selfdrive/homeassistant.py diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py new file mode 100755 index 00000000000000..5f4c99d8cef6e2 --- /dev/null +++ b/selfdrive/homeassistant.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +import zmq +from copy import copy +from selfdrive import messaging +from selfdrive.services import service_list +from cereal import log +from time import sleep +from common.transformations.coordinates import geodetic2ecef +import requests +import os +import subprocess + +def main(gctx=None): + context = zmq.Context() + poller = zmq.Poller() + sock = messaging.sub_sock(context, service_list['liveLocation'].port, poller) + + #initialize the values + latitude = -1 + longitude = -1 + altitude = -1 + speed = -1 + + #the password to get into your homeassistant UI + API_PASSWORD = '***REMOVED***' + #the url and what you want to call your EON entity. ie, 'https://myhomeassistanturl.com/api/states/eon.chris' + API_URL = 'https://***REMOVED***/api/states/eon_chris' + + + while 1: + ping = subprocess.call(["ping", "-W", "4", "-c", "1", "***REMOVED***"]) + if ping: + sleep(15) + continue + print "Transmitting to Home Assistant..." + for sock, event in poller.poll(500): + msg = sock.recv() + evt = log.Event.from_bytes(msg) + + latitude = evt.liveLocation.lat + longitude = evt.liveLocation.lon + altitude = evt.liveLocation.alt + speed = evt.liveLocation.speed + + headers = { + 'x-ha-access': API_PASSWORD + } + + stats = {'latitude': latitude, + 'longitude': longitude, + 'altitude': altitude, + 'speed': speed, + } + data = {'state': 'connected', + 'attributes': stats, + } + r = requests.post(API_URL, headers=headers, json=data) + if r.status_code == requests.codes.ok: + print "Received by Home Assistant" + sleep(3) #sleep until next time to send + else: + continue + +if __name__ == '__main__': + main() diff --git a/selfdrive/manager.py b/selfdrive/manager.py index d25aadde60c846..ccc7bb8bea67d8 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -105,6 +105,7 @@ "orbd": ("selfdrive/orbd", ["./orbd_wrapper.sh"]), "updated": "selfdrive.updated", #"gpsplanner": "selfdrive.controls.gps_plannerd", + "homeassistant": ("selfdrive", ["./homeassistant.py"]), } running = {} @@ -127,6 +128,7 @@ def get_running(): 'ubloxd', 'locationd_dummy', 'updated', + 'homeassistant', ] car_started_processes = [ From 3c31f6e4bfb12186ffef4d7214d5ec17d553d92f Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 20:56:47 -0400 Subject: [PATCH 005/156] fix manager --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index ccc7bb8bea67d8..e9aaac1646d9c7 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -105,7 +105,7 @@ "orbd": ("selfdrive/orbd", ["./orbd_wrapper.sh"]), "updated": "selfdrive.updated", #"gpsplanner": "selfdrive.controls.gps_plannerd", - "homeassistant": ("selfdrive", ["./homeassistant.py"]), + "homeassistant": "selfdrive.homeassistant", } running = {} From b269895e3d966f3563dd9c4d00604032ec820e6c Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 20:56:47 -0400 Subject: [PATCH 006/156] fix manager --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index ccc7bb8bea67d8..e9aaac1646d9c7 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -105,7 +105,7 @@ "orbd": ("selfdrive/orbd", ["./orbd_wrapper.sh"]), "updated": "selfdrive.updated", #"gpsplanner": "selfdrive.controls.gps_plannerd", - "homeassistant": ("selfdrive", ["./homeassistant.py"]), + "homeassistant": "selfdrive.homeassistant", } running = {} From b4f6cda1998d64f80021473aff22455fad811fb6 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 21:04:50 -0400 Subject: [PATCH 007/156] move things around --- selfdrive/homeassistant.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index fe0ea3432b7535..77d0980d149876 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -28,12 +28,14 @@ def main(gctx=None): while 1: - ping = subprocess.call(["ping", "-W", "4", "-c", "1", "csouershome.duckdns.org"]) - if ping: - sleep(15) - continue - print "Transmitting to Home Assistant..." + #only send when an event occurs for sock, event in poller.poll(500): + ping = subprocess.call(["ping", "-W", "4", "-c", "1", "csouershome.duckdns.org"]) + if ping: + #sleep in hopes of having a successful connection next time + sleep(15) + continue + print "Transmitting to Home Assistant..." msg = sock.recv() evt = log.Event.from_bytes(msg) @@ -45,7 +47,6 @@ def main(gctx=None): headers = { 'x-ha-access': API_PASSWORD } - stats = {'latitude': latitude, 'longitude': longitude, 'altitude': altitude, @@ -54,12 +55,11 @@ def main(gctx=None): data = {'state': 'connected', 'attributes': stats, } + r = requests.post(API_URL, headers=headers, json=data) if r.status_code == requests.codes.ok: print "Received by Home Assistant" sleep(3) #sleep until next time to send - else: - continue if __name__ == '__main__': main() From 9132bc084c755f947e6b862bf2ea2df5a316ba0c Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 21:04:50 -0400 Subject: [PATCH 008/156] move things around --- selfdrive/homeassistant.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index 5f4c99d8cef6e2..84e42928305a39 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -28,12 +28,14 @@ def main(gctx=None): while 1: - ping = subprocess.call(["ping", "-W", "4", "-c", "1", "***REMOVED***"]) - if ping: - sleep(15) - continue - print "Transmitting to Home Assistant..." + #only send when an event occurs for sock, event in poller.poll(500): + ping = subprocess.call(["ping", "-W", "4", "-c", "1", "***REMOVED***"]) + if ping: + #sleep in hopes of having a successful connection next time + sleep(15) + continue + print "Transmitting to Home Assistant..." msg = sock.recv() evt = log.Event.from_bytes(msg) @@ -45,7 +47,6 @@ def main(gctx=None): headers = { 'x-ha-access': API_PASSWORD } - stats = {'latitude': latitude, 'longitude': longitude, 'altitude': altitude, @@ -54,12 +55,11 @@ def main(gctx=None): data = {'state': 'connected', 'attributes': stats, } + r = requests.post(API_URL, headers=headers, json=data) if r.status_code == requests.codes.ok: print "Received by Home Assistant" sleep(3) #sleep until next time to send - else: - continue if __name__ == '__main__': main() From efcb70c16612fb73aa1ef6137e7f31b9c7a23f1b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 21:07:01 -0400 Subject: [PATCH 009/156] set back to 60 second delay --- selfdrive/homeassistant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index 77d0980d149876..8d480f2f74f597 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -59,7 +59,7 @@ def main(gctx=None): r = requests.post(API_URL, headers=headers, json=data) if r.status_code == requests.codes.ok: print "Received by Home Assistant" - sleep(3) #sleep until next time to send + sleep(60) #sleep until next time to send if __name__ == '__main__': main() From 841c4cbff17361cde250a6823c07a68eea3959fa Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 21:07:01 -0400 Subject: [PATCH 010/156] set back to 60 second delay --- selfdrive/homeassistant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index 84e42928305a39..b7a6e99daf1a79 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -59,7 +59,7 @@ def main(gctx=None): r = requests.post(API_URL, headers=headers, json=data) if r.status_code == requests.codes.ok: print "Received by Home Assistant" - sleep(3) #sleep until next time to send + sleep(60) #sleep until next time to send if __name__ == '__main__': main() From 30be405ff1b7a91febad58c262e9801c72662981 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 22:54:06 -0400 Subject: [PATCH 011/156] Revert "fix manager" This reverts commit 3c31f6e4bfb12186ffef4d7214d5ec17d553d92f. --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index e9aaac1646d9c7..ccc7bb8bea67d8 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -105,7 +105,7 @@ "orbd": ("selfdrive/orbd", ["./orbd_wrapper.sh"]), "updated": "selfdrive.updated", #"gpsplanner": "selfdrive.controls.gps_plannerd", - "homeassistant": "selfdrive.homeassistant", + "homeassistant": ("selfdrive", ["./homeassistant.py"]), } running = {} From 34bea7d84201efc30446dad32f07c90f6333b38a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 22:54:06 -0400 Subject: [PATCH 012/156] Revert "fix manager" This reverts commit b269895e3d966f3563dd9c4d00604032ec820e6c. --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index e9aaac1646d9c7..ccc7bb8bea67d8 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -105,7 +105,7 @@ "orbd": ("selfdrive/orbd", ["./orbd_wrapper.sh"]), "updated": "selfdrive.updated", #"gpsplanner": "selfdrive.controls.gps_plannerd", - "homeassistant": "selfdrive.homeassistant", + "homeassistant": ("selfdrive", ["./homeassistant.py"]), } running = {} From 739db96d16a07217a24e47338ec50577da2b4022 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 22:57:32 -0400 Subject: [PATCH 013/156] Revert "Revert "fix manager"" This reverts commit 30be405ff1b7a91febad58c262e9801c72662981. --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index ccc7bb8bea67d8..e9aaac1646d9c7 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -105,7 +105,7 @@ "orbd": ("selfdrive/orbd", ["./orbd_wrapper.sh"]), "updated": "selfdrive.updated", #"gpsplanner": "selfdrive.controls.gps_plannerd", - "homeassistant": ("selfdrive", ["./homeassistant.py"]), + "homeassistant": "selfdrive.homeassistant", } running = {} From 76758abbe290f6b1c5c557c3e0874fa516ef7eae Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 22:57:32 -0400 Subject: [PATCH 014/156] Revert "Revert "fix manager"" This reverts commit 34bea7d84201efc30446dad32f07c90f6333b38a. --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index ccc7bb8bea67d8..e9aaac1646d9c7 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -105,7 +105,7 @@ "orbd": ("selfdrive/orbd", ["./orbd_wrapper.sh"]), "updated": "selfdrive.updated", #"gpsplanner": "selfdrive.controls.gps_plannerd", - "homeassistant": ("selfdrive", ["./homeassistant.py"]), + "homeassistant": "selfdrive.homeassistant", } running = {} From 31bf52f6c6a242c21b55638773ce342bcf62afd5 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:00:28 -0400 Subject: [PATCH 015/156] Revert "move things around" This reverts commit b4f6cda1998d64f80021473aff22455fad811fb6. --- selfdrive/homeassistant.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index 8d480f2f74f597..8a4b23afdc1c8d 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -28,14 +28,12 @@ def main(gctx=None): while 1: - #only send when an event occurs + ping = subprocess.call(["ping", "-W", "4", "-c", "1", "csouershome.duckdns.org"]) + if ping: + sleep(15) + continue + print "Transmitting to Home Assistant..." for sock, event in poller.poll(500): - ping = subprocess.call(["ping", "-W", "4", "-c", "1", "csouershome.duckdns.org"]) - if ping: - #sleep in hopes of having a successful connection next time - sleep(15) - continue - print "Transmitting to Home Assistant..." msg = sock.recv() evt = log.Event.from_bytes(msg) @@ -47,6 +45,7 @@ def main(gctx=None): headers = { 'x-ha-access': API_PASSWORD } + stats = {'latitude': latitude, 'longitude': longitude, 'altitude': altitude, @@ -55,11 +54,16 @@ def main(gctx=None): data = {'state': 'connected', 'attributes': stats, } - r = requests.post(API_URL, headers=headers, json=data) if r.status_code == requests.codes.ok: print "Received by Home Assistant" +<<<<<<< HEAD sleep(60) #sleep until next time to send +======= + sleep(3) #sleep until next time to send + else: + continue +>>>>>>> parent of b4f6cda... move things around if __name__ == '__main__': main() From b3edb76234decc4b60018f09648c1ad385b990a0 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:00:28 -0400 Subject: [PATCH 016/156] Revert "move things around" This reverts commit 9132bc084c755f947e6b862bf2ea2df5a316ba0c. --- selfdrive/homeassistant.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index b7a6e99daf1a79..af9387057ef00d 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -28,14 +28,12 @@ def main(gctx=None): while 1: - #only send when an event occurs + ping = subprocess.call(["ping", "-W", "4", "-c", "1", "***REMOVED***"]) + if ping: + sleep(15) + continue + print "Transmitting to Home Assistant..." for sock, event in poller.poll(500): - ping = subprocess.call(["ping", "-W", "4", "-c", "1", "***REMOVED***"]) - if ping: - #sleep in hopes of having a successful connection next time - sleep(15) - continue - print "Transmitting to Home Assistant..." msg = sock.recv() evt = log.Event.from_bytes(msg) @@ -47,6 +45,7 @@ def main(gctx=None): headers = { 'x-ha-access': API_PASSWORD } + stats = {'latitude': latitude, 'longitude': longitude, 'altitude': altitude, @@ -55,11 +54,16 @@ def main(gctx=None): data = {'state': 'connected', 'attributes': stats, } - r = requests.post(API_URL, headers=headers, json=data) if r.status_code == requests.codes.ok: print "Received by Home Assistant" +<<<<<<< HEAD sleep(60) #sleep until next time to send +======= + sleep(3) #sleep until next time to send + else: + continue +>>>>>>> parent of b4f6cda... move things around if __name__ == '__main__': main() From e9e2d311a9d0713c3bbfcd37fc2f26bef33fa578 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:00:52 -0400 Subject: [PATCH 017/156] back to 3 for testing... --- selfdrive/homeassistant.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index 8a4b23afdc1c8d..a6f6e7d619089b 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -57,13 +57,7 @@ def main(gctx=None): r = requests.post(API_URL, headers=headers, json=data) if r.status_code == requests.codes.ok: print "Received by Home Assistant" -<<<<<<< HEAD - sleep(60) #sleep until next time to send -======= sleep(3) #sleep until next time to send - else: - continue ->>>>>>> parent of b4f6cda... move things around if __name__ == '__main__': main() From 588a82afce29a9f233e60bbb97ec4051f0ae2b1a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:00:52 -0400 Subject: [PATCH 018/156] back to 3 for testing... --- selfdrive/homeassistant.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index af9387057ef00d..5988c5082010ba 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -57,13 +57,7 @@ def main(gctx=None): r = requests.post(API_URL, headers=headers, json=data) if r.status_code == requests.codes.ok: print "Received by Home Assistant" -<<<<<<< HEAD - sleep(60) #sleep until next time to send -======= sleep(3) #sleep until next time to send - else: - continue ->>>>>>> parent of b4f6cda... move things around if __name__ == '__main__': main() From b911b04fa8dff56166d4b35270b24dd8995e371a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:34:26 -0400 Subject: [PATCH 019/156] refactor to make it actually wait for a good ping --- selfdrive/homeassistant.py | 70 +++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index a6f6e7d619089b..4a4b1cda1a45e6 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -26,38 +26,46 @@ def main(gctx=None): #the url and what you want to call your EON entity. ie, 'https://myhomeassistanturl.com/api/states/eon.chris' API_URL = 'https://csouershome.duckdns.org/api/states/eon_chris' - while 1: - ping = subprocess.call(["ping", "-W", "4", "-c", "1", "csouershome.duckdns.org"]) - if ping: - sleep(15) - continue - print "Transmitting to Home Assistant..." - for sock, event in poller.poll(500): - msg = sock.recv() - evt = log.Event.from_bytes(msg) - - latitude = evt.liveLocation.lat - longitude = evt.liveLocation.lon - altitude = evt.liveLocation.alt - speed = evt.liveLocation.speed - - headers = { - 'x-ha-access': API_PASSWORD - } - - stats = {'latitude': latitude, - 'longitude': longitude, - 'altitude': altitude, - 'speed': speed, - } - data = {'state': 'connected', - 'attributes': stats, - } - r = requests.post(API_URL, headers=headers, json=data) - if r.status_code == requests.codes.ok: - print "Received by Home Assistant" - sleep(3) #sleep until next time to send + ready = False + + while not ready: + ping = subprocess.call(["ping", "-W", "4", "-c", "1", "csouershome.duckdns.org"]) + if ping: + #didn't get a good ping. sleep and try again + sleep(15) + else: + ready = True + + while ready: + print "Transmitting to Home Assistant..." + for sock, event in poller.poll(500): + msg = sock.recv() + evt = log.Event.from_bytes(msg) + + latitude = evt.liveLocation.lat + longitude = evt.liveLocation.lon + altitude = evt.liveLocation.alt + speed = evt.liveLocation.speed + + headers = { + 'x-ha-access': API_PASSWORD + } + + stats = {'latitude': latitude, + 'longitude': longitude, + 'altitude': altitude, + 'speed': speed, + } + data = {'state': 'connected', + 'attributes': stats, + } + r = requests.post(API_URL, headers=headers, json=data) + if r.status_code == requests.codes.ok: + print "Received by Home Assistant" + else: + print "Problem sending. Retry" + ready = False if __name__ == '__main__': main() From e24d411e18129226f7ea001c04549e487845825a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:34:26 -0400 Subject: [PATCH 020/156] refactor to make it actually wait for a good ping --- selfdrive/homeassistant.py | 70 +++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index 5988c5082010ba..b7263049a0570c 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -26,38 +26,46 @@ def main(gctx=None): #the url and what you want to call your EON entity. ie, 'https://myhomeassistanturl.com/api/states/eon.chris' API_URL = 'https://***REMOVED***/api/states/eon_chris' - while 1: - ping = subprocess.call(["ping", "-W", "4", "-c", "1", "***REMOVED***"]) - if ping: - sleep(15) - continue - print "Transmitting to Home Assistant..." - for sock, event in poller.poll(500): - msg = sock.recv() - evt = log.Event.from_bytes(msg) - - latitude = evt.liveLocation.lat - longitude = evt.liveLocation.lon - altitude = evt.liveLocation.alt - speed = evt.liveLocation.speed - - headers = { - 'x-ha-access': API_PASSWORD - } - - stats = {'latitude': latitude, - 'longitude': longitude, - 'altitude': altitude, - 'speed': speed, - } - data = {'state': 'connected', - 'attributes': stats, - } - r = requests.post(API_URL, headers=headers, json=data) - if r.status_code == requests.codes.ok: - print "Received by Home Assistant" - sleep(3) #sleep until next time to send + ready = False + + while not ready: + ping = subprocess.call(["ping", "-W", "4", "-c", "1", "***REMOVED***"]) + if ping: + #didn't get a good ping. sleep and try again + sleep(15) + else: + ready = True + + while ready: + print "Transmitting to Home Assistant..." + for sock, event in poller.poll(500): + msg = sock.recv() + evt = log.Event.from_bytes(msg) + + latitude = evt.liveLocation.lat + longitude = evt.liveLocation.lon + altitude = evt.liveLocation.alt + speed = evt.liveLocation.speed + + headers = { + 'x-ha-access': API_PASSWORD + } + + stats = {'latitude': latitude, + 'longitude': longitude, + 'altitude': altitude, + 'speed': speed, + } + data = {'state': 'connected', + 'attributes': stats, + } + r = requests.post(API_URL, headers=headers, json=data) + if r.status_code == requests.codes.ok: + print "Received by Home Assistant" + else: + print "Problem sending. Retry" + ready = False if __name__ == '__main__': main() From 2b3253786722067051bdb91bdcd8a514d5714d14 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:36:37 -0400 Subject: [PATCH 021/156] timer again --- selfdrive/homeassistant.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index 4a4b1cda1a45e6..f63a96c0e4cab6 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -65,6 +65,7 @@ def main(gctx=None): print "Received by Home Assistant" else: print "Problem sending. Retry" + sleep(5) ready = False if __name__ == '__main__': From 91fff05e25ca978723d4e3263f0a6ec8acc740a0 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:36:37 -0400 Subject: [PATCH 022/156] timer again --- selfdrive/homeassistant.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index b7263049a0570c..53244829408927 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -65,6 +65,7 @@ def main(gctx=None): print "Received by Home Assistant" else: print "Problem sending. Retry" + sleep(5) ready = False if __name__ == '__main__': From 8086dcbfc7f1ebe0de13194a8eafe09553dd0e9d Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:57:22 -0400 Subject: [PATCH 023/156] fix and remove data --- selfdrive/homeassistant.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index f63a96c0e4cab6..1fb6393894ed86 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -22,15 +22,17 @@ def main(gctx=None): speed = -1 #the password to get into your homeassistant UI - API_PASSWORD = '894315' + API_PASSWORD = '?????????' #the url and what you want to call your EON entity. ie, 'https://myhomeassistanturl.com/api/states/eon.chris' - API_URL = 'https://csouershome.duckdns.org/api/states/eon_chris' + API_URL = '???????????' + #where you want to ping. probably 'https://myhomeassistanturl.com' + PING_URL = '?????????' while 1: ready = False while not ready: - ping = subprocess.call(["ping", "-W", "4", "-c", "1", "csouershome.duckdns.org"]) + ping = subprocess.call(["ping", "-W", "4", "-c", "1", PING_URL]) if ping: #didn't get a good ping. sleep and try again sleep(15) From d59194cca4e575e5584734a0312271d601ab2411 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 24 Jun 2018 23:57:22 -0400 Subject: [PATCH 024/156] fix and remove data --- selfdrive/homeassistant.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index 53244829408927..1fb6393894ed86 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -22,15 +22,17 @@ def main(gctx=None): speed = -1 #the password to get into your homeassistant UI - API_PASSWORD = '***REMOVED***' + API_PASSWORD = '?????????' #the url and what you want to call your EON entity. ie, 'https://myhomeassistanturl.com/api/states/eon.chris' - API_URL = 'https://***REMOVED***/api/states/eon_chris' + API_URL = '???????????' + #where you want to ping. probably 'https://myhomeassistanturl.com' + PING_URL = '?????????' while 1: ready = False while not ready: - ping = subprocess.call(["ping", "-W", "4", "-c", "1", "***REMOVED***"]) + ping = subprocess.call(["ping", "-W", "4", "-c", "1", PING_URL]) if ping: #didn't get a good ping. sleep and try again sleep(15) From 61d3aeed68094d7dfe5d48e10f4376d9a496a224 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Mon, 25 Jun 2018 00:27:20 -0400 Subject: [PATCH 025/156] private goodness --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 47d1a6687506cb..dc5ef67e682587 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ selfdrive/ui/ui /src/ one +selfdrive/passwords.txt From d2f1f263dae7252a41998f36b74cc2f5d1191066 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Mon, 25 Jun 2018 00:28:39 -0400 Subject: [PATCH 026/156] stuff and timer fix --- selfdrive/homeassistant.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/selfdrive/homeassistant.py b/selfdrive/homeassistant.py index 1fb6393894ed86..fdf37afc71a1c9 100755 --- a/selfdrive/homeassistant.py +++ b/selfdrive/homeassistant.py @@ -22,11 +22,11 @@ def main(gctx=None): speed = -1 #the password to get into your homeassistant UI - API_PASSWORD = '?????????' + API_PASSWORD = 'REMOVED' #the url and what you want to call your EON entity. ie, 'https://myhomeassistanturl.com/api/states/eon.chris' - API_URL = '???????????' + API_URL = 'https://REMOVED/api/states/eon.chris' #where you want to ping. probably 'https://myhomeassistanturl.com' - PING_URL = '?????????' + PING_URL = 'REMOVED' while 1: ready = False @@ -67,7 +67,7 @@ def main(gctx=None): print "Received by Home Assistant" else: print "Problem sending. Retry" - sleep(5) + sleep(60) ready = False if __name__ == '__main__': From b3223a87342c2f59e96856e2cde7503bfbf6bcbd Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 26 Jun 2018 00:18:21 -0400 Subject: [PATCH 027/156] ignore secrets --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 47d1a6687506cb..dc5ef67e682587 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ selfdrive/ui/ui /src/ one +selfdrive/passwords.txt From 934b81015442f3a75a071afc670a61e36a73fc63 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 22:46:46 -0400 Subject: [PATCH 028/156] First try for radarless --- ..._civic_hatchback_ex_2017_can_generated.dbc | 119 +++++++++--------- selfdrive/car/honda/carcontroller.py | 18 +-- selfdrive/car/honda/hondacan.py | 59 +++++++-- selfdrive/car/honda/interface.py | 6 + selfdrive/controls/radard.py | 2 +- 5 files changed, 127 insertions(+), 77 deletions(-) diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index 2b0b1620eab450..89a142ccb91089 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -1,42 +1,41 @@ -CM_ "AUTOGENERATED FILE, DO NOT EDIT" - - -CM_ "Imported file _bosch_2018.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_ + 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_: EBCM EON CAM RADAR PCM EPS VSA SCM BDY XXX EPB + BO_ 228 STEERING_CONTROL: 5 EON SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS @@ -104,13 +103,6 @@ BO_ 420 VSA_STATUS: 8 VSA SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON -BO_ 432 STANDSTILL: 7 VSA - 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|15] "" EON - BO_ 450 EPB_STATUS: 8 EPB SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON @@ -127,12 +119,12 @@ BO_ 464 WHEEL_SPEEDS: 8 VSA BO_ 479 ACC_CONTROL: 8 EON SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX - SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX BO_ 495 ACC_CONTROL_ON: 8 XXX SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX @@ -162,11 +154,11 @@ BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - BO_ 662 SCM_BUTTONS: 4 SCM - SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON - SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" EON - SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 27|4@0+ (1,0) [0|15] "" EON +BO_ 662 SCM_BUTTONS: 4 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 27|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 @@ -228,7 +220,7 @@ BO_ 806 SCM_FEEDBACK: 8 SCM BO_ 829 LKAS_HUD: 5 ADAS SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY - SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY + SG_ BOH : 23|2@0+ (1,0) [0|4] "" 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 @@ -236,7 +228,6 @@ BO_ 829 LKAS_HUD: 5 ADAS 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 @@ -271,9 +262,6 @@ BO_ 891 STALK_STATUS_2: 8 XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON -CM_ "honda_civic_hatchback_ex_2017_can.dbc starts here" - - BO_ 401 GEARBOX: 8 PCM SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON SG_ BOH : 45|6@0+ (1,0) [0|63] "" XXX @@ -283,6 +271,13 @@ BO_ 401 GEARBOX: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON +BO_ 432 STANDSTILL: 7 VSA + 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|15] "" EON + 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 @@ -310,13 +305,25 @@ BO_ 1029 DOORS_STATUS: 8 BDY SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON -VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; -VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; -VAL_ 545 ECON_ON_2 0 "off" 3 "on" ; +BO_ 506 BLANK_1FA: 8 XXX + SG_ CHECKSUM : 56|4@1+ (1,0) [0|15] "" XXX + SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX + + + + + VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; -VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ; -VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; - +VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; +VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; +VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +CM_ "AUTOGENERATED FILE, DO NOT EDIT" +CM_ "Imported file _bosch_2018.dbc starts here"; +CM_ "Imported file _bosch_2018.dbc starts here" +VERSION ""; +CM_ "honda_civic_hatchback_ex_2017_can.dbc starts here" +BO_ 401 GEARBOX: 8 PCM +SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EO"; CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 4b45451c620c76..017b45a3da6222 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -154,9 +154,13 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # Send gas and brake commands. if (frame % 2) == 0: idx = (frame / 2) % 4 - can_sends.append( - hondacan.create_brake_command(self.packer, apply_brake, pcm_override, - pcm_cancel_cmd, hud.chime, hud.fcw, idx)) + if CS.CP.carFingerprint == CAR.CIVIC_HATCH: + can_sends.append(hondacan.create_long_command(self.packer, gas_amount, apply_brake, idx)) + can_sends.append(hondacan.create_1fa(self.packer, idx)) + else: + can_sends.append( + hondacan.create_brake_command(self.packer, apply_brake, pcm_override, + pcm_cancel_cmd, hud.chime, hud.fcw, idx)) if CS.CP.enableGasInterceptor: # send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas. # This prevents unexpected pedal range rescaling @@ -167,9 +171,9 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ radar_send_step = 2 else: radar_send_step = 5 - - if (frame % radar_send_step) == 0: - idx = (frame/radar_send_step) % 4 - can_sends.extend(hondacan.create_radar_commands(CS.v_ego, CS.CP.carFingerprint, idx)) + if not CS.CP.enableRadar: + if (frame % radar_send_step) == 0: + idx = (frame/radar_send_step) % 4 + can_sends.extend(hondacan.create_radar_commands(CS.v_ego, CS.CP.carFingerprint, idx)) sendcan.send(can_list_to_can_capnp(can_sends, msgtype='sendcan').to_bytes()) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 92e74cd6868155..b17c19850c800f 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -27,6 +27,20 @@ def make_can_msg(addr, dat, idx, alt): dat = fix(dat, addr) return [addr, 0, dat, alt] +def create_long_command(packer, gas_amount, apply_brake, idx): + + values = { + "SET_TO_1": 0x0, + #"GAS_COMMAND": gasbrake2, + #"RELATED_TO_GAS": related_to_gas, + "CONTROL_ON": 0x05, + #"GAS_BRAKE": gasbrake, + } + return packer.make_can_msg("ACC_CONTROL", 0, values, idx) + +#create blank 0x1fa on CIVIC_HATCH with no bosch radar +def create_1fa(packer, idx): + return packer.make_can_msg("BLANK_1FA", 0, idx) def create_brake_command(packer, apply_brake, pcm_override, pcm_cancel_cmd, chime, fcw, idx): """Creates a CAN message for the Honda DBC BRAKE_COMMAND.""" @@ -49,7 +63,6 @@ def create_brake_command(packer, apply_brake, pcm_override, pcm_cancel_cmd, chim } return packer.make_can_msg("BRAKE_COMMAND", 0, values, idx) - def create_gas_command(packer, gas_amount, idx): """Creates a CAN message for the Honda DBC GAS_COMMAND.""" enable = gas_amount > 0.001 @@ -70,7 +83,7 @@ def create_steering_control(packer, apply_steer, lkas_active, car_fingerprint, i "STEER_TORQUE_REQUEST": lkas_active, } # Set bus 2 for accord and new crv. - bus = 2 if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH) else 0 + bus = 2 if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH) and CS.CP.radarOffCan else 0 return packer.make_can_msg("STEERING_CONTROL", bus, values, idx) @@ -82,17 +95,28 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): # Bosch sends commands to bus 2. if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH): bus = 2 - else: - acc_hud_values = { - 'PCM_SPEED': pcm_speed * CV.MS_TO_KPH, - 'PCM_GAS': hud.pcm_accel, - 'CRUISE_SPEED': hud.v_cruise, - 'ENABLE_MINI_CAR': hud.mini_car, - 'HUD_LEAD': hud.car, - 'SET_ME_X03': 0x03, - 'SET_ME_X03_2': 0x03, - 'SET_ME_X01': 0x01, - } + if not CS.CP.radarOffCan: + if car_fingerprint in (CAR.CIVIC_HATCH): + bus = 0 + acc_hud_values = { + 'CRUISE_SPEED': pcm_speed * CV.MS_TO_KPH, + 'ENABLE_MINI_CAR': hud.mini_car, + 'SET_TO_1': 0x01, + 'HUD_LEAD': hud.car, + 'HUD_DISTANCE': 0x03, + 'SET_ME_X03': 0x03, + } + else: + acc_hud_values = { + 'PCM_SPEED': pcm_speed * CV.MS_TO_KPH, + 'PCM_GAS': hud.pcm_accel, + 'CRUISE_SPEED': hud.v_cruise, + 'ENABLE_MINI_CAR': hud.mini_car, + 'HUD_LEAD': hud.car, + 'SET_ME_X03': 0x03, + 'SET_ME_X03_2': 0x03, + 'SET_ME_X01': 0x01, + } commands.append(packer.make_can_msg("ACC_HUD", 0, acc_hud_values, idx)) lkas_hud_values = { @@ -114,6 +138,15 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): 'LEAD_DISTANCE': 0x1e, } commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) + return commands + + if not CS.CP.radarOffCan and car_fingerprint in (CAR.CIVIC_HATCH): + commands.append(packer.make_can_msg('HIGHBEAM_CONTROL', 0, {'HIGHBEAMS_ON': False}, idx)) + radar_hud_values = { + 'ACC_ALERTS': hud.acc_alert, + 'SET_TO_1': 0x01, + } + commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) return commands diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 32c32a64f840bc..956f483d9027f4 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -20,6 +20,7 @@ # msgs sent for steering controller by camera module on can 0. # those messages are mutually exclusive on CRV and non-CRV cars CAMERA_MSGS = [0xe4, 0x194] +ACC_MSGS = [0x1df] def compute_gb_honda(accel, speed): @@ -151,7 +152,12 @@ def get_params(candidate, fingerprint): ret.safetyModel = car.CarParams.SafetyModels.honda ret.enableCamera = not any(x for x in CAMERA_MSGS if x in fingerprint) ret.enableGasInterceptor = 0x201 in fingerprint + ret.enableRadar = not any(x for x in ACC_MSGS if x in fingerprint) + if ret.enableRadar: + ret.radarOffCan = False + print "ECU Camera Simulated: ", ret.enableCamera + print "ECU Radar Simulated: ", ret.enableRadar print "ECU Gas Interceptor: ", ret.enableGasInterceptor ret.enableCruise = not ret.enableGasInterceptor diff --git a/selfdrive/controls/radard.py b/selfdrive/controls/radard.py index 00c34557d6a972..427b3b2a61967f 100755 --- a/selfdrive/controls/radard.py +++ b/selfdrive/controls/radard.py @@ -49,7 +49,7 @@ def radard_thread(gctx=None): # wait for stats about the car to come in from controls cloudlog.info("radard is waiting for CarParams") CP = car.CarParams.from_bytes(Params().get("CarParams", block=True)) - mocked = CP.carName == "mock" + mocked = True VM = VehicleModel(CP) cloudlog.info("radard got CarParams") From 9e4ac98debfc9b57430ae77b112e01eb6fcf765f Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 22:50:26 -0400 Subject: [PATCH 029/156] dbc fix --- opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc | 4 ++++ opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc b/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc index bab8601145f9ba..0bdb1e50833aab 100644 --- a/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc +++ b/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc @@ -9,6 +9,10 @@ BO_ 401 GEARBOX: 8 PCM SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON +BO_ 506 BLANK_1FA: 8 XXX + SG_ CHECKSUM : 56|4@1+ (1,0) [0|15] "" XXX + SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX + 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 diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index 89a142ccb91089..998521900aa2f5 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -305,10 +305,6 @@ BO_ 1029 DOORS_STATUS: 8 BDY SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON -BO_ 506 BLANK_1FA: 8 XXX - SG_ CHECKSUM : 56|4@1+ (1,0) [0|15] "" XXX - SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX - From 60cba744c7bc6e85cb8605131eff67415a9a5f19 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 22:51:11 -0400 Subject: [PATCH 030/156] try 2 --- ..._civic_hatchback_ex_2017_can_generated.dbc | 325 ------------------ 1 file changed, 325 deletions(-) delete mode 100644 opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc deleted file mode 100644 index 998521900aa2f5..00000000000000 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ /dev/null @@ -1,325 +0,0 @@ -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_: EBCM EON CAM RADAR PCM EPS VSA SCM BDY XXX EPB - - -BO_ 228 STEERING_CONTROL: 5 EON - SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS - SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS - SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS - SG_ STEER_TORQUE : 7|16@0- (1,0) [-4096|4096] "" EPS - SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS - SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" EPS - -BO_ 232 BRAKE_HOLD: 7 XXX - SG_ XMISSION_SPEED : 7|14@0- (1,0) [1|0] "" XXX - SG_ COMPUTER_BRAKE : 39|16@0+ (1,0) [0|0] "" XXX - SG_ COMPUTER_BRAKE_REQUEST : 29|1@0+ (1,0) [0|0] "" XXX - SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" XXX - -BO_ 304 GAS_PEDAL_2: 8 PCM - SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" EON - SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" EON - SG_ CAR_GAS : 39|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 - -BO_ 330 STEERING_SENSORS: 8 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_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON - SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" 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_ DISTANCE_COUNTER : 55|8@0+ (10,0) [0|2550] "Meters" XXX - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|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] "" EON - SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "" EON - SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "" EON - SG_ BOH2_17C : 47|10@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] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - -BO_ 399 STEER_STATUS: 7 EPS - SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-31000|31000] "tbd" EON - SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" EON - SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON - SG_ STEER_CONTROL_ACTIVE : 35|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|15] "" EON - -BO_ 420 VSA_STATUS: 8 VSA - SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON - SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON - SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON - SG_ BRAKE_HOLD_ENABLED : 45|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|15] "" EON - -BO_ 450 EPB_STATUS: 8 EPB - SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON - SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - -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_ 479 ACC_CONTROL: 8 EON - SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM - SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX - SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM - SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX - SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX - -BO_ 495 ACC_CONTROL_ON: 8 XXX - SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX - SG_ SET_TO_30 : 39|8@0+ (1,0) [0|255] "" XXX - SG_ ZEROS_BOH : 23|8@0+ (1,0) [0|255] "" XXX - SG_ ZEROS_BOH2 : 47|16@0+ (1,0) [0|255] "" XXX - SG_ SET_TO_FF : 15|8@0+ (1,0) [0|255] "" XXX - SG_ SET_TO_3 : 6|7@0+ (1,0) [0|4095] "" XXX - SG_ CONTROL_ON : 7|1@0+ (1,0) [0|1] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - -BO_ 545 XXX_16: 6 SCM - SG_ ECON_ON : 23|1@0+ (1,0) [0|1] "" XXX - SG_ DRIVE_MODE : 37|2@0+ (1,0) [0|3] "" XXX - SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" BDY - SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" BDY - -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] "" XXX - SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON - SG_ LONG_COUNTER : 55|8@0+ (1,0) [0|255] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - -BO_ 662 SCM_BUTTONS: 4 SCM - SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON - SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" EON - SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 27|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 CAR_SPEED: 8 PCM - SG_ ROUGH_CAR_SPEED : 23|8@0+ (1,0) [0|255] "" XXX - SG_ CAR_SPEED : 7|16@0+ (1,0) [0|65535] "" XXX - SG_ ROUGH_CAR_SPEED_3 : 39|16@0+ (1,0) [0|65535] "" XXX - SG_ ROUGH_CAR_SPEED_2 : 31|8@0+ (1,0) [0|255] "" XXX - SG_ LOCK_STATUS : 55|2@0+ (1,0) [0|255] "" XXX - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - -BO_ 780 ACC_HUD: 8 ADAS - 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_ 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_ 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_ ZEROS_BOH : 7|24@0+ (0.002759506,0) [0|100] "m/s" BDY - SG_ FCM_OFF : 35|1@0+ (1,0) [0|1] "" BDY - SG_ SET_TO_1 : 36|1@0+ (1,0) [0|1] "" XXX - SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY - SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY - SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY - SG_ ACC_ON : 52|1@0+ (1,0) [0|1] "" XXX - SG_ BOH_6 : 51|4@0+ (1,0) [0|15] "" XXX - SG_ SET_TO_X3 : 55|2@0+ (1,0) [0|3] "" XXX - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - -BO_ 804 CRUISE: 8 PCM - SG_ TRIP_FUEL_CONSUMED : 23|16@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 - -BO_ 806 SCM_FEEDBACK: 8 SCM - SG_ DRIVERS_DOOR_OPEN : 17|1@0+ (1,0) [0|1] "" XXX - SG_ MAIN_ON : 28|1@0+ (1,0) [0|1] "" EON - SG_ RIGHT_BLINKER : 27|1@0+ (1,0) [0|1] "" EON - SG_ LEFT_BLINKER : 26|1@0+ (1,0) [0|1] "" EON - SG_ CMBS_STATES : 22|2@0+ (1,0) [0|3] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - -BO_ 829 LKAS_HUD: 5 ADAS - SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY - SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY - SG_ BOH : 23|2@0+ (1,0) [0|4] "" 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_ 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_ 862 CAMERA_MESSAGES: 8 CAM - SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY - SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX - SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX - SG_ ZEROS_BOH_2 : 51|4@0+ (1,0) [0|15] "" XXX - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - -BO_ 884 STALK_STATUS: 8 XXX - SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON - SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON - SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON - SG_ HEADLIGHTS_ON : 54|1@0+ (1,0) [0|1] "" EON - SG_ WIPER_SWITCH : 53|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - -BO_ 891 STALK_STATUS_2: 8 XXX - SG_ WIPERS : 17|2@0+ (1,0) [0|3] "" EON - SG_ LOW_BEAMS : 35|1@0+ (1,0) [0|1] "" XXX - SG_ HIGH_BEAMS : 34|1@0+ (1,0) [0|1] "" XXX - SG_ PARK_LIGHTS : 36|1@0+ (1,0) [0|1] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - -BO_ 401 GEARBOX: 8 PCM - SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON - SG_ BOH : 45|6@0+ (1,0) [0|63] "" XXX - SG_ GEAR2 : 31|8@0+ (1,0) [0|1] "" XXX - SG_ GEAR : 39|8@0+ (1,0) [0|255] "" XXX - SG_ ZEROS_BOH : 47|2@0+ (1,0) [0|3] "" XXX - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON - -BO_ 432 STANDSTILL: 7 VSA - 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|15] "" EON - -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|15] "" EON - -BO_ 927 RADAR_HUD: 8 RADAR - SG_ ZEROS_BOH : 7|10@0+ (1,0) [0|127] "" BDY - SG_ CMBS_OFF : 12|1@0+ (1,0) [0|1] "" BDY - SG_ ZEROS_BOH3 : 31|32@0+ (1,0) [0|4294967295] "" XXX - SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|1] "" XXX - SG_ SET_TO_1 : 13|1@0+ (1,0) [0|1] "" BDY - SG_ ZEROS_BOH2 : 11|4@0+ (1,0) [0|1] "" XXX - SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|1] "" XXX - SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|1] "" BDY - SG_ SET_TO_0 : 22|1@0+ (1,0) [0|1] "" XXX - SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - -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|15] "" EON - - - - - -VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; -VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; -VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; -VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; -VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; -VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; -CM_ "AUTOGENERATED FILE, DO NOT EDIT" -CM_ "Imported file _bosch_2018.dbc starts here"; -CM_ "Imported file _bosch_2018.dbc starts here" -VERSION ""; -CM_ "honda_civic_hatchback_ex_2017_can.dbc starts here" -BO_ 401 GEARBOX: 8 PCM -SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EO"; -CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; From e941e0e18400ea71fd65ed70a6dd72a27dbdbb50 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:00:48 -0400 Subject: [PATCH 031/156] add enableRadar to capnp and change safety mode --- cereal/car.capnp | 1 + selfdrive/car/honda/interface.py | 1 + 2 files changed, 2 insertions(+) diff --git a/cereal/car.capnp b/cereal/car.capnp index b4c766651bdfb2..1de8711cc97b28 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -273,6 +273,7 @@ struct CarParams { enableCamera @26 :Bool; enableDsu @27 :Bool; # driving support unit enableApgs @28 :Bool; # advanced parking guidance system + enableRadar @29 :Bool; minEnableSpeed @17 :Float32; safetyModel @18 :Int16; diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 956f483d9027f4..61d71bbd5207cb 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -154,6 +154,7 @@ def get_params(candidate, fingerprint): ret.enableGasInterceptor = 0x201 in fingerprint ret.enableRadar = not any(x for x in ACC_MSGS if x in fingerprint) if ret.enableRadar: + ret.safetyModel = car.CarParams.SafetyModels.honda ret.radarOffCan = False print "ECU Camera Simulated: ", ret.enableCamera From 85a85355ddc208546826d6283caa89c5fc20ed83 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:02:23 -0400 Subject: [PATCH 032/156] fail --- cereal/car.capnp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cereal/car.capnp b/cereal/car.capnp index 1de8711cc97b28..52c0075173475b 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -273,7 +273,7 @@ struct CarParams { enableCamera @26 :Bool; enableDsu @27 :Bool; # driving support unit enableApgs @28 :Bool; # advanced parking guidance system - enableRadar @29 :Bool; + enableRadar @49 :Bool; minEnableSpeed @17 :Float32; safetyModel @18 :Int16; From 1b69ed80c8bcda5261781bce07bc3c4698603fb0 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:04:20 -0400 Subject: [PATCH 033/156] carstate change --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 88cc6d7b328873..333cb221a8c664 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -264,7 +264,7 @@ def update(self, cp): self.left_blinker_on = cp.vl["SCM_FEEDBACK"]['LEFT_BLINKER'] self.right_blinker_on = cp.vl["SCM_FEEDBACK"]['RIGHT_BLINKER'] - if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH): + if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.CRV_5G, CAR.ACCORD): self.park_brake = cp.vl["EPB_STATUS"]['EPB_STATE'] != 0 self.brake_hold = cp.vl["VSA_STATUS"]['BRAKE_HOLD_ACTIVE'] self.main_on = cp.vl["SCM_FEEDBACK"]['MAIN_ON'] From 7f61dfe3177779d030b09d63a6f51f8a45531d89 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:06:26 -0400 Subject: [PATCH 034/156] carstate --- selfdrive/car/honda/carstate.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 333cb221a8c664..b1e3d5f2b85eb5 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -121,6 +121,15 @@ def get_can_signals(CP): signals += [("CRUISE_SPEED_PCM", "CRUISE", 0), ("CRUISE_SPEED_OFFSET", "CRUISE_PARAMS", 0)] checks += [("CRUISE_PARAMS", 50)] + if CP.carFingerprint != CAR.CIVIC_HATCH: + signals += [("BRAKE_PRESSED", "BRAKE_MODULE", 0)] + checks += [("BRAKE_MODULE", 50)] + signals += [("CAR_GAS", "GAS_PEDAL_2", 0), + ("MAIN_ON", "SCM_FEEDBACK", 0), + ("EPB_STATE", "EPB_STATUS", 0), + ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0), + checks += [("GAS_PEDAL_2", 100)] + if CP.carFingerprint == CAR.ACCORD: signals += [("DRIVERS_DOOR_OPEN", "SCM_FEEDBACK", 1)] From 2a2aa46ef914be8f4a9449718eac3b1ee4cc7ea0 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:07:26 -0400 Subject: [PATCH 035/156] carstate --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index b1e3d5f2b85eb5..1396e962028b5f 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -127,7 +127,7 @@ def get_can_signals(CP): signals += [("CAR_GAS", "GAS_PEDAL_2", 0), ("MAIN_ON", "SCM_FEEDBACK", 0), ("EPB_STATE", "EPB_STATUS", 0), - ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0), + ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0)] checks += [("GAS_PEDAL_2", 100)] From d9de863aa636f0bacd4d3ca9018ffaf90f3270fb Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:09:26 -0400 Subject: [PATCH 036/156] carstate --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 1396e962028b5f..ef403ec7ae5260 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -273,7 +273,7 @@ def update(self, cp): self.left_blinker_on = cp.vl["SCM_FEEDBACK"]['LEFT_BLINKER'] self.right_blinker_on = cp.vl["SCM_FEEDBACK"]['RIGHT_BLINKER'] - if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.CRV_5G, CAR.ACCORD): + if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH): self.park_brake = cp.vl["EPB_STATUS"]['EPB_STATE'] != 0 self.brake_hold = cp.vl["VSA_STATUS"]['BRAKE_HOLD_ACTIVE'] self.main_on = cp.vl["SCM_FEEDBACK"]['MAIN_ON'] From 8d9dd178b05a1dcb25e993d5a5ca575fbe22b263 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:12:57 -0400 Subject: [PATCH 037/156] carstate --- selfdrive/car/honda/carstate.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index ef403ec7ae5260..b04ede7f4d1b9a 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -300,21 +300,31 @@ def update(self, cp): self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - if self.CP.radarOffCan: - self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. - self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) + if self.CP.enableRadar: if self.CP.carFingerprint == CAR.CIVIC_HATCH: + self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ (self.brake_switch and self.brake_switch_prev and \ cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) self.brake_switch_prev = self.brake_switch self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - else: - self.brake_pressed = cp.vl["BRAKE_MODULE"]['BRAKE_PRESSED'] - # On set, cruise set speed pulses between 254~255 and the set speed prev is set to avoid this. - self.v_cruise_pcm = self.v_cruise_pcm_prev if cp.vl["ACC_HUD"]['CRUISE_SPEED'] > 160.0 else cp.vl["ACC_HUD"]['CRUISE_SPEED'] - self.v_cruise_pcm_prev = self.v_cruise_pcm + else: + if self.CP.radarOffCan: + self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. + self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) + if self.CP.carFingerprint == CAR.CIVIC_HATCH: + self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ + (self.brake_switch and self.brake_switch_prev and \ + cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) + self.brake_switch_prev = self.brake_switch + self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + else: + self.brake_pressed = cp.vl["BRAKE_MODULE"]['BRAKE_PRESSED'] + # On set, cruise set speed pulses between 254~255 and the set speed prev is set to avoid this. + self.v_cruise_pcm = self.v_cruise_pcm_prev if cp.vl["ACC_HUD"]['CRUISE_SPEED'] > 160.0 else cp.vl["ACC_HUD"]['CRUISE_SPEED'] + self.v_cruise_pcm_prev = self.v_cruise_pcm else: self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] self.cruise_speed_offset = calc_cruise_offset(cp.vl["CRUISE_PARAMS"]['CRUISE_SPEED_OFFSET'], self.v_ego) From 1e1ea35a89a0dc1d2e9631abb30faa795a3f0fb6 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:14:43 -0400 Subject: [PATCH 038/156] carstate --- selfdrive/car/honda/carstate.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index b04ede7f4d1b9a..9e16cc74e36c27 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -309,22 +309,21 @@ def update(self, cp): cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) self.brake_switch_prev = self.brake_switch self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - else: - if self.CP.radarOffCan: - self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. - self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) - if self.CP.carFingerprint == CAR.CIVIC_HATCH: - self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ - (self.brake_switch and self.brake_switch_prev and \ - cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) - self.brake_switch_prev = self.brake_switch - self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - else: - self.brake_pressed = cp.vl["BRAKE_MODULE"]['BRAKE_PRESSED'] - # On set, cruise set speed pulses between 254~255 and the set speed prev is set to avoid this. - self.v_cruise_pcm = self.v_cruise_pcm_prev if cp.vl["ACC_HUD"]['CRUISE_SPEED'] > 160.0 else cp.vl["ACC_HUD"]['CRUISE_SPEED'] - self.v_cruise_pcm_prev = self.v_cruise_pcm + if self.CP.radarOffCan: + self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. + self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) + if self.CP.carFingerprint == CAR.CIVIC_HATCH: + self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ + (self.brake_switch and self.brake_switch_prev and \ + cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) + self.brake_switch_prev = self.brake_switch + self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + else: + self.brake_pressed = cp.vl["BRAKE_MODULE"]['BRAKE_PRESSED'] + # On set, cruise set speed pulses between 254~255 and the set speed prev is set to avoid this. + self.v_cruise_pcm = self.v_cruise_pcm_prev if cp.vl["ACC_HUD"]['CRUISE_SPEED'] > 160.0 else cp.vl["ACC_HUD"]['CRUISE_SPEED'] + self.v_cruise_pcm_prev = self.v_cruise_pcm else: self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] self.cruise_speed_offset = calc_cruise_offset(cp.vl["CRUISE_PARAMS"]['CRUISE_SPEED_OFFSET'], self.v_ego) From c303b9150861fd9dc17753769569425c1e58aaad Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:15:52 -0400 Subject: [PATCH 039/156] carstate --- selfdrive/car/honda/carstate.py | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 9e16cc74e36c27..c1667deea71e01 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -300,15 +300,6 @@ def update(self, cp): self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - if self.CP.enableRadar: - if self.CP.carFingerprint == CAR.CIVIC_HATCH: - self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) - self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ - (self.brake_switch and self.brake_switch_prev and \ - cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) - self.brake_switch_prev = self.brake_switch - self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] if self.CP.radarOffCan: self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) @@ -325,16 +316,26 @@ def update(self, cp): self.v_cruise_pcm = self.v_cruise_pcm_prev if cp.vl["ACC_HUD"]['CRUISE_SPEED'] > 160.0 else cp.vl["ACC_HUD"]['CRUISE_SPEED'] self.v_cruise_pcm_prev = self.v_cruise_pcm else: - self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - self.cruise_speed_offset = calc_cruise_offset(cp.vl["CRUISE_PARAMS"]['CRUISE_SPEED_OFFSET'], self.v_ego) - self.v_cruise_pcm = cp.vl["CRUISE"]['CRUISE_SPEED_PCM'] - # brake switch has shown some single time step noise, so only considered when - # switch is on for at least 2 consecutive CAN samples - self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ - (self.brake_switch and self.brake_switch_prev and \ - cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) - self.brake_switch_prev = self.brake_switch - self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + if self.CP.enableRadar: + if self.CP.carFingerprint == CAR.CIVIC_HATCH: + self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) + self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ + (self.brake_switch and self.brake_switch_prev and \ + cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) + self.brake_switch_prev = self.brake_switch + self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + else: + self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + self.cruise_speed_offset = calc_cruise_offset(cp.vl["CRUISE_PARAMS"]['CRUISE_SPEED_OFFSET'], self.v_ego) + self.v_cruise_pcm = cp.vl["CRUISE"]['CRUISE_SPEED_PCM'] + # brake switch has shown some single time step noise, so only considered when + # switch is on for at least 2 consecutive CAN samples + self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ + (self.brake_switch and self.brake_switch_prev and \ + cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) + self.brake_switch_prev = self.brake_switch + self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] self.user_brake = cp.vl["VSA_STATUS"]['USER_BRAKE'] self.standstill = not cp.vl["STANDSTILL"]['WHEELS_MOVING'] From 11db122a1c922f626f48341a4f49b4065417cd00 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:17:33 -0400 Subject: [PATCH 040/156] carstate --- selfdrive/car/honda/carstate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index c1667deea71e01..ad241f63af3c53 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -325,6 +325,9 @@ def update(self, cp): cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) self.brake_switch_prev = self.brake_switch self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + + self.v_cruise_pcm = 0 ## TODO: do this + self.v_cruise_pcm_prev = 0 ## TODO: do this else: self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] self.cruise_speed_offset = calc_cruise_offset(cp.vl["CRUISE_PARAMS"]['CRUISE_SPEED_OFFSET'], self.v_ego) From d554924ff7d943511ef70c4825166e8827d52d11 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:19:20 -0400 Subject: [PATCH 041/156] hondacan --- selfdrive/car/honda/hondacan.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index b17c19850c800f..06193ec117f4ae 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -3,6 +3,7 @@ import common.numpy_fast as np from selfdrive.config import Conversions as CV from selfdrive.car.honda.values import CAR +from selfdrive.car.honda.carstate import CarState # *** Honda specific *** def can_cksum(mm): From 865d514b4e220f2feb2701530203740790cd9379 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:19:47 -0400 Subject: [PATCH 042/156] hondacan --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 06193ec117f4ae..b14679779b6c3a 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -3,7 +3,7 @@ import common.numpy_fast as np from selfdrive.config import Conversions as CV from selfdrive.car.honda.values import CAR -from selfdrive.car.honda.carstate import CarState +from selfdrive.car.honda.carstate import CarState, CS, CP # *** Honda specific *** def can_cksum(mm): From 5f9188f3b6fa9789e482c9a08fcc07f8eab1d611 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:22:06 -0400 Subject: [PATCH 043/156] interface --- selfdrive/car/honda/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 61d71bbd5207cb..225e31ea96bf90 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -97,7 +97,7 @@ def __init__(self, CP, sendcan=None): # sending if read only is False if sendcan is not None: self.sendcan = sendcan - self.CC = CarController(self.cp.dbc_name, CP.enableCamera) + self.CC = CarController(self.cp.dbc_name, CP.enableCamera, CP.enableRadar) if self.CS.CP.carFingerprint == CAR.ACURA_ILX: self.compute_gb = get_compute_gb_acura() From 1f5c338a9f0ec6deb9063705672161b6e47e9c16 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:25:29 -0400 Subject: [PATCH 044/156] interface --- selfdrive/car/honda/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 225e31ea96bf90..61d71bbd5207cb 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -97,7 +97,7 @@ def __init__(self, CP, sendcan=None): # sending if read only is False if sendcan is not None: self.sendcan = sendcan - self.CC = CarController(self.cp.dbc_name, CP.enableCamera, CP.enableRadar) + self.CC = CarController(self.cp.dbc_name, CP.enableCamera) if self.CS.CP.carFingerprint == CAR.ACURA_ILX: self.compute_gb = get_compute_gb_acura() From df097ffefccc121d594f1fe4662347ac423b9832 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:27:14 -0400 Subject: [PATCH 045/156] fake the camera too --- selfdrive/car/honda/interface.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 61d71bbd5207cb..c7ff1e7ccfd708 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -156,6 +156,7 @@ def get_params(candidate, fingerprint): if ret.enableRadar: ret.safetyModel = car.CarParams.SafetyModels.honda ret.radarOffCan = False + ret.enableCamera = True print "ECU Camera Simulated: ", ret.enableCamera print "ECU Radar Simulated: ", ret.enableRadar From e62376275434e4b49b785ed02c7f969d30f310bd Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:28:55 -0400 Subject: [PATCH 046/156] interface --- selfdrive/car/honda/interface.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index c7ff1e7ccfd708..43f531be24ee6a 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -150,13 +150,12 @@ def get_params(candidate, fingerprint): ret.radarOffCan = True else: ret.safetyModel = car.CarParams.SafetyModels.honda - ret.enableCamera = not any(x for x in CAMERA_MSGS if x in fingerprint) ret.enableGasInterceptor = 0x201 in fingerprint + ret.enableCamera = not any(x for x in CAMERA_MSGS if x in fingerprint) ret.enableRadar = not any(x for x in ACC_MSGS if x in fingerprint) if ret.enableRadar: ret.safetyModel = car.CarParams.SafetyModels.honda ret.radarOffCan = False - ret.enableCamera = True print "ECU Camera Simulated: ", ret.enableCamera print "ECU Radar Simulated: ", ret.enableRadar From 54d67919c3492f8156ee9775e0c0d1e2c318d8b9 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:35:46 -0400 Subject: [PATCH 047/156] new dbc --- ..._civic_hatchback_ex_2017_can_generated.dbc | 326 ++++++++++++++++++ 1 file changed, 326 insertions(+) create mode 100644 opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc new file mode 100644 index 00000000000000..5455ed1c3ae115 --- /dev/null +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -0,0 +1,326 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _bosch_2018.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_ + +BU_: EBCM EON CAM RADAR PCM EPS VSA SCM BDY XXX EPB + +BO_ 228 STEERING_CONTROL: 5 EON + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS + SG_ STEER_TORQUE : 7|16@0- (1,0) [-4096|4096] "" EPS + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" EPS + +BO_ 232 BRAKE_HOLD: 7 XXX + SG_ XMISSION_SPEED : 7|14@0- (1,0) [1|0] "" XXX + SG_ COMPUTER_BRAKE : 39|16@0+ (1,0) [0|0] "" XXX + SG_ COMPUTER_BRAKE_REQUEST : 29|1@0+ (1,0) [0|0] "" XXX + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 51|4@0+ (1,0) [0|15] "" XXX + +BO_ 304 GAS_PEDAL_2: 8 PCM + SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ CAR_GAS : 39|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 + +BO_ 330 STEERING_SENSORS: 8 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_ STEER_ANGLE_OFFSET : 39|8@0- (-0.1,0) [-128|127] "deg" EON + SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" 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_ DISTANCE_COUNTER : 55|8@0+ (10,0) [0|2550] "Meters" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|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] "" EON + SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "" EON + SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "" EON + SG_ BOH2_17C : 47|10@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] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_TORQUE_MOTOR : 23|16@0- (1,0) [-31000|31000] "tbd" EON + SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|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|15] "" EON + +BO_ 420 VSA_STATUS: 8 VSA + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|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|15] "" EON + +BO_ 432 STANDSTILL: 7 VSA + 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|15] "" EON + +BO_ 450 EPB_STATUS: 8 EPB + SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON + SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +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_ 479 ACC_CONTROL: 8 EON + SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM + SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX + SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM + SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX + SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 495 ACC_CONTROL_ON: 8 XXX + SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_30 : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH : 23|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH2 : 47|16@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_FF : 15|8@0+ (1,0) [0|255] "" XXX + SG_ SET_TO_3 : 6|7@0+ (1,0) [0|4095] "" XXX + SG_ CONTROL_ON : 7|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + +BO_ 545 XXX_16: 6 SCM + SG_ ECON_ON : 23|1@0+ (1,0) [0|1] "" XXX + SG_ DRIVE_MODE : 37|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 43|4@0+ (1,0) [0|15] "" BDY + +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] "" XXX + SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON + SG_ LONG_COUNTER : 55|8@0+ (1,0) [0|255] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + + BO_ 662 SCM_BUTTONS: 4 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 27|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 CAR_SPEED: 8 PCM + SG_ ROUGH_CAR_SPEED : 23|8@0+ (1,0) [0|255] "" XXX + SG_ CAR_SPEED : 7|16@0+ (1,0) [0|65535] "" XXX + SG_ ROUGH_CAR_SPEED_3 : 39|16@0+ (1,0) [0|65535] "" XXX + SG_ ROUGH_CAR_SPEED_2 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ LOCK_STATUS : 55|2@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 780 ACC_HUD: 8 ADAS + 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_ 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_ 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_ ZEROS_BOH : 7|24@0+ (0.002759506,0) [0|100] "m/s" BDY + SG_ FCM_OFF : 35|1@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_1 : 36|1@0+ (1,0) [0|1] "" XXX + SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY + SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY + SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY + SG_ ACC_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ BOH_6 : 51|4@0+ (1,0) [0|15] "" XXX + SG_ SET_TO_X3 : 55|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 804 CRUISE: 8 PCM + SG_ TRIP_FUEL_CONSUMED : 23|16@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 + +BO_ 806 SCM_FEEDBACK: 8 SCM + SG_ DRIVERS_DOOR_OPEN : 17|1@0+ (1,0) [0|1] "" XXX + SG_ MAIN_ON : 28|1@0+ (1,0) [0|1] "" EON + SG_ RIGHT_BLINKER : 27|1@0+ (1,0) [0|1] "" EON + SG_ LEFT_BLINKER : 26|1@0+ (1,0) [0|1] "" EON + SG_ CMBS_STATES : 22|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 829 LKAS_HUD: 5 ADAS + SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY + SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" 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_ 862 CAMERA_MESSAGES: 8 CAM + SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY + SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX + SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ ZEROS_BOH_2 : 51|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 884 STALK_STATUS: 8 XXX + SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON + SG_ HEADLIGHTS_ON : 54|1@0+ (1,0) [0|1] "" EON + SG_ WIPER_SWITCH : 53|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 891 STALK_STATUS_2: 8 XXX + SG_ WIPERS : 17|2@0+ (1,0) [0|3] "" EON + SG_ LOW_BEAMS : 35|1@0+ (1,0) [0|1] "" XXX + SG_ HIGH_BEAMS : 34|1@0+ (1,0) [0|1] "" XXX + SG_ PARK_LIGHTS : 36|1@0+ (1,0) [0|1] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +CM_ "honda_civic_hatchback_ex_2017_can.dbc starts here" + + +BO_ 401 GEARBOX: 8 PCM + SG_ GEAR_SHIFTER : 5|6@0+ (1,0) [0|63] "" EON + SG_ BOH : 45|6@0+ (1,0) [0|63] "" XXX + SG_ GEAR2 : 31|8@0+ (1,0) [0|1] "" XXX + SG_ GEAR : 39|8@0+ (1,0) [0|255] "" XXX + SG_ ZEROS_BOH : 47|2@0+ (1,0) [0|3] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 506 BLANK_1FA: 8 XXX + SG_ CHECKSUM : 56|4@1+ (1,0) [0|15] "" XXX + SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX + +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|15] "" EON + +BO_ 927 RADAR_HUD: 8 RADAR + SG_ ZEROS_BOH : 7|10@0+ (1,0) [0|127] "" BDY + SG_ CMBS_OFF : 12|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH3 : 31|32@0+ (1,0) [0|4294967295] "" XXX + SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|1] "" XXX + SG_ SET_TO_1 : 13|1@0+ (1,0) [0|1] "" BDY + SG_ ZEROS_BOH2 : 11|4@0+ (1,0) [0|1] "" XXX + SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|1] "" XXX + SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|1] "" BDY + SG_ SET_TO_0 : 22|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +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|15] "" EON + +VAL_ 401 GEAR_SHIFTER 32 "L" 16 "S" 8 "D" 4 "N" 2 "R" 1 "P" ; +VAL_ 401 GEAR 7 "L" 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 545 ECON_ON_2 0 "off" 3 "on" ; +VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; +VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ; +VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; +VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; + +CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; From 62ab877225c1fd25cf00d0b63e822a8be883e85a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:38:34 -0400 Subject: [PATCH 048/156] dbc fix --- opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc | 2 +- opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc b/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc index 0bdb1e50833aab..7bcc35d31ae049 100644 --- a/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc +++ b/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc @@ -10,8 +10,8 @@ BO_ 401 GEARBOX: 8 PCM SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 506 BLANK_1FA: 8 XXX - SG_ CHECKSUM : 56|4@1+ (1,0) [0|15] "" XXX SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX BO_ 892 CRUISE_PARAMS: 8 PCM SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index 5455ed1c3ae115..ac2cc7d5c6a64a 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -284,8 +284,8 @@ BO_ 401 GEARBOX: 8 PCM SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 506 BLANK_1FA: 8 XXX - SG_ CHECKSUM : 56|4@1+ (1,0) [0|15] "" XXX SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX BO_ 892 CRUISE_PARAMS: 8 PCM SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON From 1adf37d7fd638e9e74c991123841f50dc5e9fa96 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:40:03 -0400 Subject: [PATCH 049/156] dbc again... --- opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc | 2 +- opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc b/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc index 7bcc35d31ae049..0c0c9c3f055e9c 100644 --- a/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc +++ b/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc @@ -11,7 +11,7 @@ BO_ 401 GEARBOX: 8 PCM BO_ 506 BLANK_1FA: 8 XXX SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|3@0+ (1,0) [0|3] "" XXX BO_ 892 CRUISE_PARAMS: 8 PCM SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index ac2cc7d5c6a64a..22e989ca5675a3 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -285,7 +285,7 @@ BO_ 401 GEARBOX: 8 PCM BO_ 506 BLANK_1FA: 8 XXX SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX - SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|3@0+ (1,0) [0|3] "" XXX BO_ 892 CRUISE_PARAMS: 8 PCM SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON From ba3e0ecdb8377e176b1fcb8bc7f8b02abe5d8e6b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 7 Jul 2018 23:44:31 -0400 Subject: [PATCH 050/156] dbc --- opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc | 4 ++-- opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc b/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc index 0c0c9c3f055e9c..062877f6038b61 100644 --- a/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc +++ b/opendbc/generator/honda/honda_civic_hatchback_ex_2017_can.dbc @@ -10,8 +10,8 @@ BO_ 401 GEARBOX: 8 PCM SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 506 BLANK_1FA: 8 XXX - SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX - SG_ COUNTER : 61|3@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX BO_ 892 CRUISE_PARAMS: 8 PCM SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index 22e989ca5675a3..4af7701dc69cdc 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -284,8 +284,8 @@ BO_ 401 GEARBOX: 8 PCM SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 506 BLANK_1FA: 8 XXX - SG_ COUNTER : 60|2@0+ (1,0) [0|3] "" XXX - SG_ COUNTER : 61|3@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX BO_ 892 CRUISE_PARAMS: 8 PCM SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON From ffd48dda8030a26eb670cc19e76a1d23eeed1123 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 00:01:48 -0400 Subject: [PATCH 051/156] print dbc for debug --- selfdrive/car/honda/interface.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 43f531be24ee6a..e7ad7a99fd04b9 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -94,6 +94,7 @@ def __init__(self, CP, sendcan=None): self.CS = CarState(CP) self.VM = VehicleModel(CP) + print "DBC is " print self.cp.dbc_name # sending if read only is False if sendcan is not None: self.sendcan = sendcan From a923740b0a0ff465eb182c060b744513fec61d84 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 00:02:30 -0400 Subject: [PATCH 052/156] print --- selfdrive/car/honda/interface.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index e7ad7a99fd04b9..7db78c435a6e11 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -94,7 +94,8 @@ def __init__(self, CP, sendcan=None): self.CS = CarState(CP) self.VM = VehicleModel(CP) - print "DBC is " print self.cp.dbc_name + print "DBC is ", + print self.cp.dbc_name # sending if read only is False if sendcan is not None: self.sendcan = sendcan From bfa3ec865ee84ae3279eaecf9c6ca3dffd74386f Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 00:03:44 -0400 Subject: [PATCH 053/156] more debugs --- selfdrive/car/honda/interface.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 7db78c435a6e11..9b3cebb636fac3 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -94,8 +94,15 @@ def __init__(self, CP, sendcan=None): self.CS = CarState(CP) self.VM = VehicleModel(CP) - print "DBC is ", + print "DBC is", print self.cp.dbc_name + + print "sendcan is", + print sendcan + + print "enableCamera is", + print CP.enableCamera + # sending if read only is False if sendcan is not None: self.sendcan = sendcan From aa1c361bc6f5f3a5e6eaf211d832df7ef7d1d2d9 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 00:04:48 -0400 Subject: [PATCH 054/156] move debug --- selfdrive/car/honda/interface.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 9b3cebb636fac3..aa78fec4f107fc 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -97,15 +97,14 @@ def __init__(self, CP, sendcan=None): print "DBC is", print self.cp.dbc_name - print "sendcan is", - print sendcan - print "enableCamera is", print CP.enableCamera # sending if read only is False if sendcan is not None: self.sendcan = sendcan + print "sendcan is", + print self.sendcan self.CC = CarController(self.cp.dbc_name, CP.enableCamera) if self.CS.CP.carFingerprint == CAR.ACURA_ILX: From 542d42f2e62c0399e71c1ff0e9cd40424344b3c7 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 00:05:27 -0400 Subject: [PATCH 055/156] debug --- selfdrive/car/honda/interface.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index aa78fec4f107fc..340e9c34e96b8d 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -105,6 +105,8 @@ def __init__(self, CP, sendcan=None): self.sendcan = sendcan print "sendcan is", print self.sendcan + print self.cp + print CP self.CC = CarController(self.cp.dbc_name, CP.enableCamera) if self.CS.CP.carFingerprint == CAR.ACURA_ILX: From 8cd1e7b9b409bd45427f4d800fd1a55d466b183b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 00:21:01 -0400 Subject: [PATCH 056/156] more debug and beep fix --- selfdrive/car/honda/carcontroller.py | 2 +- selfdrive/car/honda/interface.py | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 017b45a3da6222..981881befedab4 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -100,7 +100,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ hud_car = 0 # For lateral control-only, send chimes as a beep since we don't send 0x1fa - if CS.CP.radarOffCan: + if CS.CP.radarOffCan or car_fingerprint in (CAR.CIVIC_HATCH): snd_beep = snd_beep if snd_beep is not 0 else snd_chime #print chime, alert_id, hud_alert diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 340e9c34e96b8d..330310ec4bd2d9 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -94,18 +94,12 @@ def __init__(self, CP, sendcan=None): self.CS = CarState(CP) self.VM = VehicleModel(CP) - print "DBC is", - print self.cp.dbc_name - - print "enableCamera is", - print CP.enableCamera - # sending if read only is False if sendcan is not None: self.sendcan = sendcan - print "sendcan is", - print self.sendcan + print "self.cp is", print self.cp + print "CP is", print CP self.CC = CarController(self.cp.dbc_name, CP.enableCamera) From 4ab907de9017c67672b997442d6efdfd303f4579 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 01:01:56 -0400 Subject: [PATCH 057/156] hondacan syntax --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index b14679779b6c3a..40727b40d72104 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -118,7 +118,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): 'SET_ME_X03_2': 0x03, 'SET_ME_X01': 0x01, } - commands.append(packer.make_can_msg("ACC_HUD", 0, acc_hud_values, idx)) + commands.append(packer.make_can_msg('ACC_HUD', 0, acc_hud_values, idx)) lkas_hud_values = { 'SET_ME_X41': 0x41, From 21b996158ad4734a8c7a4f716211c8f929a6146b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 01:02:56 -0400 Subject: [PATCH 058/156] fix? --- selfdrive/controls/radard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/controls/radard.py b/selfdrive/controls/radard.py index 427b3b2a61967f..ee177207b3d5a8 100755 --- a/selfdrive/controls/radard.py +++ b/selfdrive/controls/radard.py @@ -49,7 +49,7 @@ def radard_thread(gctx=None): # wait for stats about the car to come in from controls cloudlog.info("radard is waiting for CarParams") CP = car.CarParams.from_bytes(Params().get("CarParams", block=True)) - mocked = True + mocked = False VM = VehicleModel(CP) cloudlog.info("radard got CarParams") From 3ebdb412f448794c6821ab22000cd194c7801a66 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 01:05:30 -0400 Subject: [PATCH 059/156] go back --- selfdrive/controls/radard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/controls/radard.py b/selfdrive/controls/radard.py index ee177207b3d5a8..427b3b2a61967f 100755 --- a/selfdrive/controls/radard.py +++ b/selfdrive/controls/radard.py @@ -49,7 +49,7 @@ def radard_thread(gctx=None): # wait for stats about the car to come in from controls cloudlog.info("radard is waiting for CarParams") CP = car.CarParams.from_bytes(Params().get("CarParams", block=True)) - mocked = False + mocked = True VM = VehicleModel(CP) cloudlog.info("radard got CarParams") From 143d9cd37af7b9e39dfdd7ba28a6471c9e645d07 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 01:11:23 -0400 Subject: [PATCH 060/156] hondacan --- selfdrive/car/honda/hondacan.py | 1 - 1 file changed, 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 40727b40d72104..77ea2276e9869a 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -139,7 +139,6 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): 'LEAD_DISTANCE': 0x1e, } commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) - return commands if not CS.CP.radarOffCan and car_fingerprint in (CAR.CIVIC_HATCH): commands.append(packer.make_can_msg('HIGHBEAM_CONTROL', 0, {'HIGHBEAMS_ON': False}, idx)) From 84853ade228bc168d8f4999d96900c7639ea7597 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 09:54:46 -0400 Subject: [PATCH 061/156] make radarOffCan good again --- selfdrive/car/honda/carcontroller.py | 60 ++++++++++----------- selfdrive/car/honda/carstate.py | 78 ++++++++++++++-------------- selfdrive/car/honda/hondacan.py | 24 ++++----- selfdrive/car/honda/interface.py | 1 - 4 files changed, 80 insertions(+), 83 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 981881befedab4..4ce4582be9b900 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -100,7 +100,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ hud_car = 0 # For lateral control-only, send chimes as a beep since we don't send 0x1fa - if CS.CP.radarOffCan or car_fingerprint in (CAR.CIVIC_HATCH): + if CS.CP.radarOffCan: snd_beep = snd_beep if snd_beep is not 0 else snd_chime #print chime, alert_id, hud_alert @@ -145,35 +145,35 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ can_sends.extend(hondacan.create_ui_commands(self.packer, pcm_speed, hud, CS.CP.carFingerprint, idx)) if CS.CP.radarOffCan: - # If using stock ACC, spam cancel command to kill gas when OP disengages. - if pcm_cancel_cmd: - can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.CANCEL, idx)) - elif CS.stopped: - can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.RES_ACCEL, idx)) - else: - # Send gas and brake commands. - if (frame % 2) == 0: - idx = (frame / 2) % 4 - if CS.CP.carFingerprint == CAR.CIVIC_HATCH: - can_sends.append(hondacan.create_long_command(self.packer, gas_amount, apply_brake, idx)) - can_sends.append(hondacan.create_1fa(self.packer, idx)) - else: - can_sends.append( - hondacan.create_brake_command(self.packer, apply_brake, pcm_override, - pcm_cancel_cmd, hud.chime, hud.fcw, idx)) - if CS.CP.enableGasInterceptor: - # send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas. - # This prevents unexpected pedal range rescaling - can_sends.append(hondacan.create_gas_command(self.packer, apply_gas, idx)) - - # radar at 20Hz, but these msgs need to be sent at 50Hz on ilx (seems like an Acura bug) - if CS.CP.carFingerprint == CAR.ACURA_ILX: - radar_send_step = 2 - else: - radar_send_step = 5 if not CS.CP.enableRadar: - if (frame % radar_send_step) == 0: - idx = (frame/radar_send_step) % 4 - can_sends.extend(hondacan.create_radar_commands(CS.v_ego, CS.CP.carFingerprint, idx)) + # If using stock ACC, spam cancel command to kill gas when OP disengages. + if pcm_cancel_cmd: + can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.CANCEL, idx)) + elif CS.stopped: + can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.RES_ACCEL, idx)) + # Send gas and brake commands. + if (frame % 2) == 0: + idx = (frame / 2) % 4 + if CS.CP.enableRadar and CS.CP.carFingerprint == CAR.CIVIC_HATCH: + can_sends.append(hondacan.create_long_command(self.packer, gas_amount, apply_brake, idx)) + can_sends.append(hondacan.create_1fa(self.packer, idx)) + else: + can_sends.append( + hondacan.create_brake_command(self.packer, apply_brake, pcm_override, + pcm_cancel_cmd, hud.chime, hud.fcw, idx)) + if CS.CP.enableGasInterceptor: + # send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas. + # This prevents unexpected pedal range rescaling + can_sends.append(hondacan.create_gas_command(self.packer, apply_gas, idx)) + + # radar at 20Hz, but these msgs need to be sent at 50Hz on ilx (seems like an Acura bug) + if CS.CP.carFingerprint == CAR.ACURA_ILX: + radar_send_step = 2 + else: + radar_send_step = 5 + if not CS.CP.enableRadar: + if (frame % radar_send_step) == 0: + idx = (frame/radar_send_step) % 4 + can_sends.extend(hondacan.create_radar_commands(CS.v_ego, CS.CP.carFingerprint, idx)) sendcan.send(can_list_to_can_capnp(can_sends, msgtype='sendcan').to_bytes()) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index ad241f63af3c53..c62df606dee7ae 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -110,26 +110,24 @@ def get_can_signals(CP): if CP.carFingerprint != CAR.CIVIC_HATCH: signals += [("BRAKE_PRESSED", "BRAKE_MODULE", 0)] checks += [("BRAKE_MODULE", 50)] - signals += [("CAR_GAS", "GAS_PEDAL_2", 0), - ("MAIN_ON", "SCM_FEEDBACK", 0), - ("EPB_STATE", "EPB_STATUS", 0), - ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0), - ("CRUISE_SPEED", "ACC_HUD", 0)] - checks += [("GAS_PEDAL_2", 100)] + if CP.enableRadar: + signals += [("CAR_GAS", "GAS_PEDAL_2", 0), + ("MAIN_ON", "SCM_FEEDBACK", 0), + ("EPB_STATE", "EPB_STATUS", 0), + ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0)] + checks += [("GAS_PEDAL_2", 100)] + else: + signals += [("CAR_GAS", "GAS_PEDAL_2", 0), + ("MAIN_ON", "SCM_FEEDBACK", 0), + ("EPB_STATE", "EPB_STATUS", 0), + ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0), + ("CRUISE_SPEED", "ACC_HUD", 0)] + checks += [("GAS_PEDAL_2", 100)] else: # Nidec signals. signals += [("CRUISE_SPEED_PCM", "CRUISE", 0), ("CRUISE_SPEED_OFFSET", "CRUISE_PARAMS", 0)] checks += [("CRUISE_PARAMS", 50)] - if CP.carFingerprint != CAR.CIVIC_HATCH: - signals += [("BRAKE_PRESSED", "BRAKE_MODULE", 0)] - checks += [("BRAKE_MODULE", 50)] - signals += [("CAR_GAS", "GAS_PEDAL_2", 0), - ("MAIN_ON", "SCM_FEEDBACK", 0), - ("EPB_STATE", "EPB_STATUS", 0), - ("BRAKE_HOLD_ACTIVE", "VSA_STATUS", 0)] - checks += [("GAS_PEDAL_2", 100)] - if CP.carFingerprint == CAR.ACCORD: signals += [("DRIVERS_DOOR_OPEN", "SCM_FEEDBACK", 1)] @@ -301,21 +299,6 @@ def update(self, cp): self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] if self.CP.radarOffCan: - self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. - self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) - if self.CP.carFingerprint == CAR.CIVIC_HATCH: - self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ - (self.brake_switch and self.brake_switch_prev and \ - cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) - self.brake_switch_prev = self.brake_switch - self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - else: - self.brake_pressed = cp.vl["BRAKE_MODULE"]['BRAKE_PRESSED'] - # On set, cruise set speed pulses between 254~255 and the set speed prev is set to avoid this. - self.v_cruise_pcm = self.v_cruise_pcm_prev if cp.vl["ACC_HUD"]['CRUISE_SPEED'] > 160.0 else cp.vl["ACC_HUD"]['CRUISE_SPEED'] - self.v_cruise_pcm_prev = self.v_cruise_pcm - else: if self.CP.enableRadar: if self.CP.carFingerprint == CAR.CIVIC_HATCH: self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) @@ -329,16 +312,31 @@ def update(self, cp): self.v_cruise_pcm = 0 ## TODO: do this self.v_cruise_pcm_prev = 0 ## TODO: do this else: - self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - self.cruise_speed_offset = calc_cruise_offset(cp.vl["CRUISE_PARAMS"]['CRUISE_SPEED_OFFSET'], self.v_ego) - self.v_cruise_pcm = cp.vl["CRUISE"]['CRUISE_SPEED_PCM'] - # brake switch has shown some single time step noise, so only considered when - # switch is on for at least 2 consecutive CAN samples - self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ - (self.brake_switch and self.brake_switch_prev and \ - cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) - self.brake_switch_prev = self.brake_switch - self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. + self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) + if self.CP.carFingerprint == CAR.CIVIC_HATCH: + self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ + (self.brake_switch and self.brake_switch_prev and \ + cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) + self.brake_switch_prev = self.brake_switch + self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + else: + self.brake_pressed = cp.vl["BRAKE_MODULE"]['BRAKE_PRESSED'] + # On set, cruise set speed pulses between 254~255 and the set speed prev is set to avoid this. + self.v_cruise_pcm = self.v_cruise_pcm_prev if cp.vl["ACC_HUD"]['CRUISE_SPEED'] > 160.0 else cp.vl["ACC_HUD"]['CRUISE_SPEED'] + self.v_cruise_pcm_prev = self.v_cruise_pcm + else: + self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] + self.cruise_speed_offset = calc_cruise_offset(cp.vl["CRUISE_PARAMS"]['CRUISE_SPEED_OFFSET'], self.v_ego) + self.v_cruise_pcm = cp.vl["CRUISE"]['CRUISE_SPEED_PCM'] + # brake switch has shown some single time step noise, so only considered when + # switch is on for at least 2 consecutive CAN samples + self.brake_pressed = cp.vl["POWERTRAIN_DATA"]['BRAKE_PRESSED'] or \ + (self.brake_switch and self.brake_switch_prev and \ + cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] != self.brake_switch_ts) + self.brake_switch_prev = self.brake_switch + self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] self.user_brake = cp.vl["VSA_STATUS"]['USER_BRAKE'] self.standstill = not cp.vl["STANDSTILL"]['WHEELS_MOVING'] diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 77ea2276e9869a..ada14538bbed16 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -96,7 +96,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): # Bosch sends commands to bus 2. if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH): bus = 2 - if not CS.CP.radarOffCan: + if CS.CP.enableRadar: if car_fingerprint in (CAR.CIVIC_HATCH): bus = 0 acc_hud_values = { @@ -107,17 +107,17 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): 'HUD_DISTANCE': 0x03, 'SET_ME_X03': 0x03, } - else: - acc_hud_values = { - 'PCM_SPEED': pcm_speed * CV.MS_TO_KPH, - 'PCM_GAS': hud.pcm_accel, - 'CRUISE_SPEED': hud.v_cruise, - 'ENABLE_MINI_CAR': hud.mini_car, - 'HUD_LEAD': hud.car, - 'SET_ME_X03': 0x03, - 'SET_ME_X03_2': 0x03, - 'SET_ME_X01': 0x01, - } + else: + acc_hud_values = { + 'PCM_SPEED': pcm_speed * CV.MS_TO_KPH, + 'PCM_GAS': hud.pcm_accel, + 'CRUISE_SPEED': hud.v_cruise, + 'ENABLE_MINI_CAR': hud.mini_car, + 'HUD_LEAD': hud.car, + 'SET_ME_X03': 0x03, + 'SET_ME_X03_2': 0x03, + 'SET_ME_X01': 0x01, + } commands.append(packer.make_can_msg('ACC_HUD', 0, acc_hud_values, idx)) lkas_hud_values = { diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 330310ec4bd2d9..a6d64d6ea80994 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -159,7 +159,6 @@ def get_params(candidate, fingerprint): ret.enableRadar = not any(x for x in ACC_MSGS if x in fingerprint) if ret.enableRadar: ret.safetyModel = car.CarParams.SafetyModels.honda - ret.radarOffCan = False print "ECU Camera Simulated: ", ret.enableCamera print "ECU Radar Simulated: ", ret.enableRadar From d2612fadc286bef97d83bd8b0408bb6ee3a8859c Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 10:15:07 -0400 Subject: [PATCH 062/156] debug print --- selfdrive/car/car_helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 0255137ab0b21d..c9c245a737a58d 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -97,5 +97,6 @@ def get_car(logcan, sendcan=None, passive=True): return None, None params = interface_cls.get_params(candidate, fingerprints) - + print "params is", + print params return interface_cls(params, sendcan), params From da3ea612593c099ab63eedcfdd2640e9e12d73c5 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 10:15:48 -0400 Subject: [PATCH 063/156] less debug --- selfdrive/car/honda/interface.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index a6d64d6ea80994..79328e738936d0 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -97,10 +97,6 @@ def __init__(self, CP, sendcan=None): # sending if read only is False if sendcan is not None: self.sendcan = sendcan - print "self.cp is", - print self.cp - print "CP is", - print CP self.CC = CarController(self.cp.dbc_name, CP.enableCamera) if self.CS.CP.carFingerprint == CAR.ACURA_ILX: From d076bcbd77658b583433a0853a0a4cf0fbb3cfd8 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 10:28:02 -0400 Subject: [PATCH 064/156] less debug --- selfdrive/car/car_helpers.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index c9c245a737a58d..46bf55e83497d9 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -97,6 +97,4 @@ def get_car(logcan, sendcan=None, passive=True): return None, None params = interface_cls.get_params(candidate, fingerprints) - print "params is", - print params return interface_cls(params, sendcan), params From b78d4de38ad919a663ce1027467915fb3dc258e1 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 11:17:39 -0400 Subject: [PATCH 065/156] things --- selfdrive/car/car_helpers.py | 1 + selfdrive/manager.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 46bf55e83497d9..6c67d73f6c2401 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -97,4 +97,5 @@ def get_car(logcan, sendcan=None, passive=True): return None, None params = interface_cls.get_params(candidate, fingerprints) + return interface_cls(params, sendcan), params diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 7ebafc5f78915d..f1530b58d143bf 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -87,7 +87,7 @@ # comment out anything you don't want to run managed_processes = { "uploader": "selfdrive.loggerd.uploader", - "controlsd": "selfdrive.controls.controlsd", + #"controlsd": "selfdrive.controls.controlsd", "radard": "selfdrive.controls.radard", "ubloxd": "selfdrive.locationd.ubloxd", "locationd_dummy": "selfdrive.locationd.locationd_dummy", @@ -105,7 +105,7 @@ #"orbd": ("selfdrive/orbd", ["./orbd_wrapper.sh"]), "updated": "selfdrive.updated", #"gpsplanner": "selfdrive.controls.gps_plannerd", - "homeassistant": "selfdrive.homeassistant", + #"homeassistant": "selfdrive.homeassistant", } running = {} From c49bc57a790bcdf852a2606b708de618069ec021 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 11:49:09 -0400 Subject: [PATCH 066/156] is this it? --- selfdrive/car/honda/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 3b3f0bab0563ae..f7049eb6e5bd9d 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -99,7 +99,7 @@ class CAR: CAR.ACURA_ILX: dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.ACURA_RDX: dbc_dict('acura_rdx_2018_can_generated', 'acura_ilx_2016_nidec'), CAR.CIVIC: dbc_dict('honda_civic_touring_2016_can_generated', 'acura_ilx_2016_nidec'), - CAR.CIVIC_HATCH: dbc_dict('honda_civic_hatchback_ex_2017_can_generated', None), + CAR.CIVIC_HATCH: dbc_dict('honda_civic_hatchback_ex_2017_can_generated', 'honda_civic_hatchback_ex_2017_can_generated'), CAR.CRV: dbc_dict('honda_crv_touring_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.CRV_5G: dbc_dict('honda_crv_ex_2017_can_generated', None), CAR.ODYSSEY: dbc_dict('honda_odyssey_exl_2018_generated', 'acura_ilx_2016_nidec'), From b8d674b08745fd9c28a4b4493cbcd8b760193e43 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:28:02 -0400 Subject: [PATCH 067/156] turn off mocked radar --- selfdrive/controls/radard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/controls/radard.py b/selfdrive/controls/radard.py index 427b3b2a61967f..ee177207b3d5a8 100755 --- a/selfdrive/controls/radard.py +++ b/selfdrive/controls/radard.py @@ -49,7 +49,7 @@ def radard_thread(gctx=None): # wait for stats about the car to come in from controls cloudlog.info("radard is waiting for CarParams") CP = car.CarParams.from_bytes(Params().get("CarParams", block=True)) - mocked = True + mocked = False VM = VehicleModel(CP) cloudlog.info("radard got CarParams") From 6b3e18eef2ca09b68536f3c31f4750e260018e59 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:28:10 -0400 Subject: [PATCH 068/156] no radar dbc for hatch --- selfdrive/car/honda/values.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index f7049eb6e5bd9d..5667dd15e4714c 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -57,37 +57,37 @@ class CAR: 1024L: 5, 513L: 6, 1027L: 5, 1029L: 8, 929L: 4, 1057L: 5, 777L: 8, 1034L: 5, 1036L: 8, 398L: 3, 399L: 7, 145L: 8, 660L: 8, 985L: 3, 923L: 2, 542L: 7, 773L: 7, 800L: 8, 432L: 7, 419L: 8, 420L: 8, 1030L: 5, 422L: 8, 808L: 8, 428L: 8, 304L: 8, 819L: 7, 821L: 5, 57L: 3, 316L: 8, 545L: 4, 464L: 8, 1108L: 8, 597L: 8, 342L: 6, 983L: 8, 344L: 8, 804L: 8, 1039L: 8, 476L: 4, 892L: 8, 490L: 8, 1064L: 7, 882L: 2, 884L: 7, 887L: 8, 888L: 8, 380L: 8, 1365L: 5, # sent messages 0xe4: 5, 0x1fa: 8, 0x200: 6, 0x30c: 8, 0x33d: 5, - }], + }], CAR.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 - }], + 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 + }], CAR.CIVIC: [{ 1024L: 5, 513L: 6, 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 0xe4: 5, 0x1fa: 8, 0x200: 6, 0x30c: 8, 0x33d: 5, 0x35e: 8, 0x39f: 8, - }], + }], CAR.CIVIC_HATCH: [{ - 57L: 3, 148L: 8, 228L: 5, 304L: 8, 330L: 8, 344L: 8, 380L: 8, 399L: 7, 401L: 8, 420L: 8, 427L: 3, 428L: 8, 432L: 7, 441L: 5, 450L: 8, 464L: 8, 470L: 2, 476L: 7, 477L: 8, 479L: 8, 490L: 8, 493L: 5, 495L: 8, 506L: 8, 545L: 6, 597L: 8, 662L: 4, 773L: 7, 777L: 8, 780L: 8, 795L: 8, 800L: 8, 804L: 8, 806L: 8, 808L: 8, 829L: 5, 862L: 8, 884L: 8, 891L: 8, 892L: 8, 927L: 8, 929L: 8, 985L: 3, 1024L: 5, 1027L: 5, 1029L: 8, 1036L: 8, 1039L: 8, 1108L: 8, 1302L: 8, 1322L: 5, 1361L: 5, 1365L: 5, 1424L: 5, 1600L: 5, 1601L: 8, 1633L: 8 - }], + 57L: 3, 148L: 8, 228L: 5, 304L: 8, 330L: 8, 344L: 8, 380L: 8, 399L: 7, 401L: 8, 420L: 8, 427L: 3, 428L: 8, 432L: 7, 441L: 5, 450L: 8, 464L: 8, 470L: 2, 476L: 7, 477L: 8, 479L: 8, 490L: 8, 493L: 5, 495L: 8, 506L: 8, 545L: 6, 597L: 8, 662L: 4, 773L: 7, 777L: 8, 780L: 8, 795L: 8, 800L: 8, 804L: 8, 806L: 8, 808L: 8, 829L: 5, 862L: 8, 884L: 8, 891L: 8, 892L: 8, 927L: 8, 929L: 8, 985L: 3, 1024L: 5, 1027L: 5, 1029L: 8, 1036L: 8, 1039L: 8, 1108L: 8, 1302L: 8, 1322L: 5, 1361L: 5, 1365L: 5, 1424L: 5, 1600L: 5, 1601L: 8, 1633L: 8 + }], CAR.CRV: [{ 57L: 3, 145L: 8, 316L: 8, 340L: 8, 342L: 6, 344L: 8, 380L: 8, 398L: 3, 399L: 6, 401L: 8, 420L: 8, 422L: 8, 426L: 8, 432L: 7, 464L: 8, 474L: 5, 476L: 4, 487L: 4, 490L: 8, 493L: 3, 507L: 1, 542L: 7, 545L: 4, 597L: 8, 660L: 8, 661L: 4, 773L: 7, 777L: 8, 800L: 8, 804L: 8, 808L: 8, 882L: 2, 884L: 7, 888L: 8, 891L: 8, 892L: 8, 923L: 2, 929L: 8, 983L: 8, 985L: 3, 1024L: 5, 1027L: 5, 1029L: 8, 1033L: 5, 1036L: 8, 1039L: 8, 1057L: 5, 1064L: 7, 1108L: 8, 1125L: 8, 1296L: 8, 1365L: 5, 1424L: 5, 1600L: 5, 1601L: 8, # sent messages 0x194: 4, 0x1fa: 8, 0x30c: 8, 0x33d: 5, - }], + }], CAR.CRV_5G: [{ 57L: 3, 148L: 8, 199L: 4, 228L: 5, 231L: 5, 232L: 7, 304L: 8, 330L: 8, 340L: 8, 344L: 8, 380L: 8, 399L: 7, 401L: 8, 420L: 8, 423L: 2, 427L: 3, 428L: 8, 432L: 7, 441L: 5, 446L: 3, 450L: 8, 464L: 8, 467L: 2, 469L: 3, 470L: 2, 474L: 8, 476L: 7, 477L: 8, 479L: 8, 490L: 8, 493L: 5, 495L: 8, 507L: 1, 545L: 6, 597L: 8, 661L: 4, 662L: 4, 773L: 7, 777L: 8, 780L: 8, 795L: 8, 800L: 8, 804L: 8, 806L: 8, 808L: 8, 814L: 4, 815L: 8, 817L: 4, 825L: 4, 829L: 5, 862L: 8, 881L: 8, 882L: 4, 884L: 8, 888L: 8, 891L: 8, 927L: 8, 918L: 7, 929L: 8, 983L: 8, 985L: 3, 1024L: 5, 1027L: 5, 1029L: 8, 1036L: 8, 1039L: 8, 1064L: 7, 1108L: 8, 1092L: 1, 1115L: 4, 1125L: 8, 1127L: 2, 1296L: 8, 1302L: 8, 1322L: 5, 1361L: 5, 1365L: 5, 1424L: 5, 1600L: 5, 1601L: 8, 1618L: 5, 1633L: 8, 1670L: 5 - }], + }], CAR.ODYSSEY: [{ 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 - }, + }, # Odyssey Elite { 57L: 3, 148L: 8, 228L: 5, 229L: 4, 304L: 8, 342L: 6, 344L: 8, 380L: 8, 399L: 7, 411L: 5, 419L: 8, 420L: 8, 427L: 3, 432L: 7, 440L: 8, 450L: 8, 463L: 8, 464L: 8, 476L: 4, 490L: 8, 506L: 8, 507L: 1, 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, 1616L: 5, 1619L: 5, 1623L: 5, 1668L: 5 - }], + }], # Includes 2017 Touring and 2016 EX-L messaging. CAR.PILOT: [{ 57L: 3, 145L: 8, 228L: 5, 229L: 4, 308L: 5, 316L: 8, 334L: 8, 339L: 7, 342L: 6, 344L: 8, 379L: 8, 380L: 8, 392L: 6, 399L: 7, 419L: 8, 420L: 8, 422L: 8, 425L: 8, 426L: 8, 427L: 3, 432L: 7, 463L: 8, 464L: 8, 476L: 4, 490L: 8, 506L: 8, 507L: 1, 538L: 3, 542L: 7, 545L: 5, 546L: 3, 597L: 8, 660L: 8, 773L: 7, 777L: 8, 780L: 8, 795L: 8, 800L: 8, 804L: 8, 808L: 8, 819L: 7, 821L: 5, 829L: 5, 837L: 5, 856L: 7, 871L: 8, 882L: 2, 884L: 7, 891L: 8, 892L: 8, 923L: 2, 929L: 8, 963L: 8, 965L: 8, 966L: 8, 967L: 8, 983L: 8, 985L: 3, 1027L: 5, 1029L: 8, 1036L: 8, 1039L: 8, 1064L: 7, 1088L: 8, 1089L: 8, 1108L: 8, 1125L: 8, 1296L: 8, 1424L: 5, 1600L: 5, 1601L: 8, 1612L: 5, 1613L: 5, 1616L: 5, 1618L: 5, 1668L: 5 - }], + }], CAR.RIDGELINE: [{ 57L: 3, 145L: 8, 228L: 5, 229L: 4, 308L: 5, 316L: 8, 339L: 7, 342L: 6, 344L: 8, 380L: 8, 392L: 6, 399L: 7, 419L: 8, 420L: 8, 422L: 8, 425L: 8, 426L: 8, 427L: 3, 432L: 7, 464L: 8, 471L: 3, 476L: 4, 490L: 8, 506L: 8, 545L: 5, 546L: 3, 597L: 8, 660L: 8, 773L: 7, 777L: 8, 780L: 8, 795L: 8, 800L: 8, 804L: 8, 808L: 8, 819L: 7, 821L: 5, 829L: 5, 871L: 8, 882L: 2, 884L: 7, 892L: 8, 923L: 2, 927L: 8, 929L: 8, 963L: 8, 965L: 8, 966L: 8, 967L: 8, 983L: 8, 985L: 3, 1027L: 5, 1029L: 8, 1036L: 8, 1039L: 8, 1064L: 7, 1088L: 8, 1089L: 8, 1108L: 8, 1125L: 8, 1296L: 8, 1365L: 5, 1424L: 5, 1600L: 5, 1601L: 8, 1613L: 5, 1616L: 5, 1618L: 5, 1668L: 5, 2015L: 3 }] @@ -99,7 +99,7 @@ class CAR: CAR.ACURA_ILX: dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.ACURA_RDX: dbc_dict('acura_rdx_2018_can_generated', 'acura_ilx_2016_nidec'), CAR.CIVIC: dbc_dict('honda_civic_touring_2016_can_generated', 'acura_ilx_2016_nidec'), - CAR.CIVIC_HATCH: dbc_dict('honda_civic_hatchback_ex_2017_can_generated', 'honda_civic_hatchback_ex_2017_can_generated'), + CAR.CIVIC_HATCH: dbc_dict('honda_civic_hatchback_ex_2017_can_generated', None), CAR.CRV: dbc_dict('honda_crv_touring_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.CRV_5G: dbc_dict('honda_crv_ex_2017_can_generated', None), CAR.ODYSSEY: dbc_dict('honda_odyssey_exl_2018_generated', 'acura_ilx_2016_nidec'), From 6f8629c771bf7f85d3a5fe94f48b9a66ac41440f Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:29:29 -0400 Subject: [PATCH 069/156] Revert "turn off mocked radar" This reverts commit b8d674b08745fd9c28a4b4493cbcd8b760193e43. --- selfdrive/controls/radard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/controls/radard.py b/selfdrive/controls/radard.py index ee177207b3d5a8..427b3b2a61967f 100755 --- a/selfdrive/controls/radard.py +++ b/selfdrive/controls/radard.py @@ -49,7 +49,7 @@ def radard_thread(gctx=None): # wait for stats about the car to come in from controls cloudlog.info("radard is waiting for CarParams") CP = car.CarParams.from_bytes(Params().get("CarParams", block=True)) - mocked = False + mocked = True VM = VehicleModel(CP) cloudlog.info("radard got CarParams") From 35199fa59135f71493978dd389ead4ece50a7ffe Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:45:36 -0400 Subject: [PATCH 070/156] hondacan --- selfdrive/car/honda/hondacan.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index ada14538bbed16..73c2b795b8aa11 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -31,7 +31,6 @@ def make_can_msg(addr, dat, idx, alt): def create_long_command(packer, gas_amount, apply_brake, idx): values = { - "SET_TO_1": 0x0, #"GAS_COMMAND": gasbrake2, #"RELATED_TO_GAS": related_to_gas, "CONTROL_ON": 0x05, @@ -140,7 +139,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): } commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) - if not CS.CP.radarOffCan and car_fingerprint in (CAR.CIVIC_HATCH): + if CS.CP.enableRadar: commands.append(packer.make_can_msg('HIGHBEAM_CONTROL', 0, {'HIGHBEAMS_ON': False}, idx)) radar_hud_values = { 'ACC_ALERTS': hud.acc_alert, From 2918f5181c4c1d7ca3c21d767627a1407300763c Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:47:10 -0400 Subject: [PATCH 071/156] hondacan --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 73c2b795b8aa11..d5e58c12bf0134 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -3,7 +3,7 @@ import common.numpy_fast as np from selfdrive.config import Conversions as CV from selfdrive.car.honda.values import CAR -from selfdrive.car.honda.carstate import CarState, CS, CP +from selfdrive.car.honda.carstate import CS # *** Honda specific *** def can_cksum(mm): From da4c8afda52db42f43fd0a3f407111fda1683638 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:48:13 -0400 Subject: [PATCH 072/156] trial --- selfdrive/car/honda/hondacan.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index d5e58c12bf0134..4d33ba530aab27 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -3,7 +3,7 @@ import common.numpy_fast as np from selfdrive.config import Conversions as CV from selfdrive.car.honda.values import CAR -from selfdrive.car.honda.carstate import CS +#from selfdrive.car.honda.carstate import CarState, CS # *** Honda specific *** def can_cksum(mm): @@ -95,7 +95,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): # Bosch sends commands to bus 2. if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH): bus = 2 - if CS.CP.enableRadar: + if True: if car_fingerprint in (CAR.CIVIC_HATCH): bus = 0 acc_hud_values = { @@ -139,7 +139,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): } commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) - if CS.CP.enableRadar: + if True: commands.append(packer.make_can_msg('HIGHBEAM_CONTROL', 0, {'HIGHBEAMS_ON': False}, idx)) radar_hud_values = { 'ACC_ALERTS': hud.acc_alert, From 2ca66feb9aba9bdd872d3cf5737b30dcbf062c5c Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:50:16 -0400 Subject: [PATCH 073/156] hondacan --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 4d33ba530aab27..d6b92ad0121c18 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -3,7 +3,7 @@ import common.numpy_fast as np from selfdrive.config import Conversions as CV from selfdrive.car.honda.values import CAR -#from selfdrive.car.honda.carstate import CarState, CS +from selfdrive.car.honda.carstate import CarState # *** Honda specific *** def can_cksum(mm): From eb4a80fe91ba2e28ce635f49216e68334aea3dd5 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:51:14 -0400 Subject: [PATCH 074/156] manually set bus --- selfdrive/car/honda/hondacan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index d6b92ad0121c18..4b76e72ac8798e 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -3,7 +3,6 @@ import common.numpy_fast as np from selfdrive.config import Conversions as CV from selfdrive.car.honda.values import CAR -from selfdrive.car.honda.carstate import CarState # *** Honda specific *** def can_cksum(mm): @@ -83,7 +82,8 @@ def create_steering_control(packer, apply_steer, lkas_active, car_fingerprint, i "STEER_TORQUE_REQUEST": lkas_active, } # Set bus 2 for accord and new crv. - bus = 2 if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH) and CS.CP.radarOffCan else 0 + bus = 2 if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH) else 0 + bus = 0 return packer.make_can_msg("STEERING_CONTROL", bus, values, idx) From 6a3b7215e5bb04cce26654c363273a8d84666ab6 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:52:10 -0400 Subject: [PATCH 075/156] disable highbeam message --- selfdrive/car/honda/hondacan.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 4b76e72ac8798e..f31f55b708c29e 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -139,13 +139,13 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): } commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) - if True: - commands.append(packer.make_can_msg('HIGHBEAM_CONTROL', 0, {'HIGHBEAMS_ON': False}, idx)) - radar_hud_values = { - 'ACC_ALERTS': hud.acc_alert, - 'SET_TO_1': 0x01, - } - commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) + # if True: + # commands.append(packer.make_can_msg('HIGHBEAM_CONTROL', 0, {'HIGHBEAMS_ON': False}, idx)) + # radar_hud_values = { + # 'ACC_ALERTS': hud.acc_alert, + # 'SET_TO_1': 0x01, + # } + # commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) return commands From 9a7ee40eac372006b6322f93626f0871e4055a43 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:53:46 -0400 Subject: [PATCH 076/156] fix variablen name --- selfdrive/car/honda/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 4ce4582be9b900..25c6d66eabe1cf 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -155,7 +155,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ if (frame % 2) == 0: idx = (frame / 2) % 4 if CS.CP.enableRadar and CS.CP.carFingerprint == CAR.CIVIC_HATCH: - can_sends.append(hondacan.create_long_command(self.packer, gas_amount, apply_brake, idx)) + can_sends.append(hondacan.create_long_command(self.packer, apply_gas, apply_brake, idx)) can_sends.append(hondacan.create_1fa(self.packer, idx)) else: can_sends.append( From bf9a1850678b02d1a9622e2a0b241c19d74d56c2 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 12:55:48 -0400 Subject: [PATCH 077/156] blank_1fa --- selfdrive/car/honda/hondacan.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index f31f55b708c29e..2f6101cb34f031 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -39,7 +39,8 @@ def create_long_command(packer, gas_amount, apply_brake, idx): #create blank 0x1fa on CIVIC_HATCH with no bosch radar def create_1fa(packer, idx): - return packer.make_can_msg("BLANK_1FA", 0, idx) + values = {} + return packer.make_can_msg("BLANK_1FA", 0, values, idx) def create_brake_command(packer, apply_brake, pcm_override, pcm_cancel_cmd, chime, fcw, idx): """Creates a CAN message for the Honda DBC BRAKE_COMMAND.""" From 34e3f803eae8915a7b2ae0802fd3e1b1c17f5dba Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 13:08:48 -0400 Subject: [PATCH 078/156] use the huddata's cruise speed for ui --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 2f6101cb34f031..5463ff3dc59ba8 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -100,7 +100,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): if car_fingerprint in (CAR.CIVIC_HATCH): bus = 0 acc_hud_values = { - 'CRUISE_SPEED': pcm_speed * CV.MS_TO_KPH, + 'CRUISE_SPEED': hud_v_cruise, 'ENABLE_MINI_CAR': hud.mini_car, 'SET_TO_1': 0x01, 'HUD_LEAD': hud.car, From 34154884af38457e4130a4bf2164b6f3b44efa50 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 13:10:32 -0400 Subject: [PATCH 079/156] fix --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 5463ff3dc59ba8..b410ef292f4bde 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -100,7 +100,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): if car_fingerprint in (CAR.CIVIC_HATCH): bus = 0 acc_hud_values = { - 'CRUISE_SPEED': hud_v_cruise, + 'CRUISE_SPEED': hud.v_cruise, 'ENABLE_MINI_CAR': hud.mini_car, 'SET_TO_1': 0x01, 'HUD_LEAD': hud.car, From b49f4d094d7d5ce4833708323dcebc51128915ec Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 13:13:30 -0400 Subject: [PATCH 080/156] static test --- selfdrive/car/honda/hondacan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index b410ef292f4bde..4f13a6b5463ef7 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -30,8 +30,8 @@ def make_can_msg(addr, dat, idx, alt): def create_long_command(packer, gas_amount, apply_brake, idx): values = { - #"GAS_COMMAND": gasbrake2, - #"RELATED_TO_GAS": related_to_gas, + "GAS_COMMAND": 0xd0, + "RELATED_TO_GAS": 0x45, "CONTROL_ON": 0x05, #"GAS_BRAKE": gasbrake, } From a89064837d63efa0dd1c871616bb76cce66eaa57 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 13:16:59 -0400 Subject: [PATCH 081/156] acc hud syntax --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 4f13a6b5463ef7..733a942e7adb0f 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -118,7 +118,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): 'SET_ME_X03_2': 0x03, 'SET_ME_X01': 0x01, } - commands.append(packer.make_can_msg('ACC_HUD', 0, acc_hud_values, idx)) + commands.append(packer.make_can_msg('ACC_HUD', 0, acc_hud_values, idx)) lkas_hud_values = { 'SET_ME_X41': 0x41, From 12627607fb14169a284f89ddc10f604a3aea9be2 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 13:20:06 -0400 Subject: [PATCH 082/156] match dbc --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 733a942e7adb0f..233110301f8dd9 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -105,7 +105,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): 'SET_TO_1': 0x01, 'HUD_LEAD': hud.car, 'HUD_DISTANCE': 0x03, - 'SET_ME_X03': 0x03, + 'SET_To_X3': 0x03, } else: acc_hud_values = { From b8266d8f651308eee6e441cf3812526e0d702c98 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 13:20:45 -0400 Subject: [PATCH 083/156] capitalization --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 233110301f8dd9..2cf77296e241f0 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -105,7 +105,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): 'SET_TO_1': 0x01, 'HUD_LEAD': hud.car, 'HUD_DISTANCE': 0x03, - 'SET_To_X3': 0x03, + 'SET_TO_X3': 0x03, } else: acc_hud_values = { From 1f3d9eb39682dbccbb9d2dbfb94d76a9505d81c2 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 13:26:10 -0400 Subject: [PATCH 084/156] default acc off --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 2cf77296e241f0..94b7100aa85971 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -32,7 +32,7 @@ def create_long_command(packer, gas_amount, apply_brake, idx): values = { "GAS_COMMAND": 0xd0, "RELATED_TO_GAS": 0x45, - "CONTROL_ON": 0x05, + #"CONTROL_ON": 0x05, #"GAS_BRAKE": gasbrake, } return packer.make_can_msg("ACC_CONTROL", 0, values, idx) From fe431191d289a6ababb765664a37d2ce9215487d Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 13:31:09 -0400 Subject: [PATCH 085/156] disable mini car --- selfdrive/car/honda/hondacan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 94b7100aa85971..99d60500c45bef 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -103,8 +103,8 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): 'CRUISE_SPEED': hud.v_cruise, 'ENABLE_MINI_CAR': hud.mini_car, 'SET_TO_1': 0x01, - 'HUD_LEAD': hud.car, - 'HUD_DISTANCE': 0x03, + #'HUD_LEAD': hud.car, + 'HUD_DISTANCE': 0x02, 'SET_TO_X3': 0x03, } else: From 8f16fe03b121df15e04c5c523c13bf37f3959a09 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 13:33:07 -0400 Subject: [PATCH 086/156] minimal --- selfdrive/car/honda/hondacan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 99d60500c45bef..26497c29ce54f5 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -101,10 +101,10 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): bus = 0 acc_hud_values = { 'CRUISE_SPEED': hud.v_cruise, - 'ENABLE_MINI_CAR': hud.mini_car, + #'ENABLE_MINI_CAR': hud.mini_car, 'SET_TO_1': 0x01, #'HUD_LEAD': hud.car, - 'HUD_DISTANCE': 0x02, + #'HUD_DISTANCE': 0x02, 'SET_TO_X3': 0x03, } else: From 282f0a571d21406031291e89805313ba748b20eb Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 15:09:19 -0400 Subject: [PATCH 087/156] add 0x1ef to OPs creations --- selfdrive/car/honda/hondacan.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 26497c29ce54f5..3446811c2b65d1 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -37,6 +37,17 @@ def create_long_command(packer, gas_amount, apply_brake, idx): } return packer.make_can_msg("ACC_CONTROL", 0, values, idx) +def create_acc_control_on(packer, idx): + values = { + "SET_TO_3": 0x03, + "CONTROL_ON": 0x0, + "SET_TO_FF": 0xff, + "SET_TO_75": 0x75, + "SET_TO_30": 0x30, + } + + return packer.make_can_msg("ACC_CONTROL_ON", 0, values, idx) + #create blank 0x1fa on CIVIC_HATCH with no bosch radar def create_1fa(packer, idx): values = {} From 337a082a5949fd137c665ed73441481610741467 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 8 Jul 2018 15:13:50 -0400 Subject: [PATCH 088/156] add it to carcontroller --- selfdrive/car/honda/carcontroller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 25c6d66eabe1cf..8289cff01b24a0 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -156,6 +156,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ idx = (frame / 2) % 4 if CS.CP.enableRadar and CS.CP.carFingerprint == CAR.CIVIC_HATCH: can_sends.append(hondacan.create_long_command(self.packer, apply_gas, apply_brake, idx)) + can_sends.append(hondacan.create_acc_control_on(self.packer, idx)) can_sends.append(hondacan.create_1fa(self.packer, idx)) else: can_sends.append( From eae2d2891a9808b9ec1435a1240ab1977a52c5d9 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Fri, 13 Jul 2018 08:36:52 -0400 Subject: [PATCH 089/156] vision radar --- selfdrive/controls/radard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/controls/radard.py b/selfdrive/controls/radard.py index 5f69085cf2b5e2..e77138d34479a0 100755 --- a/selfdrive/controls/radard.py +++ b/selfdrive/controls/radard.py @@ -51,7 +51,7 @@ def radard_thread(gctx=None): # wait for stats about the car to come in from controls cloudlog.info("radard is waiting for CarParams") CP = car.CarParams.from_bytes(Params().get("CarParams", block=True)) - mocked = CP.carName == "mock" + mocked = True VM = VehicleModel(CP) cloudlog.info("radard got CarParams") From 4f55e51fc5074bac9219680cd3da5bb77f2c1271 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Fri, 13 Jul 2018 08:38:18 -0400 Subject: [PATCH 090/156] stop auto update --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index ae4317ae111b39..1a29d6654f2fe0 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -96,7 +96,7 @@ "visiond": ("selfdrive/visiond", ["./visiond"]), "sensord": ("selfdrive/sensord", ["./sensord"]), "gpsd": ("selfdrive/sensord", ["./gpsd"]), - "updated": "selfdrive.updated", + #"updated": "selfdrive.updated", "homeassistant": "selfdrive.homeassistant", } android_packages = ("ai.comma.plus.offroad", "ai.comma.plus.frame") From b05387fa5e9549eb79a4848f858faaa7d39af013 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 19:28:58 -0400 Subject: [PATCH 091/156] things - change variable to visionRadar - adds some things for keyboard based testing of gas/brake values. not tested and likely will break everything. - use OP to store cruise states. we control everything --- cereal/car.capnp | 2 +- cereal/log.capnp | 6 +++++ selfdrive/car/honda/carcontroller.py | 38 +++++++++++++++++++++++----- selfdrive/car/honda/carstate.py | 13 +++++++--- selfdrive/car/honda/hondacan.py | 21 ++++++++++----- selfdrive/car/honda/interface.py | 23 +++++++++++------ selfdrive/service_list.yaml | 2 ++ 7 files changed, 79 insertions(+), 26 deletions(-) diff --git a/cereal/car.capnp b/cereal/car.capnp index 52c0075173475b..3877871700a0f1 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -273,7 +273,7 @@ struct CarParams { enableCamera @26 :Bool; enableDsu @27 :Bool; # driving support unit enableApgs @28 :Bool; # advanced parking guidance system - enableRadar @49 :Bool; + visionRadar @49 :Bool; minEnableSpeed @17 :Float32; safetyModel @18 :Int16; diff --git a/cereal/log.capnp b/cereal/log.capnp index 84bf1b3b5ec56f..8b8b6a1f6ee6e9 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -1463,6 +1463,11 @@ struct Joystick { buttons @1: List(Bool); } +struct visionKeyboard { + gas @0: UInt64; + brake @1: UInt64; +} + struct OrbOdometry { # timing first startMonoTime @0 :UInt64; @@ -1582,5 +1587,6 @@ struct Event { orbKeyFrame @56 :OrbKeyFrame; uiLayoutState @57 :UiLayoutState; orbFeaturesSummary @58 :OrbFeaturesSummary; + visionKeyboard @59 :visionKeyboard; } } diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 8289cff01b24a0..b0b764e5f07a41 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -5,6 +5,7 @@ from selfdrive.car.honda import hondacan from selfdrive.car.honda.values import AH, CruiseButtons, CAR from selfdrive.can.packer import CANPacker +import zmq def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): @@ -63,6 +64,10 @@ def __init__(self, dbc_name, enable_camera=True): self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) + context = zmq.Context() + poller = zmq.Poller() + keyboard = messaging.sub_sock(context, service_list['visionKeyboard'].port, conflate=True, poller=poller) + def update(self, sendcan, enabled, CS, frame, actuators, \ pcm_speed, pcm_override, pcm_cancel_cmd, pcm_accel, \ hud_v_cruise, hud_show_lanes, hud_show_car, hud_alert, \ @@ -116,19 +121,38 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # **** process the car messages **** # *** compute control surfaces *** - BRAKE_MAX = 1024/4 + apply_gas = 0 + apply_brake = 0 + + for keyboard, event in poller.poll(500): + msg = keyboard.recv() + evt = log.Event.from_bytes(msg) + + apply_gas = evt.visionKeyboard.gas + apply_brake = evt.visionKeyboard.brake + + if CS.CP.visionRadar: + BRAKE_MAX = 800 #convert to negative later on + else: + BRAKE_MAX = 1024/4 if CS.CP.carFingerprint in (CAR.ACURA_ILX): STEER_MAX = 0xF00 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) else: STEER_MAX = 0x1000 - + if CS.CP.visionRadar: + GAS_MAX = 500 # steer torque is converted back to CAN reference (positive when steering right) - apply_gas = clip(actuators.gas, 0., 1.) - apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX - 1)) + # if CS.CP.visionRadar: + # apply_gas = int(clip(actuators.gas * GAS_MAX, 0, GAS_MAX - 1)) + # else: + # apply_gas = clip(actuators.gas, 0., 1.) + # apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX - 1)) apply_steer = int(clip(-actuators.steer * STEER_MAX, -STEER_MAX, STEER_MAX)) + + # any other cp.vl[0x18F]['STEER_STATUS'] is common and can happen during user override. sending 0 torque to avoid EPS sending error 5 lkas_active = enabled and not CS.steer_not_allowed @@ -145,7 +169,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ can_sends.extend(hondacan.create_ui_commands(self.packer, pcm_speed, hud, CS.CP.carFingerprint, idx)) if CS.CP.radarOffCan: - if not CS.CP.enableRadar: + if not CS.CP.visionRadar: # If using stock ACC, spam cancel command to kill gas when OP disengages. if pcm_cancel_cmd: can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.CANCEL, idx)) @@ -154,7 +178,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # Send gas and brake commands. if (frame % 2) == 0: idx = (frame / 2) % 4 - if CS.CP.enableRadar and CS.CP.carFingerprint == CAR.CIVIC_HATCH: + if CS.CP.visionRadar and CS.CP.carFingerprint == CAR.CIVIC_HATCH: can_sends.append(hondacan.create_long_command(self.packer, apply_gas, apply_brake, idx)) can_sends.append(hondacan.create_acc_control_on(self.packer, idx)) can_sends.append(hondacan.create_1fa(self.packer, idx)) @@ -172,7 +196,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ radar_send_step = 2 else: radar_send_step = 5 - if not CS.CP.enableRadar: + if not CS.CP.visionRadar: if (frame % radar_send_step) == 0: idx = (frame/radar_send_step) % 4 can_sends.extend(hondacan.create_radar_commands(CS.v_ego, CS.CP.carFingerprint, idx)) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index c62df606dee7ae..509c8f0a242d63 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -110,7 +110,7 @@ def get_can_signals(CP): if CP.carFingerprint != CAR.CIVIC_HATCH: signals += [("BRAKE_PRESSED", "BRAKE_MODULE", 0)] checks += [("BRAKE_MODULE", 50)] - if CP.enableRadar: + if CP.visionRadar: signals += [("CAR_GAS", "GAS_PEDAL_2", 0), ("MAIN_ON", "SCM_FEEDBACK", 0), ("EPB_STATE", "EPB_STATUS", 0), @@ -183,6 +183,9 @@ def __init__(self, CP): self.cruise_buttons = 0 self.cruise_setting = 0 + self.op_cruise_enabled = 0 + self.op_cruise_speed = 0 + self.op_cruise_speed_prev = 0 self.v_cruise_pcm_prev = 0 self.blinker_on = 0 @@ -263,8 +266,10 @@ def update(self, cp): self.gear = 0 if self.CP.carFingerprint == CAR.CIVIC else cp.vl["GEARBOX"]['GEAR'] self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] - - self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] + if self.CP.visionRadar: + self.cruise_setting = self.CP.op_cruise_state + else: + self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS'] self.blinker_on = cp.vl["SCM_FEEDBACK"]['LEFT_BLINKER'] or cp.vl["SCM_FEEDBACK"]['RIGHT_BLINKER'] @@ -299,7 +304,7 @@ def update(self, cp): self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] if self.CP.radarOffCan: - if self.CP.enableRadar: + if self.CP.visionRadar: if self.CP.carFingerprint == CAR.CIVIC_HATCH: self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) self.brake_switch = cp.vl["POWERTRAIN_DATA"]['BRAKE_SWITCH'] diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 3446811c2b65d1..2ceabde46802d4 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -27,13 +27,21 @@ def make_can_msg(addr, dat, idx, alt): dat = fix(dat, addr) return [addr, 0, dat, alt] -def create_long_command(packer, gas_amount, apply_brake, idx): +def create_long_command(packer, apply_gas, apply_brake, idx): + apply_brake = apply_brake * -1 #braking is negative on this signal + if apply_gas > 0: + apply_brake = 0 + if apply_brake < 0: + apply_gas = 0 + + gasbrake = gas_amount + apply_brake + values = { "GAS_COMMAND": 0xd0, "RELATED_TO_GAS": 0x45, #"CONTROL_ON": 0x05, - #"GAS_BRAKE": gasbrake, + "GAS_BRAKE": gasbrake, } return packer.make_can_msg("ACC_CONTROL", 0, values, idx) @@ -95,7 +103,8 @@ def create_steering_control(packer, apply_steer, lkas_active, car_fingerprint, i } # Set bus 2 for accord and new crv. bus = 2 if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH) else 0 - bus = 0 + if True: + bus = 0 return packer.make_can_msg("STEERING_CONTROL", bus, values, idx) @@ -112,10 +121,10 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): bus = 0 acc_hud_values = { 'CRUISE_SPEED': hud.v_cruise, - #'ENABLE_MINI_CAR': hud.mini_car, + 'ENABLE_MINI_CAR': hud.mini_car, 'SET_TO_1': 0x01, - #'HUD_LEAD': hud.car, - #'HUD_DISTANCE': 0x02, + 'HUD_LEAD': hud.car, + 'HUD_DISTANCE': 0x02, 'SET_TO_X3': 0x03, } else: diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 79328e738936d0..45dc9fe7ca6d13 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -152,12 +152,12 @@ def get_params(candidate, fingerprint): ret.safetyModel = car.CarParams.SafetyModels.honda ret.enableGasInterceptor = 0x201 in fingerprint ret.enableCamera = not any(x for x in CAMERA_MSGS if x in fingerprint) - ret.enableRadar = not any(x for x in ACC_MSGS if x in fingerprint) - if ret.enableRadar: + ret.visionRadar = not any(x for x in ACC_MSGS if x in fingerprint) + if ret.visionRadar: ret.safetyModel = car.CarParams.SafetyModels.honda print "ECU Camera Simulated: ", ret.enableCamera - print "ECU Radar Simulated: ", ret.enableRadar + print "ECU Radar Simulated: ", ret.visionRadar print "ECU Gas Interceptor: ", ret.enableGasInterceptor ret.enableCruise = not ret.enableGasInterceptor @@ -398,11 +398,18 @@ def update(self, c): ret.steeringPressed = self.CS.steer_override # cruise state - ret.cruiseState.enabled = self.CS.pcm_acc_status != 0 - ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS - ret.cruiseState.available = bool(self.CS.main_on) - ret.cruiseState.speedOffset = self.CS.cruise_speed_offset - ret.cruiseState.standstill = False + if ret.visionRadar: + ret.cruiseState.enabled = self.CC.enabled + ret.cruiseState.speed = c.hudControl.setSpeed #use speed that controlsd stores already in meters/sec + ret.cruiseState.available = bool(self.CS.main_on) + ret.cruiseState.speedOffset = 0 ## TODO: + ret.cruiseState.standstill = False + else: + ret.cruiseState.enabled = self.CS.pcm_acc_status != 0 + ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS + ret.cruiseState.available = bool(self.CS.main_on) + ret.cruiseState.speedOffset = self.CS.cruise_speed_offset + ret.cruiseState.standstill = False # TODO: button presses buttonEvents = [] diff --git a/selfdrive/service_list.yaml b/selfdrive/service_list.yaml index 4195ee7b54fdfb..9575c2a4bd336e 100644 --- a/selfdrive/service_list.yaml +++ b/selfdrive/service_list.yaml @@ -74,6 +74,8 @@ testModel: [8040, false] testLiveLocation: [8045, false] testJoystick: [8056, false] +visionKeyboard: [8063, true] + # 8080 is reserved for slave testing daemon # 8762 is reserved for logserver From af27e624a158cbfc4f072cdd7bd9d9fe16dce090 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:20:35 -0400 Subject: [PATCH 092/156] Capitalization lives matter --- cereal/log.capnp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cereal/log.capnp b/cereal/log.capnp index 20c14abd2ed7b1..e02be7d91ac6d9 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -1474,7 +1474,7 @@ struct Joystick { buttons @1: List(Bool); } -struct visionKeyboard { +struct VisionKeyboard { gas @0: UInt64; brake @1: UInt64; } @@ -1604,6 +1604,6 @@ struct Event { uiLayoutState @57 :UiLayoutState; orbFeaturesSummary @58 :OrbFeaturesSummary; driverMonitoring @59 :DriverMonitoring; - visionKeyboard @60 :visionKeyboard; + visionKeyboard @60 :VisionKeyboard; } } From 7d27ac9b6d06d082cdbcfcf6c737cc30e5e61e7a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:23:31 -0400 Subject: [PATCH 093/156] add enabled safety to long control --- selfdrive/car/honda/carcontroller.py | 4 ++-- selfdrive/car/honda/hondacan.py | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 8ff642e2fcf4e6..47cd96bee913a2 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -120,7 +120,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # *** compute control surfaces *** apply_gas = 0 apply_brake = 0 - + for keyboard, event in poller.poll(500): msg = keyboard.recv() evt = log.Event.from_bytes(msg) @@ -176,7 +176,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ if (frame % 2) == 0: idx = (frame / 2) % 4 if CS.CP.visionRadar and CS.CP.carFingerprint == CAR.CIVIC_HATCH: - can_sends.append(hondacan.create_long_command(self.packer, apply_gas, apply_brake, idx)) + can_sends.append(hondacan.create_long_command(self.packer, enabled, apply_gas, apply_brake, idx)) can_sends.append(hondacan.create_acc_control_on(self.packer, idx)) can_sends.append(hondacan.create_1fa(self.packer, idx)) else: diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 2ceabde46802d4..dff73f8a89c6d5 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -27,14 +27,17 @@ def make_can_msg(addr, dat, idx, alt): dat = fix(dat, addr) return [addr, 0, dat, alt] -def create_long_command(packer, apply_gas, apply_brake, idx): +def create_long_command(packer, enabled, apply_gas, apply_brake, idx): apply_brake = apply_brake * -1 #braking is negative on this signal if apply_gas > 0: apply_brake = 0 if apply_brake < 0: apply_gas = 0 - - gasbrake = gas_amount + apply_brake + #a bit of safety here + if not enabled: + apply_gas = 0 + apply_brake = 0 + gasbrake = apply_gas + apply_brake values = { From ca01d98d40a76a9bc40f2837e8337f8deedcd6d5 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:29:03 -0400 Subject: [PATCH 094/156] import messaging --- selfdrive/car/honda/carcontroller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 47cd96bee913a2..2c4f516557eb95 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -6,6 +6,7 @@ from selfdrive.car.honda.values import AH, CruiseButtons, CAR from selfdrive.can.packer import CANPacker import zmq +import selfdrive.messaging as messaging def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): # hyst params... TODO: move these to VehicleParams From 9120571d88685f2f53eef8ee8048f7dfd21187b9 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:29:43 -0400 Subject: [PATCH 095/156] import service list --- selfdrive/car/honda/carcontroller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 2c4f516557eb95..1dd2b7492a6e0d 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -7,6 +7,7 @@ from selfdrive.can.packer import CANPacker import zmq import selfdrive.messaging as messaging +from selfdrive.services import service_list def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): # hyst params... TODO: move these to VehicleParams From a958a539859ab578799e9a7e616fd2a0e2f4db04 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:32:39 -0400 Subject: [PATCH 096/156] add to capnp --- cereal/car.capnp | 2 ++ selfdrive/car/honda/carstate.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cereal/car.capnp b/cereal/car.capnp index 2f732aeaf91503..a1a9b7355c3126 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -212,6 +212,8 @@ struct CarControl { cruiseControl @4 :CruiseControl; hudControl @5 :HUDControl; + op_cruise_enabled @8 : + struct Actuators { # range from 0.0 - 1.0 gas @0: Float32; diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 99641d842ac39d..47b48ab3d41813 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -269,7 +269,7 @@ def update(self, cp): self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] if self.CP.visionRadar: - self.cruise_setting = self.CP.op_cruise_state + self.cruise_setting = self.CP.op_cruise_enabled else: self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS'] From dad09bb3aaef058693976fcedcf453751e8e591b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:33:24 -0400 Subject: [PATCH 097/156] fix --- cereal/car.capnp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cereal/car.capnp b/cereal/car.capnp index a1a9b7355c3126..a80c48069b0942 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -212,7 +212,7 @@ struct CarControl { cruiseControl @4 :CruiseControl; hudControl @5 :HUDControl; - op_cruise_enabled @8 : + op_cruise_enabled @8 :Bool; struct Actuators { # range from 0.0 - 1.0 From 639eb7db43d35cd03f508885f70dfc117035de8e Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:34:30 -0400 Subject: [PATCH 098/156] name fix --- cereal/car.capnp | 2 +- selfdrive/car/honda/carstate.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cereal/car.capnp b/cereal/car.capnp index a80c48069b0942..c6400d896b1355 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -212,7 +212,7 @@ struct CarControl { cruiseControl @4 :CruiseControl; hudControl @5 :HUDControl; - op_cruise_enabled @8 :Bool; + opcruiseenabled @8 :Bool; struct Actuators { # range from 0.0 - 1.0 diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 47b48ab3d41813..6174ce6161168f 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -182,7 +182,7 @@ def __init__(self, CP): self.cruise_buttons = 0 self.cruise_setting = 0 - self.op_cruise_enabled = 0 + self.opcruiseenabled = 0 self.op_cruise_speed = 0 self.op_cruise_speed_prev = 0 self.v_cruise_pcm_prev = 0 @@ -269,7 +269,7 @@ def update(self, cp): self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] if self.CP.visionRadar: - self.cruise_setting = self.CP.op_cruise_enabled + self.cruise_setting = self.CP.opcruiseenabled else: self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS'] From e2e957a055479f334240c85e78eecca6b25fbf16 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:36:18 -0400 Subject: [PATCH 099/156] change --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 6174ce6161168f..a2bad7382c0e6e 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -269,7 +269,7 @@ def update(self, cp): self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] if self.CP.visionRadar: - self.cruise_setting = self.CP.opcruiseenabled + self.cruise_setting = self.CC.enabled else: self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS'] From bbf97d3cd84866a83ba6d9874631f006fd09c208 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:43:08 -0400 Subject: [PATCH 100/156] Revert "change" This reverts commit e2e957a055479f334240c85e78eecca6b25fbf16. --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index a2bad7382c0e6e..6174ce6161168f 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -269,7 +269,7 @@ def update(self, cp): self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] if self.CP.visionRadar: - self.cruise_setting = self.CC.enabled + self.cruise_setting = self.CP.opcruiseenabled else: self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS'] From 9b9d4824ada7bd03467e75ac3d17a0b6667ce4c3 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:50:46 -0400 Subject: [PATCH 101/156] null it --- selfdrive/car/honda/carstate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 6174ce6161168f..561915b6c012c1 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -182,7 +182,6 @@ def __init__(self, CP): self.cruise_buttons = 0 self.cruise_setting = 0 - self.opcruiseenabled = 0 self.op_cruise_speed = 0 self.op_cruise_speed_prev = 0 self.v_cruise_pcm_prev = 0 @@ -269,7 +268,7 @@ def update(self, cp): self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] if self.CP.visionRadar: - self.cruise_setting = self.CP.opcruiseenabled + self.cruise_setting = 0 else: self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS'] From b408b405cdc1e1e6935c059f7d4f01796b701909 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:57:47 -0400 Subject: [PATCH 102/156] change --- selfdrive/car/honda/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 8a502a5fd5844e..64333bb8da4a8b 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -420,7 +420,7 @@ def update(self, c): ret.steeringPressed = self.CS.steer_override # cruise state - if ret.visionRadar: + if self.CP.visionRadar: ret.cruiseState.enabled = self.CC.enabled ret.cruiseState.speed = c.hudControl.setSpeed #use speed that controlsd stores already in meters/sec ret.cruiseState.available = bool(self.CS.main_on) From b5a16761aebe00225bd603f53496ccfbf95753f5 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:58:49 -0400 Subject: [PATCH 103/156] try --- selfdrive/car/honda/carcontroller.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 1dd2b7492a6e0d..f2842c390b5798 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -62,6 +62,7 @@ def __init__(self, dbc_name, enable_camera=True): self.braking = False self.brake_steady = 0. self.brake_last = 0. + self.enabled = False self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) @@ -74,6 +75,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ hud_v_cruise, hud_show_lanes, hud_show_car, hud_alert, \ snd_beep, snd_chime): + self.enabled = enabled """ Controls thread """ if not self.enable_camera: From 362e97298fd25d45545548d596f45651a6ae4ae3 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 20:59:25 -0400 Subject: [PATCH 104/156] disable this --- selfdrive/car/honda/carcontroller.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index f2842c390b5798..c70ed93e3a4365 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -125,12 +125,12 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ apply_gas = 0 apply_brake = 0 - for keyboard, event in poller.poll(500): - msg = keyboard.recv() - evt = log.Event.from_bytes(msg) - - apply_gas = evt.visionKeyboard.gas - apply_brake = evt.visionKeyboard.brake + # for keyboard, event in poller.poll(500): + # msg = keyboard.recv() + # evt = log.Event.from_bytes(msg) + # + # apply_gas = evt.visionKeyboard.gas + # apply_brake = evt.visionKeyboard.brake if CS.CP.visionRadar: BRAKE_MAX = 800 #convert to negative later on From 98e9ff718b8de1eb99cffc9c84b0a9ab8ea549f0 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 21 Jul 2018 21:01:13 -0400 Subject: [PATCH 105/156] reenable --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 202de96d0e3ab7..4280dff95bb640 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -82,7 +82,7 @@ managed_processes = { "thermald": "selfdrive.thermald", "uploader": "selfdrive.loggerd.uploader", - #"controlsd": "selfdrive.controls.controlsd", + "controlsd": "selfdrive.controls.controlsd", "radard": "selfdrive.controls.radard", "ubloxd": "selfdrive.locationd.ubloxd", "loggerd": ("selfdrive/loggerd", ["./loggerd"]), From 364aa01dfc430c02b7c571eaacb86ce9aa1b2c0b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 22 Jul 2018 15:00:50 -0400 Subject: [PATCH 106/156] try. move to eon for working --- cereal/car.capnp | 2 -- selfdrive/car/honda/carcontroller.py | 1 - selfdrive/car/honda/carstate.py | 4 +--- selfdrive/car/honda/interface.py | 2 +- selfdrive/service_list.yaml | 2 +- 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/cereal/car.capnp b/cereal/car.capnp index c6400d896b1355..2f732aeaf91503 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -212,8 +212,6 @@ struct CarControl { cruiseControl @4 :CruiseControl; hudControl @5 :HUDControl; - opcruiseenabled @8 :Bool; - struct Actuators { # range from 0.0 - 1.0 gas @0: Float32; diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index c70ed93e3a4365..9d8e9982a28ebb 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -62,7 +62,6 @@ def __init__(self, dbc_name, enable_camera=True): self.braking = False self.brake_steady = 0. self.brake_last = 0. - self.enabled = False self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 561915b6c012c1..8c4ae9d80ccf06 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -182,8 +182,6 @@ def __init__(self, CP): self.cruise_buttons = 0 self.cruise_setting = 0 - self.op_cruise_speed = 0 - self.op_cruise_speed_prev = 0 self.v_cruise_pcm_prev = 0 self.blinker_on = 0 @@ -268,7 +266,7 @@ def update(self, cp): self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] if self.CP.visionRadar: - self.cruise_setting = 0 + self.cruise_setting = c.enabled else: self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS'] diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 64333bb8da4a8b..fbaea059f5ec03 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -421,7 +421,7 @@ def update(self, c): # cruise state if self.CP.visionRadar: - ret.cruiseState.enabled = self.CC.enabled + ret.cruiseState.enabled = c.enabled ret.cruiseState.speed = c.hudControl.setSpeed #use speed that controlsd stores already in meters/sec ret.cruiseState.available = bool(self.CS.main_on) ret.cruiseState.speedOffset = 0 ## TODO: diff --git a/selfdrive/service_list.yaml b/selfdrive/service_list.yaml index 51b0952c1d87d9..7fe442d05a3abf 100644 --- a/selfdrive/service_list.yaml +++ b/selfdrive/service_list.yaml @@ -70,12 +70,12 @@ uiLayoutState: [8060, true] frontEncodeIdx: [8061, true] orbFeaturesSummary: [8062, true] driverMonitoring: [8063, true] +visionKeyboard: [8064, true] testModel: [8040, false] testLiveLocation: [8045, false] testJoystick: [8056, false] -visionKeyboard: [8063, true] # 8080 is reserved for slave testing daemon # 8762 is reserved for logserver From 169641be05fc71aba2742761ce9ef30ea43adcb4 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 22 Jul 2018 15:16:09 -0400 Subject: [PATCH 107/156] more --- selfdrive/car/honda/carstate.py | 5 +---- selfdrive/car/honda/interface.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 8c4ae9d80ccf06..32e2656e796990 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -265,10 +265,7 @@ def update(self, cp): self.gear = 0 if self.CP.carFingerprint == CAR.CIVIC else cp.vl["GEARBOX"]['GEAR'] self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] - if self.CP.visionRadar: - self.cruise_setting = c.enabled - else: - self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] + self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING'] self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS'] self.blinker_on = cp.vl["SCM_FEEDBACK"]['LEFT_BLINKER'] or cp.vl["SCM_FEEDBACK"]['RIGHT_BLINKER'] diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index fbaea059f5ec03..24132b7a4d26bd 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -422,7 +422,7 @@ def update(self, c): # cruise state if self.CP.visionRadar: ret.cruiseState.enabled = c.enabled - ret.cruiseState.speed = c.hudControl.setSpeed #use speed that controlsd stores already in meters/sec + ret.cruiseState.speed = hud_v_cruise ret.cruiseState.available = bool(self.CS.main_on) ret.cruiseState.speedOffset = 0 ## TODO: ret.cruiseState.standstill = False From f2d6383904e0aeedba4799c76010cb0a693db497 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 22 Jul 2018 15:17:21 -0400 Subject: [PATCH 108/156] a --- selfdrive/car/honda/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 24132b7a4d26bd..bf4a71112a3d75 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -422,7 +422,7 @@ def update(self, c): # cruise state if self.CP.visionRadar: ret.cruiseState.enabled = c.enabled - ret.cruiseState.speed = hud_v_cruise + ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS ret.cruiseState.available = bool(self.CS.main_on) ret.cruiseState.speedOffset = 0 ## TODO: ret.cruiseState.standstill = False From a7023abb584ecad40f4445ba831c9f8f0878737c Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Mon, 23 Jul 2018 23:33:05 -0400 Subject: [PATCH 109/156] vision radar is now broken. should rebase to 0.5 --- opendbc/generator/honda/_bosch_2018.dbc | 2 +- ..._civic_hatchback_ex_2017_can_generated.dbc | 2 +- panda/board/safety/safety_honda.h | 12 ++--- selfdrive/car/honda/carcontroller.py | 47 ++++++++++++++----- selfdrive/car/honda/carstate.py | 6 ++- selfdrive/car/honda/hondacan.py | 40 +++++++++------- selfdrive/car/honda/interface.py | 23 ++++----- 7 files changed, 76 insertions(+), 56 deletions(-) diff --git a/opendbc/generator/honda/_bosch_2018.dbc b/opendbc/generator/honda/_bosch_2018.dbc index 9c0ecd717e226f..4c216cd67a2136 100644 --- a/opendbc/generator/honda/_bosch_2018.dbc +++ b/opendbc/generator/honda/_bosch_2018.dbc @@ -116,7 +116,7 @@ BO_ 464 WHEEL_SPEEDS: 8 VSA BO_ 479 ACC_CONTROL: 8 EON SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX - SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX + SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index cf3398d76e3a44..df30d64111c5aa 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -120,7 +120,7 @@ BO_ 464 WHEEL_SPEEDS: 8 VSA BO_ 479 ACC_CONTROL: 8 EON SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX - SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX + SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX diff --git a/panda/board/safety/safety_honda.h b/panda/board/safety/safety_honda.h index b64e45ce6d9653..36c28337439d1c 100644 --- a/panda/board/safety/safety_honda.h +++ b/panda/board/safety/safety_honda.h @@ -33,7 +33,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { if (buttons == 4 || buttons == 3) { controls_allowed = 1; } else if (buttons == 2) { - controls_allowed = 0; + controls_allowed = 1; } } @@ -50,7 +50,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { if (IS_USER_BRAKE_MSG(to_push)) { int brake = USER_BRAKE_VALUE(to_push); if (brake && (!(brake_prev) || ego_speed)) { - controls_allowed = 0; + controls_allowed = 1; } brake_prev = brake; } @@ -62,7 +62,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { int gas_interceptor = ((to_push->RDLR & 0xFF) << 8) | ((to_push->RDLR & 0xFF00) >> 8); if ((gas_interceptor > gas_interceptor_threshold) && (gas_interceptor_prev <= gas_interceptor_threshold)) { - controls_allowed = 0; + controls_allowed = 1; } gas_interceptor_prev = gas_interceptor; } @@ -72,7 +72,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { if ((to_push->RIR>>21) == 0x17C) { int gas = to_push->RDLR & 0xFF; if (gas && !(gas_prev)) { - controls_allowed = 0; + controls_allowed = 1; } gas_prev = gas; } @@ -86,7 +86,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { // block all commands that produce actuation static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { - + return true; // disallow actuator commands if gas or brake (with vehicle moving) are pressed // and the the latching controls_allowed flag is True int pedal_pressed = gas_prev || (gas_interceptor_prev > gas_interceptor_threshold) || @@ -119,7 +119,7 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) { if ((to_send->RDLR & 0xFFFF0000) != to_send->RDLR) return 0; } } - + // FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW // ensuring that only the cancel button press is sent (VAL 2) when controls are off. // This avoids unintended engagements while still allowing resume spam diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 9d8e9982a28ebb..02c975583901bf 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -9,6 +9,12 @@ import selfdrive.messaging as messaging from selfdrive.services import service_list +# Accel limits +ACCEL_HYST_GAP = 0.02 # don't change accel command for small oscilalitons within this value +ACCEL_MAX = 1.5 # 1.5 m/s2 +ACCEL_MIN = -3.0 # 3 m/s2 +ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN) + def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): # hyst params... TODO: move these to VehicleParams brake_hyst_on = 0.02 # to activate brakes exceed this value @@ -34,6 +40,19 @@ def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): return brake, braking, brake_steady +def accel_hysteresis(accel, accel_steady, enabled): + + # for small accel oscillations within ACCEL_HYST_GAP, don't change the accel command + if not enabled: + # send 0 when disabled, otherwise acc faults + accel_steady = 0. + elif accel > accel_steady + ACCEL_HYST_GAP: + accel_steady = accel - ACCEL_HYST_GAP + elif accel < accel_steady - ACCEL_HYST_GAP: + accel_steady = accel + ACCEL_HYST_GAP + accel = accel_steady + + return accel, accel_steady def process_hud_alert(hud_alert): # initialize to no alert @@ -62,6 +81,7 @@ def __init__(self, dbc_name, enable_camera=True): self.braking = False self.brake_steady = 0. self.brake_last = 0. + self.accel_steady = 0. self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) @@ -74,8 +94,8 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ hud_v_cruise, hud_show_lanes, hud_show_car, hud_alert, \ snd_beep, snd_chime): - self.enabled = enabled """ Controls thread """ + CS.setspeed = hud_v_cruise if not self.enable_camera: return @@ -121,8 +141,8 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # **** process the car messages **** # *** compute control surfaces *** - apply_gas = 0 - apply_brake = 0 + # apply_gas = 0 + # apply_brake = 0 # for keyboard, event in poller.poll(500): # msg = keyboard.recv() @@ -143,16 +163,17 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ STEER_MAX = 0x1000 if CS.CP.visionRadar: GAS_MAX = 500 - # steer torque is converted back to CAN reference (positive when steering right) - # if CS.CP.visionRadar: - # apply_gas = int(clip(actuators.gas * GAS_MAX, 0, GAS_MAX - 1)) - # else: - # apply_gas = clip(actuators.gas, 0., 1.) - # apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX - 1)) + #steer torque is converted back to CAN reference (positive when steering right) + if CS.CP.visionRadar: + # gas and brake + apply_accel = actuators.gas - actuators.brake + apply_accel, self.accel_steady = accel_hysteresis(apply_accel, self.accel_steady, enabled) + apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) + else: + apply_gas = clip(actuators.gas, 0., 1.) + apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX)) apply_steer = int(clip(-actuators.steer * STEER_MAX, -STEER_MAX, STEER_MAX)) - - # any other cp.vl[0x18F]['STEER_STATUS'] is common and can happen during user override. sending 0 torque to avoid EPS sending error 5 lkas_active = enabled and not CS.steer_not_allowed @@ -179,8 +200,8 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ if (frame % 2) == 0: idx = (frame / 2) % 4 if CS.CP.visionRadar and CS.CP.carFingerprint == CAR.CIVIC_HATCH: - can_sends.append(hondacan.create_long_command(self.packer, enabled, apply_gas, apply_brake, idx)) - can_sends.append(hondacan.create_acc_control_on(self.packer, idx)) + can_sends.append(hondacan.create_long_command(self.packer, enabled, apply_accel, idx)) + can_sends.append(hondacan.create_acc_control_on(self.packer, enabled, idx)) can_sends.append(hondacan.create_1fa(self.packer, idx)) else: can_sends.append( diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 32e2656e796990..2a99a47166ece5 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -188,6 +188,8 @@ def __init__(self, CP): self.left_blinker_on = 0 self.right_blinker_on = 0 + self.setspeed = 0 + self.stopped = 0 # vEgo kalman filter @@ -308,8 +310,8 @@ def update(self, cp): self.brake_switch_prev = self.brake_switch self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] - self.v_cruise_pcm = 0 ## TODO: do this - self.v_cruise_pcm_prev = 0 ## TODO: do this + self.v_cruise_pcm = self.setspeed + self.v_cruise_pcm_prev = self.v_cruise_pcm else: self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index dff73f8a89c6d5..9b3cf275d20f30 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -27,31 +27,35 @@ def make_can_msg(addr, dat, idx, alt): dat = fix(dat, addr) return [addr, 0, dat, alt] -def create_long_command(packer, enabled, apply_gas, apply_brake, idx): - apply_brake = apply_brake * -1 #braking is negative on this signal - if apply_gas > 0: - apply_brake = 0 - if apply_brake < 0: - apply_gas = 0 - #a bit of safety here - if not enabled: - apply_gas = 0 - apply_brake = 0 - gasbrake = apply_gas + apply_brake - +def create_long_command(packer, enabled, accel, idx): + #we control engine torque request on bosch + # if apply_gas > 0: + # apply_brake = 0 + # if apply_brake < 0: + # apply_gas = 0 + + #set the other things + control_on = 5 if enabled else 0 + state_flag = 0 if accel >= -56 else 69 #the target for the state flip seems to be variable. been seen as high was -56 or -59 and low as -296 + if state_flag == 69 and accel < 0.00: + gas_command = 208 + else: + gas_command = accel values = { - "GAS_COMMAND": 0xd0, - "RELATED_TO_GAS": 0x45, - #"CONTROL_ON": 0x05, - "GAS_BRAKE": gasbrake, + "GAS_COMMAND": gas_command, + "STATE_FLAG": state_flag, + "CONTROL_ON": control_on, + "GAS_BRAKE": accel, } return packer.make_can_msg("ACC_CONTROL", 0, values, idx) -def create_acc_control_on(packer, idx): +def create_acc_control_on(packer, enabled, idx): + control_on = 5 if enabled else 0 + values = { "SET_TO_3": 0x03, - "CONTROL_ON": 0x0, + "CONTROL_ON": control_on, "SET_TO_FF": 0xff, "SET_TO_75": 0x75, "SET_TO_30": 0x30, diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index bf4a71112a3d75..db56fd47a6cc41 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -150,11 +150,9 @@ def get_params(candidate, fingerprint): if ret.visionRadar: ret.safetyModel = car.CarParams.SafetyModels.honda - print "ECU Camera Simulated: ", ret.enableCamera - print "ECU Radar Simulated: ", ret.visionRadar - print "ECU Gas Interceptor: ", ret.enableGasInterceptor cloudlog.warn("ECU Camera Simulated: %r", ret.enableCamera) cloudlog.warn("ECU Gas Interceptor: %r", ret.enableGasInterceptor) + cloudlog.warn("ECU Radar Simulated: %r", ret.visionRadar) ret.enableCruise = not ret.enableGasInterceptor @@ -420,18 +418,11 @@ def update(self, c): ret.steeringPressed = self.CS.steer_override # cruise state - if self.CP.visionRadar: - ret.cruiseState.enabled = c.enabled - ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS - ret.cruiseState.available = bool(self.CS.main_on) - ret.cruiseState.speedOffset = 0 ## TODO: - ret.cruiseState.standstill = False - else: - ret.cruiseState.enabled = self.CS.pcm_acc_status != 0 - ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS - ret.cruiseState.available = bool(self.CS.main_on) - ret.cruiseState.speedOffset = self.CS.cruise_speed_offset - ret.cruiseState.standstill = False + ret.cruiseState.enabled = self.CS.pcm_acc_status != 0 + ret.cruiseState.speed = self.CS.v_cruise_pcm * CV.KPH_TO_MS + ret.cruiseState.available = bool(self.CS.main_on) + ret.cruiseState.speedOffset = self.CS.cruise_speed_offset + ret.cruiseState.standstill = False # TODO: button presses buttonEvents = [] @@ -544,6 +535,7 @@ def update(self, c): cur_time = sec_since_boot() enable_pressed = False + # handle button presses for b in ret.buttonEvents: @@ -551,6 +543,7 @@ def update(self, c): if b.type in ["accelCruise", "decelCruise"] and not b.pressed: self.last_enable_pressed = cur_time enable_pressed = True + ret.cruiseState.enabled = enable_pressed # do disable on button down if b.type == "cancel" and b.pressed: From f86575866cbdcfd447e07a2daff58c9805062521 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 28 Jul 2018 18:50:12 -0400 Subject: [PATCH 110/156] battery limit mods --- selfdrive/thermald.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/selfdrive/thermald.py b/selfdrive/thermald.py index 97e63b143892c0..b96a4dc03ac440 100755 --- a/selfdrive/thermald.py +++ b/selfdrive/thermald.py @@ -158,6 +158,11 @@ def thermald_thread(): msg.thermal.freeSpace = avail with open("/sys/class/power_supply/battery/capacity") as f: msg.thermal.batteryPercent = int(f.read()) + #limit charging + if msg.thermal.batteryPercent > 70: + os.system("echo 0 > /sys/class/power_supply/battery/charging_enabled") + elif msg.thermal.batteryPercent < 67: + os.system("echo 1 > /sys/class/power_supply/battery/charging_enabled") with open("/sys/class/power_supply/battery/status") as f: msg.thermal.batteryStatus = f.read().strip() with open("/sys/class/power_supply/usb/online") as f: @@ -218,7 +223,7 @@ def thermald_thread(): should_start = should_start and msg.thermal.freeSpace > 0.02 # require usb power in passive mode - should_start = should_start and (not passive or msg.thermal.usbOnline) + #should_start = should_start and (not passive or msg.thermal.usbOnline) # confirm we have completed training and aren't uninstalling should_start = should_start and accepted_terms and (passive or completed_training) and (not do_uninstall) @@ -269,4 +274,3 @@ def main(gctx=None): if __name__ == "__main__": main() - From 5983ecad5552f309cb354d950165b99c9a68e76f Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 28 Jul 2018 20:01:20 -0400 Subject: [PATCH 111/156] better, but not accel. apply opendbc corrections for acceleration --- opendbc/generator/honda/_bosch_2018.dbc | 6 ++-- .../honda_accord_s2t_2018_can_generated.dbc | 6 ++-- ..._civic_hatchback_ex_2017_can_generated.dbc | 6 ++-- opendbc/honda_crv_ex_2017_can_generated.dbc | 6 ++-- selfdrive/car/honda/carcontroller.py | 32 +++++-------------- selfdrive/car/honda/carstate.py | 13 +++++--- selfdrive/car/honda/hondacan.py | 29 +++++++++++------ selfdrive/car/honda/interface.py | 9 ++++-- selfdrive/manager.py | 2 +- 9 files changed, 55 insertions(+), 54 deletions(-) diff --git a/opendbc/generator/honda/_bosch_2018.dbc b/opendbc/generator/honda/_bosch_2018.dbc index 4c216cd67a2136..707fdc3fe06437 100644 --- a/opendbc/generator/honda/_bosch_2018.dbc +++ b/opendbc/generator/honda/_bosch_2018.dbc @@ -116,12 +116,12 @@ BO_ 464 WHEEL_SPEEDS: 8 VSA BO_ 479 ACC_CONTROL: 8 EON SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX - SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX - SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM - SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ GAS_BRAKE : 31|14@0- (.001,0) [0|1] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (.001,0) [0|1] "" PCM + SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX BO_ 495 ACC_CONTROL_ON: 8 XXX SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX diff --git a/opendbc/honda_accord_s2t_2018_can_generated.dbc b/opendbc/honda_accord_s2t_2018_can_generated.dbc index 6d83a6b8c5a9e5..5293e7f3030795 100644 --- a/opendbc/honda_accord_s2t_2018_can_generated.dbc +++ b/opendbc/honda_accord_s2t_2018_can_generated.dbc @@ -120,12 +120,12 @@ BO_ 464 WHEEL_SPEEDS: 8 VSA BO_ 479 ACC_CONTROL: 8 EON SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX - SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX - SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM - SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ GAS_BRAKE : 31|14@0- (.001,0) [0|1] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (.001,0) [0|1] "" PCM + SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX BO_ 495 ACC_CONTROL_ON: 8 XXX SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index df30d64111c5aa..6bb8770f6438b3 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -120,12 +120,12 @@ BO_ 464 WHEEL_SPEEDS: 8 VSA BO_ 479 ACC_CONTROL: 8 EON SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX - SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX - SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM - SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ GAS_BRAKE : 31|14@0- (.001,0) [0|1] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (.001,0) [0|1] "" PCM + SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX BO_ 495 ACC_CONTROL_ON: 8 XXX SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX diff --git a/opendbc/honda_crv_ex_2017_can_generated.dbc b/opendbc/honda_crv_ex_2017_can_generated.dbc index edcdf64d512d50..39e5975d84c644 100644 --- a/opendbc/honda_crv_ex_2017_can_generated.dbc +++ b/opendbc/honda_crv_ex_2017_can_generated.dbc @@ -120,12 +120,12 @@ BO_ 464 WHEEL_SPEEDS: 8 VSA BO_ 479 ACC_CONTROL: 8 EON SG_ SET_TO_1 : 20|5@0+ (1,0) [0|1] "" PCM SG_ CONTROL_ON : 23|3@0+ (1,0) [0|5] "" XXX - SG_ RELATED_TO_GAS : 7|7@0+ (1,0) [0|69] "" XXX - SG_ GAS_COMMAND : 0|9@0+ (1,0) [0|1] "" PCM - SG_ GAS_BRAKE : 31|14@0- (1,0) [0|1] "" XXX SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + SG_ GAS_BRAKE : 31|14@0- (.001,0) [0|1] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (.001,0) [0|1] "" PCM + SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX BO_ 495 ACC_CONTROL_ON: 8 XXX SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 02c975583901bf..767da6e96f3d69 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -141,28 +141,13 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # **** process the car messages **** # *** compute control surfaces *** - # apply_gas = 0 - # apply_brake = 0 - - # for keyboard, event in poller.poll(500): - # msg = keyboard.recv() - # evt = log.Event.from_bytes(msg) - # - # apply_gas = evt.visionKeyboard.gas - # apply_brake = evt.visionKeyboard.brake - - if CS.CP.visionRadar: - BRAKE_MAX = 800 #convert to negative later on - else: - BRAKE_MAX = 1024/4 + BRAKE_MAX = 1024/4 if CS.CP.carFingerprint in (CAR.ACURA_ILX): STEER_MAX = 0xF00 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) else: STEER_MAX = 0x1000 - if CS.CP.visionRadar: - GAS_MAX = 500 #steer torque is converted back to CAN reference (positive when steering right) if CS.CP.visionRadar: # gas and brake @@ -173,7 +158,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ apply_gas = clip(actuators.gas, 0., 1.) apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX)) apply_steer = int(clip(-actuators.steer * STEER_MAX, -STEER_MAX, STEER_MAX)) - + # any other cp.vl[0x18F]['STEER_STATUS'] is common and can happen during user override. sending 0 torque to avoid EPS sending error 5 lkas_active = enabled and not CS.steer_not_allowed @@ -189,13 +174,12 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ idx = (frame/10) % 4 can_sends.extend(hondacan.create_ui_commands(self.packer, pcm_speed, hud, CS.CP.carFingerprint, idx)) - if CS.CP.radarOffCan: - if not CS.CP.visionRadar: - # If using stock ACC, spam cancel command to kill gas when OP disengages. - if pcm_cancel_cmd: - can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.CANCEL, idx)) - elif CS.stopped: - can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.RES_ACCEL, idx)) + if CS.CP.radarOffCan and not CS.CP.visionRadar: + # If using stock ACC, spam cancel command to kill gas when OP disengages. + if pcm_cancel_cmd: + can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.CANCEL, idx)) + elif CS.stopped: + can_sends.append(hondacan.spam_buttons_command(self.packer, CruiseButtons.RES_ACCEL, idx)) # Send gas and brake commands. if (frame % 2) == 0: idx = (frame / 2) % 4 diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 2a99a47166ece5..eb4d14efd6e063 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -188,7 +188,8 @@ def __init__(self, CP): self.left_blinker_on = 0 self.right_blinker_on = 0 - self.setspeed = 0 + self.setspeed = 255 + self.setspeed_prev = 255 self.stopped = 0 @@ -226,8 +227,9 @@ def update(self, cp): self.door_all_closed = not cp.vl["SCM_FEEDBACK"]['DRIVERS_DOOR_OPEN'] else: self.standstill = not cp.vl["STANDSTILL"]['WHEELS_MOVING'] - self.door_all_closed = not any([cp.vl["DOORS_STATUS"]['DOOR_OPEN_FL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_FR'], - cp.vl["DOORS_STATUS"]['DOOR_OPEN_RL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_RR']]) + self.door_all_closed = True + # self.door_all_closed = not any([cp.vl["DOORS_STATUS"]['DOOR_OPEN_FL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_FR'], + # cp.vl["DOORS_STATUS"]['DOOR_OPEN_RL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_RR']]) self.seatbelt = not cp.vl["SEATBELT_STATUS"]['SEATBELT_DRIVER_LAMP'] and cp.vl["SEATBELT_STATUS"]['SEATBELT_DRIVER_LATCHED'] # 2 = temporary; 3 = TBD; 4 = temporary, hit a bump; 5 = (permanent); 6 = temporary; 7 = (permanent) @@ -235,7 +237,8 @@ def update(self, cp): self.steer_error = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 2, 3, 4, 6] self.steer_not_allowed = cp.vl["STEER_STATUS"]['STEER_STATUS'] != 0 self.steer_warning = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 3] # 3 is low speed lockout, not worth a warning - self.brake_error = cp.vl["STANDSTILL"]['BRAKE_ERROR_1'] or cp.vl["STANDSTILL"]['BRAKE_ERROR_2'] + #self.brake_error = cp.vl["STANDSTILL"]['BRAKE_ERROR_1'] or cp.vl["STANDSTILL"]['BRAKE_ERROR_2'] + self.brake_error = 0 self.esp_disabled = cp.vl["VSA_STATUS"]['ESP_DISABLED'] # calc best v_ego estimate, by averaging two opposite corners @@ -311,7 +314,7 @@ def update(self, cp): self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] self.v_cruise_pcm = self.setspeed - self.v_cruise_pcm_prev = self.v_cruise_pcm + self.v_cruise_pcm_prev = self.setspeed else: self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 9b3cf275d20f30..dc18ff65ffabbc 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -29,19 +29,30 @@ def make_can_msg(addr, dat, idx, alt): def create_long_command(packer, enabled, accel, idx): #we control engine torque request on bosch - # if apply_gas > 0: - # apply_brake = 0 - # if apply_brake < 0: - # apply_gas = 0 + gas_command = 0xd0 + state_flag = 0x45 - #set the other things control_on = 5 if enabled else 0 - state_flag = 0 if accel >= -56 else 69 #the target for the state flip seems to be variable. been seen as high was -56 or -59 and low as -296 - if state_flag == 69 and accel < 0.00: - gas_command = 208 - else: + #set the state flag + if not enabled: + state_flag = 0x45 + elif enabled and accel < 0: + state_flag = 0x45 + elif enabled and accel > 0: + state_flag = 0 + + if enabled and accel > 0: gas_command = accel + elif enabled and accel < 0: + gas_command = 0xd0 + if not enabled: + gas_command = 0xd0 + + #backup values + #state_flag = 0x45 + #gas_command = 0xd0 + #accel = 0x0 values = { "GAS_COMMAND": gas_command, "STATE_FLAG": state_flag, diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index db56fd47a6cc41..297cd76f46a125 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -155,6 +155,7 @@ def get_params(candidate, fingerprint): cloudlog.warn("ECU Radar Simulated: %r", ret.visionRadar) ret.enableCruise = not ret.enableGasInterceptor + ret.enableCruise = not ret.visionRadar # kg of standard extra cargo to count for drive, gas, etc... std_cargo = 136 @@ -517,10 +518,10 @@ def update(self, c): # disable on pedals rising edge or when brake is pressed and speed isn't zero if (ret.gasPressed and not self.gas_pressed_prev) or \ (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) + events.append(create_event('pedalPressed', [ ET.NO_ENTRY, ET.USER_DISABLE])) if ret.gasPressed: - events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) + events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) # it can happen that car cruise disables while comma system is enabled: need to # keep braking if needed or if the speed is very low @@ -543,7 +544,7 @@ def update(self, c): if b.type in ["accelCruise", "decelCruise"] and not b.pressed: self.last_enable_pressed = cur_time enable_pressed = True - ret.cruiseState.enabled = enable_pressed + #ret.cruiseState.enabled = enable_pressed # do disable on button down if b.type == "cancel" and b.pressed: @@ -562,6 +563,7 @@ def update(self, c): self.last_enable_sent = cur_time elif enable_pressed: events.append(create_event('buttonEnable', [ET.ENABLE])) + #self.CS.v_cruise_pcm = self.CS.v_ego * CV.MS_TO_KPH ret.events = events ret.canMonoTimes = canMonoTimes @@ -578,6 +580,7 @@ def update(self, c): def apply(self, c): if c.hudControl.speedVisible: hud_v_cruise = c.hudControl.setSpeed * CV.MS_TO_KPH + self.CS.setspeed = hud_v_cruise else: hud_v_cruise = 255 diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 4280dff95bb640..202de96d0e3ab7 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -82,7 +82,7 @@ managed_processes = { "thermald": "selfdrive.thermald", "uploader": "selfdrive.loggerd.uploader", - "controlsd": "selfdrive.controls.controlsd", + #"controlsd": "selfdrive.controls.controlsd", "radard": "selfdrive.controls.radard", "ubloxd": "selfdrive.locationd.ubloxd", "loggerd": ("selfdrive/loggerd", ["./loggerd"]), From 4cb2d7d2a4dbd5db8e308afaa66d97fc33f3ad61 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 29 Jul 2018 00:54:23 -0400 Subject: [PATCH 112/156] some adjustments --- selfdrive/car/honda/carstate.py | 2 +- selfdrive/car/honda/hondacan.py | 21 ++++++++++++--------- selfdrive/car/honda/interface.py | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index eb4d14efd6e063..77af326ece5141 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -314,7 +314,7 @@ def update(self, cp): self.brake_switch_ts = cp.ts["POWERTRAIN_DATA"]['BRAKE_SWITCH'] self.v_cruise_pcm = self.setspeed - self.v_cruise_pcm_prev = self.setspeed + self.v_cruise_pcm_prev = self.v_cruise_pcm else: self.stopped = cp.vl["ACC_HUD"]['CRUISE_SPEED'] == 252. self.cruise_speed_offset = calc_cruise_offset(0, self.v_ego) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index dc18ff65ffabbc..c7d121ddcb71fd 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -28,31 +28,34 @@ def make_can_msg(addr, dat, idx, alt): return [addr, 0, dat, alt] def create_long_command(packer, enabled, accel, idx): - #we control engine torque request on bosch + #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled gas_command = 0xd0 state_flag = 0x45 + #get accel value back to can reference + accel = accel * 1000 + control_on = 5 if enabled else 0 - #set the state flag + #set the state flag. This has at least 4 values, depending on what's going on. if not enabled: - state_flag = 0x45 + state_flag = 0x45 #69 in decimal elif enabled and accel < 0: state_flag = 0x45 elif enabled and accel > 0: - state_flag = 0 + state_flag = 0x0 + if not enabled: + gas_command = 0xd0 if enabled and accel > 0: gas_command = accel elif enabled and accel < 0: - gas_command = 0xd0 - if not enabled: - gas_command = 0xd0 + gas_command = 0xd0 #208 in decimal - - #backup values + #backup values if we need to hard disable to be able to drive #state_flag = 0x45 #gas_command = 0xd0 #accel = 0x0 + values = { "GAS_COMMAND": gas_command, "STATE_FLAG": state_flag, diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 297cd76f46a125..ff4da9047479a4 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -518,10 +518,10 @@ def update(self, c): # disable on pedals rising edge or when brake is pressed and speed isn't zero if (ret.gasPressed and not self.gas_pressed_prev) or \ (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - events.append(create_event('pedalPressed', [ ET.NO_ENTRY, ET.USER_DISABLE])) + events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) if ret.gasPressed: - events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) + events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) # it can happen that car cruise disables while comma system is enabled: need to # keep braking if needed or if the speed is very low From efd6ffeb086198dc333691fe4e27b53cdcde7593 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 29 Jul 2018 13:16:50 -0400 Subject: [PATCH 113/156] debug print --- selfdrive/controls/controlsd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 1b8ad21282a78c..79b78f9cb826d4 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -268,6 +268,7 @@ def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, PL.PP.c_poly, PL.PP.c_prob, CS.steeringAngle, CS.steeringPressed) + print active # *** gas/brake PID loop *** actuators.gas, actuators.brake = LoC.update(active, CS.vEgo, CS.brakePressed, CS.standstill, CS.cruiseState.standstill, v_cruise_kph, plan.vTarget, plan.vTargetFuture, plan.aTarget, @@ -511,7 +512,7 @@ def controlsd_thread(gctx=None, rate=100, default_bias=0.): prof.checkpoint("State transition") # compute actuators - actuators, v_cruise_kph, driver_status, angle_offset = state_control(plan, CS, CP, state, events, v_cruise_kph, + actuators, v_cruise_kph, driver_status, angle_offset = state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, AM, rk, driver_status, PL, LaC, LoC, VM, angle_offset, passive) prof.checkpoint("State Control") From 03b6f3061b405190087cc7bc51f6584b837a5a9f Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Mon, 30 Jul 2018 22:15:07 -0400 Subject: [PATCH 114/156] 1df isn't being set properly. try decimal. print apply_accel for debug --- selfdrive/car/honda/carcontroller.py | 2 ++ selfdrive/car/honda/hondacan.py | 21 +++++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 767da6e96f3d69..4edf1a22cecc84 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -153,7 +153,9 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # gas and brake apply_accel = actuators.gas - actuators.brake apply_accel, self.accel_steady = accel_hysteresis(apply_accel, self.accel_steady, enabled) + print "apply_accel old is ", apply_accel apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) + print "apply_accel new is ", apply_accel else: apply_gas = clip(actuators.gas, 0., 1.) apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX)) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index c7d121ddcb71fd..3638543e16e915 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -29,33 +29,30 @@ def make_can_msg(addr, dat, idx, alt): def create_long_command(packer, enabled, accel, idx): #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled - gas_command = 0xd0 - state_flag = 0x45 + gas_command = 208 + state_flag = 69 #get accel value back to can reference - accel = accel * 1000 + #accel = accel * 1000 control_on = 5 if enabled else 0 #set the state flag. This has at least 4 values, depending on what's going on. - if not enabled: - state_flag = 0x45 #69 in decimal - elif enabled and accel < 0: - state_flag = 0x45 + if not enabled or accel < 0: + state_flag = 69 #69 in decimal elif enabled and accel > 0: - state_flag = 0x0 + state_flag = 0 - if not enabled: - gas_command = 0xd0 + if not enabled or accel < 0: + gas_command = 208 if enabled and accel > 0: gas_command = accel - elif enabled and accel < 0: - gas_command = 0xd0 #208 in decimal #backup values if we need to hard disable to be able to drive #state_flag = 0x45 #gas_command = 0xd0 #accel = 0x0 + #we dont set set_to_1 on CIVIC_HATCH. values = { "GAS_COMMAND": gas_command, "STATE_FLAG": state_flag, From 14ed72b1720b46a307f44c18fdaa7fe1400eef6a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Mon, 30 Jul 2018 23:13:48 -0400 Subject: [PATCH 115/156] value fix attempt. --- selfdrive/car/honda/hondacan.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 3638543e16e915..7907260ceccad7 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -29,7 +29,7 @@ def make_can_msg(addr, dat, idx, alt): def create_long_command(packer, enabled, accel, idx): #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled - gas_command = 208 + gas_command = 0.208 state_flag = 69 #get accel value back to can reference @@ -43,7 +43,7 @@ def create_long_command(packer, enabled, accel, idx): state_flag = 0 if not enabled or accel < 0: - gas_command = 208 + gas_command = 0.208 if enabled and accel > 0: gas_command = accel From 8c94d93e8d97f139ac18cbcb2071944a7e294b0c Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 31 Jul 2018 09:18:06 -0400 Subject: [PATCH 116/156] disable pedal press and long control stuff --- selfdrive/car/honda/hondacan.py | 6 +++--- selfdrive/car/honda/interface.py | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 7907260ceccad7..e5338482f00147 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -31,18 +31,18 @@ def create_long_command(packer, enabled, accel, idx): #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled gas_command = 0.208 state_flag = 69 - + accel = 0 #get accel value back to can reference #accel = accel * 1000 control_on = 5 if enabled else 0 #set the state flag. This has at least 4 values, depending on what's going on. - if not enabled or accel < 0: + if not enabled or accel <= 0: state_flag = 69 #69 in decimal elif enabled and accel > 0: state_flag = 0 - if not enabled or accel < 0: + if not enabled or accel <= 0: gas_command = 0.208 if enabled and accel > 0: gas_command = accel diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index ff4da9047479a4..82bdc2a6dcdd46 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -516,12 +516,12 @@ def update(self, c): events.append(create_event('speedTooLow', [ET.NO_ENTRY])) # disable on pedals rising edge or when brake is pressed and speed isn't zero - if (ret.gasPressed and not self.gas_pressed_prev) or \ - (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - - if ret.gasPressed: - events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) + # if (ret.gasPressed and not self.gas_pressed_prev) or \ + # (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): + # events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) + # + # if ret.gasPressed: + # events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) # it can happen that car cruise disables while comma system is enabled: need to # keep braking if needed or if the speed is very low From c15957bea7b0a9ce1c48b8b9928d36ba91294420 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 31 Jul 2018 20:45:18 -0400 Subject: [PATCH 117/156] actually allow gas! --- selfdrive/car/honda/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 82bdc2a6dcdd46..a04603e7b708d8 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -354,7 +354,7 @@ def get_params(candidate, fingerprint): ret.steerMaxV = [1.] # max steer allowed ret.gasMaxBP = [0.] # m/s - ret.gasMaxV = [0.6] if ret.enableGasInterceptor else [0.] # max gas allowed + ret.gasMaxV = [0.6] if ret.enableGasInterceptor or ret.visionRadar else [0.] # max gas allowed ret.brakeMaxBP = [5., 20.] # m/s ret.brakeMaxV = [1., 0.8] # max brake allowed From 7d5de08d16739a64a28f9d39d32d155c39cf90ab Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 31 Jul 2018 20:45:25 -0400 Subject: [PATCH 118/156] remove accel limit --- selfdrive/car/honda/hondacan.py | 1 - 1 file changed, 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index e5338482f00147..a85743921b9b24 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -31,7 +31,6 @@ def create_long_command(packer, enabled, accel, idx): #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled gas_command = 0.208 state_flag = 69 - accel = 0 #get accel value back to can reference #accel = accel * 1000 From 76ab08c130a9fe4ee96a264b08996476e3a48b1b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 31 Jul 2018 20:45:33 -0400 Subject: [PATCH 119/156] remove state print --- selfdrive/controls/controlsd.py | 1 - 1 file changed, 1 deletion(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 79b78f9cb826d4..e9db44487c7fca 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -268,7 +268,6 @@ def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, PL.PP.c_poly, PL.PP.c_prob, CS.steeringAngle, CS.steeringPressed) - print active # *** gas/brake PID loop *** actuators.gas, actuators.brake = LoC.update(active, CS.vEgo, CS.brakePressed, CS.standstill, CS.cruiseState.standstill, v_cruise_kph, plan.vTarget, plan.vTargetFuture, plan.aTarget, From e74c2e35c8afcfcda00f18491ca7ae50e9ee4f93 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 31 Jul 2018 20:46:26 -0400 Subject: [PATCH 120/156] manager controlled controlsd --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 202de96d0e3ab7..4280dff95bb640 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -82,7 +82,7 @@ managed_processes = { "thermald": "selfdrive.thermald", "uploader": "selfdrive.loggerd.uploader", - #"controlsd": "selfdrive.controls.controlsd", + "controlsd": "selfdrive.controls.controlsd", "radard": "selfdrive.controls.radard", "ubloxd": "selfdrive.locationd.ubloxd", "loggerd": ("selfdrive/loggerd", ["./loggerd"]), From ca5e60a94a2b0a60bb546e10cf1107e20b4fb8c5 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 31 Jul 2018 20:50:38 -0400 Subject: [PATCH 121/156] reenable pedal safety and preenable --- selfdrive/car/honda/interface.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index a04603e7b708d8..83d640af07adde 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -516,12 +516,12 @@ def update(self, c): events.append(create_event('speedTooLow', [ET.NO_ENTRY])) # disable on pedals rising edge or when brake is pressed and speed isn't zero - # if (ret.gasPressed and not self.gas_pressed_prev) or \ - # (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): - # events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - # - # if ret.gasPressed: - # events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) + if (ret.gasPressed and not self.gas_pressed_prev) or \ + (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): + events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) + + if ret.gasPressed: + events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) # it can happen that car cruise disables while comma system is enabled: need to # keep braking if needed or if the speed is very low From 66e958e7190ff394da08d65e0755e3efc80b084e Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 31 Jul 2018 21:00:31 -0400 Subject: [PATCH 122/156] refactor and add switching value --- selfdrive/car/honda/hondacan.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index a85743921b9b24..818a053b7030f0 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -31,21 +31,21 @@ def create_long_command(packer, enabled, accel, idx): #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled gas_command = 0.208 state_flag = 69 - #get accel value back to can reference - #accel = accel * 1000 control_on = 5 if enabled else 0 + + #this is variable. # TODO: RE this switching point for gas command and state flag based on gas_brake/accel + switch_value = -0.11 + #set the state flag. This has at least 4 values, depending on what's going on. - if not enabled or accel <= 0: + if not enabled or accel <= switch_value state_flag = 69 #69 in decimal - elif enabled and accel > 0: - state_flag = 0 - - if not enabled or accel <= 0: gas_command = 0.208 - if enabled and accel > 0: + elif enabled or accel > switch_value: + state_flag = 0 gas_command = accel + #backup values if we need to hard disable to be able to drive #state_flag = 0x45 #gas_command = 0xd0 From f1a80964185fbe3ab02696096bc2a37db6c8114a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 31 Jul 2018 21:03:41 -0400 Subject: [PATCH 123/156] syntax --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 818a053b7030f0..b8494edb277b14 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -38,7 +38,7 @@ def create_long_command(packer, enabled, accel, idx): switch_value = -0.11 #set the state flag. This has at least 4 values, depending on what's going on. - if not enabled or accel <= switch_value + if not enabled or accel <= switch_value: state_flag = 69 #69 in decimal gas_command = 0.208 elif enabled or accel > switch_value: From f62bac5534a576f072477931ffb4627736b58afc Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Wed, 1 Aug 2018 09:39:00 -0400 Subject: [PATCH 124/156] disable again --- selfdrive/car/honda/hondacan.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index b8494edb277b14..2962ebbb82bcab 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -34,22 +34,21 @@ def create_long_command(packer, enabled, accel, idx): control_on = 5 if enabled else 0 - #this is variable. # TODO: RE this switching point for gas command and state flag based on gas_brake/accel - switch_value = -0.11 + #this is variable. # TODO: RE this switching point for gas command and state flag based on gas_brake + flop_threshold = -0.11 #set the state flag. This has at least 4 values, depending on what's going on. - if not enabled or accel <= switch_value: + if not enabled or accel <= flop_threshold: state_flag = 69 #69 in decimal gas_command = 0.208 - elif enabled or accel > switch_value: + elif enabled or accel > flop_threshold: state_flag = 0 gas_command = accel - #backup values if we need to hard disable to be able to drive - #state_flag = 0x45 - #gas_command = 0xd0 - #accel = 0x0 + state_flag = 69 + gas_command = 0.208 + accel = 0 #we dont set set_to_1 on CIVIC_HATCH. values = { From 20cbfdb34370d51015f90a3f6796d65720a80f74 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 2 Aug 2018 16:24:16 -0400 Subject: [PATCH 125/156] refactor and adjust prints --- selfdrive/car/honda/carcontroller.py | 4 +--- selfdrive/car/honda/hondacan.py | 11 +++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 4edf1a22cecc84..b33289898e287a 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -153,14 +153,12 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # gas and brake apply_accel = actuators.gas - actuators.brake apply_accel, self.accel_steady = accel_hysteresis(apply_accel, self.accel_steady, enabled) - print "apply_accel old is ", apply_accel apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) - print "apply_accel new is ", apply_accel else: apply_gas = clip(actuators.gas, 0., 1.) apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX)) apply_steer = int(clip(-actuators.steer * STEER_MAX, -STEER_MAX, STEER_MAX)) - + # any other cp.vl[0x18F]['STEER_STATUS'] is common and can happen during user override. sending 0 torque to avoid EPS sending error 5 lkas_active = enabled and not CS.steer_not_allowed diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 2962ebbb82bcab..b36c46004d8962 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -28,20 +28,23 @@ def make_can_msg(addr, dat, idx, alt): return [addr, 0, dat, alt] def create_long_command(packer, enabled, accel, idx): + print accel + #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled gas_command = 0.208 state_flag = 69 - control_on = 5 if enabled else 0 #this is variable. # TODO: RE this switching point for gas command and state flag based on gas_brake - flop_threshold = -0.11 + switch_threshold = -0.11 #set the state flag. This has at least 4 values, depending on what's going on. - if not enabled or accel <= flop_threshold: + if not enabled: + state_flag = 69 #69 in decimal + if enabled and accel <= switch_threshold: state_flag = 69 #69 in decimal gas_command = 0.208 - elif enabled or accel > flop_threshold: + elif enabled or accel > switch_threshold: state_flag = 0 gas_command = accel From 0df316c16f2bf0021877340eac50180d720ee47c Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 26 Jun 2018 00:18:21 -0400 Subject: [PATCH 126/156] ignore secrets --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 71ca33c6528c7a..fefa96c1622715 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ selfdrive/test/tests/plant/out /src/ one +selfdrive/passwords.txt From 7202ffb671d30852c2bc1f4e5b153bf7fe22b5f9 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Fri, 3 Aug 2018 16:10:53 -0400 Subject: [PATCH 127/156] add lkas button switching and get rid of accel scaling --- selfdrive/car/honda/carcontroller.py | 12 ++++++++---- selfdrive/car/honda/carstate.py | 2 ++ selfdrive/car/honda/hondacan.py | 29 ++++++++++++++-------------- selfdrive/car/honda/interface.py | 26 ++++++++++++++++--------- 4 files changed, 42 insertions(+), 27 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index e8e6b4eb2fde20..5296cd7fa7420d 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -10,12 +10,13 @@ import selfdrive.messaging as messaging from selfdrive.services import service_list -# Accel limits +# Accel limits from toyota ACCEL_HYST_GAP = 0.02 # don't change accel command for small oscilalitons within this value ACCEL_MAX = 1.5 # 1.5 m/s2 ACCEL_MIN = -3.0 # 3 m/s2 ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN) +#honda def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): # hyst params... TODO: move these to VehicleParams brake_hyst_on = 0.02 # to activate brakes exceed this value @@ -41,6 +42,7 @@ def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): return brake, braking, brake_steady +#from toyota def accel_hysteresis(accel, accel_steady, enabled): # for small accel oscillations within ACCEL_HYST_GAP, don't change the accel command @@ -152,10 +154,12 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ STEER_MAX = 0x1000 #steer torque is converted back to CAN reference (positive when steering right) if CS.CP.visionRadar: - # gas and brake + # gas and brake. braking is negative apply_accel = actuators.gas - actuators.brake apply_accel, self.accel_steady = accel_hysteresis(apply_accel, self.accel_steady, enabled) - apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) + #apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) + apply_accel = clip(apply_accel, ACCEL_MIN, ACCEL_MAX) + else: apply_gas = clip(actuators.gas, 0., 1.) apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX)) @@ -186,7 +190,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ if (frame % 2) == 0: idx = (frame / 2) % 4 if CS.CP.visionRadar and CS.CP.carFingerprint == CAR.CIVIC_HATCH: - can_sends.append(hondacan.create_long_command(self.packer, enabled, apply_accel, idx)) + can_sends.append(hondacan.create_long_command(self.packer, enabled, CS.longenabled, apply_accel, idx)) can_sends.append(hondacan.create_acc_control_on(self.packer, enabled, idx)) can_sends.append(hondacan.create_1fa(self.packer, idx)) else: diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 59a801ef8238bc..b93dbefe29f6af 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -192,6 +192,8 @@ def __init__(self, CP): self.setspeed_prev = 255 self.stopped = 0 + #defaut to no long control for testing + self.longenabled = False # vEgo kalman filter dt = 0.01 diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 535015d3323dd3..0eada64d35c214 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -27,7 +27,7 @@ def make_can_msg(addr, dat, idx, alt): dat = fix(dat, addr) return [addr, 0, dat, alt] -def create_long_command(packer, enabled, accel, idx): +def create_long_command(packer, enabled, longenabled, accel, idx): print accel #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled @@ -38,20 +38,21 @@ def create_long_command(packer, enabled, accel, idx): #this is variable. # TODO: RE this switching point for gas command and state flag based on gas_brake switch_threshold = -0.11 - #set the state flag. This has at least 4 values, depending on what's going on. - if not enabled: - state_flag = 69 #69 in decimal - if enabled and accel <= switch_threshold: - state_flag = 69 #69 in decimal + if longenabled: + #set the state flag. This has at least 4 values, depending on what's going on. + if not enabled: + state_flag = 69 #69 in decimal + if enabled and accel <= switch_threshold: + state_flag = 69 #69 in decimal + gas_command = 0.208 + elif enabled or accel > switch_threshold: + state_flag = 0 + gas_command = accel + else: + #backup values if we need to hard disable to be able to drive + state_flag = 69 gas_command = 0.208 - elif enabled or accel > switch_threshold: - state_flag = 0 - gas_command = accel - - #backup values if we need to hard disable to be able to drive - state_flag = 69 - gas_command = 0.208 - accel = 0 + accel = 0 #we dont set set_to_1 on CIVIC_HATCH. values = { diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index f234647b922dd6..ffdd417f53f1b9 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -540,15 +540,23 @@ def update(self, c): # handle button presses for b in ret.buttonEvents: - # do enable on both accel and decel buttons - if b.type in ["accelCruise", "decelCruise"] and not b.pressed: - self.last_enable_pressed = cur_time - enable_pressed = True - #ret.cruiseState.enabled = enable_pressed - - # do disable on button down - if b.type == "cancel" and b.pressed: - events.append(create_event('buttonCancel', [ET.USER_DISABLE])) + if b.type in ["altButton1"] and b.pressed: + if self.CS.longenabled == True: + self.CS.longenabled = False + else: + self.CS.longenabled = True + + #allow lkas button to disable long control when enabled + if self.longenabled: + # do enable on both accel and decel buttons + if b.type in ["accelCruise", "decelCruise"] and not b.pressed: + self.last_enable_pressed = cur_time + enable_pressed = True + #ret.cruiseState.enabled = enable_pressed + + # do disable on button down + if b.type == "cancel" and b.pressed: + events.append(create_event('buttonCancel', [ET.USER_DISABLE])) if self.CP.enableCruise: # KEEP THIS EVENT LAST! send enable event if button is pressed and there are From 11f3baebec1876ae2d5828bdfb10421c97a95310 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Fri, 3 Aug 2018 20:35:20 -0400 Subject: [PATCH 128/156] fix syntax --- selfdrive/car/honda/interface.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index ffdd417f53f1b9..3d3819875e0d88 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -516,12 +516,13 @@ def update(self, c): events.append(create_event('speedTooLow', [ET.NO_ENTRY])) # disable on pedals rising edge or when brake is pressed and speed isn't zero - if (ret.gasPressed and not self.gas_pressed_prev) or \ + if self.CS.longenabled: + if (ret.gasPressed and not self.gas_pressed_prev) or \ (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - if ret.gasPressed: - events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) + if ret.gasPressed: + events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) # it can happen that car cruise disables while comma system is enabled: need to # keep braking if needed or if the speed is very low @@ -536,7 +537,7 @@ def update(self, c): cur_time = sec_since_boot() enable_pressed = False - + print self.CS.longenabled # handle button presses for b in ret.buttonEvents: @@ -547,7 +548,7 @@ def update(self, c): self.CS.longenabled = True #allow lkas button to disable long control when enabled - if self.longenabled: + if True: # do enable on both accel and decel buttons if b.type in ["accelCruise", "decelCruise"] and not b.pressed: self.last_enable_pressed = cur_time From ffbebb3626a4370d514fd0bd682029844af15bf5 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Fri, 3 Aug 2018 20:35:20 -0400 Subject: [PATCH 129/156] fix syntax --- selfdrive/car/honda/interface.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index ffdd417f53f1b9..3d3819875e0d88 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -516,12 +516,13 @@ def update(self, c): events.append(create_event('speedTooLow', [ET.NO_ENTRY])) # disable on pedals rising edge or when brake is pressed and speed isn't zero - if (ret.gasPressed and not self.gas_pressed_prev) or \ + if self.CS.longenabled: + if (ret.gasPressed and not self.gas_pressed_prev) or \ (ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)): events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE])) - if ret.gasPressed: - events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) + if ret.gasPressed: + events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) # it can happen that car cruise disables while comma system is enabled: need to # keep braking if needed or if the speed is very low @@ -536,7 +537,7 @@ def update(self, c): cur_time = sec_since_boot() enable_pressed = False - + print self.CS.longenabled # handle button presses for b in ret.buttonEvents: @@ -547,7 +548,7 @@ def update(self, c): self.CS.longenabled = True #allow lkas button to disable long control when enabled - if self.longenabled: + if True: # do enable on both accel and decel buttons if b.type in ["accelCruise", "decelCruise"] and not b.pressed: self.last_enable_pressed = cur_time From b02517d42d2fd18aa6d4eb9e8ab3c15d71f3c43c Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 4 Aug 2018 01:09:05 -0400 Subject: [PATCH 130/156] refactor. some missing bosch stuff. add accel thresholds. braking, idk untested --- selfdrive/car/honda/carcontroller.py | 4 +- selfdrive/car/honda/hondacan.py | 77 +++++++++++++++++----------- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 5296cd7fa7420d..512c90b45f3db7 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -173,12 +173,12 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ # Send steering command. idx = frame % 4 - can_sends.append(hondacan.create_steering_control(self.packer, apply_steer, lkas_active, CS.CP.carFingerprint, idx)) + can_sends.append(hondacan.create_steering_control(self.packer, apply_steer, lkas_active, CS.CP.carFingerprint, CS.CP.visionRadar, CS.CP.radarOffCan, idx)) # Send dashboard UI commands. if (frame % 10) == 0: idx = (frame/10) % 4 - can_sends.extend(hondacan.create_ui_commands(self.packer, pcm_speed, hud, CS.CP.carFingerprint, idx)) + can_sends.extend(hondacan.create_ui_commands(self.packer, pcm_speed, hud, CS.CP.carFingerprint, CS.longenabled, CS.CP.visionRadar, CS.CP.radarOffCan, idx)) if CS.CP.radarOffCan and not CS.CP.visionRadar: # If using stock ACC, spam cancel command to kill gas when OP disengages. diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 0eada64d35c214..154f2ebf06e59e 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -35,19 +35,40 @@ def create_long_command(packer, enabled, longenabled, accel, idx): state_flag = 69 control_on = 5 if enabled else 0 - #this is variable. # TODO: RE this switching point for gas command and state flag based on gas_brake - switch_threshold = -0.11 + ## TODO: VERIFY THESE + HI_ACCEL_THRESHOLD = 1.52 + MID_ACCEL_THRESHOLD = 0.632 + LO_ACCEL_THRESHOLD = -0.11 + + #THESE MAY BE UNNECESSARY + LO_BRAKE_THRESHOLD = 0 + MID_BRAKE_THRESHOLD = 0 + HI_BRAKE_THRESHOLD = 0 if longenabled: #set the state flag. This has at least 4 values, depending on what's going on. if not enabled: state_flag = 69 #69 in decimal - if enabled and accel <= switch_threshold: - state_flag = 69 #69 in decimal gas_command = 0.208 - elif enabled or accel > switch_threshold: - state_flag = 0 - gas_command = accel + accel = 0 + if enabled: + if accel <= LO_ACCEL_THRESHOLD: + state_flag = 69 #69 in decimal + gas_command = 0.208 + + #going to low accel + elif accel > LO_ACCEL_THRESHOLD: + state_flag = 0 + gas_command = accel + #going to mid accel + elif accel > MID_ACCEL_THRESHOLD: + state_flag = 1 + gas_command = accel - 0.506 + #going to high accel + elif accel > HI_ACCEL_THRESHOLD: + state_flag = 2 + gas_command = accel - (0.506 * 2) + else: #backup values if we need to hard disable to be able to drive state_flag = 69 @@ -64,11 +85,9 @@ def create_long_command(packer, enabled, longenabled, accel, idx): return packer.make_can_msg("ACC_CONTROL", 0, values, idx) def create_acc_control_on(packer, enabled, idx): - control_on = 5 if enabled else 0 - values = { "SET_TO_3": 0x03, - "CONTROL_ON": control_on, + "CONTROL_ON": enabled, "SET_TO_FF": 0xff, "SET_TO_75": 0x75, "SET_TO_30": 0x30, @@ -115,49 +134,47 @@ def create_gas_command(packer, gas_amount, idx): return packer.make_can_msg("GAS_COMMAND", 0, values, idx) -def create_steering_control(packer, apply_steer, lkas_active, car_fingerprint, idx): +def create_steering_control(packer, apply_steer, lkas_active, car_fingerprint, visionradar, radaroffcan, idx): """Creates a CAN message for the Honda DBC STEERING_CONTROL.""" values = { "STEER_TORQUE": apply_steer if lkas_active else 0, "STEER_TORQUE_REQUEST": lkas_active, } # Set bus 2 for accord and new crv. - bus = 2 if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH) else 0 - if True: - bus = 0 + bus = 2 if radaroffcan and not visionradar else 0 return packer.make_can_msg("STEERING_CONTROL", bus, values, idx) -def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, idx): +def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, longenabled, visionradar, radaroffcan, idx): """Creates an iterable of CAN messages for the UIs.""" commands = [] bus = 0 # Bosch sends commands to bus 2. - if car_fingerprint in (CAR.CRV_5G, CAR.ACCORD, CAR.CIVIC_HATCH): + if radaroffcan and not visionradar: bus = 2 - if True: - if car_fingerprint in (CAR.CIVIC_HATCH): - bus = 0 + else: + if radaroffcan: acc_hud_values = { 'CRUISE_SPEED': hud.v_cruise, 'ENABLE_MINI_CAR': hud.mini_car, 'SET_TO_1': 0x01, 'HUD_LEAD': hud.car, 'HUD_DISTANCE': 0x02, + 'ACC_ON': longenabled, 'SET_TO_X3': 0x03, } - else: - acc_hud_values = { - 'PCM_SPEED': pcm_speed * CV.MS_TO_KPH, - 'PCM_GAS': hud.pcm_accel, - 'CRUISE_SPEED': hud.v_cruise, - 'ENABLE_MINI_CAR': hud.mini_car, - 'HUD_LEAD': hud.car, - 'SET_ME_X03': 0x03, - 'SET_ME_X03_2': 0x03, - 'SET_ME_X01': 0x01, - } + else: + acc_hud_values = { + 'PCM_SPEED': pcm_speed * CV.MS_TO_KPH, + 'PCM_GAS': hud.pcm_accel, + 'CRUISE_SPEED': hud.v_cruise, + 'ENABLE_MINI_CAR': hud.mini_car, + 'HUD_LEAD': hud.car, + 'SET_ME_X03': 0x03, + 'SET_ME_X03_2': 0x03, + 'SET_ME_X01': 0x01, + } commands.append(packer.make_can_msg('ACC_HUD', 0, acc_hud_values, idx)) lkas_hud_values = { From 29451e793e2c0faaa11674874abe901870969fb6 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 00:03:27 -0400 Subject: [PATCH 131/156] adjustments. add prints gascommand and accel aren't matching up for some reason. --- selfdrive/car/honda/hondacan.py | 9 +++++---- selfdrive/car/honda/interface.py | 8 ++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 154f2ebf06e59e..14a7982abc3c57 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -28,7 +28,6 @@ def make_can_msg(addr, dat, idx, alt): return [addr, 0, dat, alt] def create_long_command(packer, enabled, longenabled, accel, idx): - print accel #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled gas_command = 0.208 @@ -52,10 +51,10 @@ def create_long_command(packer, enabled, longenabled, accel, idx): gas_command = 0.208 accel = 0 if enabled: + #brake to coast-ish if accel <= LO_ACCEL_THRESHOLD: state_flag = 69 #69 in decimal gas_command = 0.208 - #going to low accel elif accel > LO_ACCEL_THRESHOLD: state_flag = 0 @@ -63,11 +62,11 @@ def create_long_command(packer, enabled, longenabled, accel, idx): #going to mid accel elif accel > MID_ACCEL_THRESHOLD: state_flag = 1 - gas_command = accel - 0.506 + gas_command = (accel - 0.506) #going to high accel elif accel > HI_ACCEL_THRESHOLD: state_flag = 2 - gas_command = accel - (0.506 * 2) + gas_command = (accel - (0.506 * 2)) else: #backup values if we need to hard disable to be able to drive @@ -75,6 +74,8 @@ def create_long_command(packer, enabled, longenabled, accel, idx): gas_command = 0.208 accel = 0 + print "accel", print accel, print "gas_command", print gas_command + #we dont set set_to_1 on CIVIC_HATCH. values = { "GAS_COMMAND": gas_command, diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 3d3819875e0d88..8fcde8dfb8d9dd 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -354,7 +354,12 @@ def get_params(candidate, fingerprint): ret.steerMaxV = [1.] # max steer allowed ret.gasMaxBP = [0.] # m/s - ret.gasMaxV = [0.6] if ret.enableGasInterceptor or ret.visionRadar else [0.] # max gas allowed + if ret.enableGasInterceptor: + ret.gasMaxV = [0.6] + elif ret.visionRadar: + ret.gasMaxV = [0.5] + else: + ret.gasMaxV = [0] ret.brakeMaxBP = [5., 20.] # m/s ret.brakeMaxV = [1., 0.8] # max brake allowed @@ -537,7 +542,6 @@ def update(self, c): cur_time = sec_since_boot() enable_pressed = False - print self.CS.longenabled # handle button presses for b in ret.buttonEvents: From c75972463ab7f72a49d87f108959d52e05866327 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 00:05:41 -0400 Subject: [PATCH 132/156] fix? --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 14a7982abc3c57..dea53b1feda539 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -74,7 +74,7 @@ def create_long_command(packer, enabled, longenabled, accel, idx): gas_command = 0.208 accel = 0 - print "accel", print accel, print "gas_command", print gas_command + print "accel", accel, "gas_command", gas_command #we dont set set_to_1 on CIVIC_HATCH. values = { From b5fd7034a81a7030624df941de0c12a21ce9e55b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 09:03:42 -0400 Subject: [PATCH 133/156] trying to debug gas command. reduce hysteresis --- selfdrive/car/honda/carcontroller.py | 26 ++++++++++++-------------- selfdrive/car/honda/hondacan.py | 14 ++++++++++---- selfdrive/thermald.py | 2 +- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 512c90b45f3db7..7bd4255fed40f6 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -11,7 +11,7 @@ from selfdrive.services import service_list # Accel limits from toyota -ACCEL_HYST_GAP = 0.02 # don't change accel command for small oscilalitons within this value +ACCEL_HYST_GAP = 0.1 # was 0.02 # don't change accel command for small oscilalitons within this value ACCEL_MAX = 1.5 # 1.5 m/s2 ACCEL_MIN = -3.0 # 3 m/s2 ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN) @@ -43,19 +43,19 @@ def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): return brake, braking, brake_steady #from toyota -def accel_hysteresis(accel, accel_steady, enabled): +def accel_hysteresis(accel, accel_prev, actuators.gas, actuators.brake, enabled): # for small accel oscillations within ACCEL_HYST_GAP, don't change the accel command if not enabled: # send 0 when disabled, otherwise acc faults - accel_steady = 0. - elif accel > accel_steady + ACCEL_HYST_GAP: - accel_steady = accel - ACCEL_HYST_GAP - elif accel < accel_steady - ACCEL_HYST_GAP: - accel_steady = accel + ACCEL_HYST_GAP - accel = accel_steady + accel_prev = 0. + elif accel > accel_prev + ACCEL_HYST_GAP: + accel_prev = accel - ACCEL_HYST_GAP + elif accel < accel_prev - ACCEL_HYST_GAP: + accel_prev = accel + ACCEL_HYST_GAP + accel = accel_prev - return accel, accel_steady + return accel, accel_prev def process_hud_alert(hud_alert): # initialize to no alert @@ -84,7 +84,7 @@ def __init__(self, dbc_name, enable_camera=True): self.braking = False self.brake_steady = 0. self.brake_last = 0. - self.accel_steady = 0. + self.accel_prev = 0. self.enable_camera = enable_camera self.packer = CANPacker(dbc_name) self.new_radar_config = False @@ -155,10 +155,8 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ #steer torque is converted back to CAN reference (positive when steering right) if CS.CP.visionRadar: # gas and brake. braking is negative - apply_accel = actuators.gas - actuators.brake - apply_accel, self.accel_steady = accel_hysteresis(apply_accel, self.accel_steady, enabled) - #apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) - apply_accel = clip(apply_accel, ACCEL_MIN, ACCEL_MAX) + apply_accel, self.accel_prev = accel_hysteresis(apply_accel, self.accel_prev, actuators.gas, actuators.brake, enabled) + apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) else: apply_gas = clip(actuators.gas, 0., 1.) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index dea53b1feda539..a302dd40cb9d26 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -35,9 +35,9 @@ def create_long_command(packer, enabled, longenabled, accel, idx): control_on = 5 if enabled else 0 ## TODO: VERIFY THESE - HI_ACCEL_THRESHOLD = 1.52 - MID_ACCEL_THRESHOLD = 0.632 - LO_ACCEL_THRESHOLD = -0.11 + HI_ACCEL_THRESHOLD = [1.52] + MID_ACCEL_THRESHOLD = [0.632] + LO_ACCEL_THRESHOLD = [-0.11] #THESE MAY BE UNNECESSARY LO_BRAKE_THRESHOLD = 0 @@ -50,23 +50,29 @@ def create_long_command(packer, enabled, longenabled, accel, idx): state_flag = 69 #69 in decimal gas_command = 0.208 accel = 0 + print "disabled ", if enabled: #brake to coast-ish if accel <= LO_ACCEL_THRESHOLD: state_flag = 69 #69 in decimal gas_command = 0.208 + print "idle/brake ", #going to low accel elif accel > LO_ACCEL_THRESHOLD: state_flag = 0 gas_command = accel + print "low accel ", #going to mid accel elif accel > MID_ACCEL_THRESHOLD: state_flag = 1 + #zero out when almost to 9 high bits. 9bit high would be 0.511 gas_command = (accel - 0.506) + print "mid accel ", #going to high accel elif accel > HI_ACCEL_THRESHOLD: state_flag = 2 gas_command = (accel - (0.506 * 2)) + print "hi accel ", else: #backup values if we need to hard disable to be able to drive @@ -74,7 +80,7 @@ def create_long_command(packer, enabled, longenabled, accel, idx): gas_command = 0.208 accel = 0 - print "accel", accel, "gas_command", gas_command + print "accel ", accel, "gas_command ", gas_command #we dont set set_to_1 on CIVIC_HATCH. values = { diff --git a/selfdrive/thermald.py b/selfdrive/thermald.py index ff6752b568c476..23a624dca0cb1a 100755 --- a/selfdrive/thermald.py +++ b/selfdrive/thermald.py @@ -257,7 +257,7 @@ def thermald_thread(): msg.thermal.thermalStatus = thermal_status thermal_sock.send(msg.to_bytes()) - print msg + #print msg # report to server once per minute if (count%60) == 0: From 63977b11410764759c83dc3ee3ba288aae54d5e6 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 09:06:30 -0400 Subject: [PATCH 134/156] syntax --- selfdrive/car/honda/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 7bd4255fed40f6..f823ba122ecaba 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -43,7 +43,7 @@ def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): return brake, braking, brake_steady #from toyota -def accel_hysteresis(accel, accel_prev, actuators.gas, actuators.brake, enabled): +def accel_hysteresis(accel, accel_prev, actuators_gas, actuators_brake, enabled): # for small accel oscillations within ACCEL_HYST_GAP, don't change the accel command if not enabled: From 2b37d53f68851a7bdde2f9fa17166e5082ad1426 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 09:09:54 -0400 Subject: [PATCH 135/156] trying to stop prints --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 8a0092ae710f37..5b633a1ba041e7 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -282,7 +282,7 @@ def manager_init(should_register=True): def system(cmd): try: - cloudlog.info("running %s" % cmd) + #cloudlog.info("running %s" % cmd) subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError as e: cloudlog.event("running failed", From 8c06e4bb35812708523c4abf7c19922cd538af57 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 09:11:27 -0400 Subject: [PATCH 136/156] again --- selfdrive/manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 5b633a1ba041e7..3499a8f07db73e 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -80,7 +80,7 @@ # comment out anything you don't want to run managed_processes = { - "thermald": "selfdrive.thermald", + #"thermald": "selfdrive.thermald", "uploader": "selfdrive.loggerd.uploader", "controlsd": "selfdrive.controls.controlsd", "radard": "selfdrive.controls.radard", @@ -282,7 +282,7 @@ def manager_init(should_register=True): def system(cmd): try: - #cloudlog.info("running %s" % cmd) + cloudlog.info("running %s" % cmd) subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError as e: cloudlog.event("running failed", From 8c38568ceb43c96f037d97833f01d7cad419782a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 09:22:34 -0400 Subject: [PATCH 137/156] revert thermald comment --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 3499a8f07db73e..8a0092ae710f37 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -80,7 +80,7 @@ # comment out anything you don't want to run managed_processes = { - #"thermald": "selfdrive.thermald", + "thermald": "selfdrive.thermald", "uploader": "selfdrive.loggerd.uploader", "controlsd": "selfdrive.controls.controlsd", "radard": "selfdrive.controls.radard", From bb4d5073cdb2c79db897aae3ec2f5b073404e05b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 09:32:56 -0400 Subject: [PATCH 138/156] broken? --- selfdrive/car/honda/carcontroller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index f823ba122ecaba..3b9283efbc8436 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -43,7 +43,7 @@ def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint): return brake, braking, brake_steady #from toyota -def accel_hysteresis(accel, accel_prev, actuators_gas, actuators_brake, enabled): +def accel_hysteresis(accel, accel_prev, enabled): # for small accel oscillations within ACCEL_HYST_GAP, don't change the accel command if not enabled: @@ -155,7 +155,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ #steer torque is converted back to CAN reference (positive when steering right) if CS.CP.visionRadar: # gas and brake. braking is negative - apply_accel, self.accel_prev = accel_hysteresis(apply_accel, self.accel_prev, actuators.gas, actuators.brake, enabled) + apply_accel, self.accel_prev = accel_hysteresis(apply_accel, self.accel_prev, enabled) apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) else: From 5b05fee3bea5ecec577fbd05b547cd5090ca2367 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 11:31:41 -0400 Subject: [PATCH 139/156] fix and refactor --- selfdrive/car/honda/carcontroller.py | 1 + selfdrive/car/honda/hondacan.py | 57 +++++++++++----------------- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 3b9283efbc8436..a6fa46ba6daeaa 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -155,6 +155,7 @@ def update(self, sendcan, enabled, CS, frame, actuators, \ #steer torque is converted back to CAN reference (positive when steering right) if CS.CP.visionRadar: # gas and brake. braking is negative + apply_accel = actuators.gas - actuators.brake apply_accel, self.accel_prev = accel_hysteresis(apply_accel, self.accel_prev, enabled) apply_accel = clip(apply_accel * ACCEL_SCALE, ACCEL_MIN, ACCEL_MAX) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index a302dd40cb9d26..71b738b73bf2ec 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -28,10 +28,6 @@ def make_can_msg(addr, dat, idx, alt): return [addr, 0, dat, alt] def create_long_command(packer, enabled, longenabled, accel, idx): - - #we control engine torque request/acceleration on bosch. initailize two variables as if we're disabled - gas_command = 0.208 - state_flag = 69 control_on = 5 if enabled else 0 ## TODO: VERIFY THESE @@ -44,41 +40,34 @@ def create_long_command(packer, enabled, longenabled, accel, idx): MID_BRAKE_THRESHOLD = 0 HI_BRAKE_THRESHOLD = 0 - if longenabled: - #set the state flag. This has at least 4 values, depending on what's going on. - if not enabled: + #set the state flag. This has at least 4 values, depending on what's going on. + if longenabled and enabled: + #brake to coast-ish + if accel <= LO_ACCEL_THRESHOLD: state_flag = 69 #69 in decimal gas_command = 0.208 - accel = 0 - print "disabled ", - if enabled: - #brake to coast-ish - if accel <= LO_ACCEL_THRESHOLD: - state_flag = 69 #69 in decimal - gas_command = 0.208 - print "idle/brake ", - #going to low accel - elif accel > LO_ACCEL_THRESHOLD: - state_flag = 0 - gas_command = accel - print "low accel ", - #going to mid accel - elif accel > MID_ACCEL_THRESHOLD: - state_flag = 1 - #zero out when almost to 9 high bits. 9bit high would be 0.511 - gas_command = (accel - 0.506) - print "mid accel ", - #going to high accel - elif accel > HI_ACCEL_THRESHOLD: - state_flag = 2 - gas_command = (accel - (0.506 * 2)) - print "hi accel ", - + print "idle/brake ", + #going to low accel + elif accel > LO_ACCEL_THRESHOLD: + state_flag = 0 + gas_command = accel + print "low accel ", + #going to mid accel + elif accel > MID_ACCEL_THRESHOLD: + state_flag = 1 + #zero out when almost to 9 high bits. 9bit high would be 0.511 + gas_command = (accel - 0.506) + print "mid accel ", + #going to high accel + elif accel > HI_ACCEL_THRESHOLD: + state_flag = 2 + gas_command = (accel - (0.506 * 2)) + print "hi accel ", else: - #backup values if we need to hard disable to be able to drive - state_flag = 69 + state_flag = 69 #69 in decimal gas_command = 0.208 accel = 0 + print "disabled ", print "accel ", accel, "gas_command ", gas_command From 34edb814f788034b34efd91394ca332ef3d74df1 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 9 Aug 2018 11:41:14 -0400 Subject: [PATCH 140/156] syntax? --- selfdrive/car/honda/hondacan.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 71b738b73bf2ec..b1513d0e419982 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -43,23 +43,23 @@ def create_long_command(packer, enabled, longenabled, accel, idx): #set the state flag. This has at least 4 values, depending on what's going on. if longenabled and enabled: #brake to coast-ish - if accel <= LO_ACCEL_THRESHOLD: + if (accel <= LO_ACCEL_THRESHOLD): state_flag = 69 #69 in decimal gas_command = 0.208 print "idle/brake ", #going to low accel - elif accel > LO_ACCEL_THRESHOLD: + elif (accel > LO_ACCEL_THRESHOLD): state_flag = 0 gas_command = accel print "low accel ", #going to mid accel - elif accel > MID_ACCEL_THRESHOLD: + elif (accel > MID_ACCEL_THRESHOLD): state_flag = 1 - #zero out when almost to 9 high bits. 9bit high would be 0.511 + #zero out when almost to 9 high bits (max for gas_command). 9bits high would be 0.511 gas_command = (accel - 0.506) print "mid accel ", #going to high accel - elif accel > HI_ACCEL_THRESHOLD: + elif (accel > HI_ACCEL_THRESHOLD): state_flag = 2 gas_command = (accel - (0.506 * 2)) print "hi accel ", From 3b89cdd25acf5d8a0c653267afccd94dbf49eea4 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Sat, 11 Aug 2018 15:38:27 -0400 Subject: [PATCH 141/156] why don't the variables work??? --- selfdrive/car/honda/hondacan.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index b1513d0e419982..b28eea05a7f9ea 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -42,34 +42,34 @@ def create_long_command(packer, enabled, longenabled, accel, idx): #set the state flag. This has at least 4 values, depending on what's going on. if longenabled and enabled: - #brake to coast-ish - if (accel <= LO_ACCEL_THRESHOLD): - state_flag = 69 #69 in decimal - gas_command = 0.208 - print "idle/brake ", #going to low accel - elif (accel > LO_ACCEL_THRESHOLD): + if (accel < 0.632 and accel >= -0.11): state_flag = 0 gas_command = accel print "low accel ", #going to mid accel - elif (accel > MID_ACCEL_THRESHOLD): + elif (accel > 0.632 and accel < 1.52): state_flag = 1 #zero out when almost to 9 high bits (max for gas_command). 9bits high would be 0.511 gas_command = (accel - 0.506) print "mid accel ", #going to high accel - elif (accel > HI_ACCEL_THRESHOLD): + elif (accel >= 1.52): state_flag = 2 gas_command = (accel - (0.506 * 2)) print "hi accel ", + #brake to coast-ish + else: + state_flag = 69 #69 in decimal + gas_command = 0.208 + print "idle/brake ", else: state_flag = 69 #69 in decimal gas_command = 0.208 accel = 0 print "disabled ", - print "accel ", accel, "gas_command ", gas_command + print "accel ", accel, "gas_command ", gas_command, "state_flag", state_flag #we dont set set_to_1 on CIVIC_HATCH. values = { From 64cd35e385f1a5f34270a03ed2caa2dd56195d7b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 11 Aug 2018 15:43:54 -0400 Subject: [PATCH 142/156] Revert "why don't the variables work???" This reverts commit 3b89cdd25acf5d8a0c653267afccd94dbf49eea4. --- selfdrive/car/honda/hondacan.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index b28eea05a7f9ea..b1513d0e419982 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -42,34 +42,34 @@ def create_long_command(packer, enabled, longenabled, accel, idx): #set the state flag. This has at least 4 values, depending on what's going on. if longenabled and enabled: + #brake to coast-ish + if (accel <= LO_ACCEL_THRESHOLD): + state_flag = 69 #69 in decimal + gas_command = 0.208 + print "idle/brake ", #going to low accel - if (accel < 0.632 and accel >= -0.11): + elif (accel > LO_ACCEL_THRESHOLD): state_flag = 0 gas_command = accel print "low accel ", #going to mid accel - elif (accel > 0.632 and accel < 1.52): + elif (accel > MID_ACCEL_THRESHOLD): state_flag = 1 #zero out when almost to 9 high bits (max for gas_command). 9bits high would be 0.511 gas_command = (accel - 0.506) print "mid accel ", #going to high accel - elif (accel >= 1.52): + elif (accel > HI_ACCEL_THRESHOLD): state_flag = 2 gas_command = (accel - (0.506 * 2)) print "hi accel ", - #brake to coast-ish - else: - state_flag = 69 #69 in decimal - gas_command = 0.208 - print "idle/brake ", else: state_flag = 69 #69 in decimal gas_command = 0.208 accel = 0 print "disabled ", - print "accel ", accel, "gas_command ", gas_command, "state_flag", state_flag + print "accel ", accel, "gas_command ", gas_command #we dont set set_to_1 on CIVIC_HATCH. values = { From 513d593ee3cfc265d14a607bc146f503416513a7 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sat, 11 Aug 2018 15:44:33 -0400 Subject: [PATCH 143/156] Revert "Revert "why don't the variables work???"" This reverts commit 64cd35e385f1a5f34270a03ed2caa2dd56195d7b. --- selfdrive/car/honda/hondacan.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index b1513d0e419982..b28eea05a7f9ea 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -42,34 +42,34 @@ def create_long_command(packer, enabled, longenabled, accel, idx): #set the state flag. This has at least 4 values, depending on what's going on. if longenabled and enabled: - #brake to coast-ish - if (accel <= LO_ACCEL_THRESHOLD): - state_flag = 69 #69 in decimal - gas_command = 0.208 - print "idle/brake ", #going to low accel - elif (accel > LO_ACCEL_THRESHOLD): + if (accel < 0.632 and accel >= -0.11): state_flag = 0 gas_command = accel print "low accel ", #going to mid accel - elif (accel > MID_ACCEL_THRESHOLD): + elif (accel > 0.632 and accel < 1.52): state_flag = 1 #zero out when almost to 9 high bits (max for gas_command). 9bits high would be 0.511 gas_command = (accel - 0.506) print "mid accel ", #going to high accel - elif (accel > HI_ACCEL_THRESHOLD): + elif (accel >= 1.52): state_flag = 2 gas_command = (accel - (0.506 * 2)) print "hi accel ", + #brake to coast-ish + else: + state_flag = 69 #69 in decimal + gas_command = 0.208 + print "idle/brake ", else: state_flag = 69 #69 in decimal gas_command = 0.208 accel = 0 print "disabled ", - print "accel ", accel, "gas_command ", gas_command + print "accel ", accel, "gas_command ", gas_command, "state_flag", state_flag #we dont set set_to_1 on CIVIC_HATCH. values = { From 95ef57a9f7d4e90e70475c1dc7d9d6ccaa1743c0 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Sun, 12 Aug 2018 22:56:35 -0400 Subject: [PATCH 144/156] need to make radar hud --- selfdrive/car/honda/hondacan.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index b28eea05a7f9ea..6b375d136e87b9 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -66,7 +66,6 @@ def create_long_command(packer, enabled, longenabled, accel, idx): else: state_flag = 69 #69 in decimal gas_command = 0.208 - accel = 0 print "disabled ", print "accel ", accel, "gas_command ", gas_command, "state_flag", state_flag @@ -184,14 +183,20 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, longenabled, vis if car_fingerprint in (CAR.CIVIC, CAR.ODYSSEY): commands.append(packer.make_can_msg('HIGHBEAM_CONTROL', 0, {'HIGHBEAMS_ON': False}, idx)) - + if not visionradar: radar_hud_values = { 'ACC_ALERTS': hud.acc_alert, 'LEAD_SPEED': 0x1fe, # What are these magic values 'LEAD_STATE': 0x7, 'LEAD_DISTANCE': 0x1e, } - commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) + + elif visionradar: + radar_hud_values = { + 'SET_TO_1' : 0x01, + } + + commands.append(packer.make_can_msg('RADAR_HUD', 0, radar_hud_values, idx)) # if True: # commands.append(packer.make_can_msg('HIGHBEAM_CONTROL', 0, {'HIGHBEAMS_ON': False}, idx)) From 52196fcbfd2ac7389788413828f987377abed4f6 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Mon, 13 Aug 2018 16:38:35 -0400 Subject: [PATCH 145/156] bring back 2 checks --- selfdrive/car/honda/carstate.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index b93dbefe29f6af..37307241e59d2d 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -229,9 +229,8 @@ def update(self, cp): self.door_all_closed = not cp.vl["SCM_FEEDBACK"]['DRIVERS_DOOR_OPEN'] else: self.standstill = not cp.vl["STANDSTILL"]['WHEELS_MOVING'] - self.door_all_closed = True - # self.door_all_closed = not any([cp.vl["DOORS_STATUS"]['DOOR_OPEN_FL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_FR'], - # cp.vl["DOORS_STATUS"]['DOOR_OPEN_RL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_RR']]) + self.door_all_closed = not any([cp.vl["DOORS_STATUS"]['DOOR_OPEN_FL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_FR'], + cp.vl["DOORS_STATUS"]['DOOR_OPEN_RL'], cp.vl["DOORS_STATUS"]['DOOR_OPEN_RR']]) self.seatbelt = not cp.vl["SEATBELT_STATUS"]['SEATBELT_DRIVER_LAMP'] and cp.vl["SEATBELT_STATUS"]['SEATBELT_DRIVER_LATCHED'] # 2 = temporary; 3 = TBD; 4 = temporary, hit a bump; 5 = (permanent); 6 = temporary; 7 = (permanent) @@ -239,8 +238,7 @@ def update(self, cp): self.steer_error = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 2, 3, 4, 6] self.steer_not_allowed = cp.vl["STEER_STATUS"]['STEER_STATUS'] != 0 self.steer_warning = cp.vl["STEER_STATUS"]['STEER_STATUS'] not in [0, 3] # 3 is low speed lockout, not worth a warning - #self.brake_error = cp.vl["STANDSTILL"]['BRAKE_ERROR_1'] or cp.vl["STANDSTILL"]['BRAKE_ERROR_2'] - self.brake_error = 0 + self.brake_error = cp.vl["STANDSTILL"]['BRAKE_ERROR_1'] or cp.vl["STANDSTILL"]['BRAKE_ERROR_2'] self.esp_disabled = cp.vl["VSA_STATUS"]['ESP_DISABLED'] # calc best v_ego estimate, by averaging two opposite corners From ac258d24ffa36bc854f6618640295b0c84e73ec6 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Wed, 15 Aug 2018 14:22:22 -0400 Subject: [PATCH 146/156] dont allow gas_command to go negative (is invalid) --- selfdrive/car/honda/hondacan.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 6b375d136e87b9..7099a42b983850 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -42,8 +42,13 @@ def create_long_command(packer, enabled, longenabled, accel, idx): #set the state flag. This has at least 4 values, depending on what's going on. if longenabled and enabled: + #going to idle/coast + if (accel <= 0 and accel >= -0.11): + state_flag = 0 + gas_command = 0.208 + print "idle/coast ", #going to low accel - if (accel < 0.632 and accel >= -0.11): + if (accel < 0.632 and accel > 0): state_flag = 0 gas_command = accel print "low accel ", @@ -58,11 +63,11 @@ def create_long_command(packer, enabled, longenabled, accel, idx): state_flag = 2 gas_command = (accel - (0.506 * 2)) print "hi accel ", - #brake to coast-ish + #going to brake else: state_flag = 69 #69 in decimal gas_command = 0.208 - print "idle/brake ", + print "brake ", else: state_flag = 69 #69 in decimal gas_command = 0.208 From e618de249b7e25974a629531869967d27fcae1ed Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Wed, 15 Aug 2018 14:22:50 -0400 Subject: [PATCH 147/156] set hyst gap and max gas back to prior values --- selfdrive/car/honda/carcontroller.py | 2 +- selfdrive/car/honda/interface.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index a6fa46ba6daeaa..72bd4ce98d2fd9 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -11,7 +11,7 @@ from selfdrive.services import service_list # Accel limits from toyota -ACCEL_HYST_GAP = 0.1 # was 0.02 # don't change accel command for small oscilalitons within this value +ACCEL_HYST_GAP = 0.02 # was 0.02 # don't change accel command for small oscilalitons within this value ACCEL_MAX = 1.5 # 1.5 m/s2 ACCEL_MIN = -3.0 # 3 m/s2 ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 8fcde8dfb8d9dd..7486594d48703c 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -357,7 +357,7 @@ def get_params(candidate, fingerprint): if ret.enableGasInterceptor: ret.gasMaxV = [0.6] elif ret.visionRadar: - ret.gasMaxV = [0.5] + ret.gasMaxV = [0.6] else: ret.gasMaxV = [0] ret.brakeMaxBP = [5., 20.] # m/s From 113f2b39f271968677d33ef15b658e7502d362a3 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Wed, 15 Aug 2018 14:25:11 -0400 Subject: [PATCH 148/156] cant accel when not longenabled --- selfdrive/car/honda/hondacan.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 7099a42b983850..5d559400190976 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -71,6 +71,7 @@ def create_long_command(packer, enabled, longenabled, accel, idx): else: state_flag = 69 #69 in decimal gas_command = 0.208 + accel = 0 print "disabled ", print "accel ", accel, "gas_command ", gas_command, "state_flag", state_flag From 0da0bb1dac26acf77efc0280646c49244617dab6 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Wed, 15 Aug 2018 22:50:09 -0400 Subject: [PATCH 149/156] add newly found braking flag on 1df --- opendbc/generator/honda/_bosch_2018.dbc | 1 + opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc | 1 + selfdrive/car/honda/hondacan.py | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/opendbc/generator/honda/_bosch_2018.dbc b/opendbc/generator/honda/_bosch_2018.dbc index 707fdc3fe06437..9e77ae7850bb1b 100644 --- a/opendbc/generator/honda/_bosch_2018.dbc +++ b/opendbc/generator/honda/_bosch_2018.dbc @@ -122,6 +122,7 @@ BO_ 479 ACC_CONTROL: 8 EON SG_ GAS_BRAKE : 31|14@0- (.001,0) [0|1] "" XXX SG_ GAS_COMMAND : 0|9@0+ (.001,0) [0|1] "" PCM SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX + SG_ BRAKING_FLAG : 62|1@0+ (1,0) [0|1] "" XXX BO_ 495 ACC_CONTROL_ON: 8 XXX SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index 6bb8770f6438b3..9b86f0db254e96 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -126,6 +126,7 @@ BO_ 479 ACC_CONTROL: 8 EON SG_ GAS_BRAKE : 31|14@0- (.001,0) [0|1] "" XXX SG_ GAS_COMMAND : 0|9@0+ (.001,0) [0|1] "" PCM SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX + SG_ BRAKING_FLAG : 62|1@0+ (1,0) [0|1] "" XXX BO_ 495 ACC_CONTROL_ON: 8 XXX SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 5d559400190976..081018d4163a37 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -45,31 +45,37 @@ def create_long_command(packer, enabled, longenabled, accel, idx): #going to idle/coast if (accel <= 0 and accel >= -0.11): state_flag = 0 + braking_flag = 0 gas_command = 0.208 print "idle/coast ", #going to low accel if (accel < 0.632 and accel > 0): state_flag = 0 + braking_flag = 0 gas_command = accel print "low accel ", #going to mid accel elif (accel > 0.632 and accel < 1.52): state_flag = 1 + braking_flag = 0 #zero out when almost to 9 high bits (max for gas_command). 9bits high would be 0.511 gas_command = (accel - 0.506) print "mid accel ", #going to high accel elif (accel >= 1.52): state_flag = 2 + braking_flag = 0 gas_command = (accel - (0.506 * 2)) print "hi accel ", #going to brake else: state_flag = 69 #69 in decimal + braking_flag = 1 gas_command = 0.208 print "brake ", else: state_flag = 69 #69 in decimal + braking_flag = 0 gas_command = 0.208 accel = 0 print "disabled ", @@ -80,6 +86,7 @@ def create_long_command(packer, enabled, longenabled, accel, idx): values = { "GAS_COMMAND": gas_command, "STATE_FLAG": state_flag, + "BRAKING_FLAG": braking_flag, "CONTROL_ON": control_on, "GAS_BRAKE": accel, } From f5da91ca2fecf4a0a1d7245b008b2630f045370b Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Wed, 15 Aug 2018 23:22:46 -0400 Subject: [PATCH 150/156] max to 0.5 until i can fix the trans dropdown jerk --- selfdrive/car/honda/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 72bd4ce98d2fd9..56ecd7b0e3d242 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -12,7 +12,7 @@ # Accel limits from toyota ACCEL_HYST_GAP = 0.02 # was 0.02 # don't change accel command for small oscilalitons within this value -ACCEL_MAX = 1.5 # 1.5 m/s2 +ACCEL_MAX = 0.5 # 1.5 m/s2 ACCEL_MIN = -3.0 # 3 m/s2 ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN) From 0035c27d5710d0d68ac9853085711d6b4b6a86e4 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 16 Aug 2018 09:15:04 -0400 Subject: [PATCH 151/156] bugs and a tad more hyst --- selfdrive/car/honda/carcontroller.py | 2 +- selfdrive/car/honda/hondacan.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 56ecd7b0e3d242..8dbe87d173fb17 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -11,7 +11,7 @@ from selfdrive.services import service_list # Accel limits from toyota -ACCEL_HYST_GAP = 0.02 # was 0.02 # don't change accel command for small oscilalitons within this value +ACCEL_HYST_GAP = 0.05 # was 0.02 # don't change accel command for small oscilalitons within this value ACCEL_MAX = 0.5 # 1.5 m/s2 ACCEL_MIN = -3.0 # 3 m/s2 ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 081018d4163a37..5d873388793be4 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -68,11 +68,16 @@ def create_long_command(packer, enabled, longenabled, accel, idx): gas_command = (accel - (0.506 * 2)) print "hi accel ", #going to brake - else: + elif (accel < -0.11): state_flag = 69 #69 in decimal braking_flag = 1 gas_command = 0.208 print "brake ", + else: + state_flag = 69 #69 in decimal + braking_flag = 0 + gas_command = 0.208 + print "why? ", else: state_flag = 69 #69 in decimal braking_flag = 0 From e9eeca37a755da3271f9137e9143179d0c949df6 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 16 Aug 2018 22:56:51 -0400 Subject: [PATCH 152/156] new braking flag and put hyst back --- opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc | 7 ++++--- selfdrive/car/honda/carcontroller.py | 2 +- selfdrive/car/honda/hondacan.py | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index 9b86f0db254e96..2e49d9e257a654 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -123,10 +123,11 @@ BO_ 479 ACC_CONTROL: 8 EON SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - SG_ GAS_BRAKE : 31|14@0- (.001,0) [0|1] "" XXX - SG_ GAS_COMMAND : 0|9@0+ (.001,0) [0|1] "" PCM SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX - SG_ BRAKING_FLAG : 62|1@0+ (1,0) [0|1] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (0.001,0) [0|1] "" PCM + SG_ GAS_BRAKE : 31|13@0- (0.001,0) [0|1] "" XXX + SG_ BRAKING_1 : 62|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKING_2 : 34|1@0+ (1,0) [0|1] "" XXX BO_ 495 ACC_CONTROL_ON: 8 XXX SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 8dbe87d173fb17..56ecd7b0e3d242 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -11,7 +11,7 @@ from selfdrive.services import service_list # Accel limits from toyota -ACCEL_HYST_GAP = 0.05 # was 0.02 # don't change accel command for small oscilalitons within this value +ACCEL_HYST_GAP = 0.02 # was 0.02 # don't change accel command for small oscilalitons within this value ACCEL_MAX = 0.5 # 1.5 m/s2 ACCEL_MIN = -3.0 # 3 m/s2 ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 5d873388793be4..ea4a0c6ad83e32 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -91,7 +91,8 @@ def create_long_command(packer, enabled, longenabled, accel, idx): values = { "GAS_COMMAND": gas_command, "STATE_FLAG": state_flag, - "BRAKING_FLAG": braking_flag, + "BRAKING_1": braking_flag, + "BRAKING_2": braking_flag, "CONTROL_ON": control_on, "GAS_BRAKE": accel, } From 4e6c18175bf9cf2a33e4455e2f8c03143546dc23 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 16 Aug 2018 22:57:40 -0400 Subject: [PATCH 153/156] update bosch dbc --- opendbc/generator/honda/_bosch_2018.dbc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/opendbc/generator/honda/_bosch_2018.dbc b/opendbc/generator/honda/_bosch_2018.dbc index 9e77ae7850bb1b..f33a077656490c 100644 --- a/opendbc/generator/honda/_bosch_2018.dbc +++ b/opendbc/generator/honda/_bosch_2018.dbc @@ -119,10 +119,11 @@ BO_ 479 ACC_CONTROL: 8 EON SG_ ZEROS_BOH : 33|18@0+ (1,0) [100|100] "" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX - SG_ GAS_BRAKE : 31|14@0- (.001,0) [0|1] "" XXX - SG_ GAS_COMMAND : 0|9@0+ (.001,0) [0|1] "" PCM SG_ STATE_FLAG : 7|7@0+ (1,0) [0|69] "" XXX - SG_ BRAKING_FLAG : 62|1@0+ (1,0) [0|1] "" XXX + SG_ GAS_COMMAND : 0|9@0+ (0.001,0) [0|1] "" PCM + SG_ GAS_BRAKE : 31|13@0- (0.001,0) [0|1] "" XXX + SG_ BRAKING_1 : 62|1@0+ (1,0) [0|1] "" XXX + SG_ BRAKING_2 : 34|1@0+ (1,0) [0|1] "" XXX BO_ 495 ACC_CONTROL_ON: 8 XXX SG_ SET_TO_75 : 31|8@0+ (1,0) [0|255] "" XXX From 8affc198fee74739217c89f3798ea7e228853ecc Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Fri, 17 Aug 2018 00:07:49 -0400 Subject: [PATCH 154/156] pull in dbc edits --- opendbc/generator/honda/_bosch_2018.dbc | 6 +++--- opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/opendbc/generator/honda/_bosch_2018.dbc b/opendbc/generator/honda/_bosch_2018.dbc index f33a077656490c..7db38f7c1e31c0 100644 --- a/opendbc/generator/honda/_bosch_2018.dbc +++ b/opendbc/generator/honda/_bosch_2018.dbc @@ -64,10 +64,10 @@ BO_ 330 STEERING_SENSORS: 8 EPS SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 344 ENGINE_DATA: 8 PCM - SG_ XMISSION_SPEED : 7|16@0+ (0.002759506,0) [0|70] "m/s" EON + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" 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_ DISTANCE_COUNTER : 55|8@0+ (10,0) [0|2550] "Meters" XXX + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON diff --git a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc index 2e49d9e257a654..360491d46cd1ef 100644 --- a/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc +++ b/opendbc/honda_civic_hatchback_ex_2017_can_generated.dbc @@ -68,10 +68,10 @@ BO_ 330 STEERING_SENSORS: 8 EPS SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON BO_ 344 ENGINE_DATA: 8 PCM - SG_ XMISSION_SPEED : 7|16@0+ (0.002759506,0) [0|70] "m/s" EON + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" 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_ DISTANCE_COUNTER : 55|8@0+ (10,0) [0|2550] "Meters" XXX + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ODOMETER : 55|8@0+ (10,0) [0|2550] "m" XXX SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON From fa84acdaa741f7e968a0aaddd90f45bc8ddfd0af Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Mon, 20 Aug 2018 23:38:12 -0400 Subject: [PATCH 155/156] bring back thermal print --- selfdrive/thermald.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/thermald.py b/selfdrive/thermald.py index e13a92bec18822..bf5d4d7c6c91e0 100755 --- a/selfdrive/thermald.py +++ b/selfdrive/thermald.py @@ -257,7 +257,7 @@ def thermald_thread(): msg.thermal.thermalStatus = thermal_status thermal_sock.send(msg.to_bytes()) - #print msg + print msg # report to server once per minute if (count%60) == 0: From 826df69ce003be5d2057c9166f5a8f56a419a7ea Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Wed, 22 Aug 2018 15:14:31 -0400 Subject: [PATCH 156/156] max accel set back --- selfdrive/car/honda/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 56ecd7b0e3d242..72bd4ce98d2fd9 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -12,7 +12,7 @@ # Accel limits from toyota ACCEL_HYST_GAP = 0.02 # was 0.02 # don't change accel command for small oscilalitons within this value -ACCEL_MAX = 0.5 # 1.5 m/s2 +ACCEL_MAX = 1.5 # 1.5 m/s2 ACCEL_MIN = -3.0 # 3 m/s2 ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN)