Remove get_one_can from messaging (#1946)

* move get_one_can into openpilot

* bump cereal
old-commit-hash: 714f8c3f0b
commatwo_master
Adeeb Shihadeh 5 years ago committed by GitHub
parent fefe79bedb
commit 224b7fd34b
  1. 2
      cereal
  2. 9
      selfdrive/car/car_helpers.py
  3. 4
      selfdrive/controls/controlsd.py
  4. 4
      tools/carcontrols/debug_controls.py

@ -1 +1 @@
Subproject commit 29099e87a1372694fb81b426faaa57e832bbe87a Subproject commit 430cc73a3b7c31de902bd0a62fbac7cd3a05cf3e

@ -27,6 +27,13 @@ def get_startup_event(car_recognized, controller_available):
return event return event
def get_one_can(logcan):
while True:
can = messaging.recv_one_retry(logcan)
if len(can.can) > 0:
return can
def load_interfaces(brand_names): def load_interfaces(brand_names):
ret = {} ret = {}
for brand_name in brand_names: for brand_name in brand_names:
@ -114,7 +121,7 @@ def fingerprint(logcan, sendcan, has_relay):
done = False done = False
while not done: while not done:
a = messaging.get_one_can(logcan) a = get_one_can(logcan)
for can in a.can: for can in a.can:
# need to independently try to fingerprint both bus 0 and 1 to work # need to independently try to fingerprint both bus 0 and 1 to work

@ -10,7 +10,7 @@ from common.params import Params, put_nonblocking
import cereal.messaging as messaging import cereal.messaging as messaging
from selfdrive.config import Conversions as CV from selfdrive.config import Conversions as CV
from selfdrive.boardd.boardd import can_list_to_can_capnp from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.car.car_helpers import get_car, get_startup_event from selfdrive.car.car_helpers import get_car, get_startup_event, get_one_can
from selfdrive.controls.lib.lane_planner import CAMERA_OFFSET from selfdrive.controls.lib.lane_planner import CAMERA_OFFSET
from selfdrive.controls.lib.drive_helpers import update_v_cruise, initialize_v_cruise from selfdrive.controls.lib.drive_helpers import update_v_cruise, initialize_v_cruise
from selfdrive.controls.lib.longcontrol import LongControl, STARTING_TARGET_SPEED from selfdrive.controls.lib.longcontrol import LongControl, STARTING_TARGET_SPEED
@ -64,7 +64,7 @@ class Controls:
hw_type = messaging.recv_one(self.sm.sock['health']).health.hwType hw_type = messaging.recv_one(self.sm.sock['health']).health.hwType
has_relay = hw_type in [HwType.blackPanda, HwType.uno, HwType.dos] has_relay = hw_type in [HwType.blackPanda, HwType.uno, HwType.dos]
print("Waiting for CAN messages...") print("Waiting for CAN messages...")
messaging.get_one_can(self.can_sock) get_one_can(self.can_sock)
self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], has_relay) self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], has_relay)

@ -4,7 +4,7 @@ from common.params import Params
from copy import copy from copy import copy
from cereal import car, log from cereal import car, log
import cereal.messaging as messaging import cereal.messaging as messaging
from selfdrive.car.car_helpers import get_car from selfdrive.car.car_helpers import get_car, get_one_can
from selfdrive.boardd.boardd import can_list_to_can_capnp from selfdrive.boardd.boardd import can_list_to_can_capnp
HwType = log.HealthData.HwType HwType = log.HealthData.HwType
@ -28,7 +28,7 @@ def steer_thread():
hw_type = messaging.recv_one(health).health.hwType hw_type = messaging.recv_one(health).health.hwType
has_relay = hw_type in [HwType.blackPanda, HwType.uno, HwType.dos] has_relay = hw_type in [HwType.blackPanda, HwType.uno, HwType.dos]
print("Waiting for CAN messages...") print("Waiting for CAN messages...")
messaging.get_one_can(logcan) get_one_can(logcan)
CI, CP = get_car(logcan, sendcan, has_relay) CI, CP = get_car(logcan, sendcan, has_relay)
Params().put("CarParams", CP.to_bytes()) Params().put("CarParams", CP.to_bytes())

Loading…
Cancel
Save