diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml
index 5bd9acc200..fedeaa734b 100644
--- a/.github/workflows/selfdrive_tests.yaml
+++ b/.github/workflows/selfdrive_tests.yaml
@@ -310,7 +310,7 @@ jobs:
./selfdrive/loggerd/tests/test_logger &&\
./system/proclogd/tests/test_proclog && \
./selfdrive/ui/replay/tests/test_replay && \
- ./selfdrive/camerad/test/ae_gray_test && \
+ ./system/camerad/test/ae_gray_test && \
coverage xml"
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v2
diff --git a/Jenkinsfile b/Jenkinsfile
index ebc26a5920..dba1f257d6 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -88,8 +88,8 @@ pipeline {
steps {
sh "git config --global --add safe.directory ${WORKSPACE}"
sh "git lfs pull"
- sh "${WORKSPACE}/tools/sim/build_container.sh"
lock(resource: "", label: "simulator", inversePrecedence: true, quantity: 1) {
+ sh "${WORKSPACE}/tools/sim/build_container.sh"
sh "DETACH=1 ${WORKSPACE}/tools/sim/start_carla.sh"
sh "${WORKSPACE}/tools/sim/start_openpilot_docker.sh"
}
@@ -139,8 +139,8 @@ pipeline {
steps {
phone_steps("tici-party", [
["build", "cd selfdrive/manager && ./build.py"],
- ["test camerad", "python selfdrive/camerad/test/test_camerad.py"],
- ["test exposure", "python selfdrive/camerad/test/test_exposure.py"],
+ ["test camerad", "python system/camerad/test/test_camerad.py"],
+ ["test exposure", "python system/camerad/test/test_exposure.py"],
])
}
}
diff --git a/RELEASES.md b/RELEASES.md
index 7f365e5cef..5d81b43085 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -13,6 +13,7 @@ Version 0.8.15 (2022-XX-XX)
* Display speed limit while navigating
* Reduced power usage: device runs cooler and fan spins less
* AGNOS 5
+* Honda Civic 2022 support
* Hyundai Tucson 2021 support thanks to bluesforte!
* Lexus NX Hybrid 2020 support thanks to AlexandreSato!
diff --git a/SConstruct b/SConstruct
index b5c4edc99b..b243a4dc45 100644
--- a/SConstruct
+++ b/SConstruct
@@ -94,7 +94,7 @@ if arch == "larch64":
"/usr/lib/aarch64-linux-gnu"
]
cpppath += [
- "#selfdrive/camerad/include",
+ "#system/camerad/include",
]
cflags = ["-DQCOM2", "-mcpu=cortex-a57"]
cxxflags = ["-DQCOM2", "-mcpu=cortex-a57"]
@@ -379,6 +379,7 @@ SConscript(['rednose/SConscript'])
# Build system services
SConscript([
+ 'system/camerad/SConscript',
'system/clocksd/SConscript',
'system/proclogd/SConscript',
])
@@ -396,7 +397,6 @@ SConscript(['third_party/SConscript'])
SConscript(['common/kalman/SConscript'])
SConscript(['common/transformations/SConscript'])
-SConscript(['selfdrive/camerad/SConscript'])
SConscript(['selfdrive/modeld/SConscript'])
SConscript(['selfdrive/controls/lib/cluster/SConscript'])
diff --git a/docs/CARS.md b/docs/CARS.md
index f1ed8ec17c..c175d4e7a3 100644
--- a/docs/CARS.md
+++ b/docs/CARS.md
@@ -149,7 +149,7 @@ How We Rate The Cars
|Volkswagen|Taos 2022[8](#footnotes)|Driver Assistance|
|
|
|
|
|
|Volkswagen|Touran 2017|Driver Assistance|
|
|
|
|
|
-# Bronze - 71 cars
+# Bronze - 72 cars
|Make|Model|Supported Package|openpilot ACC|Stop and Go|Steer to 0|Steering Torque|Actively Maintained|
|---|---|---|:---:|:---:|:---:|:---:|:---:|
@@ -163,13 +163,14 @@ How We Rate The Cars
|Chrysler|Pacifica 2017-18|Adaptive Cruise|
|
|
|
|
|
|Chrysler|Pacifica 2020|Adaptive Cruise|
|
|
|
|
|
|Chrysler|Pacifica Hybrid 2017-18|Adaptive Cruise|
|
|
|
|
|
-|Chrysler|Pacifica Hybrid 2019-21|Adaptive Cruise|
|
|
|
|
|
+|Chrysler|Pacifica Hybrid 2019-22|Adaptive Cruise|
|
|
|
|
|
|Genesis|G90 2018|All|
|
|
|
|
|
|GMC|Acadia 2018[1](#footnotes)|Adaptive Cruise|
|
|
|
|
|
|Honda|Accord 2018-21|All|
|
|
|
|
|
|Honda|Accord Hybrid 2018-21|All|
|
|
|
|
|
|Honda|Civic 2016-18|Honda Sensing|
|
|
|
|
|
|Honda|Civic 2019-20|All|
|
|
[3](#footnotes)|
|
|
+|Honda|Civic 2022|All|
|
|
|
|
|
|Honda|Civic Hatchback 2017-21|Honda Sensing|
|
|
|
|
|
|Honda|CR-V 2015-16|Touring|
|
|
|
|
|
|Honda|CR-V 2017-21|Honda Sensing|
|
|
|
|
|
diff --git a/docs/c_docs.rst b/docs/c_docs.rst
index 218cd5a7d9..4e1e8a247a 100644
--- a/docs/c_docs.rst
+++ b/docs/c_docs.rst
@@ -28,11 +28,11 @@ selfdrive
camerad
^^^^^^^
.. autodoxygenindex::
- :project: selfdrive_camerad_cameras
+ :project: system_camerad_cameras
.. autodoxygenindex::
- :project: selfdrive_camerad_transforms
+ :project: system_camerad_transforms
.. autodoxygenindex::
- :project: selfdrive_camerad_imgproc
+ :project: system_camerad_imgproc
locationd
^^^^^^^^^
diff --git a/release/files_common b/release/files_common
index b6cd4fa797..ecb71b4e69 100644
--- a/release/files_common
+++ b/release/files_common
@@ -182,6 +182,7 @@ selfdrive/controls/lib/longitudinal_mpc_lib/.gitignore
selfdrive/controls/lib/lateral_mpc_lib/*
selfdrive/controls/lib/longitudinal_mpc_lib/*
+selfdrive/hardware
system/hardware/__init__.py
system/hardware/base.h
system/hardware/base.py
@@ -298,24 +299,24 @@ selfdrive/ui/replay/*.h
selfdrive/ui/qt/maps/*.cc
selfdrive/ui/qt/maps/*.h
-selfdrive/camerad/SConscript
-selfdrive/camerad/main.cc
+system/camerad/SConscript
+system/camerad/main.cc
-selfdrive/camerad/snapshot/*
-selfdrive/camerad/include/*
-selfdrive/camerad/cameras/camera_common.h
-selfdrive/camerad/cameras/camera_common.cc
-selfdrive/camerad/cameras/sensor2_i2c.h
+system/camerad/snapshot/*
+system/camerad/include/*
+system/camerad/cameras/camera_common.h
+system/camerad/cameras/camera_common.cc
+system/camerad/cameras/sensor2_i2c.h
-selfdrive/camerad/transforms/rgb_to_yuv.cc
-selfdrive/camerad/transforms/rgb_to_yuv.h
-selfdrive/camerad/transforms/rgb_to_yuv.cl
-selfdrive/camerad/transforms/rgb_to_yuv_test.cc
+system/camerad/transforms/rgb_to_yuv.cc
+system/camerad/transforms/rgb_to_yuv.h
+system/camerad/transforms/rgb_to_yuv.cl
+system/camerad/transforms/rgb_to_yuv_test.cc
-selfdrive/camerad/imgproc/conv.cl
-selfdrive/camerad/imgproc/pool.cl
-selfdrive/camerad/imgproc/utils.cc
-selfdrive/camerad/imgproc/utils.h
+system/camerad/imgproc/conv.cl
+system/camerad/imgproc/pool.cl
+system/camerad/imgproc/utils.cc
+system/camerad/imgproc/utils.h
selfdrive/manager/__init__.py
selfdrive/manager/build.py
@@ -495,6 +496,7 @@ opendbc/honda_odyssey_exl_2018_generated.dbc
opendbc/honda_odyssey_extreme_edition_2018_china_can_generated.dbc
opendbc/honda_insight_ex_2019_can_generated.dbc
opendbc/acura_ilx_2016_nidec.dbc
+opendbc/honda_civic_ex_2022_can_generated.dbc
opendbc/kia_ev6.dbc
opendbc/hyundai_kia_generic.dbc
diff --git a/release/files_tici b/release/files_tici
index 485a898799..f8c0a27959 100644
--- a/release/files_tici
+++ b/release/files_tici
@@ -7,9 +7,9 @@ system/timezoned.py
selfdrive/assets/navigation/*
selfdrive/assets/training_wide/*
-selfdrive/camerad/cameras/camera_qcom2.cc
-selfdrive/camerad/cameras/camera_qcom2.h
-selfdrive/camerad/cameras/real_debayer.cl
+system/camerad/cameras/camera_qcom2.cc
+system/camerad/cameras/camera_qcom2.h
+system/camerad/cameras/real_debayer.cl
selfdrive/ui/qt/spinner_larch64
selfdrive/ui/qt/text_larch64
diff --git a/selfdrive/athena/athenad.py b/selfdrive/athena/athenad.py
index 26220dfa99..b0e138c495 100755
--- a/selfdrive/athena/athenad.py
+++ b/selfdrive/athena/athenad.py
@@ -493,7 +493,7 @@ def getNetworks():
@dispatcher.add_method
def takeSnapshot():
- from selfdrive.camerad.snapshot.snapshot import jpeg_write, snapshot
+ from system.camerad.snapshot.snapshot import jpeg_write, snapshot
ret = snapshot()
if ret is not None:
def b64jpeg(x):
diff --git a/selfdrive/car/chrysler/values.py b/selfdrive/car/chrysler/values.py
index a0d4225d9a..bdd80757f4 100644
--- a/selfdrive/car/chrysler/values.py
+++ b/selfdrive/car/chrysler/values.py
@@ -37,7 +37,7 @@ class ChryslerCarInfo(CarInfo):
CAR_INFO: Dict[str, Optional[Union[ChryslerCarInfo, List[ChryslerCarInfo]]]] = {
CAR.PACIFICA_2017_HYBRID: ChryslerCarInfo("Chrysler Pacifica Hybrid 2017-18"),
CAR.PACIFICA_2018_HYBRID: None, # same platforms
- CAR.PACIFICA_2019_HYBRID: ChryslerCarInfo("Chrysler Pacifica Hybrid 2019-21"),
+ CAR.PACIFICA_2019_HYBRID: ChryslerCarInfo("Chrysler Pacifica Hybrid 2019-22"),
CAR.PACIFICA_2018: ChryslerCarInfo("Chrysler Pacifica 2017-18"),
CAR.PACIFICA_2020: ChryslerCarInfo("Chrysler Pacifica 2020"),
CAR.JEEP_CHEROKEE: ChryslerCarInfo("Jeep Grand Cherokee 2016-18", video_link="https://www.youtube.com/watch?v=eLR9o2JkuRk"),
diff --git a/selfdrive/car/docs_definitions.py b/selfdrive/car/docs_definitions.py
index 9e013d70ac..5b6eb1664d 100644
--- a/selfdrive/car/docs_definitions.py
+++ b/selfdrive/car/docs_definitions.py
@@ -123,7 +123,8 @@ class CarInfo:
class Harness(Enum):
nidec = "Honda Nidec"
- bosch = "Honda Bosch A"
+ bosch_a = "Honda Bosch A"
+ bosch_b = "Honda Bosch B"
toyota = "Toyota"
subaru = "Subaru"
fca = "FCA"
diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py
index a6aa84adf6..4d04927b2f 100644
--- a/selfdrive/car/honda/carcontroller.py
+++ b/selfdrive/car/honda/carcontroller.py
@@ -7,7 +7,7 @@ from common.realtime import DT_CTRL
from opendbc.can.packer import CANPacker
from selfdrive.car import create_gas_interceptor_command
from selfdrive.car.honda import hondacan
-from selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, HONDA_NIDEC_ALT_PCM_ACCEL, CarControllerParams
+from selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, HONDA_NIDEC_ALT_PCM_ACCEL, CarControllerParams
from selfdrive.controls.lib.drive_helpers import rate_limit
VisualAlert = car.CarControl.HUDControl.VisualAlert
@@ -189,7 +189,7 @@ class CarController:
pcm_accel = int(clip((accel / 1.44) / max_accel, 0.0, 1.0) * 0xc6)
if not self.CP.openpilotLongitudinalControl:
- if self.frame % 2 == 0:
+ if self.frame % 2 == 0 and self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS: # radarless cars don't have supplemental message
idx = self.frame // 2
can_sends.append(hondacan.create_bosch_supplemental_1(self.packer, self.CP.carFingerprint, idx))
# If using stock ACC, spam cancel command to kill gas when OP disengages.
@@ -241,7 +241,7 @@ class CarController:
idx = (self.frame // 10) % 4
hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), hud_control.leadVisible,
hud_control.lanesVisible, fcw_display, acc_alert, steer_required)
- can_sends.extend(hondacan.create_ui_commands(self.packer, self.CP, CC.enabled, pcm_speed, hud, CS.is_metric, idx, CS.stock_hud))
+ can_sends.extend(hondacan.create_ui_commands(self.packer, self.CP, CC.enabled, pcm_speed, hud, CS.is_metric, idx, CS.stock_hud, self.frame))
if self.CP.openpilotLongitudinalControl and self.CP.carFingerprint not in HONDA_BOSCH:
self.speed = pcm_speed
diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py
index f5cdc838c4..5358ce249a 100644
--- a/selfdrive/car/honda/carstate.py
+++ b/selfdrive/car/honda/carstate.py
@@ -5,8 +5,9 @@ from common.conversions import Conversions as CV
from common.numpy_fast import interp
from opendbc.can.can_define import CANDefine
from opendbc.can.parser import CANParser
+from selfdrive.car.honda.hondacan import get_pt_bus
+from selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_ALT_BRAKE_SIGNAL, HONDA_BOSCH_RADARLESS
from selfdrive.car.interfaces import CarStateBase
-from selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_ALT_BRAKE_SIGNAL
TransmissionType = car.CarParams.TransmissionType
@@ -80,7 +81,8 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg):
checks.append(("EPB_STATUS", 50))
if CP.carFingerprint in HONDA_BOSCH:
- if not CP.openpilotLongitudinalControl:
+ # these messages are on camera bus on radarless cars
+ if not CP.openpilotLongitudinalControl and CP.carFingerprint not in HONDA_BOSCH_RADARLESS:
signals += [
("CRUISE_CONTROL_LABEL", "ACC_HUD"),
("CRUISE_SPEED", "ACC_HUD"),
@@ -100,23 +102,16 @@ def get_can_signals(CP, gearbox_msg, main_on_sig_msg):
else:
checks.append(("CRUISE_PARAMS", 50))
- if CP.carFingerprint in (CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E):
+ if CP.carFingerprint in (CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.CIVIC_2022):
signals.append(("DRIVERS_DOOR_OPEN", "SCM_FEEDBACK"))
- elif CP.carFingerprint == CAR.ODYSSEY_CHN:
+ elif CP.carFingerprint in (CAR.ODYSSEY_CHN, CAR.FREED, CAR.HRV):
signals.append(("DRIVERS_DOOR_OPEN", "SCM_BUTTONS"))
- elif CP.carFingerprint in (CAR.FREED, CAR.HRV):
- signals += [("DRIVERS_DOOR_OPEN", "SCM_BUTTONS"),
- ("WHEELS_MOVING", "STANDSTILL")]
else:
signals += [("DOOR_OPEN_FL", "DOORS_STATUS"),
("DOOR_OPEN_FR", "DOORS_STATUS"),
("DOOR_OPEN_RL", "DOORS_STATUS"),
- ("DOOR_OPEN_RR", "DOORS_STATUS"),
- ("WHEELS_MOVING", "STANDSTILL")]
- checks += [
- ("DOORS_STATUS", 3),
- ("STANDSTILL", 50),
- ]
+ ("DOOR_OPEN_RR", "DOORS_STATUS")]
+ checks.append(("DOORS_STATUS", 3))
# add gas interceptor reading if we are using it
if CP.enableGasInterceptor:
@@ -175,7 +170,8 @@ class CarState(CarStateBase):
# STANDSTILL->WHEELS_MOVING bit can be noisy around zero, so use XMISSION_SPEED
# panda checks if the signal is non-zero
ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 1e-5
- if self.CP.carFingerprint in (CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E):
+ # TODO: find a common signal across all cars
+ if self.CP.carFingerprint in (CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.CIVIC_2022):
ret.doorOpen = bool(cp.vl["SCM_FEEDBACK"]["DRIVERS_DOOR_OPEN"])
elif self.CP.carFingerprint in (CAR.ODYSSEY_CHN, CAR.FREED, CAR.HRV):
ret.doorOpen = bool(cp.vl["SCM_BUTTONS"]["DRIVERS_DOOR_OPEN"])
@@ -235,11 +231,15 @@ class CarState(CarStateBase):
if self.CP.carFingerprint in HONDA_BOSCH:
if not self.CP.openpilotLongitudinalControl:
- ret.cruiseState.nonAdaptive = cp.vl["ACC_HUD"]["CRUISE_CONTROL_LABEL"] != 0
- ret.cruiseState.standstill = cp.vl["ACC_HUD"]["CRUISE_SPEED"] == 252.
+ # ACC_HUD is on camera bus on radarless cars
+ acc_hud = cp_cam.vl["ACC_HUD"] if self.CP.carFingerprint in HONDA_BOSCH_RADARLESS else cp.vl["ACC_HUD"]
+ ret.cruiseState.nonAdaptive = acc_hud["CRUISE_CONTROL_LABEL"] != 0
+ ret.cruiseState.standstill = acc_hud["CRUISE_SPEED"] == 252.
+ # on certain cars, CRUISE_SPEED changes to imperial with car's unit setting
+ conversion_factor = CV.MPH_TO_MS if self.CP.carFingerprint in HONDA_BOSCH_RADARLESS and not self.is_metric else CV.KPH_TO_MS
# On set, cruise set speed pulses between 254~255 and the set speed prev is set to avoid this.
- ret.cruiseState.speed = self.v_cruise_pcm_prev if cp.vl["ACC_HUD"]["CRUISE_SPEED"] > 160.0 else cp.vl["ACC_HUD"]["CRUISE_SPEED"] * CV.KPH_TO_MS
+ ret.cruiseState.speed = self.v_cruise_pcm_prev if acc_hud["CRUISE_SPEED"] > 160.0 else acc_hud["CRUISE_SPEED"] * conversion_factor
self.v_cruise_pcm_prev = ret.cruiseState.speed
else:
ret.cruiseState.speed = cp.vl["CRUISE"]["CRUISE_SPEED_PCM"] * CV.KPH_TO_MS
@@ -269,14 +269,14 @@ class CarState(CarStateBase):
ret.brakePressed = True
if self.CP.carFingerprint in HONDA_BOSCH:
- ret.stockAeb = (not self.CP.openpilotLongitudinalControl) and bool(cp.vl["ACC_CONTROL"]["AEB_STATUS"] and cp.vl["ACC_CONTROL"]["ACCEL_COMMAND"] < -1e-5)
+ # TODO: find the radarless AEB_STATUS bit and make sure ACCEL_COMMAND is correct to enable AEB alerts
+ if self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS:
+ ret.stockAeb = (not self.CP.openpilotLongitudinalControl) and bool(cp.vl["ACC_CONTROL"]["AEB_STATUS"] and cp.vl["ACC_CONTROL"]["ACCEL_COMMAND"] < -1e-5)
else:
ret.stockAeb = bool(cp_cam.vl["BRAKE_COMMAND"]["AEB_REQ_1"] and cp_cam.vl["BRAKE_COMMAND"]["COMPUTER_BRAKE"] > 1e-5)
- if self.CP.carFingerprint in HONDA_BOSCH:
- self.stock_hud = False
- ret.stockFcw = False
- else:
+ self.stock_hud = False
+ if self.CP.carFingerprint not in HONDA_BOSCH:
ret.stockFcw = cp_cam.vl["BRAKE_COMMAND"]["FCW"] != 0
self.stock_hud = cp_cam.vl["ACC_HUD"]
self.stock_brake = cp_cam.vl["BRAKE_COMMAND"]
@@ -291,8 +291,7 @@ class CarState(CarStateBase):
def get_can_parser(self, CP):
signals, checks = get_can_signals(CP, self.gearbox_msg, self.main_on_sig_msg)
- bus_pt = 1 if CP.carFingerprint in HONDA_BOSCH else 0
- return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus_pt)
+ return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, get_pt_bus(CP.carFingerprint))
@staticmethod
def get_cam_can_parser(CP):
@@ -301,7 +300,14 @@ class CarState(CarStateBase):
("STEERING_CONTROL", 100),
]
- if CP.carFingerprint not in HONDA_BOSCH:
+ if CP.carFingerprint in HONDA_BOSCH_RADARLESS and not CP.openpilotLongitudinalControl:
+ signals += [
+ ("CRUISE_SPEED", "ACC_HUD"),
+ ("CRUISE_CONTROL_LABEL", "ACC_HUD"),
+ ]
+ checks.append(("ACC_HUD", 10))
+
+ elif CP.carFingerprint not in HONDA_BOSCH:
signals += [("COMPUTER_BRAKE", "BRAKE_COMMAND"),
("AEB_REQ_1", "BRAKE_COMMAND"),
("FCW", "BRAKE_COMMAND"),
diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py
index 3d8c79c809..6a1fb2e459 100644
--- a/selfdrive/car/honda/hondacan.py
+++ b/selfdrive/car/honda/hondacan.py
@@ -1,5 +1,5 @@
from common.conversions import Conversions as CV
-from selfdrive.car.honda.values import HondaFlags, HONDA_BOSCH, CAR, CarControllerParams
+from selfdrive.car.honda.values import HondaFlags, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, CAR, CarControllerParams
# CAN bus layout with relay
# 0 = ACC-CAN - radar side
@@ -7,8 +7,9 @@ from selfdrive.car.honda.values import HondaFlags, HONDA_BOSCH, CAR, CarControll
# 2 = ACC-CAN - camera side
# 3 = F-CAN A - OBDII port
+
def get_pt_bus(car_fingerprint):
- return 1 if car_fingerprint in HONDA_BOSCH else 0
+ return 1 if car_fingerprint in (HONDA_BOSCH - HONDA_BOSCH_RADARLESS) else 0
def get_lkas_cmd_bus(car_fingerprint, radar_disabled=False):
@@ -18,6 +19,7 @@ def get_lkas_cmd_bus(car_fingerprint, radar_disabled=False):
# normally steering commands are sent to radar, which forwards them to powertrain bus
return 0
+
def create_brake_command(packer, apply_brake, pump_on, pcm_override, pcm_cancel_cmd, fcw, idx, car_fingerprint, stock_brake):
# TODO: do we loose pressure if we keep pump off for long?
brakelights = apply_brake > 0
@@ -78,6 +80,7 @@ def create_acc_commands(packer, enabled, active, accel, gas, idx, stopping, car_
return commands
+
def create_steering_control(packer, apply_steer, lkas_active, car_fingerprint, idx, radar_disabled):
values = {
"STEER_TORQUE": apply_steer if lkas_active else 0,
@@ -98,7 +101,7 @@ def create_bosch_supplemental_1(packer, car_fingerprint, idx):
return packer.make_can_msg("BOSCH_SUPPLEMENTAL_1", bus, values, idx)
-def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, idx, stock_hud):
+def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, idx, stock_hud, frame):
commands = []
bus_pt = get_pt_bus(CP.carFingerprint)
radar_disabled = CP.carFingerprint in HONDA_BOSCH and CP.openpilotLongitudinalControl
@@ -135,6 +138,12 @@ def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, idx, stoc
'BEEP': 0,
}
+ if CP.carFingerprint in HONDA_BOSCH_RADARLESS:
+ lkas_hud_values['LANE_LINES'] = 3
+ lkas_hud_values['DASHED_LANES'] = hud.lanes_visible
+ # TODO: understand this better, does car need to see it fall after start up?
+ lkas_hud_values['LKAS_PROBLEM'] = 0 if frame > 200 else 1
+
if not (CP.flags & HondaFlags.BOSCH_EXT_HUD):
lkas_hud_values['SET_ME_X48'] = 0x48
@@ -162,5 +171,6 @@ def spam_buttons_command(packer, button_val, idx, car_fingerprint):
'CRUISE_BUTTONS': button_val,
'CRUISE_SETTING': 0,
}
- bus = get_pt_bus(car_fingerprint)
+ # send buttons to camera on radarless cars
+ bus = 2 if car_fingerprint in HONDA_BOSCH_RADARLESS else get_pt_bus(car_fingerprint)
return packer.make_can_msg("SCM_BUTTONS", bus, values, idx)
diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py
index 994152608e..a78189b697 100755
--- a/selfdrive/car/honda/interface.py
+++ b/selfdrive/car/honda/interface.py
@@ -3,7 +3,7 @@ from cereal import car
from panda import Panda
from common.conversions import Conversions as CV
from common.numpy_fast import interp
-from selfdrive.car.honda.values import CarControllerParams, CruiseButtons, HondaFlags, CAR, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_ALT_BRAKE_SIGNAL
+from selfdrive.car.honda.values import CarControllerParams, CruiseButtons, HondaFlags, CAR, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_ALT_BRAKE_SIGNAL, HONDA_BOSCH_RADARLESS
from selfdrive.car import STD_CARGO_KG, CivicParams, create_button_enable_events, create_button_event, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config
from selfdrive.car.interfaces import CarInterfaceBase
from selfdrive.car.disable_ecu import disable_ecu
@@ -37,9 +37,10 @@ class CarInterface(CarInterfaceBase):
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hondaBosch)]
ret.radarOffCan = True
- # Disable the radar and let openpilot control longitudinal
- # WARNING: THIS DISABLES AEB!
- ret.openpilotLongitudinalControl = disable_radar
+ if candidate not in HONDA_BOSCH_RADARLESS:
+ # Disable the radar and let openpilot control longitudinal
+ # WARNING: THIS DISABLES AEB!
+ ret.openpilotLongitudinalControl = disable_radar
ret.pcmCruise = not ret.openpilotLongitudinalControl
else:
@@ -104,7 +105,7 @@ class CarInterface(CarInterfaceBase):
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]]
tire_stiffness_factor = 1.
- elif candidate in (CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL):
+ elif candidate in (CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CIVIC_2022):
stop_and_go = True
ret.mass = CivicParams.MASS
ret.wheelbase = CivicParams.WHEELBASE
@@ -304,6 +305,9 @@ class CarInterface(CarInterfaceBase):
if ret.openpilotLongitudinalControl and candidate in HONDA_BOSCH:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_BOSCH_LONG
+ if candidate in HONDA_BOSCH_RADARLESS:
+ ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_RADARLESS
+
# min speed to enable ACC. if car can do stop and go, then set enabling speed
# to a negative value, so it won't matter. Otherwise, add 0.5 mph margin to not
# conflict with PCM acc
@@ -325,7 +329,7 @@ class CarInterface(CarInterfaceBase):
@staticmethod
def init(CP, logcan, sendcan):
- if CP.carFingerprint in HONDA_BOSCH and CP.openpilotLongitudinalControl:
+ if CP.carFingerprint in (HONDA_BOSCH - HONDA_BOSCH_RADARLESS) and CP.openpilotLongitudinalControl:
disable_ecu(logcan, sendcan, bus=1, addr=0x18DAB0F1, com_cont_req=b'\x28\x83\x03')
# returns a car.CarState
diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py
index 152f71e98a..0bdb8ccd91 100644
--- a/selfdrive/car/honda/values.py
+++ b/selfdrive/car/honda/values.py
@@ -75,6 +75,7 @@ class CAR:
CIVIC = "HONDA CIVIC 2016"
CIVIC_BOSCH = "HONDA CIVIC (BOSCH) 2019"
CIVIC_BOSCH_DIESEL = "HONDA CIVIC SEDAN 1.6 DIESEL 2019"
+ CIVIC_2022 = "HONDA CIVIC 2022"
ACURA_ILX = "ACURA ILX 2016"
CRV = "HONDA CR-V 2016"
CRV_5G = "HONDA CR-V 2017"
@@ -108,33 +109,34 @@ class HondaCarInfo(CarInfo):
CAR_INFO: Dict[str, Optional[Union[HondaCarInfo, List[HondaCarInfo]]]] = {
CAR.ACCORD: [
- HondaCarInfo("Honda Accord 2018-21", "All", video_link="https://www.youtube.com/watch?v=mrUwlj3Mi58", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch),
- HondaCarInfo("Honda Inspire 2018", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch),
+ HondaCarInfo("Honda Accord 2018-21", "All", video_link="https://www.youtube.com/watch?v=mrUwlj3Mi58", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch_a),
+ HondaCarInfo("Honda Inspire 2018", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch_a),
],
- CAR.ACCORDH: HondaCarInfo("Honda Accord Hybrid 2018-21", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch),
+ CAR.ACCORDH: HondaCarInfo("Honda Accord Hybrid 2018-21", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch_a),
CAR.CIVIC: HondaCarInfo("Honda Civic 2016-18", harness=Harness.nidec),
CAR.CIVIC_BOSCH: [
- HondaCarInfo("Honda Civic 2019-20", "All", video_link="https://www.youtube.com/watch?v=4Iz1Mz5LGF8", footnotes=[Footnote.CIVIC_DIESEL], min_steer_speed=2. * CV.MPH_TO_MS, harness=Harness.bosch),
- HondaCarInfo("Honda Civic Hatchback 2017-21", harness=Harness.bosch),
+ HondaCarInfo("Honda Civic 2019-20", "All", video_link="https://www.youtube.com/watch?v=4Iz1Mz5LGF8", footnotes=[Footnote.CIVIC_DIESEL], min_steer_speed=2. * CV.MPH_TO_MS, harness=Harness.bosch_a),
+ HondaCarInfo("Honda Civic Hatchback 2017-21", harness=Harness.bosch_a),
],
CAR.CIVIC_BOSCH_DIESEL: None, # same platform
+ CAR.CIVIC_2022: HondaCarInfo("Honda Civic 2022", "All", min_steer_speed=0., harness=Harness.bosch_b),
CAR.ACURA_ILX: HondaCarInfo("Acura ILX 2016-19", "AcuraWatch Plus", min_steer_speed=25. * CV.MPH_TO_MS, harness=Harness.nidec),
CAR.CRV: HondaCarInfo("Honda CR-V 2015-16", "Touring", harness=Harness.nidec),
- CAR.CRV_5G: HondaCarInfo("Honda CR-V 2017-21", harness=Harness.bosch),
+ CAR.CRV_5G: HondaCarInfo("Honda CR-V 2017-21", harness=Harness.bosch_a),
CAR.CRV_EU: None, # HondaCarInfo("Honda CR-V EU", "Touring"), # Euro version of CRV Touring
- CAR.CRV_HYBRID: HondaCarInfo("Honda CR-V Hybrid 2017-19", harness=Harness.bosch),
+ CAR.CRV_HYBRID: HondaCarInfo("Honda CR-V Hybrid 2017-19", harness=Harness.bosch_a),
CAR.FIT: HondaCarInfo("Honda Fit 2018-19", harness=Harness.nidec),
CAR.FREED: HondaCarInfo("Honda Freed 2020", harness=Harness.nidec),
CAR.HRV: HondaCarInfo("Honda HR-V 2019-20", harness=Harness.nidec),
CAR.ODYSSEY: HondaCarInfo("Honda Odyssey 2018-20", min_steer_speed=0., harness=Harness.nidec),
CAR.ODYSSEY_CHN: None, # Chinese version of Odyssey
CAR.ACURA_RDX: HondaCarInfo("Acura RDX 2016-18", "AcuraWatch Plus", harness=Harness.nidec),
- CAR.ACURA_RDX_3G: HondaCarInfo("Acura RDX 2019-21", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch),
+ CAR.ACURA_RDX_3G: HondaCarInfo("Acura RDX 2019-21", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch_a),
CAR.PILOT: HondaCarInfo("Honda Pilot 2016-21", harness=Harness.nidec),
CAR.PASSPORT: HondaCarInfo("Honda Passport 2019-21", "All", harness=Harness.nidec),
CAR.RIDGELINE: HondaCarInfo("Honda Ridgeline 2017-22", harness=Harness.nidec),
- CAR.INSIGHT: HondaCarInfo("Honda Insight 2019-21", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch),
- CAR.HONDA_E: HondaCarInfo("Honda e 2020", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch),
+ CAR.INSIGHT: HondaCarInfo("Honda Insight 2019-21", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch_a),
+ CAR.HONDA_E: HondaCarInfo("Honda e 2020", "All", min_steer_speed=3. * CV.MPH_TO_MS, harness=Harness.bosch_a),
}
@@ -1392,6 +1394,40 @@ FW_VERSIONS = {
b'57114-TYF-E030\x00\x00'
],
},
+ CAR.CIVIC_2022: {
+ (Ecu.eps, 0x18DA30F1, None): [
+ b'39990-T39-A130\x00\x00',
+ b'39990-T43-J020\x00\x00',
+ ],
+ (Ecu.gateway, 0x18DAEFF1, None): [
+ b'38897-T20-A020\x00\x00',
+ b'38897-T20-A510\x00\x00',
+ b'38897-T21-A010\x00\x00',
+ ],
+ (Ecu.srs, 0x18DA53F1, None): [
+ b'77959-T20-A970\x00\x00',
+ b'77959-T47-A940\x00\x00',
+ ],
+ (Ecu.combinationMeter, 0x18DA60F1, None): [
+ b'78108-T21-A220\x00\x00',
+ b'78108-T21-A620\x00\x00',
+ b'78108-T23-A110\x00\x00',
+ ],
+ (Ecu.vsa, 0x18DA28F1, None): [
+ b'57114-T20-AB40\x00\x00',
+ b'57114-T43-JB30\x00\x00',
+ ],
+ (Ecu.transmission, 0x18da1ef1, None): [
+ b'28101-65D-A020\x00\x00',
+ b'28101-65D-A120\x00\x00',
+ b'28101-65H-A020\x00\x00',
+ ],
+ (Ecu.programmedFuelInjection, 0x18da10f1, None): [
+ b'37805-64L-A540\x00\x00',
+ b'37805-64S-A540\x00\x00',
+ b'37805-64S-A720\x00\x00',
+ ],
+ },
}
DBC = {
@@ -1417,6 +1453,7 @@ DBC = {
CAR.RIDGELINE: dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'),
CAR.INSIGHT: dbc_dict('honda_insight_ex_2019_can_generated', None),
CAR.HONDA_E: dbc_dict('acura_rdx_2020_can_generated', None),
+ CAR.CIVIC_2022: dbc_dict('honda_civic_ex_2022_can_generated', None),
}
STEER_THRESHOLD = {
@@ -1429,5 +1466,6 @@ HONDA_NIDEC_ALT_PCM_ACCEL = {CAR.ODYSSEY}
HONDA_NIDEC_ALT_SCM_MESSAGES = {CAR.ACURA_ILX, CAR.ACURA_RDX, CAR.CRV, CAR.CRV_EU, CAR.FIT, CAR.FREED, CAR.HRV, CAR.ODYSSEY_CHN,
CAR.PILOT, CAR.PASSPORT, CAR.RIDGELINE}
HONDA_BOSCH = {CAR.ACCORD, CAR.ACCORDH, CAR.CIVIC_BOSCH, CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_5G,
- CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E}
+ CAR.CRV_HYBRID, CAR.INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.CIVIC_2022}
HONDA_BOSCH_ALT_BRAKE_SIGNAL = {CAR.ACCORD, CAR.CRV_5G, CAR.ACURA_RDX_3G}
+HONDA_BOSCH_RADARLESS = {CAR.CIVIC_2022}
diff --git a/selfdrive/car/tests/routes.py b/selfdrive/car/tests/routes.py
index a9d36f9eab..19b1a05c23 100644
--- a/selfdrive/car/tests/routes.py
+++ b/selfdrive/car/tests/routes.py
@@ -71,6 +71,7 @@ routes = [
TestRoute("f34a60d68d83b1e5|2020-10-06--14-35-55", HONDA.ACURA_RDX),
TestRoute("54fd8451b3974762|2021-04-01--14-50-10", HONDA.RIDGELINE),
TestRoute("2d5808fae0b38ac6|2021-09-01--17-14-11", HONDA.HONDA_E),
+ TestRoute("f44aa96ace22f34a|2021-12-22--06-22-31", HONDA.CIVIC_2022),
TestRoute("6fe86b4e410e4c37|2020-07-22--16-27-13", HYUNDAI.HYUNDAI_GENESIS),
TestRoute("70c5bec28ec8e345|2020-08-08--12-22-23", HYUNDAI.GENESIS_G70),
diff --git a/selfdrive/loggerd/encoder/encoder.h b/selfdrive/loggerd/encoder/encoder.h
index 312b68ba19..21ef65cf12 100644
--- a/selfdrive/loggerd/encoder/encoder.h
+++ b/selfdrive/loggerd/encoder/encoder.h
@@ -8,7 +8,7 @@
#include "cereal/visionipc/visionipc.h"
#include "common/queue.h"
#include "selfdrive/loggerd/video_writer.h"
-#include "selfdrive/camerad/cameras/camera_common.h"
+#include "system/camerad/cameras/camera_common.h"
#define V4L2_BUF_FLAG_KEYFRAME 8
diff --git a/selfdrive/loggerd/loggerd.h b/selfdrive/loggerd/loggerd.h
index 7e13e90e63..2c4990086a 100644
--- a/selfdrive/loggerd/loggerd.h
+++ b/selfdrive/loggerd/loggerd.h
@@ -15,7 +15,7 @@
#include "cereal/services.h"
#include "cereal/visionipc/visionipc.h"
#include "cereal/visionipc/visionipc_client.h"
-#include "selfdrive/camerad/cameras/camera_common.h"
+#include "system/camerad/cameras/camera_common.h"
#include "common/params.h"
#include "common/swaglog.h"
#include "common/timing.h"
diff --git a/selfdrive/manager/process_config.py b/selfdrive/manager/process_config.py
index a9a5c78a7f..7e4029664d 100644
--- a/selfdrive/manager/process_config.py
+++ b/selfdrive/manager/process_config.py
@@ -18,6 +18,8 @@ def logging(started, params, CP: car.CarParams) -> bool:
return started and run
procs = [
+ # due to qualcomm kernel bugs SIGKILLing camerad sometimes causes page table corruption
+ NativeProcess("camerad", "system/camerad", ["./camerad"], unkillable=True, callback=driverview),
NativeProcess("clocksd", "system/clocksd", ["./clocksd"]),
NativeProcess("logcatd", "system/logcatd", ["./logcatd"]),
NativeProcess("proclogd", "system/proclogd", ["./proclogd"]),
@@ -25,8 +27,6 @@ procs = [
PythonProcess("timezoned", "system.timezoned", enabled=not PC, offroad=True),
DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"),
- # due to qualcomm kernel bugs SIGKILLing camerad sometimes causes page table corruption
- NativeProcess("camerad", "selfdrive/camerad", ["./camerad"], unkillable=True, callback=driverview),
NativeProcess("dmonitoringmodeld", "selfdrive/modeld", ["./dmonitoringmodeld"], enabled=(not PC or WEBCAM), callback=driverview),
NativeProcess("encoderd", "selfdrive/loggerd", ["./encoderd"]),
NativeProcess("loggerd", "selfdrive/loggerd", ["./loggerd"], onroad=False, callback=logging),
diff --git a/selfdrive/test/process_replay/test_debayer.py b/selfdrive/test/process_replay/test_debayer.py
index eff77fc479..1b3e0f112e 100755
--- a/selfdrive/test/process_replay/test_debayer.py
+++ b/selfdrive/test/process_replay/test_debayer.py
@@ -10,7 +10,7 @@ from system.hardware import PC, TICI
from common.basedir import BASEDIR
from selfdrive.test.openpilotci import BASE_URL, get_url
from system.version import get_commit
-from selfdrive.camerad.snapshot.snapshot import yuv_to_rgb
+from system.camerad.snapshot.snapshot import yuv_to_rgb
from tools.lib.logreader import LogReader
from tools.lib.filereader import FileReader
@@ -62,7 +62,7 @@ def unbzip_frames(url):
def init_kernels(frame_offset=0):
ctx = cl.create_some_context(interactive=False)
- with open(os.path.join(BASEDIR, 'selfdrive/camerad/cameras/real_debayer.cl')) as f:
+ with open(os.path.join(BASEDIR, 'system/camerad/cameras/real_debayer.cl')) as f:
build_args = ' -cl-fast-relaxed-math -cl-denorms-are-zero -cl-single-precision-constant' + \
f' -DFRAME_STRIDE={FRAME_STRIDE} -DRGB_WIDTH={FRAME_WIDTH} -DRGB_HEIGHT={FRAME_HEIGHT} -DFRAME_OFFSET={frame_offset} -DCAM_NUM=0'
if PC:
diff --git a/selfdrive/ui/qt/widgets/cameraview.h b/selfdrive/ui/qt/widgets/cameraview.h
index ddc3fc253b..42e9043602 100644
--- a/selfdrive/ui/qt/widgets/cameraview.h
+++ b/selfdrive/ui/qt/widgets/cameraview.h
@@ -17,7 +17,7 @@
#endif
#include "cereal/visionipc/visionipc_client.h"
-#include "selfdrive/camerad/cameras/camera_common.h"
+#include "system/camerad/cameras/camera_common.h"
#include "selfdrive/ui/ui.h"
const int FRAME_BUFFER_SIZE = 5;
diff --git a/selfdrive/ui/replay/logreader.h b/selfdrive/ui/replay/logreader.h
index 7ada20605e..b4a38a5721 100644
--- a/selfdrive/ui/replay/logreader.h
+++ b/selfdrive/ui/replay/logreader.h
@@ -6,7 +6,7 @@
#endif
#include "cereal/gen/cpp/log.capnp.h"
-#include "selfdrive/camerad/cameras/camera_common.h"
+#include "system/camerad/cameras/camera_common.h"
#include "selfdrive/ui/replay/filereader.h"
const CameraType ALL_CAMERAS[] = {RoadCam, DriverCam, WideRoadCam};
diff --git a/selfdrive/camerad/SConscript b/system/camerad/SConscript
similarity index 100%
rename from selfdrive/camerad/SConscript
rename to system/camerad/SConscript
diff --git a/selfdrive/camerad/__init__.py b/system/camerad/__init__.py
similarity index 100%
rename from selfdrive/camerad/__init__.py
rename to system/camerad/__init__.py
diff --git a/selfdrive/camerad/cameras/camera_common.cc b/system/camerad/cameras/camera_common.cc
similarity index 98%
rename from selfdrive/camerad/cameras/camera_common.cc
rename to system/camerad/cameras/camera_common.cc
index a94cfedf1a..34dde9389c 100644
--- a/selfdrive/camerad/cameras/camera_common.cc
+++ b/system/camerad/cameras/camera_common.cc
@@ -1,4 +1,4 @@
-#include "selfdrive/camerad/cameras/camera_common.h"
+#include "system/camerad/cameras/camera_common.h"
#include
@@ -10,7 +10,7 @@
#include "libyuv.h"
#include
-#include "selfdrive/camerad/imgproc/utils.h"
+#include "system/camerad/imgproc/utils.h"
#include "common/clutil.h"
#include "common/modeldata.h"
#include "common/swaglog.h"
@@ -20,9 +20,9 @@
#ifdef QCOM2
#include "CL/cl_ext_qcom.h"
-#include "selfdrive/camerad/cameras/camera_qcom2.h"
+#include "system/camerad/cameras/camera_qcom2.h"
#else
-#include "selfdrive/camerad/test/camera_test.h"
+#include "system/camerad/test/camera_test.h"
#endif
ExitHandler do_exit;
diff --git a/selfdrive/camerad/cameras/camera_common.h b/system/camerad/cameras/camera_common.h
similarity index 98%
rename from selfdrive/camerad/cameras/camera_common.h
rename to system/camerad/cameras/camera_common.h
index e9c7ccd757..6b483372bb 100644
--- a/selfdrive/camerad/cameras/camera_common.h
+++ b/system/camerad/cameras/camera_common.h
@@ -9,7 +9,7 @@
#include "cereal/visionipc/visionbuf.h"
#include "cereal/visionipc/visionipc.h"
#include "cereal/visionipc/visionipc_server.h"
-#include "selfdrive/camerad/transforms/rgb_to_yuv.h"
+#include "system/camerad/transforms/rgb_to_yuv.h"
#include "common/mat.h"
#include "common/queue.h"
#include "common/swaglog.h"
diff --git a/selfdrive/camerad/cameras/camera_qcom2.cc b/system/camerad/cameras/camera_qcom2.cc
similarity index 99%
rename from selfdrive/camerad/cameras/camera_qcom2.cc
rename to system/camerad/cameras/camera_qcom2.cc
index c1ffc1275a..f001009b9a 100644
--- a/selfdrive/camerad/cameras/camera_qcom2.cc
+++ b/system/camerad/cameras/camera_qcom2.cc
@@ -1,4 +1,4 @@
-#include "selfdrive/camerad/cameras/camera_qcom2.h"
+#include "system/camerad/cameras/camera_qcom2.h"
#include
#include
@@ -20,7 +20,7 @@
#include "media/cam_sensor_cmn_header.h"
#include "media/cam_sync.h"
#include "common/swaglog.h"
-#include "selfdrive/camerad/cameras/sensor2_i2c.h"
+#include "system/camerad/cameras/sensor2_i2c.h"
// For debugging:
// echo "4294967295" > /sys/module/cam_debug_util/parameters/debug_mdl
diff --git a/selfdrive/camerad/cameras/camera_qcom2.h b/system/camerad/cameras/camera_qcom2.h
similarity index 98%
rename from selfdrive/camerad/cameras/camera_qcom2.h
rename to system/camerad/cameras/camera_qcom2.h
index 88766a68e9..57fef8d49a 100644
--- a/selfdrive/camerad/cameras/camera_qcom2.h
+++ b/system/camerad/cameras/camera_qcom2.h
@@ -6,7 +6,7 @@
#include
-#include "selfdrive/camerad/cameras/camera_common.h"
+#include "system/camerad/cameras/camera_common.h"
#include "common/util.h"
#define FRAME_BUF_COUNT 4
diff --git a/selfdrive/camerad/cameras/real_debayer.cl b/system/camerad/cameras/real_debayer.cl
similarity index 100%
rename from selfdrive/camerad/cameras/real_debayer.cl
rename to system/camerad/cameras/real_debayer.cl
diff --git a/selfdrive/camerad/cameras/sensor2_i2c.h b/system/camerad/cameras/sensor2_i2c.h
similarity index 100%
rename from selfdrive/camerad/cameras/sensor2_i2c.h
rename to system/camerad/cameras/sensor2_i2c.h
diff --git a/selfdrive/camerad/imgproc/conv.cl b/system/camerad/imgproc/conv.cl
similarity index 100%
rename from selfdrive/camerad/imgproc/conv.cl
rename to system/camerad/imgproc/conv.cl
diff --git a/selfdrive/camerad/imgproc/pool.cl b/system/camerad/imgproc/pool.cl
similarity index 100%
rename from selfdrive/camerad/imgproc/pool.cl
rename to system/camerad/imgproc/pool.cl
diff --git a/selfdrive/camerad/imgproc/utils.cc b/system/camerad/imgproc/utils.cc
similarity index 98%
rename from selfdrive/camerad/imgproc/utils.cc
rename to system/camerad/imgproc/utils.cc
index a88b8f4bb1..a7bbeb9e86 100644
--- a/selfdrive/camerad/imgproc/utils.cc
+++ b/system/camerad/imgproc/utils.cc
@@ -1,4 +1,4 @@
-#include "selfdrive/camerad/imgproc/utils.h"
+#include "system/camerad/imgproc/utils.h"
#include
#include
diff --git a/selfdrive/camerad/imgproc/utils.h b/system/camerad/imgproc/utils.h
similarity index 100%
rename from selfdrive/camerad/imgproc/utils.h
rename to system/camerad/imgproc/utils.h
diff --git a/selfdrive/camerad/include/media/cam_cpas.h b/system/camerad/include/media/cam_cpas.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_cpas.h
rename to system/camerad/include/media/cam_cpas.h
diff --git a/selfdrive/camerad/include/media/cam_defs.h b/system/camerad/include/media/cam_defs.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_defs.h
rename to system/camerad/include/media/cam_defs.h
diff --git a/selfdrive/camerad/include/media/cam_fd.h b/system/camerad/include/media/cam_fd.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_fd.h
rename to system/camerad/include/media/cam_fd.h
diff --git a/selfdrive/camerad/include/media/cam_icp.h b/system/camerad/include/media/cam_icp.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_icp.h
rename to system/camerad/include/media/cam_icp.h
diff --git a/selfdrive/camerad/include/media/cam_isp.h b/system/camerad/include/media/cam_isp.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_isp.h
rename to system/camerad/include/media/cam_isp.h
diff --git a/selfdrive/camerad/include/media/cam_isp_ife.h b/system/camerad/include/media/cam_isp_ife.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_isp_ife.h
rename to system/camerad/include/media/cam_isp_ife.h
diff --git a/selfdrive/camerad/include/media/cam_isp_vfe.h b/system/camerad/include/media/cam_isp_vfe.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_isp_vfe.h
rename to system/camerad/include/media/cam_isp_vfe.h
diff --git a/selfdrive/camerad/include/media/cam_jpeg.h b/system/camerad/include/media/cam_jpeg.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_jpeg.h
rename to system/camerad/include/media/cam_jpeg.h
diff --git a/selfdrive/camerad/include/media/cam_lrme.h b/system/camerad/include/media/cam_lrme.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_lrme.h
rename to system/camerad/include/media/cam_lrme.h
diff --git a/selfdrive/camerad/include/media/cam_req_mgr.h b/system/camerad/include/media/cam_req_mgr.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_req_mgr.h
rename to system/camerad/include/media/cam_req_mgr.h
diff --git a/selfdrive/camerad/include/media/cam_sensor.h b/system/camerad/include/media/cam_sensor.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_sensor.h
rename to system/camerad/include/media/cam_sensor.h
diff --git a/selfdrive/camerad/include/media/cam_sensor_cmn_header.h b/system/camerad/include/media/cam_sensor_cmn_header.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_sensor_cmn_header.h
rename to system/camerad/include/media/cam_sensor_cmn_header.h
diff --git a/selfdrive/camerad/include/media/cam_sync.h b/system/camerad/include/media/cam_sync.h
similarity index 100%
rename from selfdrive/camerad/include/media/cam_sync.h
rename to system/camerad/include/media/cam_sync.h
diff --git a/selfdrive/camerad/include/msm_cam_sensor.h b/system/camerad/include/msm_cam_sensor.h
similarity index 100%
rename from selfdrive/camerad/include/msm_cam_sensor.h
rename to system/camerad/include/msm_cam_sensor.h
diff --git a/selfdrive/camerad/include/msm_camsensor_sdk.h b/system/camerad/include/msm_camsensor_sdk.h
similarity index 100%
rename from selfdrive/camerad/include/msm_camsensor_sdk.h
rename to system/camerad/include/msm_camsensor_sdk.h
diff --git a/selfdrive/camerad/include/msmb_camera.h b/system/camerad/include/msmb_camera.h
similarity index 100%
rename from selfdrive/camerad/include/msmb_camera.h
rename to system/camerad/include/msmb_camera.h
diff --git a/selfdrive/camerad/include/msmb_isp.h b/system/camerad/include/msmb_isp.h
similarity index 100%
rename from selfdrive/camerad/include/msmb_isp.h
rename to system/camerad/include/msmb_isp.h
diff --git a/selfdrive/camerad/include/msmb_ispif.h b/system/camerad/include/msmb_ispif.h
similarity index 100%
rename from selfdrive/camerad/include/msmb_ispif.h
rename to system/camerad/include/msmb_ispif.h
diff --git a/selfdrive/camerad/main.cc b/system/camerad/main.cc
similarity index 89%
rename from selfdrive/camerad/main.cc
rename to system/camerad/main.cc
index 32899a8547..c1f38f2224 100644
--- a/selfdrive/camerad/main.cc
+++ b/system/camerad/main.cc
@@ -1,4 +1,4 @@
-#include "selfdrive/camerad/cameras/camera_common.h"
+#include "system/camerad/cameras/camera_common.h"
#include
diff --git a/selfdrive/camerad/snapshot/__init__.py b/system/camerad/snapshot/__init__.py
similarity index 100%
rename from selfdrive/camerad/snapshot/__init__.py
rename to system/camerad/snapshot/__init__.py
diff --git a/selfdrive/camerad/snapshot/snapshot.py b/system/camerad/snapshot/snapshot.py
similarity index 98%
rename from selfdrive/camerad/snapshot/snapshot.py
rename to system/camerad/snapshot/snapshot.py
index fa88849b69..9a81937eec 100755
--- a/selfdrive/camerad/snapshot/snapshot.py
+++ b/system/camerad/snapshot/snapshot.py
@@ -13,7 +13,7 @@ from system.hardware import PC
from selfdrive.controls.lib.alertmanager import set_offroad_alert
from selfdrive.manager.process_config import managed_processes
-LM_THRESH = 120 # defined in selfdrive/camerad/imgproc/utils.h
+LM_THRESH = 120 # defined in system/camerad/imgproc/utils.h
VISION_STREAMS = {
"roadCameraState": VisionStreamType.VISION_STREAM_ROAD,
diff --git a/selfdrive/camerad/test/.gitignore b/system/camerad/test/.gitignore
similarity index 100%
rename from selfdrive/camerad/test/.gitignore
rename to system/camerad/test/.gitignore
diff --git a/selfdrive/camerad/test/ae_gray_test.cc b/system/camerad/test/ae_gray_test.cc
similarity index 97%
rename from selfdrive/camerad/test/ae_gray_test.cc
rename to system/camerad/test/ae_gray_test.cc
index 69ef2ac6de..aabd7534ee 100644
--- a/selfdrive/camerad/test/ae_gray_test.cc
+++ b/system/camerad/test/ae_gray_test.cc
@@ -8,7 +8,7 @@
#include
#include "common/util.h"
-#include "selfdrive/camerad/cameras/camera_common.h"
+#include "system/camerad/cameras/camera_common.h"
int main() {
// set up fake camerabuf
diff --git a/selfdrive/camerad/test/ae_gray_test.h b/system/camerad/test/ae_gray_test.h
similarity index 100%
rename from selfdrive/camerad/test/ae_gray_test.h
rename to system/camerad/test/ae_gray_test.h
diff --git a/selfdrive/camerad/test/camera_test.h b/system/camerad/test/camera_test.h
similarity index 100%
rename from selfdrive/camerad/test/camera_test.h
rename to system/camerad/test/camera_test.h
diff --git a/selfdrive/camerad/test/check_skips.py b/system/camerad/test/check_skips.py
similarity index 100%
rename from selfdrive/camerad/test/check_skips.py
rename to system/camerad/test/check_skips.py
diff --git a/selfdrive/camerad/test/frame_test.py b/system/camerad/test/frame_test.py
similarity index 100%
rename from selfdrive/camerad/test/frame_test.py
rename to system/camerad/test/frame_test.py
diff --git a/selfdrive/camerad/test/get_thumbnails_for_segment.py b/system/camerad/test/get_thumbnails_for_segment.py
similarity index 100%
rename from selfdrive/camerad/test/get_thumbnails_for_segment.py
rename to system/camerad/test/get_thumbnails_for_segment.py
diff --git a/selfdrive/camerad/test/stress_restart.sh b/system/camerad/test/stress_restart.sh
similarity index 100%
rename from selfdrive/camerad/test/stress_restart.sh
rename to system/camerad/test/stress_restart.sh
diff --git a/selfdrive/camerad/test/test_camerad.py b/system/camerad/test/test_camerad.py
similarity index 100%
rename from selfdrive/camerad/test/test_camerad.py
rename to system/camerad/test/test_camerad.py
diff --git a/selfdrive/camerad/test/test_exposure.py b/system/camerad/test/test_exposure.py
similarity index 96%
rename from selfdrive/camerad/test/test_exposure.py
rename to system/camerad/test/test_exposure.py
index f42d0bfbe3..8cce7e7ffa 100755
--- a/selfdrive/camerad/test/test_exposure.py
+++ b/system/camerad/test/test_exposure.py
@@ -4,7 +4,7 @@ import unittest
import numpy as np
from selfdrive.test.helpers import with_processes
-from selfdrive.camerad.snapshot.snapshot import get_snapshots
+from system.camerad.snapshot.snapshot import get_snapshots
from system.hardware import TICI
diff --git a/selfdrive/camerad/transforms/rgb_to_yuv.cc b/system/camerad/transforms/rgb_to_yuv.cc
similarity index 96%
rename from selfdrive/camerad/transforms/rgb_to_yuv.cc
rename to system/camerad/transforms/rgb_to_yuv.cc
index 63e032e2dc..5e51579cf9 100644
--- a/selfdrive/camerad/transforms/rgb_to_yuv.cc
+++ b/system/camerad/transforms/rgb_to_yuv.cc
@@ -1,4 +1,4 @@
-#include "selfdrive/camerad/transforms/rgb_to_yuv.h"
+#include "system/camerad/transforms/rgb_to_yuv.h"
#include
#include
diff --git a/selfdrive/camerad/transforms/rgb_to_yuv.cl b/system/camerad/transforms/rgb_to_yuv.cl
similarity index 100%
rename from selfdrive/camerad/transforms/rgb_to_yuv.cl
rename to system/camerad/transforms/rgb_to_yuv.cl
diff --git a/selfdrive/camerad/transforms/rgb_to_yuv.h b/system/camerad/transforms/rgb_to_yuv.h
similarity index 100%
rename from selfdrive/camerad/transforms/rgb_to_yuv.h
rename to system/camerad/transforms/rgb_to_yuv.h
diff --git a/selfdrive/camerad/transforms/rgb_to_yuv_test.cc b/system/camerad/transforms/rgb_to_yuv_test.cc
similarity index 99%
rename from selfdrive/camerad/transforms/rgb_to_yuv_test.cc
rename to system/camerad/transforms/rgb_to_yuv_test.cc
index c960d168de..2f909e3b73 100644
--- a/selfdrive/camerad/transforms/rgb_to_yuv_test.cc
+++ b/system/camerad/transforms/rgb_to_yuv_test.cc
@@ -30,7 +30,7 @@
#include
#include "libyuv.h"
-#include "selfdrive/camerad/transforms/rgb_to_yuv.h"
+#include "system/camerad/transforms/rgb_to_yuv.h"
#include "common/clutil.h"
static inline double millis_since_boot() {
diff --git a/tools/sim/bridge.py b/tools/sim/bridge.py
index ae65e8deb8..faf67c3ef5 100755
--- a/tools/sim/bridge.py
+++ b/tools/sim/bridge.py
@@ -81,7 +81,7 @@ class Camerad:
cl_arg = f" -DHEIGHT={H} -DWIDTH={W} -DRGB_STRIDE={W * 3} -DUV_WIDTH={W // 2} -DUV_HEIGHT={H // 2} -DRGB_SIZE={W * H} -DCL_DEBUG "
# TODO: move rgb_to_yuv.cl to local dir once the frame stream camera is removed
- kernel_fn = os.path.join(BASEDIR, "selfdrive", "camerad", "transforms", "rgb_to_yuv.cl")
+ kernel_fn = os.path.join(BASEDIR, "system", "camerad", "transforms", "rgb_to_yuv.cl")
with open(kernel_fn) as f:
prg = cl.Program(self.ctx, f.read()).build(cl_arg)
self.krnl = prg.rgb_to_yuv
diff --git a/tools/webcam/README.md b/tools/webcam/README.md
index 48e5accb2a..1e07bdbbe6 100644
--- a/tools/webcam/README.md
+++ b/tools/webcam/README.md
@@ -23,14 +23,14 @@ git clone https://github.com/commaai/openpilot.git
```
cd ~/openpilot
```
-- check out selfdrive/camerad/cameras/camera_webcam.cc lines 72 and 146 before building if any camera is upside down
+- check out system/camerad/cameras/camera_webcam.cc lines 72 and 146 before building if any camera is upside down
```
USE_WEBCAM=1 scons -j$(nproc)
```
## Connect the hardware
- Connect the road facing camera first, then the driver facing camera
-- (default indexes are 1 and 2; can be modified in selfdrive/camerad/cameras/camera_webcam.cc)
+- (default indexes are 1 and 2; can be modified in system/camerad/cameras/camera_webcam.cc)
- Connect your computer to panda
## GO
diff --git a/tools/zookeeper/power_monitor.py b/tools/zookeeper/power_monitor.py
index d3bdd6679f..f88741813e 100755
--- a/tools/zookeeper/power_monitor.py
+++ b/tools/zookeeper/power_monitor.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import sys
import time
+import datetime
from common.realtime import Ratekeeper
from common.filter_simple import FirstOrderFilter
@@ -19,12 +20,19 @@ if __name__ == "__main__":
rk = Ratekeeper(rate, print_delay_threshold=None)
fltr = FirstOrderFilter(0, 5, 1. / rate, initialized=False)
+ measurements = []
+ start_time = time.monotonic()
+
try:
- start_time = time.monotonic()
while duration is None or time.monotonic() - start_time < duration:
fltr.update(z.read_power())
if rk.frame % rate == 0:
print(f"{fltr.x:.2f} W")
+ measurements.append(fltr.x)
rk.keep_time()
except KeyboardInterrupt:
pass
+
+ t = datetime.timedelta(seconds=time.monotonic() - start_time)
+ avg = sum(measurements) / len(measurements)
+ print(f"\nAverage power: {avg:.2f}W over {t}")