From fedea9fe8d489fd73f3a93ef707656bf10c94eb9 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 8 Aug 2026 09:44:21 -0700 Subject: [PATCH] camera names that make sense (#38585) --- docs/CONTRIBUTING.md | 2 +- docs/LIMITATIONS.md | 4 +- docs/concepts/logs.md | 6 +-- docs/contributing/feedback.md | 6 +-- openpilot/cereal/log.capnp | 24 ++++----- openpilot/cereal/services.py | 24 ++++----- openpilot/cereal/visionipc.py | 4 +- openpilot/cereal/visionstream.h | 4 +- openpilot/common/transformations/camera.py | 8 +-- .../selfdrive/modeld/dmonitoringmodeld.py | 4 +- openpilot/selfdrive/modeld/modeld.py | 20 +++---- openpilot/selfdrive/monitoring/policy.py | 12 ++--- openpilot/selfdrive/pandad/pandad.cc | 18 +++---- openpilot/selfdrive/selfdrived/events.py | 2 +- openpilot/selfdrive/selfdrived/selfdrived.py | 12 ++--- .../selfdrive/test/process_replay/README.md | 4 +- .../test/process_replay/migration.py | 8 +-- .../test/process_replay/model_replay.py | 11 ++-- .../test/process_replay/process_replay.py | 20 +++---- .../test/process_replay/vision_meta.py | 10 ++-- openpilot/selfdrive/test/test_onroad.py | 18 +++---- openpilot/selfdrive/test/test_power_draw.py | 2 +- .../selfdrive/ui/layouts/settings/device.py | 8 +-- .../selfdrive/ui/layouts/settings/toggles.py | 4 +- .../selfdrive/ui/mici/layouts/onboarding.py | 8 +-- .../ui/mici/layouts/settings/device.py | 10 ++-- .../ui/mici/layouts/settings/toggles.py | 2 +- .../ui/mici/onroad/augmented_road_view.py | 18 +++---- ...amera_dialog.py => cabin_camera_dialog.py} | 16 +++--- .../selfdrive/ui/mici/onroad/cameraview.py | 8 +-- .../ui/mici/tests/test_widget_leaks.py | 12 ++--- .../ui/onroad/augmented_road_view.py | 18 +++---- ...amera_dialog.py => cabin_camera_dialog.py} | 12 ++--- openpilot/selfdrive/ui/onroad/cameraview.py | 6 +-- .../selfdrive/ui/tests/diff/replay_script.py | 2 +- .../selfdrive/ui/tests/profile_onroad.py | 4 +- openpilot/selfdrive/ui/translations/app.pot | 16 +++--- openpilot/selfdrive/ui/translations/app_de.po | 22 ++++---- openpilot/selfdrive/ui/translations/app_en.po | 22 ++++---- openpilot/selfdrive/ui/translations/app_es.po | 22 ++++---- openpilot/selfdrive/ui/translations/app_fr.po | 22 ++++---- openpilot/selfdrive/ui/translations/app_ja.po | 22 ++++---- openpilot/selfdrive/ui/translations/app_ko.po | 22 ++++---- .../selfdrive/ui/translations/app_pt-BR.po | 22 ++++---- openpilot/selfdrive/ui/translations/app_th.po | 22 ++++---- openpilot/selfdrive/ui/translations/app_tr.po | 22 ++++---- openpilot/selfdrive/ui/translations/app_uk.po | 22 ++++---- .../selfdrive/ui/translations/app_zh-CHS.po | 22 ++++---- .../selfdrive/ui/translations/app_zh-CHT.po | 22 ++++---- openpilot/selfdrive/ui/ui_state.py | 2 +- openpilot/selfdrive/ui/watch3.py | 4 +- .../system/camerad/cameras/camera_qcom2.cc | 4 +- openpilot/system/camerad/cameras/hw.h | 18 +++---- openpilot/system/camerad/snapshot.py | 6 +-- openpilot/system/camerad/test/test_camerad.py | 14 ++--- openpilot/system/camerad/webcam/camerad.py | 6 +-- openpilot/system/loggerd/clip_encoder.cc | 4 +- openpilot/system/loggerd/loggerd.h | 54 +++++++++---------- .../system/loggerd/tests/test_encoder.py | 4 +- .../system/loggerd/tests/test_loggerd.py | 12 ++--- openpilot/system/webrtc/device/video.py | 4 +- .../webrtc/tests/test_stream_session.py | 2 +- openpilot/tools/cabana/README.md | 4 +- openpilot/tools/cabana/cabana.cc | 20 +++---- openpilot/tools/cabana/cameraview.cc | 4 +- .../tools/cabana/streams/replaystream.cc | 6 +-- openpilot/tools/cabana/tools/routeinfo.cc | 6 +-- openpilot/tools/cabana/videowidget.cc | 2 +- .../tools/camerastream/compressed_vipc.py | 8 +-- openpilot/tools/clip/run.py | 4 +- openpilot/tools/jotpluggler/app.h | 4 +- openpilot/tools/jotpluggler/common.h | 2 +- .../jotpluggler/layouts/camera-timings.json | 2 +- .../jotpluggler/layouts/cameras-and-map.json | 2 +- .../layouts/driver-monitoring-debug.json | 2 +- openpilot/tools/jotpluggler/runtime.cc | 22 ++++---- openpilot/tools/jotpluggler/sketch_layout.cc | 20 +++---- openpilot/tools/lib/log_time_series.py | 4 +- .../plotjuggler/layouts/camera-timings.xml | 37 +++++++------ openpilot/tools/replay/README.md | 8 +-- openpilot/tools/replay/camera.h | 4 +- openpilot/tools/replay/logreader.cc | 4 +- openpilot/tools/replay/logreader.h | 2 +- openpilot/tools/replay/main.cc | 16 +++--- openpilot/tools/replay/replay.cc | 6 +-- openpilot/tools/replay/replay.h | 4 +- openpilot/tools/replay/route.cc | 12 ++--- openpilot/tools/replay/route.h | 4 +- openpilot/tools/replay/ui.py | 10 ++-- openpilot/tools/replay/util.h | 4 +- openpilot/tools/sim/lib/camerad.py | 6 +-- tools/scripts/cycle_alerts.py | 4 +- 92 files changed, 502 insertions(+), 496 deletions(-) rename openpilot/selfdrive/ui/mici/onroad/{driver_camera_dialog.py => cabin_camera_dialog.py} (96%) rename openpilot/selfdrive/ui/onroad/{driver_camera_dialog.py => cabin_camera_dialog.py} (92%) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index cbeb5f6d3a..1d9338e457 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -58,7 +58,7 @@ A good pull request has all of the following: * Report bugs in GitHub issues. * Report driving issues in the `#driving-feedback` Discord channel. -* Consider opting into driver camera uploads to improve the driver monitoring model. +* Consider opting into cabin camera uploads to improve the driver monitoring model. * Connect your device to Wi-Fi regularly, so that we can pull data for training better driving models. * Run the `nightly` branch and report issues. This branch is like `master` but it's built just like a release. * Annotate images in the [comma10k dataset](https://github.com/commaai/comma10k). diff --git a/docs/LIMITATIONS.md b/docs/LIMITATIONS.md index 8c112659c2..5f9b7517bd 100644 --- a/docs/LIMITATIONS.md +++ b/docs/LIMITATIONS.md @@ -52,7 +52,7 @@ Many factors can impact the performance of openpilot DM, causing it to be unable * Low light conditions, such as driving at night or in dark tunnels. * Bright light (due to oncoming headlights, direct sunlight, etc.). -* The driver's face is partially or completely outside field of view of the driver facing camera. -* The driver facing camera is obstructed, covered, or damaged. +* The driver's face is partially or completely outside field of view of the cabin camera. +* The cabin camera is obstructed, covered, or damaged. The list above does not represent an exhaustive list of situations that may interfere with proper operation of openpilot components. A driver should not rely on openpilot DM to assess their level of attention. diff --git a/docs/concepts/logs.md b/docs/concepts/logs.md index dd954d4c76..a1e655935d 100644 --- a/docs/concepts/logs.md +++ b/docs/concepts/logs.md @@ -10,13 +10,13 @@ For each segment, openpilot records the following log types: rlogs contain all the messages passed amongst openpilot's processes. See [openpilot/cereal/services.py](https://github.com/commaai/openpilot/blob/master/openpilot/cereal/services.py) for a list of all the logged services. They're a zstd archive of the serialized [Cap’n Proto](https://capnproto.org/) messages. -## {f,e,d}camera.hevc +## camera video files Each camera stream is H.265 encoded and written to its respective file. -* `fcamera.hevc` is the road camera +* `fcamera.hevc` is the narrow road camera (the main forward camera) * `ecamera.hevc` is the wide road camera -* `dcamera.hevc` is the driver camera +* `dcamera.hevc` is the cabin camera ## qlog.zst & qcamera.ts diff --git a/docs/contributing/feedback.md b/docs/contributing/feedback.md index 335d24e13a..587816d140 100644 --- a/docs/contributing/feedback.md +++ b/docs/contributing/feedback.md @@ -21,14 +21,14 @@ In general, driver monitoring feedback is very actionable, and we can fix your c To post your feedback: 1. Join the [community Discord](https://discord.comma.ai). -2. If driver camera recording is toggled off, temporarily enable driver camera recording in the settings until you reproduce the issue. -3. Using comma connect, identify the relevant segment and upload the segment's logs and driver camera. +2. If cabin camera recording is toggled off, temporarily enable cabin camera recording in the settings until you reproduce the issue. +3. Using comma connect, identify the relevant segment and upload the segment's logs and cabin camera. 4. Post the segment in the `#openpilot-experience` channel on Discord with a good description. Before posting feedback, please ensure: - **openpilot is up to date** you should be on the latest openpilot release or nightly -- **the driver camera has a clear view of the driver** ensure nothing blocks view of the driver (e.g. a cable), the lens is clean, etc. +- **the cabin camera has a clear view of the driver** ensure nothing blocks view of the driver (e.g. a cable), the lens is clean, etc. - **your device is mounted properly** your device must be mounted horizontally center and relatively high on the windshield ## Other bugs diff --git a/openpilot/cereal/log.capnp b/openpilot/cereal/log.capnp index da700b58a7..fa185aa483 100644 --- a/openpilot/cereal/log.capnp +++ b/openpilot/cereal/log.capnp @@ -2562,17 +2562,17 @@ struct Event { driverStateV2 @92 :DriverStateV2; # camera stuff, each camera state has a matching encode idx - roadCameraState @2 :FrameData; - driverCameraState @70: FrameData; + narrowRoadCameraState @2 :FrameData; + cabinCameraState @70: FrameData; wideRoadCameraState @74: FrameData; - roadEncodeIdx @15 :EncodeIndex; - driverEncodeIdx @76 :EncodeIndex; + narrowRoadEncodeIdx @15 :EncodeIndex; + cabinEncodeIdx @76 :EncodeIndex; wideRoadEncodeIdx @77 :EncodeIndex; - qRoadEncodeIdx @90 :EncodeIndex; + qNarrowRoadEncodeIdx @90 :EncodeIndex; - livestreamRoadEncodeIdx @117 :EncodeIndex; + livestreamNarrowRoadEncodeIdx @117 :EncodeIndex; livestreamWideRoadEncodeIdx @118 :EncodeIndex; - livestreamDriverEncodeIdx @119 :EncodeIndex; + livestreamCabinEncodeIdx @119 :EncodeIndex; # microphone data soundPressure @103 :SoundPressure; @@ -2602,15 +2602,15 @@ struct Event { # *********** debug *********** testJoystick @52 :Joystick; - roadEncodeData @86 :EncodeData; - driverEncodeData @87 :EncodeData; + narrowRoadEncodeData @86 :EncodeData; + cabinEncodeData @87 :EncodeData; wideRoadEncodeData @88 :EncodeData; - qRoadEncodeData @89 :EncodeData; + qNarrowRoadEncodeData @89 :EncodeData; alertDebug @133 :DebugAlert; - livestreamRoadEncodeData @120 :EncodeData; + livestreamNarrowRoadEncodeData @120 :EncodeData; livestreamWideRoadEncodeData @121 :EncodeData; - livestreamDriverEncodeData @122 :EncodeData; + livestreamCabinEncodeData @122 :EncodeData; # *********** Custom: reserved for forks *********** diff --git a/openpilot/cereal/services.py b/openpilot/cereal/services.py index a41a890f97..61fb8fcbd2 100755 --- a/openpilot/cereal/services.py +++ b/openpilot/cereal/services.py @@ -33,7 +33,7 @@ _services: dict[str, tuple] = { "pandaStates": (True, 10., 1), "peripheralState": (True, 2., 1), "radarState": (True, 20., 5), - "roadEncodeIdx": (False, 20., 1), + "narrowRoadEncodeIdx": (False, 20., 1), "liveTracks": (True, 20.), "sendcan": (True, 100., 139, QueueSize.MEDIUM), "logMessage": (True, 0., None, QueueSize.BIG), @@ -61,9 +61,9 @@ _services: dict[str, tuple] = { "thumbnail": (True, 1 / 60., 1), "onroadEvents": (True, 1., 1), "carParams": (True, 0.02, 1), - "roadCameraState": (True, 20., 20), - "driverCameraState": (True, 20., 20), - "driverEncodeIdx": (False, 20., 1), + "narrowRoadCameraState": (True, 20., 20), + "cabinCameraState": (True, 20., 20), + "cabinEncodeIdx": (False, 20., 1), "driverStateV2": (True, 20., 10), "driverMonitoringState": (True, 20., 10), "wideRoadEncodeIdx": (False, 20., 1), @@ -71,26 +71,26 @@ _services: dict[str, tuple] = { "drivingModelData": (True, 20., 10), "modelV2": (True, 20., None, QueueSize.BIG), "managerState": (True, 2., 1), - "qRoadEncodeIdx": (False, 20.), + "qNarrowRoadEncodeIdx": (False, 20.), "userBookmark": (True, 0., 1), "soundPressure": (True, 10., 10), "rawAudioData": (False, 20.), "bookmarkButton": (True, 0., 1), - "roadEncodeData": (False, 20., None, QueueSize.BIG), - "driverEncodeData": (False, 20., None, QueueSize.BIG), + "narrowRoadEncodeData": (False, 20., None, QueueSize.BIG), + "cabinEncodeData": (False, 20., None, QueueSize.BIG), "wideRoadEncodeData": (False, 20., None, QueueSize.BIG), - "qRoadEncodeData": (False, 20., None, QueueSize.BIG), + "qNarrowRoadEncodeData": (False, 20., None, QueueSize.BIG), # debug "uiDebug": (True, 0., 1), "testJoystick": (True, 0.), "alertDebug": (True, 20., 5), "livestreamWideRoadEncodeIdx": (False, 20.), - "livestreamRoadEncodeIdx": (False, 20.), - "livestreamDriverEncodeIdx": (False, 20.), + "livestreamNarrowRoadEncodeIdx": (False, 20.), + "livestreamCabinEncodeIdx": (False, 20.), "livestreamWideRoadEncodeData": (False, 20., None, QueueSize.MEDIUM), - "livestreamRoadEncodeData": (False, 20., None, QueueSize.MEDIUM), - "livestreamDriverEncodeData": (False, 20., None, QueueSize.MEDIUM), + "livestreamNarrowRoadEncodeData": (False, 20., None, QueueSize.MEDIUM), + "livestreamCabinEncodeData": (False, 20., None, QueueSize.MEDIUM), "customReservedRawData0": (True, 0.), } SERVICE_LIST = {name: Service(*vals) for diff --git a/openpilot/cereal/visionipc.py b/openpilot/cereal/visionipc.py index d3c842e58e..74439babb9 100644 --- a/openpilot/cereal/visionipc.py +++ b/openpilot/cereal/visionipc.py @@ -2,7 +2,7 @@ from enum import IntEnum class VisionStreamType(IntEnum): - VISION_STREAM_ROAD = 0 - VISION_STREAM_DRIVER = 1 + VISION_STREAM_NARROW_ROAD = 0 + VISION_STREAM_CABIN = 1 VISION_STREAM_WIDE_ROAD = 2 VISION_STREAM_MAP = 3 diff --git a/openpilot/cereal/visionstream.h b/openpilot/cereal/visionstream.h index 36105ee046..adaff7b477 100644 --- a/openpilot/cereal/visionstream.h +++ b/openpilot/cereal/visionstream.h @@ -3,8 +3,8 @@ #include "msgq/visionipc/visionbuf.h" enum VisionStreamValues : VisionStreamType { - VISION_STREAM_ROAD = 0, - VISION_STREAM_DRIVER = 1, + VISION_STREAM_NARROW_ROAD = 0, + VISION_STREAM_CABIN = 1, VISION_STREAM_WIDE_ROAD = 2, VISION_STREAM_MAP = 3, }; diff --git a/openpilot/common/transformations/camera.py b/openpilot/common/transformations/camera.py index ada9c5b398..17ac226cdb 100644 --- a/openpilot/common/transformations/camera.py +++ b/openpilot/common/transformations/camera.py @@ -37,12 +37,12 @@ class _NoneCameraConfig(CameraConfig): @dataclass(frozen=True) class DeviceCameraConfig: - fcam: CameraConfig - dcam: CameraConfig - ecam: CameraConfig + narrow_road: CameraConfig + cabin: CameraConfig + wide_road: CameraConfig def all_cams(self): - for cam in ['fcam', 'dcam', 'ecam']: + for cam in ['narrow_road', 'cabin', 'wide_road']: if not isinstance(getattr(self, cam), _NoneCameraConfig): yield cam, getattr(self, cam) diff --git a/openpilot/selfdrive/modeld/dmonitoringmodeld.py b/openpilot/selfdrive/modeld/dmonitoringmodeld.py index 1ccc0b2a89..02391aeee3 100755 --- a/openpilot/selfdrive/modeld/dmonitoringmodeld.py +++ b/openpilot/selfdrive/modeld/dmonitoringmodeld.py @@ -110,8 +110,8 @@ def get_driverstate_packet(model_output, frame_id: int, location_ts: int, exec_t def main(): config_realtime_process(7, 5) - cloudlog.warning("connecting to driver stream") - vipc_client = VisionIpcClient("camerad", VisionStreamType.VISION_STREAM_DRIVER, True) + cloudlog.warning("connecting to cabin stream") + vipc_client = VisionIpcClient("camerad", VisionStreamType.VISION_STREAM_CABIN, True) while not vipc_client.connect(False): time.sleep(0.1) assert vipc_client.is_connected() diff --git a/openpilot/selfdrive/modeld/modeld.py b/openpilot/selfdrive/modeld/modeld.py index ef61c58333..f724e530e2 100755 --- a/openpilot/selfdrive/modeld/modeld.py +++ b/openpilot/selfdrive/modeld/modeld.py @@ -215,12 +215,12 @@ def main(demo=False): while True: available_streams = VisionIpcClient.available_streams("camerad", block=False) if available_streams: - use_extra_client = VisionStreamType.VISION_STREAM_WIDE_ROAD in available_streams and VisionStreamType.VISION_STREAM_ROAD in available_streams - main_wide_camera = VisionStreamType.VISION_STREAM_ROAD not in available_streams + use_extra_client = VisionStreamType.VISION_STREAM_WIDE_ROAD in available_streams and VisionStreamType.VISION_STREAM_NARROW_ROAD in available_streams + main_wide_camera = VisionStreamType.VISION_STREAM_NARROW_ROAD not in available_streams break time.sleep(.1) - vipc_client_main_stream = VisionStreamType.VISION_STREAM_WIDE_ROAD if main_wide_camera else VisionStreamType.VISION_STREAM_ROAD + vipc_client_main_stream = VisionStreamType.VISION_STREAM_WIDE_ROAD if main_wide_camera else VisionStreamType.VISION_STREAM_NARROW_ROAD vipc_client_main = VisionIpcClient("camerad", vipc_client_main_stream, True) vipc_client_extra = VisionIpcClient("camerad", VisionStreamType.VISION_STREAM_WIDE_ROAD, False) cloudlog.warning(f"vision stream set up, main_wide_camera: {main_wide_camera}, use_extra_client: {use_extra_client}") @@ -262,7 +262,7 @@ def main(demo=False): # messaging pub_socks = ["modelV2", "drivingModelData", "cameraOdometry"] + (["chestnutState"] if USBGPU else []) pm = PubMaster(pub_socks) - sm = SubMaster(["deviceState", "carState", "roadCameraState", "liveCalibration", "driverMonitoringState", "carControl", "liveDelay"]) + sm = SubMaster(["deviceState", "carState", "narrowRoadCameraState", "liveCalibration", "driverMonitoringState", "carControl", "liveDelay"]) publish_state = PublishState() params = Params() @@ -330,15 +330,17 @@ def main(demo=False): sm.update(0) desire = DH.desire is_rhd = sm["driverMonitoringState"].isRHD - frame_id = sm["roadCameraState"].frameId + frame_id = sm["narrowRoadCameraState"].frameId v_ego = max(sm["carState"].vEgo, 0.) lat_delay = sm["liveDelay"].lateralDelay + LAT_SMOOTH_SECONDS - if sm.updated["liveCalibration"] and sm.seen['roadCameraState'] and sm.seen['deviceState']: + if sm.updated["liveCalibration"] and sm.seen['narrowRoadCameraState'] and sm.seen['deviceState']: device_from_calib_euler = np.array(sm["liveCalibration"].rpyCalib, dtype=np.float32) - dc = DEVICE_CAMERAS[(str(sm['deviceState'].deviceType), str(sm['roadCameraState'].sensor))] - model_transform_main = get_warp_matrix(device_from_calib_euler, dc.ecam.intrinsics if main_wide_camera else dc.fcam.intrinsics, False).astype(np.float32) + dc = DEVICE_CAMERAS[(str(sm['deviceState'].deviceType), str(sm['narrowRoadCameraState'].sensor))] + main_intrinsics = dc.wide_road.intrinsics if main_wide_camera else dc.narrow_road.intrinsics + model_transform_main = get_warp_matrix(device_from_calib_euler, main_intrinsics, False).astype(np.float32) has_wide_camera = use_extra_client or main_wide_camera - model_transform_extra = get_warp_matrix(device_from_calib_euler, dc.ecam.intrinsics if has_wide_camera else dc.fcam.intrinsics, True).astype(np.float32) + extra_intrinsics = dc.wide_road.intrinsics if has_wide_camera else dc.narrow_road.intrinsics + model_transform_extra = get_warp_matrix(device_from_calib_euler, extra_intrinsics, True).astype(np.float32) live_calib_seen = True traffic_convention = np.zeros(2) diff --git a/openpilot/selfdrive/monitoring/policy.py b/openpilot/selfdrive/monitoring/policy.py index 1ce9f03b3e..b58f1e66dc 100644 --- a/openpilot/selfdrive/monitoring/policy.py +++ b/openpilot/selfdrive/monitoring/policy.py @@ -107,17 +107,17 @@ class DriverBlink: self.right = 0. # model output refers to center of undistorted+leveled image -ref_undistorted_cam = DEVICE_CAMERAS[("tici", "ar0231")].dcam -dcam_undistorted_FL = 598.0 -dcam_undistorted_W, dcam_undistorted_H = (ref_undistorted_cam.width, ref_undistorted_cam.height) +ref_undistorted_cam = DEVICE_CAMERAS[("tici", "ar0231")].cabin +cabin_undistorted_FL = 598.0 +cabin_undistorted_W, cabin_undistorted_H = (ref_undistorted_cam.width, ref_undistorted_cam.height) def face_orientation_from_model(orient_model, pos_model, rpy_calib): pitch_model = orient_model[0] yaw_model = orient_model[1] - face_pixel_position = ((pos_model[0]+0.5)*dcam_undistorted_W, (pos_model[1]+0.5)*dcam_undistorted_H) - yaw_focal_angle = atan2(face_pixel_position[0] - dcam_undistorted_W//2, dcam_undistorted_FL) - pitch_focal_angle = atan2(face_pixel_position[1] - dcam_undistorted_H//2, dcam_undistorted_FL) + face_pixel_position = ((pos_model[0]+0.5)*cabin_undistorted_W, (pos_model[1]+0.5)*cabin_undistorted_H) + yaw_focal_angle = atan2(face_pixel_position[0] - cabin_undistorted_W//2, cabin_undistorted_FL) + pitch_focal_angle = atan2(face_pixel_position[1] - cabin_undistorted_H//2, cabin_undistorted_FL) pitch = pitch_model + pitch_focal_angle yaw = -yaw_model + yaw_focal_angle diff --git a/openpilot/selfdrive/pandad/pandad.cc b/openpilot/selfdrive/pandad/pandad.cc index 68d74f81a1..78d12bd2ed 100644 --- a/openpilot/selfdrive/pandad/pandad.cc +++ b/openpilot/selfdrive/pandad/pandad.cc @@ -278,9 +278,9 @@ void process_panda_state(Panda *panda, PubMaster *pm, bool engaged, bool is_onro void process_peripheral_state(Panda *panda, PubMaster *pm, bool no_fan_control, bool is_onroad) { static Params params; - static SubMaster sm({"deviceState", "driverCameraState"}); + static SubMaster sm({"deviceState", "cabinCameraState"}); - static uint64_t last_driver_camera_t = 0; + static uint64_t last_cabin_camera_t = 0; static uint16_t prev_fan_speed = 999; static int ir_pwr = 0; static int prev_ir_pwr = 999; @@ -304,20 +304,20 @@ void process_peripheral_state(Panda *panda, PubMaster *pm, bool no_fan_control, } } - if (sm.updated("driverCameraState")) { - auto event = sm["driverCameraState"]; - int cur_integ_lines = event.getDriverCameraState().getIntegLines(); + if (sm.updated("cabinCameraState")) { + auto event = sm["cabinCameraState"]; + int cur_integ_lines = event.getCabinCameraState().getIntegLines(); // reset the filter when camerad restarts - if (event.getDriverCameraState().getFrameId() < prev_frame_id) { + if (event.getCabinCameraState().getFrameId() < prev_frame_id) { integ_lines_filter.reset(0); integ_lines_filter_driver_view.reset(0); driver_view = params.getBool("IsDriverViewEnabled"); } - prev_frame_id = event.getDriverCameraState().getFrameId(); + prev_frame_id = event.getCabinCameraState().getFrameId(); cur_integ_lines = (driver_view ? integ_lines_filter_driver_view : integ_lines_filter).update(cur_integ_lines); - last_driver_camera_t = event.getLogMonoTime(); + last_cabin_camera_t = event.getLogMonoTime(); if (cur_integ_lines <= CUTOFF_IL) { ir_pwr = 0; @@ -329,7 +329,7 @@ void process_peripheral_state(Panda *panda, PubMaster *pm, bool no_fan_control, } // Disable IR on input timeout - if (nanos_since_boot() - last_driver_camera_t > 1e9) { + if (nanos_since_boot() - last_cabin_camera_t > 1e9) { ir_pwr = 0; } diff --git a/openpilot/selfdrive/selfdrived/events.py b/openpilot/selfdrive/selfdrived/events.py index c9bae1f1d3..0464647c3b 100755 --- a/openpilot/selfdrive/selfdrived/events.py +++ b/openpilot/selfdrive/selfdrived/events.py @@ -297,7 +297,7 @@ def comm_issue_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaste def camera_malfunction_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert: - all_cams = ('roadCameraState', 'driverCameraState', 'wideRoadCameraState') + all_cams = ('narrowRoadCameraState', 'cabinCameraState', 'wideRoadCameraState') bad_cams = [s.replace('State', '') for s in all_cams if s in sm.data.keys() and not sm.all_checks([s, ])] return NormalPermanentAlert("Camera Malfunction", ', '.join(bad_cams)) diff --git a/openpilot/selfdrive/selfdrived/selfdrived.py b/openpilot/selfdrive/selfdrived/selfdrived.py index 2ca462a9e6..59c5f2695e 100755 --- a/openpilot/selfdrive/selfdrived/selfdrived.py +++ b/openpilot/selfdrive/selfdrived/selfdrived.py @@ -77,17 +77,17 @@ class SelfdriveD: self.gps_location_service = get_gps_location_service(self.params) self.gps_packets = [self.gps_location_service] self.sensor_packets = ["accelerometer", "gyroscope"] - self.camera_packets = ["roadCameraState", "driverCameraState", "wideRoadCameraState"] + self.camera_packets = ["narrowRoadCameraState", "cabinCameraState", "wideRoadCameraState"] # TODO: de-couple selfdrived with card/conflate on carState without introducing controls mismatches self.car_state_sock = messaging.sub_sock('carState', timeout=20) ignore = self.sensor_packets + self.gps_packets + ['alertDebug', 'lateralManeuverPlan'] if SIMULATION: - ignore += ['driverCameraState', 'managerState'] + ignore += ['cabinCameraState', 'managerState'] if REPLAY: # no vipc in replay will make them ignored anyways - ignore += ['roadCameraState', 'wideRoadCameraState'] + ignore += ['narrowRoadCameraState', 'wideRoadCameraState'] self.sm = messaging.SubMaster(['deviceState', 'pandaStates', 'peripheralState', 'modelV2', 'liveCalibration', 'carOutput', 'driverMonitoringState', 'longitudinalPlan', 'livePose', 'liveDelay', 'managerState', 'liveParameters', 'radarState', 'liveTorqueParameters', @@ -467,9 +467,9 @@ class SelfdriveD: timed_out = self.sm.frame * DT_CTRL > 6. if all_valid or timed_out or (SIMULATION and not REPLAY): available_streams = VisionIpcClient.available_streams("camerad", block=False) - if VisionStreamType.VISION_STREAM_ROAD not in available_streams: - self.sm.ignore_alive.append('roadCameraState') - self.sm.ignore_valid.append('roadCameraState') + if VisionStreamType.VISION_STREAM_NARROW_ROAD not in available_streams: + self.sm.ignore_alive.append('narrowRoadCameraState') + self.sm.ignore_valid.append('narrowRoadCameraState') if VisionStreamType.VISION_STREAM_WIDE_ROAD not in available_streams: self.sm.ignore_alive.append('wideRoadCameraState') self.sm.ignore_valid.append('wideRoadCameraState') diff --git a/openpilot/selfdrive/test/process_replay/README.md b/openpilot/selfdrive/test/process_replay/README.md index 28f3b7cd2a..f39333a3c6 100644 --- a/openpilot/selfdrive/test/process_replay/README.md +++ b/openpilot/selfdrive/test/process_replay/README.md @@ -104,9 +104,9 @@ Replaying processes that use VisionIPC (e.g. modeld, dmonitoringmodeld) require from openpilot.tools.lib.framereader import FrameReader frs = { - 'roadCameraState': FrameReader(...), + 'narrowRoadCameraState': FrameReader(...), 'wideRoadCameraState': FrameReader(...), - 'driverCameraState': FrameReader(...), + 'cabinCameraState': FrameReader(...), } output_logs = replay_process_with_name(['modeld', 'dmonitoringmodeld'], lr, frs=frs) diff --git a/openpilot/selfdrive/test/process_replay/migration.py b/openpilot/selfdrive/test/process_replay/migration.py index e38d1e1042..ff98389e2c 100644 --- a/openpilot/selfdrive/test/process_replay/migration.py +++ b/openpilot/selfdrive/test/process_replay/migration.py @@ -361,7 +361,7 @@ def migrate_peripheralState(msgs): return [], add_ops, [] -@migration(inputs=["roadEncodeIdx", "wideRoadEncodeIdx", "driverEncodeIdx", "roadCameraState", "wideRoadCameraState", "driverCameraState"]) +@migration(inputs=["narrowRoadEncodeIdx", "wideRoadEncodeIdx", "cabinEncodeIdx", "narrowRoadCameraState", "wideRoadCameraState", "cabinCameraState"]) def migrate_cameraStates(msgs): add_ops, del_ops = [], [] frame_to_encode_id = defaultdict(dict) @@ -369,7 +369,7 @@ def migrate_cameraStates(msgs): min_frame_id = defaultdict(lambda: float('inf')) for _, msg in msgs: - if msg.which() not in ["roadEncodeIdx", "wideRoadEncodeIdx", "driverEncodeIdx"]: + if msg.which() not in ["narrowRoadEncodeIdx", "wideRoadEncodeIdx", "cabinEncodeIdx"]: continue encode_index = getattr(msg, msg.which()) @@ -379,7 +379,7 @@ def migrate_cameraStates(msgs): frame_to_encode_id[meta.camera_state][encode_index.frameId] = encode_index.segmentId for index, msg in msgs: - if msg.which() not in ["roadCameraState", "wideRoadCameraState", "driverCameraState"]: + if msg.which() not in ["narrowRoadCameraState", "wideRoadCameraState", "cabinCameraState"]: continue camera_state = getattr(msg, msg.which()) @@ -392,7 +392,7 @@ def migrate_cameraStates(msgs): del_ops.append(index) continue - # fallback mechanism for logs without encodeIdx (e.g. logs from before 2022 with dcamera recording disabled) + # fallback mechanism for logs without encodeIdx (e.g. logs from before 2022 with driver recording disabled) # try to fake encode_id by subtracting lowest frameId encode_id = camera_state.frameId - min_frame_id[msg.which()] print(f"Faking encodeId to {encode_id} for camera feed {msg.which()} with frameId: {camera_state.frameId}") diff --git a/openpilot/selfdrive/test/process_replay/model_replay.py b/openpilot/selfdrive/test/process_replay/model_replay.py index 3e5616e702..3b5038b24c 100755 --- a/openpilot/selfdrive/test/process_replay/model_replay.py +++ b/openpilot/selfdrive/test/process_replay/model_replay.py @@ -146,9 +146,10 @@ def trim_logs(logs, start_frame, end_frame, frs_types, include_all_types): def model_replay(lr, frs): # modeld is using frame pairs - modeld_logs = trim_logs(lr, START_FRAME, END_FRAME, {"roadCameraState", "wideRoadCameraState"}, - {"roadEncodeIdx", "wideRoadEncodeIdx", "carParams", "carState", "carControl", "can"}) - dmodeld_logs = trim_logs(lr, START_FRAME, END_FRAME, {"driverCameraState"}, {"driverEncodeIdx", "carParams", "can"}) + camera_states = {"narrowRoadCameraState", "wideRoadCameraState"} + modeld_logs = trim_logs(lr, START_FRAME, END_FRAME, camera_states, + {"narrowRoadEncodeIdx", "wideRoadEncodeIdx", "carParams", "carState", "carControl", "can"}) + dmodeld_logs = trim_logs(lr, START_FRAME, END_FRAME, {"cabinCameraState"}, {"cabinEncodeIdx", "carParams", "can"}) if not SEND_EXTRA_INPUTS: modeld_logs = [msg for msg in modeld_logs if msg.which() != 'liveCalibration'] @@ -209,8 +210,8 @@ def get_frames(): print(f"Failed to load frames from cache {cache_name}: {e}") frs = { - 'roadCameraState': FrameReader(get_url(TEST_ROUTE, SEGMENT, "fcamera.hevc"), pix_fmt='nv12', cache_size=END_FRAME - START_FRAME), - 'driverCameraState': FrameReader(get_url(TEST_ROUTE, SEGMENT, "dcamera.hevc"), pix_fmt='nv12', cache_size=END_FRAME - START_FRAME), + 'narrowRoadCameraState': FrameReader(get_url(TEST_ROUTE, SEGMENT, "fcamera.hevc"), pix_fmt='nv12', cache_size=END_FRAME - START_FRAME), + 'cabinCameraState': FrameReader(get_url(TEST_ROUTE, SEGMENT, "dcamera.hevc"), pix_fmt='nv12', cache_size=END_FRAME - START_FRAME), 'wideRoadCameraState': FrameReader(get_url(TEST_ROUTE, SEGMENT, "ecamera.hevc"), pix_fmt='nv12', cache_size=END_FRAME - START_FRAME), } for fr in frs.values(): diff --git a/openpilot/selfdrive/test/process_replay/process_replay.py b/openpilot/selfdrive/test/process_replay/process_replay.py index 5d2e5a22fa..346d532140 100755 --- a/openpilot/selfdrive/test/process_replay/process_replay.py +++ b/openpilot/selfdrive/test/process_replay/process_replay.py @@ -396,7 +396,7 @@ class ModeldCameraSyncRcvCallback: def __call__(self, msg, cfg, frame): self.is_dual_camera = len(cfg.vision_pubs) == 2 - if msg.which() == "roadCameraState": + if msg.which() == "narrowRoadCameraState": self.road_present = True elif msg.which() == "wideRoadCameraState": self.wide_road_present = True @@ -434,7 +434,7 @@ CONFIGS = [ pubs=[ "carState", "deviceState", "pandaStates", "peripheralState", "liveCalibration", "driverMonitoringState", "longitudinalPlan", "livePose", "liveDelay", "liveParameters", "radarState", "modelV2", - "driverCameraState", "roadCameraState", "wideRoadCameraState", "managerState", "liveTorqueParameters", + "cabinCameraState", "narrowRoadCameraState", "wideRoadCameraState", "managerState", "liveTorqueParameters", "accelerometer", "gyroscope", "carOutput", "gpsLocationExternal", "gpsLocation", "controlsState", "carControl", "driverAssistance", "alertDebug", ], @@ -549,28 +549,28 @@ CONFIGS = [ ), ProcessConfig( proc_name="modeld", - pubs=["deviceState", "roadCameraState", "wideRoadCameraState", "liveCalibration", "liveDelay", "driverMonitoringState", "carState", "carControl"], + pubs=["deviceState", "narrowRoadCameraState", "wideRoadCameraState", "liveCalibration", "liveDelay", "driverMonitoringState", "carState", "carControl"], subs=["modelV2", "drivingModelData", "cameraOdometry"], ignore=["logMonoTime", "modelV2.frameDropPerc", "modelV2.modelExecutionTime", "drivingModelData.frameDropPerc", "drivingModelData.modelExecutionTime"], should_recv_callback=ModeldCameraSyncRcvCallback(), tolerance=NUMPY_TOLERANCE, processing_time=0.020, - main_pub=vipc_get_endpoint_name("camerad", meta_from_camera_state("roadCameraState").stream), - vision_pubs=["roadCameraState", "wideRoadCameraState"], + main_pub=vipc_get_endpoint_name("camerad", meta_from_camera_state("narrowRoadCameraState").stream), + vision_pubs=["narrowRoadCameraState", "wideRoadCameraState"], ignore_alive_pubs=["wideRoadCameraState"], init_callback=get_car_params_callback, ), ProcessConfig( proc_name="dmonitoringmodeld", - pubs=["liveCalibration", "driverCameraState"], + pubs=["liveCalibration", "cabinCameraState"], subs=["driverStateV2"], ignore=["logMonoTime", "driverStateV2.modelExecutionTime", "driverStateV2.gpuExecutionTime"], - should_recv_callback=MessageBasedRcvCallback("driverCameraState"), + should_recv_callback=MessageBasedRcvCallback("cabinCameraState"), tolerance=NUMPY_TOLERANCE, processing_time=0.020, - main_pub=vipc_get_endpoint_name("camerad", meta_from_camera_state("driverCameraState").stream), - vision_pubs=["driverCameraState"], - ignore_alive_pubs=["driverCameraState"], + main_pub=vipc_get_endpoint_name("camerad", meta_from_camera_state("cabinCameraState").stream), + vision_pubs=["cabinCameraState"], + ignore_alive_pubs=["cabinCameraState"], ), ] diff --git a/openpilot/selfdrive/test/process_replay/vision_meta.py b/openpilot/selfdrive/test/process_replay/vision_meta.py index 28f2829650..6942d88367 100644 --- a/openpilot/selfdrive/test/process_replay/vision_meta.py +++ b/openpilot/selfdrive/test/process_replay/vision_meta.py @@ -4,14 +4,14 @@ from openpilot.common.realtime import DT_MDL, DT_DMON from openpilot.common.transformations.camera import DEVICE_CAMERAS VideoStreamMeta = namedtuple("VideoStreamMeta", ["camera_state", "encode_index", "stream", "dt", "frame_sizes"]) -ROAD_CAMERA_FRAME_SIZES = {k: (v.dcam.width, v.dcam.height) for k, v in DEVICE_CAMERAS.items()} -WIDE_ROAD_CAMERA_FRAME_SIZES = {k: (v.ecam.width, v.ecam.height) for k, v in DEVICE_CAMERAS.items() if v.ecam is not None} -DRIVER_CAMERA_FRAME_SIZES = {k: (v.dcam.width, v.dcam.height) for k, v in DEVICE_CAMERAS.items()} +NARROW_ROAD_CAMERA_FRAME_SIZES = {k: (v.narrow_road.width, v.narrow_road.height) for k, v in DEVICE_CAMERAS.items()} +WIDE_ROAD_CAMERA_FRAME_SIZES = {k: (v.wide_road.width, v.wide_road.height) for k, v in DEVICE_CAMERAS.items() if v.wide_road is not None} +CABIN_CAMERA_FRAME_SIZES = {k: (v.cabin.width, v.cabin.height) for k, v in DEVICE_CAMERAS.items()} VIPC_STREAM_METADATA = [ # metadata: (state_msg_type, encode_msg_type, stream_type, dt, frame_sizes) - ("roadCameraState", "roadEncodeIdx", VisionStreamType.VISION_STREAM_ROAD, DT_MDL, ROAD_CAMERA_FRAME_SIZES), + ("narrowRoadCameraState", "narrowRoadEncodeIdx", VisionStreamType.VISION_STREAM_NARROW_ROAD, DT_MDL, NARROW_ROAD_CAMERA_FRAME_SIZES), ("wideRoadCameraState", "wideRoadEncodeIdx", VisionStreamType.VISION_STREAM_WIDE_ROAD, DT_MDL, WIDE_ROAD_CAMERA_FRAME_SIZES), - ("driverCameraState", "driverEncodeIdx", VisionStreamType.VISION_STREAM_DRIVER, DT_DMON, DRIVER_CAMERA_FRAME_SIZES), + ("cabinCameraState", "cabinEncodeIdx", VisionStreamType.VISION_STREAM_CABIN, DT_DMON, CABIN_CAMERA_FRAME_SIZES), ] diff --git a/openpilot/selfdrive/test/test_onroad.py b/openpilot/selfdrive/test/test_onroad.py index 2ee876a6ef..fb8cd1393f 100755 --- a/openpilot/selfdrive/test/test_onroad.py +++ b/openpilot/selfdrive/test/test_onroad.py @@ -83,8 +83,8 @@ TIMINGS = { "controlsState": [2.5, 0.35], "longitudinalPlan": [2.5, 0.5], "driverAssistance": [2.5, 0.5], - "roadCameraState": [2.5, 0.35], - "driverCameraState": [2.5, 0.35], + "narrowRoadCameraState": [2.5, 0.35], + "cabinCameraState": [2.5, 0.35], "modelV2": [2.5, 0.35], "driverStateV2": [2.5, 0.40], "livePose": [2.5, 0.35], @@ -304,7 +304,7 @@ class TestOnroad(OpenpilotTestCase): result += "------------------------------------------------\n" result += "----------------- SOF Timing ------------------\n" result += "------------------------------------------------\n" - for name in ['roadCameraState', 'wideRoadCameraState', 'driverCameraState']: + for name in ['narrowRoadCameraState', 'wideRoadCameraState', 'cabinCameraState']: ts = self.ts[name]['timestampSof'] d_ms = np.diff(ts) / 1e6 d50 = np.abs(d_ms-50) @@ -317,8 +317,8 @@ class TestOnroad(OpenpilotTestCase): print(result) def test_camera_sync(self, subtests): - cam_states = ['roadCameraState', 'wideRoadCameraState', 'driverCameraState'] - encode_cams = ['roadEncodeIdx', 'wideRoadEncodeIdx', 'driverEncodeIdx'] + cam_states = ['narrowRoadCameraState', 'wideRoadCameraState', 'cabinCameraState'] + encode_cams = ['narrowRoadEncodeIdx', 'wideRoadEncodeIdx', 'cabinEncodeIdx'] for cams in (cam_states, encode_cams): with subtests.test(cams=cams): # sanity checks within a single cam @@ -349,15 +349,15 @@ class TestOnroad(OpenpilotTestCase): diff = (max(ts.values()) - min(ts.values())) assert diff < 2, f"Cameras not synced properly: frame_id={start+i}, {diff=:.1f}ms, {ts=}" - # driver camera should be staggered ~25ms from road camera + # cabin camera should be staggered ~25ms from road camera offset_ms = abs(self.ts[cams[2]]['timestampSof'][i] - self.ts[cams[0]]['timestampSof'][i]) / 1e6 - assert 20 < offset_ms < 30, f"driver camera stagger out of range at frame {start+i}: {offset_ms:.1f}ms" + assert 20 < offset_ms < 30, f"cabin camera stagger out of range at frame {start+i}: {offset_ms:.1f}ms" def test_camera_encoder_matches(self, subtests): # sanity check that the frame metadata is consistent with the encoded frames - pairs = [('roadCameraState', 'roadEncodeIdx'), + pairs = [('narrowRoadCameraState', 'narrowRoadEncodeIdx'), ('wideRoadCameraState', 'wideRoadEncodeIdx'), - ('driverCameraState', 'driverEncodeIdx')] + ('cabinCameraState', 'cabinEncodeIdx')] for cam, enc in pairs: with subtests.test(camera=cam, encoder=enc): cam_frames = {fid: (sof, eof) for fid, sof, eof in zip( diff --git a/openpilot/selfdrive/test/test_power_draw.py b/openpilot/selfdrive/test/test_power_draw.py index 4fba2e8c99..8cad68978f 100755 --- a/openpilot/selfdrive/test/test_power_draw.py +++ b/openpilot/selfdrive/test/test_power_draw.py @@ -34,7 +34,7 @@ class Proc: PROCS = [ - Proc(['camerad'], 1.65, atol=0.4, msgs=['roadCameraState', 'wideRoadCameraState', 'driverCameraState']), + Proc(['camerad'], 1.65, atol=0.4, msgs=['narrowRoadCameraState', 'wideRoadCameraState', 'cabinCameraState']), Proc(['modeld'], 1.5, atol=0.2, msgs=['modelV2']), Proc(['dmonitoringmodeld'], 0.65, atol=0.35, msgs=['driverStateV2']), Proc(['encoderd'], 0.23, msgs=[]), diff --git a/openpilot/selfdrive/ui/layouts/settings/device.py b/openpilot/selfdrive/ui/layouts/settings/device.py index 22853b0bd9..ddc5c23160 100644 --- a/openpilot/selfdrive/ui/layouts/settings/device.py +++ b/openpilot/selfdrive/ui/layouts/settings/device.py @@ -5,7 +5,7 @@ from openpilot.cereal import messaging, log from openpilot.common.basedir import BASEDIR from openpilot.common.params import Params from openpilot.common.swaglog import cloudlog -from openpilot.selfdrive.ui.onroad.driver_camera_dialog import DriverCameraDialog +from openpilot.selfdrive.ui.onroad.cabin_camera_dialog import CabinCameraDialog from openpilot.selfdrive.ui.ui_state import ui_state from openpilot.selfdrive.ui.layouts.onboarding import TrainingGuide from openpilot.selfdrive.ui.widgets.pairing_dialog import PairingDialog @@ -21,7 +21,7 @@ from openpilot.system.ui.widgets.scroller_tici import Scroller # Description constants DESCRIPTIONS = { 'pair_device': tr_noop("Pair your device with comma connect (connect.comma.ai) and claim your comma prime offer."), - 'driver_camera': tr_noop("Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)"), + 'cabin_camera': tr_noop("Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)"), 'reset_calibration': tr_noop("openpilot requires the device to be mounted within 4° left or right and within 5° up or 9° down."), 'review_guide': tr_noop("Review the rules, features, and limitations of openpilot"), } @@ -57,8 +57,8 @@ class DeviceLayout(Widget): text_item(lambda: tr("Dongle ID"), self._params.get("DongleId") or (lambda: tr("N/A"))), text_item(lambda: tr("Serial"), self._params.get("HardwareSerial") or (lambda: tr("N/A"))), self._pair_device_btn, - button_item(lambda: tr("Driver Camera"), lambda: tr("PREVIEW"), lambda: tr(DESCRIPTIONS['driver_camera']), - callback=lambda: gui_app.push_widget(DriverCameraDialog()), enabled=ui_state.is_offroad), + button_item(lambda: tr("Cabin Camera"), lambda: tr("PREVIEW"), lambda: tr(DESCRIPTIONS['cabin_camera']), + callback=lambda: gui_app.push_widget(CabinCameraDialog()), enabled=ui_state.is_offroad), self._reset_calib_btn, button_item(lambda: tr("Review Training Guide"), lambda: tr("REVIEW"), lambda: tr(DESCRIPTIONS['review_guide']), self._on_review_training_guide, enabled=ui_state.is_offroad), diff --git a/openpilot/selfdrive/ui/layouts/settings/toggles.py b/openpilot/selfdrive/ui/layouts/settings/toggles.py index b03ecd10ec..090c49f14e 100644 --- a/openpilot/selfdrive/ui/layouts/settings/toggles.py +++ b/openpilot/selfdrive/ui/layouts/settings/toggles.py @@ -28,7 +28,7 @@ DESCRIPTIONS = { "without a turn signal activated while driving over 31 mph (50 km/h)." ), "AlwaysOnDM": tr_noop("Enable driver monitoring even when openpilot is not engaged."), - 'RecordFront': tr_noop("Upload data from the driver facing camera and help improve the driver monitoring algorithm."), + 'RecordFront': tr_noop("Upload data from the cabin camera and help improve the driver monitoring algorithm."), "IsMetric": tr_noop("Display speed in km/h instead of mph."), "RecordAudio": tr_noop("Record and store microphone audio while driving. The audio will be included in the dashcam video in comma connect."), } @@ -73,7 +73,7 @@ class TogglesLayout(Widget): False, ), "RecordFront": ( - lambda: tr("Record and Upload Driver Camera"), + lambda: tr("Record and Upload Cabin Camera"), DESCRIPTIONS["RecordFront"], "monitoring.png", True, diff --git a/openpilot/selfdrive/ui/mici/layouts/onboarding.py b/openpilot/selfdrive/ui/mici/layouts/onboarding.py index f1ebd3bacd..2b448ac73d 100644 --- a/openpilot/selfdrive/ui/mici/layouts/onboarding.py +++ b/openpilot/selfdrive/ui/mici/layouts/onboarding.py @@ -16,10 +16,10 @@ from openpilot.common.version import terms_version, training_version from openpilot.selfdrive.ui.ui_state import ui_state, device from openpilot.selfdrive.ui.mici.widgets.dialog import BigConfirmationCircleButton from openpilot.selfdrive.ui.mici.onroad.driver_state import DriverStateRenderer -from openpilot.selfdrive.ui.mici.onroad.driver_camera_dialog import BaseDriverCameraDialog +from openpilot.selfdrive.ui.mici.onroad.cabin_camera_dialog import BaseCabinCameraDialog -class DriverCameraSetupDialog(BaseDriverCameraDialog): +class CabinCameraSetupDialog(BaseCabinCameraDialog): def __init__(self): super().__init__() self.driver_state_renderer = DriverStateRenderer(inset=True) @@ -104,7 +104,7 @@ class TrainingGuideDMTutorial(NavWidget): self._good_button.set_enabled(False) self._progress = FirstOrderFilter(0.0, 0.5, 1 / gui_app.target_fps) - self._dialog = DriverCameraSetupDialog() + self._dialog = CabinCameraSetupDialog() self._bad_face_page = DMBadFaceDetected() # Disable driver monitoring model when device times out for inactivity @@ -231,7 +231,7 @@ class TrainingGuideRecordFront(NavScroller): exit_on_confirm=False) self._scroller.add_widgets([ - GreyBigButton("driver camera data", "do you want to share video data for training?", + GreyBigButton("cabin camera data", "do you want to share video data for training?", gui_app.texture("icons_mici/setup/green_dm.png", 64, 64)), GreyBigButton("", "Sharing your data with comma helps improve openpilot for everyone."), self._accept_button, diff --git a/openpilot/selfdrive/ui/mici/layouts/settings/device.py b/openpilot/selfdrive/ui/mici/layouts/settings/device.py index 7f4a9ab0b8..6038ff7d35 100644 --- a/openpilot/selfdrive/ui/mici/layouts/settings/device.py +++ b/openpilot/selfdrive/ui/mici/layouts/settings/device.py @@ -9,7 +9,7 @@ from openpilot.system.ui.widgets.scroller import NavRawScrollPanel, NavScroller from openpilot.selfdrive.ui.mici.widgets.button import BigButton, BigCircleButton from openpilot.selfdrive.ui.mici.widgets.dialog import BigDialog, BigConfirmationDialog from openpilot.selfdrive.ui.mici.widgets.pairing_dialog import PairingDialog -from openpilot.selfdrive.ui.mici.onroad.driver_camera_dialog import DriverCameraDialog +from openpilot.selfdrive.ui.mici.onroad.cabin_camera_dialog import CabinCameraDialog from openpilot.selfdrive.ui.mici.layouts.onboarding import TrainingGuide, TermsPage from openpilot.system.ui.lib.application import gui_app, FontWeight, MousePos from openpilot.system.ui.lib.multilang import tr @@ -189,9 +189,9 @@ class DeviceLayoutMici(NavScroller): regulatory_btn = BigButton("regulatory info", "", gui_app.texture("icons_mici/settings/device/info.png", 64, 64)) regulatory_btn.set_click_callback(self._on_regulatory) - driver_cam_btn = BigButton("driver\ncamera preview", "", gui_app.texture("icons_mici/settings/device/cameras.png", 64, 64)) - driver_cam_btn.set_click_callback(lambda: gui_app.push_widget(DriverCameraDialog())) - driver_cam_btn.set_enabled(lambda: ui_state.is_offroad()) + cabin_cam_btn = BigButton("driver\ncamera preview", "", gui_app.texture("icons_mici/settings/device/cameras.png", 64, 64)) + cabin_cam_btn.set_click_callback(lambda: gui_app.push_widget(CabinCameraDialog())) + cabin_cam_btn.set_enabled(lambda: ui_state.is_offroad()) review_training_guide_btn = BigButton("review\ntraining guide", "", gui_app.texture("icons_mici/settings/device/info.png", 64, 64)) review_training_guide_btn.set_click_callback(lambda: gui_app.push_widget(ReviewTrainingGuide(completed_callback=lambda: gui_app.pop_widgets_to(self)))) @@ -204,7 +204,7 @@ class DeviceLayoutMici(NavScroller): DeviceInfoLayoutMici(), PairBigButton(), review_training_guide_btn, - driver_cam_btn, + cabin_cam_btn, terms_btn, regulatory_btn, reset_calibration_btn, diff --git a/openpilot/selfdrive/ui/mici/layouts/settings/toggles.py b/openpilot/selfdrive/ui/mici/layouts/settings/toggles.py index 57cbf9410b..4d5113448d 100644 --- a/openpilot/selfdrive/ui/mici/layouts/settings/toggles.py +++ b/openpilot/selfdrive/ui/mici/layouts/settings/toggles.py @@ -47,7 +47,7 @@ class TogglesLayoutMici(NavScroller): is_metric_toggle = BigParamControl("use metric units", "IsMetric") ldw_toggle = BigParamControl("lane departure warnings", "IsLdwEnabled") always_on_dm_toggle = BigParamControl("always-on driver monitor", "AlwaysOnDM") - record_front = BigParamControl("record & upload driver camera", "RecordFront", toggle_callback=restart_needed_callback) + record_front = BigParamControl("record & upload cabin camera", "RecordFront", toggle_callback=restart_needed_callback) record_mic = BigParamControl("record & upload mic audio", "RecordAudio", toggle_callback=restart_needed_callback) enable_openpilot = BigParamControl("enable openpilot", "OpenpilotEnabledToggle", toggle_callback=restart_needed_callback) diff --git a/openpilot/selfdrive/ui/mici/onroad/augmented_road_view.py b/openpilot/selfdrive/ui/mici/onroad/augmented_road_view.py index 92f6b835e3..46348a9f16 100644 --- a/openpilot/selfdrive/ui/mici/onroad/augmented_road_view.py +++ b/openpilot/selfdrive/ui/mici/onroad/augmented_road_view.py @@ -21,7 +21,7 @@ from enum import IntEnum OpState = log.SelfdriveState.OpenpilotState CALIBRATED = log.LiveCalibrationData.Status.calibrated -ROAD_CAM = VisionStreamType.VISION_STREAM_ROAD +NARROW_ROAD_CAM = VisionStreamType.VISION_STREAM_NARROW_ROAD WIDE_CAM = VisionStreamType.VISION_STREAM_WIDE_ROAD DEFAULT_DEVICE_CAMERA = DEVICE_CAMERAS["tici", "ar0231"] @@ -130,7 +130,7 @@ class BookmarkIcon(Widget): class AugmentedRoadView(CameraView): - def __init__(self, bookmark_callback=None, stream_type: VisionStreamType = VisionStreamType.VISION_STREAM_ROAD): + def __init__(self, bookmark_callback=None, stream_type: VisionStreamType = VisionStreamType.VISION_STREAM_NARROW_ROAD): super().__init__("camerad", stream_type) self._bookmark_callback = bookmark_callback self._set_placeholder_color(rl.BLACK) @@ -250,12 +250,12 @@ class AugmentedRoadView(CameraView): if v_ego < WIDE_CAM_MAX_SPEED: target = WIDE_CAM elif v_ego > ROAD_CAM_MIN_SPEED: - target = ROAD_CAM + target = NARROW_ROAD_CAM else: # Hysteresis zone - keep current stream target = self.stream_type else: - target = ROAD_CAM + target = NARROW_ROAD_CAM if self.stream_type != target: self.switch_stream(target) @@ -263,8 +263,8 @@ class AugmentedRoadView(CameraView): def _update_calibration(self): # Update device camera if not already set sm = ui_state.sm - if not self.device_camera and sm.seen['roadCameraState'] and sm.seen['deviceState']: - self.device_camera = DEVICE_CAMERAS[(str(sm['deviceState'].deviceType), str(sm['roadCameraState'].sensor))] + if not self.device_camera and sm.seen['narrowRoadCameraState'] and sm.seen['deviceState']: + self.device_camera = DEVICE_CAMERAS[(str(sm['deviceState'].deviceType), str(sm['narrowRoadCameraState'].sensor))] # Check if live calibration data is available and valid if not (sm.updated["liveCalibration"] and sm.valid['liveCalibration']): @@ -298,7 +298,7 @@ class AugmentedRoadView(CameraView): # Get camera configuration device_camera = self.device_camera or DEFAULT_DEVICE_CAMERA is_wide_camera = self.stream_type == WIDE_CAM - intrinsic = device_camera.ecam.intrinsics if is_wide_camera else device_camera.fcam.intrinsics + intrinsic = device_camera.wide_road.intrinsics if is_wide_camera else device_camera.narrow_road.intrinsics calibration = self.view_from_wide_calib if is_wide_camera else self.view_from_calib if is_wide_camera: zoom = 0.7 * 1.5 @@ -353,14 +353,14 @@ class AugmentedRoadView(CameraView): if __name__ == "__main__": gui_app.init_window("OnRoad Camera View") - road_camera_view = AugmentedRoadView(lambda: None, stream_type=ROAD_CAM) + road_camera_view = AugmentedRoadView(lambda: None, stream_type=NARROW_ROAD_CAM) print("***press space to switch camera view***") try: for _ in gui_app.render(): ui_state.update() if rl.is_key_released(rl.KeyboardKey.KEY_SPACE): if WIDE_CAM in road_camera_view.available_streams: - stream = ROAD_CAM if road_camera_view.stream_type == WIDE_CAM else WIDE_CAM + stream = NARROW_ROAD_CAM if road_camera_view.stream_type == WIDE_CAM else WIDE_CAM road_camera_view.switch_stream(stream) road_camera_view.render(rl.Rectangle(0, 0, gui_app.width, gui_app.height)) finally: diff --git a/openpilot/selfdrive/ui/mici/onroad/driver_camera_dialog.py b/openpilot/selfdrive/ui/mici/onroad/cabin_camera_dialog.py similarity index 96% rename from openpilot/selfdrive/ui/mici/onroad/driver_camera_dialog.py rename to openpilot/selfdrive/ui/mici/onroad/cabin_camera_dialog.py index 24276c42b8..e86c0aa739 100644 --- a/openpilot/selfdrive/ui/mici/onroad/driver_camera_dialog.py +++ b/openpilot/selfdrive/ui/mici/onroad/cabin_camera_dialog.py @@ -11,7 +11,7 @@ from openpilot.system.ui.widgets.nav_widget import NavWidget from openpilot.system.ui.widgets.label import gui_label -class DriverCameraView(CameraView): +class CabinCameraView(CameraView): def _calc_frame_matrix(self, rect: rl.Rectangle): base = super()._calc_frame_matrix(rect) driver_view_ratio = 1.5 @@ -20,11 +20,11 @@ class DriverCameraView(CameraView): return base -class BaseDriverCameraDialog(Widget): +class BaseCabinCameraDialog(Widget): # Not a NavWidget so training guide can use this without back navigation def __init__(self): super().__init__() - self._camera_view = DriverCameraView("camerad", VisionStreamType.VISION_STREAM_DRIVER) + self._camera_view = CabinCameraView("camerad", VisionStreamType.VISION_STREAM_CABIN) self.driver_state_renderer = DriverStateRenderer(lines=True) self.driver_state_renderer.set_rect(rl.Rectangle(0, 0, 200, 200)) self.driver_state_renderer.load_icons() @@ -229,7 +229,7 @@ class BaseDriverCameraDialog(Widget): rl.draw_texture_v(self._glasses_texture, glasses_pos, rl.Color(70, 80, 161, int(255 * glasses_prob))) -class DriverCameraDialog(NavWidget, BaseDriverCameraDialog): +class CabinCameraDialog(NavWidget, BaseCabinCameraDialog): def __init__(self): super().__init__() # TODO: this can grow unbounded, should be given some thought @@ -237,12 +237,12 @@ class DriverCameraDialog(NavWidget, BaseDriverCameraDialog): if __name__ == "__main__": - gui_app.init_window("Driver Camera View (mici)") + gui_app.init_window("Cabin Camera View (mici)") - driver_camera_view = DriverCameraDialog() - gui_app.push_widget(driver_camera_view) + cabin_camera_view = CabinCameraDialog() + gui_app.push_widget(cabin_camera_view) try: for _ in gui_app.render(): ui_state.update() finally: - driver_camera_view.close() + cabin_camera_view.close() diff --git a/openpilot/selfdrive/ui/mici/onroad/cameraview.py b/openpilot/selfdrive/ui/mici/onroad/cameraview.py index 64dd6d023d..8a3e2cbed5 100644 --- a/openpilot/selfdrive/ui/mici/onroad/cameraview.py +++ b/openpilot/selfdrive/ui/mici/onroad/cameraview.py @@ -126,7 +126,7 @@ class CameraView(Widget): self._engaged_loc = rl.get_shader_location(self.shader, "engaged") self._engaged_val = rl.ffi.new("int[1]", [1]) self._enhance_driver_loc = rl.get_shader_location(self.shader, "enhance_driver") - self._enhance_driver_val = rl.ffi.new("int[1]", [1 if stream_type == VisionStreamType.VISION_STREAM_DRIVER else 0]) + self._enhance_driver_val = rl.ffi.new("int[1]", [1 if stream_type == VisionStreamType.VISION_STREAM_CABIN else 0]) self.frame: VisionBuf | None = None self.texture_y: rl.Texture | None = None @@ -243,8 +243,8 @@ class CameraView(Widget): transform = self._calc_frame_matrix(rect) src_rect = rl.Rectangle(0, 0, float(self.frame.width), float(self.frame.height)) - # Flip driver camera horizontally - if self._stream_type == VisionStreamType.VISION_STREAM_DRIVER: + # Flip cabin camera horizontally + if self._stream_type == VisionStreamType.VISION_STREAM_CABIN: src_rect.width = -src_rect.width # Calculate scale @@ -410,6 +410,6 @@ class CameraView(Widget): if __name__ == "__main__": gui_app.init_window("camera view") - road = CameraView("camerad", VisionStreamType.VISION_STREAM_ROAD) + road = CameraView("camerad", VisionStreamType.VISION_STREAM_NARROW_ROAD) for _ in gui_app.render(): road.render(rl.Rectangle(0, 0, gui_app.width, gui_app.height)) diff --git a/openpilot/selfdrive/ui/mici/tests/test_widget_leaks.py b/openpilot/selfdrive/ui/mici/tests/test_widget_leaks.py index 271cb2704f..c0f1ac1510 100755 --- a/openpilot/selfdrive/ui/mici/tests/test_widget_leaks.py +++ b/openpilot/selfdrive/ui/mici/tests/test_widget_leaks.py @@ -4,13 +4,13 @@ import unittest # FIXME: known small leaks not worth worrying about at the moment KNOWN_LEAKS = { - "openpilot.selfdrive.ui.mici.onroad.driver_camera_dialog.DriverCameraView", + "openpilot.selfdrive.ui.mici.onroad.cabin_camera_dialog.CabinCameraView", "openpilot.selfdrive.ui.mici.layouts.onboarding.TermsPage", "openpilot.selfdrive.ui.mici.layouts.onboarding.TrainingGuide", "openpilot.selfdrive.ui.mici.layouts.onboarding.DeclinePage", "openpilot.selfdrive.ui.mici.layouts.onboarding.OnboardingWindow", "openpilot.selfdrive.ui.onroad.driver_state.DriverStateRenderer", - "openpilot.selfdrive.ui.onroad.driver_camera_dialog.DriverCameraDialog", + "openpilot.selfdrive.ui.onroad.cabin_camera_dialog.CabinCameraDialog", "openpilot.selfdrive.ui.layouts.onboarding.TermsPage", "openpilot.selfdrive.ui.layouts.onboarding.DeclinePage", "openpilot.selfdrive.ui.layouts.onboarding.OnboardingWindow", @@ -51,13 +51,13 @@ class TestWidgetLeaks(OpenpilotTestCase): # mici dialogs from openpilot.selfdrive.ui.mici.layouts.onboarding import TrainingGuide as MiciTrainingGuide, OnboardingWindow as MiciOnboardingWindow - from openpilot.selfdrive.ui.mici.onroad.driver_camera_dialog import DriverCameraDialog as MiciDriverCameraDialog + from openpilot.selfdrive.ui.mici.onroad.cabin_camera_dialog import CabinCameraDialog as MiciCabinCameraDialog from openpilot.selfdrive.ui.mici.widgets.pairing_dialog import PairingDialog as MiciPairingDialog from openpilot.selfdrive.ui.mici.widgets.dialog import BigDialog, BigConfirmationDialog, BigInputDialog from openpilot.selfdrive.ui.mici.layouts.settings.device import MiciFccModal # tici dialogs - from openpilot.selfdrive.ui.onroad.driver_camera_dialog import DriverCameraDialog as TiciDriverCameraDialog + from openpilot.selfdrive.ui.onroad.cabin_camera_dialog import CabinCameraDialog as TiciCabinCameraDialog from openpilot.selfdrive.ui.layouts.onboarding import OnboardingWindow as TiciOnboardingWindow from openpilot.selfdrive.ui.widgets.pairing_dialog import PairingDialog as TiciPairingDialog from openpilot.system.ui.widgets.confirm_dialog import ConfirmDialog @@ -71,7 +71,7 @@ class TestWidgetLeaks(OpenpilotTestCase): for ctor in ( # mici - MiciDriverCameraDialog, MiciPairingDialog, + MiciCabinCameraDialog, MiciPairingDialog, lambda: MiciTrainingGuide(lambda: None), lambda: MiciOnboardingWindow(lambda: None), lambda: BigDialog("test", "test"), @@ -79,7 +79,7 @@ class TestWidgetLeaks(OpenpilotTestCase): lambda: BigInputDialog("test"), lambda: MiciFccModal(text="test"), # tici - TiciDriverCameraDialog, TiciOnboardingWindow, TiciPairingDialog, Keyboard, + TiciCabinCameraDialog, TiciOnboardingWindow, TiciPairingDialog, Keyboard, lambda: ConfirmDialog("test", "ok"), lambda: MultiOptionDialog("test", ["a", "b"]), lambda: HtmlModal(text="test"), diff --git a/openpilot/selfdrive/ui/onroad/augmented_road_view.py b/openpilot/selfdrive/ui/onroad/augmented_road_view.py index ff0cfb5eea..44d8910a03 100644 --- a/openpilot/selfdrive/ui/onroad/augmented_road_view.py +++ b/openpilot/selfdrive/ui/onroad/augmented_road_view.py @@ -15,7 +15,7 @@ from openpilot.common.transformations.orientation import rot_from_euler OpState = log.SelfdriveState.OpenpilotState CALIBRATED = log.LiveCalibrationData.Status.calibrated -ROAD_CAM = VisionStreamType.VISION_STREAM_ROAD +NARROW_ROAD_CAM = VisionStreamType.VISION_STREAM_NARROW_ROAD WIDE_CAM = VisionStreamType.VISION_STREAM_WIDE_ROAD DEFAULT_DEVICE_CAMERA = DEVICE_CAMERAS["tici", "ar0231"] @@ -31,7 +31,7 @@ INF_POINT = np.array([1000.0, 0.0, 0.0]) class AugmentedRoadView(CameraView): - def __init__(self, stream_type: VisionStreamType = VisionStreamType.VISION_STREAM_ROAD): + def __init__(self, stream_type: VisionStreamType = VisionStreamType.VISION_STREAM_NARROW_ROAD): super().__init__("camerad", stream_type) self._set_placeholder_color(BORDER_COLORS[UIStatus.DISENGAGED]) @@ -115,12 +115,12 @@ class AugmentedRoadView(CameraView): if v_ego < WIDE_CAM_MAX_SPEED: target = WIDE_CAM elif v_ego > ROAD_CAM_MIN_SPEED: - target = ROAD_CAM + target = NARROW_ROAD_CAM else: # Hysteresis zone - keep current stream target = self.stream_type else: - target = ROAD_CAM + target = NARROW_ROAD_CAM if self.stream_type != target: self.switch_stream(target) @@ -128,8 +128,8 @@ class AugmentedRoadView(CameraView): def _update_calibration(self): # Update device camera if not already set sm = ui_state.sm - if not self.device_camera and sm.seen['roadCameraState'] and sm.seen['deviceState']: - self.device_camera = DEVICE_CAMERAS[(str(sm['deviceState'].deviceType), str(sm['roadCameraState'].sensor))] + if not self.device_camera and sm.seen['narrowRoadCameraState'] and sm.seen['deviceState']: + self.device_camera = DEVICE_CAMERAS[(str(sm['deviceState'].deviceType), str(sm['narrowRoadCameraState'].sensor))] # Check if live calibration data is available and valid if not (sm.updated["liveCalibration"] and sm.valid['liveCalibration']): @@ -162,7 +162,7 @@ class AugmentedRoadView(CameraView): # Get camera configuration device_camera = self.device_camera or DEFAULT_DEVICE_CAMERA is_wide_camera = self.stream_type == WIDE_CAM - intrinsic = device_camera.ecam.intrinsics if is_wide_camera else device_camera.fcam.intrinsics + intrinsic = device_camera.wide_road.intrinsics if is_wide_camera else device_camera.narrow_road.intrinsics calibration = self.view_from_wide_calib if is_wide_camera else self.view_from_calib zoom = 2.0 if is_wide_camera else 1.1 @@ -213,7 +213,7 @@ class AugmentedRoadView(CameraView): if __name__ == "__main__": gui_app.init_window("OnRoad Camera View") - road_camera_view = AugmentedRoadView(ROAD_CAM) + road_camera_view = AugmentedRoadView(NARROW_ROAD_CAM) gui_app.push_widget(road_camera_view) print("***press space to switch camera view***") try: @@ -221,7 +221,7 @@ if __name__ == "__main__": ui_state.update() if rl.is_key_released(rl.KeyboardKey.KEY_SPACE): if WIDE_CAM in road_camera_view.available_streams: - stream = ROAD_CAM if road_camera_view.stream_type == WIDE_CAM else WIDE_CAM + stream = NARROW_ROAD_CAM if road_camera_view.stream_type == WIDE_CAM else WIDE_CAM road_camera_view.switch_stream(stream) finally: road_camera_view.close() diff --git a/openpilot/selfdrive/ui/onroad/driver_camera_dialog.py b/openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py similarity index 92% rename from openpilot/selfdrive/ui/onroad/driver_camera_dialog.py rename to openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py index 8735774458..7bb1917c35 100644 --- a/openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +++ b/openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py @@ -9,9 +9,9 @@ from openpilot.system.ui.lib.multilang import tr from openpilot.system.ui.widgets.label import gui_label -class DriverCameraDialog(CameraView): +class CabinCameraDialog(CameraView): def __init__(self): - super().__init__("camerad", VisionStreamType.VISION_STREAM_DRIVER) + super().__init__("camerad", VisionStreamType.VISION_STREAM_CABIN) self.driver_state_renderer = DriverStateRenderer() # TODO: this can grow unbounded, should be given some thought device.add_interactive_timeout_callback(gui_app.pop_widget) @@ -100,12 +100,12 @@ class DriverCameraDialog(CameraView): if __name__ == "__main__": - gui_app.init_window("Driver Camera View") + gui_app.init_window("Cabin Camera View") - driver_camera_view = DriverCameraDialog() - gui_app.push_widget(driver_camera_view) + cabin_camera_view = CabinCameraDialog() + gui_app.push_widget(cabin_camera_view) try: for _ in gui_app.render(): ui_state.update() finally: - driver_camera_view.close() + cabin_camera_view.close() diff --git a/openpilot/selfdrive/ui/onroad/cameraview.py b/openpilot/selfdrive/ui/onroad/cameraview.py index 3b6a2fcd30..aa4f2271dc 100644 --- a/openpilot/selfdrive/ui/onroad/cameraview.py +++ b/openpilot/selfdrive/ui/onroad/cameraview.py @@ -203,8 +203,8 @@ class CameraView(Widget): transform = self._calc_frame_matrix(rect) src_rect = rl.Rectangle(0, 0, float(self.frame.width), float(self.frame.height)) - # Flip driver camera horizontally - if self._stream_type == VisionStreamType.VISION_STREAM_DRIVER: + # Flip cabin camera horizontally + if self._stream_type == VisionStreamType.VISION_STREAM_CABIN: src_rect.width = -src_rect.width # Calculate scale @@ -363,6 +363,6 @@ class CameraView(Widget): if __name__ == "__main__": gui_app.init_window("camera view") - road = CameraView("camerad", VisionStreamType.VISION_STREAM_ROAD) + road = CameraView("camerad", VisionStreamType.VISION_STREAM_NARROW_ROAD) for _ in gui_app.render(): road.render(rl.Rectangle(0, 0, gui_app.width, gui_app.height)) diff --git a/openpilot/selfdrive/ui/tests/diff/replay_script.py b/openpilot/selfdrive/ui/tests/diff/replay_script.py index 91e6d3b921..30e811dbc9 100644 --- a/openpilot/selfdrive/ui/tests/diff/replay_script.py +++ b/openpilot/selfdrive/ui/tests/diff/replay_script.py @@ -321,7 +321,7 @@ def build_mici_script(pm: PubMaster, main_layout, script: Script) -> None: lambda: swipe_left(width * 2), click, # first page, click next lambda: swipe_left(width * 2), swipe_down # second page, go back (TODO: make driver cam preview work) ), - None, # TODO: preview driver camera; enabling this causes MultiplePublishersError later in onroad alert tests + None, # TODO: preview cabin camera; enabling this causes MultiplePublishersError later in onroad alert tests lambda: explore_setting(swipe_left), # terms & conditions (swipe to view QR code) lambda: explore_setting(lambda: swipe_up(height * 3), lambda: swipe_down(height * 3)), # regulatory info lambda: run_actions(click, lambda: swipe_left(width)), # reset calibration confirm (goes back automatically) diff --git a/openpilot/selfdrive/ui/tests/profile_onroad.py b/openpilot/selfdrive/ui/tests/profile_onroad.py index 7c73bfa97b..98816f9ddf 100755 --- a/openpilot/selfdrive/ui/tests/profile_onroad.py +++ b/openpilot/selfdrive/ui/tests/profile_onroad.py @@ -90,7 +90,7 @@ if __name__ == "__main__": W, H = 2048, 1216 vipc = VisionIpcServer("camerad") - vipc.create_buffers(VisionStreamType.VISION_STREAM_ROAD, 5, W, H) + vipc.create_buffers(VisionStreamType.VISION_STREAM_NARROW_ROAD, 5, W, H) vipc.start_listener() yuv_buffer_size = W * H + (W // 2) * (H // 2) * 2 yuv_data = np.random.default_rng().integers(0, 256, yuv_buffer_size, dtype=np.uint8).tobytes() @@ -100,7 +100,7 @@ if __name__ == "__main__": break if ui_state.sm.frame % 3 == 0: eof = int((ui_state.sm.frame % 3) * 0.05 * 1e9) - vipc.send(VisionStreamType.VISION_STREAM_ROAD, yuv_data, ui_state.sm.frame % 3, eof, eof) + vipc.send(VisionStreamType.VISION_STREAM_NARROW_ROAD, yuv_data, ui_state.sm.frame % 3, eof, eof) ui_state.update() pr.dump_stats(f'{args.output}_deterministic.stats') diff --git a/openpilot/selfdrive/ui/translations/app.pot b/openpilot/selfdrive/ui/translations/app.pot index cb0491e107..cdd0af4c86 100644 --- a/openpilot/selfdrive/ui/translations/app.pot +++ b/openpilot/selfdrive/ui/translations/app.pot @@ -381,7 +381,7 @@ msgid "ERROR" msgstr "" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" msgstr "" #: openpilot/selfdrive/ui/layouts/settings/device.py @@ -449,7 +449,7 @@ msgid "Serial" msgstr "" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" +msgid "Cabin Camera" msgstr "" #: openpilot/selfdrive/ui/layouts/settings/device.py @@ -704,7 +704,7 @@ msgid "Enable driver monitoring even when openpilot is not engaged." msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py @@ -748,7 +748,7 @@ msgid "Always-On Driver Monitoring" msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" +msgid "Record and Upload Cabin Camera" msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py @@ -779,10 +779,6 @@ msgstr "" msgid "Enable the openpilot longitudinal control (alpha) toggle to allow Experimental mode." msgstr "" -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py -msgid "camera starting" -msgstr "" - #: openpilot/selfdrive/ui/onroad/hud_renderer.py msgid "MAX" msgstr "" @@ -795,6 +791,10 @@ msgstr "" msgid "mph" msgstr "" +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py +msgid "camera starting" +msgstr "" + #: openpilot/selfdrive/ui/onroad/alert_renderer.py msgid "openpilot Unavailable" msgstr "" diff --git a/openpilot/selfdrive/ui/translations/app_de.po b/openpilot/selfdrive/ui/translations/app_de.po index 43baa133ae..1a3cd51ac4 100644 --- a/openpilot/selfdrive/ui/translations/app_de.po +++ b/openpilot/selfdrive/ui/translations/app_de.po @@ -126,6 +126,10 @@ msgstr "VERBINDUNG" msgid "CONNECTING..." msgstr "VERBINDUNG" +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "Dongle-ID" msgid "Download" msgstr "Herunterladen" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "Fahrerkamera" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "Fahrstil" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "Verhindern Sie das Hochladen großer Datenmengen bei einer getakteten Mobilfunkverbindung" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "Vorschau der Fahrer‑Kamera, um sicherzustellen, dass die Fahrerüberwachung gute Sicht hat. (Fahrzeug muss ausgeschaltet sein)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "Neustarten und aktualisieren" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "Fahrerkamera aufzeichnen und hochladen" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "Jetzt abonnieren" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "Daten von der Fahrer‑Kamera hochladen und den Fahrerüberwachungs‑Algorithmus verbessern." +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "Sie müssen die Nutzungsbedingungen akzeptieren, um openpilot zu verwend msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "Sie müssen die Nutzungsbedingungen akzeptieren, um openpilot zu verwenden. Lesen Sie die aktuellen Bedingungen unter https://comma.ai/terms, bevor Sie fortfahren." -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "Kamera startet" diff --git a/openpilot/selfdrive/ui/translations/app_en.po b/openpilot/selfdrive/ui/translations/app_en.po index 3e578de6a4..c45da337eb 100644 --- a/openpilot/selfdrive/ui/translations/app_en.po +++ b/openpilot/selfdrive/ui/translations/app_en.po @@ -126,6 +126,10 @@ msgstr "CONNECT" msgid "CONNECTING..." msgstr "CONNECTING..." +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "Dongle ID" msgid "Download" msgstr "Download" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "Driver Camera" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "Driving Personality" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "Prevent large data uploads when on a metered cellular connection" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "Reboot and Update" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "Record and Upload Driver Camera" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "Upgrade Now" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "Upload data from the driver facing camera and help improve the driver monitoring algorithm." +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "You must accept the Terms and Conditions in order to use openpilot." msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "camera starting" diff --git a/openpilot/selfdrive/ui/translations/app_es.po b/openpilot/selfdrive/ui/translations/app_es.po index e1c74f53c2..55ba293128 100644 --- a/openpilot/selfdrive/ui/translations/app_es.po +++ b/openpilot/selfdrive/ui/translations/app_es.po @@ -126,6 +126,10 @@ msgstr "CONECTAR" msgid "CONNECTING..." msgstr "CONECTAR" +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "ID del dongle" msgid "Download" msgstr "Descargar" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "Cámara del conductor" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "Estilo de conducción" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "Evite grandes cargas de datos cuando esté en una conexión celular medida" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "Previsualiza la cámara hacia el conductor para asegurarte de que la supervisión del conductor tenga buena visibilidad. (el vehículo debe estar apagado)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "Reiniciar y actualizar" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "Grabar y subir cámara del conductor" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "Mejorar ahora" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "Sube datos de la cámara orientada al conductor y ayuda a mejorar el algoritmo de supervisión del conductor." +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "Debes aceptar los Términos y Condiciones para poder usar openpilot." msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "Debes aceptar los Términos y Condiciones para usar openpilot. Lee los términos más recientes en https://comma.ai/terms antes de continuar." -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "iniciando cámara" diff --git a/openpilot/selfdrive/ui/translations/app_fr.po b/openpilot/selfdrive/ui/translations/app_fr.po index b76018394f..1e0f370dcd 100644 --- a/openpilot/selfdrive/ui/translations/app_fr.po +++ b/openpilot/selfdrive/ui/translations/app_fr.po @@ -126,6 +126,10 @@ msgstr "CONNECTER" msgid "CONNECTING..." msgstr "CONNECTER..." +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "ID du dongle" msgid "Download" msgstr "Télécharger" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "Caméra conducteur" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "Personnalité de conduite" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "Eviter les transferts de données volumineux lors d'une connexion à un réseau cellulaire limité" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "Prévisualisez la caméra orientée conducteur pour vous assurer que la surveillance du conducteur a une bonne visibilité. (le véhicule doit être éteint)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "Redémarrer et mettre à jour" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "Enregistrer et téléverser la caméra conducteur" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "Mettre à niveau maintenant" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "Téléverser les données de la caméra orientée conducteur et aider à améliorer l'algorithme de surveillance du conducteur." +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "Vous devez accepter les conditions générales pour utiliser openpilot." msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "Vous devez accepter les conditions générales pour utiliser openpilot. Lisez les dernières conditions sur https://comma.ai/terms avant de continuer." -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "démarrage de la caméra" diff --git a/openpilot/selfdrive/ui/translations/app_ja.po b/openpilot/selfdrive/ui/translations/app_ja.po index 4fbdb6fe80..2a2f76ae15 100644 --- a/openpilot/selfdrive/ui/translations/app_ja.po +++ b/openpilot/selfdrive/ui/translations/app_ja.po @@ -126,6 +126,10 @@ msgstr "接続" msgid "CONNECTING..." msgstr "接続中..." +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "ドングルID" msgid "Download" msgstr "ダウンロード" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "ドライバーカメラ" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "走行性格" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "従量課金の携帯回線接続時は大きなデータのアップロードを抑制" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "ドライバー向きカメラのプレビューでモニタリングの視界を確認します。(車両は停止状態である必要があります)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "再起動して更新" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "ドライバーカメラを記録してアップロード" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "今すぐアップグレード" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "ドライバー向きカメラのデータをアップロードしてモニタリングアルゴリズムの改善に協力してください。" +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "openpilotを使用するには、利用規約に同意する必要があ msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "openpilotを使用するには利用規約に同意する必要があります。続行する前に https://comma.ai/terms の最新の規約をお読みください。" -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "カメラを起動中" diff --git a/openpilot/selfdrive/ui/translations/app_ko.po b/openpilot/selfdrive/ui/translations/app_ko.po index 29d297be88..863986c0b6 100644 --- a/openpilot/selfdrive/ui/translations/app_ko.po +++ b/openpilot/selfdrive/ui/translations/app_ko.po @@ -126,6 +126,10 @@ msgstr "연결" msgid "CONNECTING..." msgstr "연결 중..." +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "동글 ID" msgid "Download" msgstr "다운로드" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "운전자 카메라" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "주행 성향" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "종량제 셀룰러 연결 시 대용량 업로드 방지" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "운전자 모니터링의 가시성을 확인하기 위해 운전자 카메라를 미리 봅니다. (차량은 꺼져 있어야 합니다)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "재시작 및 업데이트" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "운전자 카메라 기록 및 업로드" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "지금 업그레이드" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "운전자 방향 카메라 데이터를 업로드하여 운전자 모니터링 알고리즘 개선에 도움을 주세요." +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "openpilot을 사용하려면 약관에 동의해야 합니다." msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "openpilot을 사용하려면 약관에 동의해야 합니다. 계속하기 전에 https://comma.ai/terms 에서 최신 약관을 읽어주세요." -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "카메라 시작 중" diff --git a/openpilot/selfdrive/ui/translations/app_pt-BR.po b/openpilot/selfdrive/ui/translations/app_pt-BR.po index 29a95b22fd..a478ccc931 100644 --- a/openpilot/selfdrive/ui/translations/app_pt-BR.po +++ b/openpilot/selfdrive/ui/translations/app_pt-BR.po @@ -126,6 +126,10 @@ msgstr "CONECTAR" msgid "CONNECTING..." msgstr "CONECTANDO..." +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "ID do Dongle" msgid "Download" msgstr "Baixar" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "Câmera do Motorista" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "Personalidade" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "Evitar uploads grandes de dados em conexões móveis limitadas" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "Pré-visualize a câmera voltada para o motorista para garantir que o monitoramento do motorista tenha boa visibilidade. (veículo deve estar desligado)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "Reiniciar e Atualizar" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "Gravar e Enviar Câmera do Motorista" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "Atualizar Agora" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "Envie dados da câmera voltada para o motorista e ajude a melhorar o algoritmo de monitoramento do motorista." +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "Você deve aceitar os Termos e Condições para usar o openpilot." msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "Você deve aceitar os Termos e Condições para usar o openpilot. Leia os termos mais recentes em https://comma.ai/terms antes de continuar." -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "câmera iniciando" diff --git a/openpilot/selfdrive/ui/translations/app_th.po b/openpilot/selfdrive/ui/translations/app_th.po index 59cc8df33d..c15d859954 100644 --- a/openpilot/selfdrive/ui/translations/app_th.po +++ b/openpilot/selfdrive/ui/translations/app_th.po @@ -126,6 +126,10 @@ msgstr "เชื่อมต่อ" msgid "CONNECTING..." msgstr "กำลังเชื่อมต่อ..." +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "รหัสดองเกิล" msgid "Download" msgstr "ดาวน์โหลด" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "กล้องไดร์เวอร์" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "บุคลิกภาพในการขับขี่" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "ป้องกันการอัพโหลดข้อมูลขนาดใหญ่เมื่อใช้การเชื่อมต่อมือถือแบบคิดค่าบริการตามปริมาณข้อมูล" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "ดูตัวอย่างกล้องที่หันหน้าไปทางคนขับเพื่อให้แน่ใจว่าการตรวจสอบผู้ขับขี่มีทัศนวิสัยที่ดี (รถจะต้องถูกปิด)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "รีบูตและอัปเดต" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "บันทึกและอัพโหลดกล้องไดร์เวอร์" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "อัพเกรดทันที" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "อัปโหลดข้อมูลจากกล้องที่หันเข้าหาคนขับและช่วยปรับปรุงอัลกอริธึมการตรวจสอบผู้ขับขี่" +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "คุณต้องยอมรับข้อกำหนดและ msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "คุณต้องยอมรับข้อกำหนดและเงื่อนไขเพื่อใช้ openpilot อ่านข้อกำหนดล่าสุดได้ที่ https://comma.ai/terms ก่อนดำเนินการต่อ" -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "กำลังเริ่มกล้อง" diff --git a/openpilot/selfdrive/ui/translations/app_tr.po b/openpilot/selfdrive/ui/translations/app_tr.po index cf15e2c806..aefbb535de 100644 --- a/openpilot/selfdrive/ui/translations/app_tr.po +++ b/openpilot/selfdrive/ui/translations/app_tr.po @@ -126,6 +126,10 @@ msgstr "BAĞLAN" msgid "CONNECTING..." msgstr "BAĞLAN" +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "Dongle kimliği" msgid "Download" msgstr "İndir" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "Sürücü Kamerası" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "Sürüş Kişiliği" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "Ölçülü bir hücresel bağlantıdayken büyük veri yüklemelerini engelle" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "Sürücü izleme görünürlüğünün iyi olduğundan emin olmak için sürücüye bakan kamerayı önizleyin. (araç kapalı olmalıdır)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "Yeniden Başlat ve Güncelle" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "Sürücü Kamerasını Kaydet ve Yükle" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "Şimdi Yükselt" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "Sürücüye bakan kameradan veri yükleyin ve sürücü izleme algoritmasını geliştirmeye yardımcı olun." +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "openpilot'u kullanmak için Şartlar ve Koşulları kabul etmelisiniz." msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "openpilot'u kullanmak için Şartlar ve Koşulları kabul etmelisiniz. Devam etmeden önce en güncel şartları https://comma.ai/terms adresinde okuyun." -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "kamera başlatılıyor" diff --git a/openpilot/selfdrive/ui/translations/app_uk.po b/openpilot/selfdrive/ui/translations/app_uk.po index 24fab4f2e8..e4717ae462 100644 --- a/openpilot/selfdrive/ui/translations/app_uk.po +++ b/openpilot/selfdrive/ui/translations/app_uk.po @@ -126,6 +126,10 @@ msgstr "ПІДКЛЮЧИТИ" msgid "CONNECTING..." msgstr "ПІДКЛЮЧА..." +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "ID ключа" msgid "Download" msgstr "Завантажити" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "Камера водія" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "Стиль водіння" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "Запобігати великим завантаженням даних під час лімітного стільникового з'єднання" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "Попередньо перегляньте камеру, спрямовану на водія, щоб переконатися, що система моніторингу водія має добру видимість. (автомобіль повинен бути вимкнений)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "Перезавантажити та оновити" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "Писати та вантажити відео з камери водія" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "Оновити зараз" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "Завантажуйте дані з камери, спрямованої на водія, та допоможіть покращити алгоритм моніторингу водія." +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "Ви повинні прийняти Умови та положення, msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "Ви повинні прийняти Умови використання, щоб користуватися openpilot. Перед тим, як продовжити, ознайомтеся з останніми умовами на сайті https://comma.ai/terms." -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "запуск камери" diff --git a/openpilot/selfdrive/ui/translations/app_zh-CHS.po b/openpilot/selfdrive/ui/translations/app_zh-CHS.po index 2028b6ac1f..f1ec22857f 100644 --- a/openpilot/selfdrive/ui/translations/app_zh-CHS.po +++ b/openpilot/selfdrive/ui/translations/app_zh-CHS.po @@ -126,6 +126,10 @@ msgstr "连接" msgid "CONNECTING..." msgstr "连接中..." +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "设备 ID" msgid "Download" msgstr "下载" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "车内摄像头" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "驾驶风格" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "在计量制蜂窝网络时避免大量上传" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "预览车内摄像头以确保驾驶员监控视野良好。(车辆必须熄火)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "重启并更新" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "录制并上传车内摄像头" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "立即升级" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "上传车内摄像头数据,帮助改进驾驶员监控算法。" +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "您必须接受条款与条件才能使用 openpilot。" msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "您必须接受条款与条件才能使用 openpilot。继续前请阅读 https://comma.ai/terms 上的最新条款。" -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "相机启动中" diff --git a/openpilot/selfdrive/ui/translations/app_zh-CHT.po b/openpilot/selfdrive/ui/translations/app_zh-CHT.po index 39a67b432d..c5e5289984 100644 --- a/openpilot/selfdrive/ui/translations/app_zh-CHT.po +++ b/openpilot/selfdrive/ui/translations/app_zh-CHT.po @@ -126,6 +126,10 @@ msgstr "連線" msgid "CONNECTING..." msgstr "連線中..." +#: openpilot/selfdrive/ui/layouts/settings/device.py +msgid "Cabin Camera" +msgstr "" + #: openpilot/system/ui/widgets/confirm_dialog.py #: openpilot/system/ui/widgets/keyboard.py #: openpilot/system/ui/widgets/network.py @@ -205,10 +209,6 @@ msgstr "裝置 ID" msgid "Download" msgstr "下載" -#: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Driver Camera" -msgstr "車內鏡頭" - #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Driving Personality" msgstr "駕駛風格" @@ -466,8 +466,8 @@ msgid "Prevent large data uploads when on a metered cellular connection" msgstr "在計量制行動網路時避免大量上傳" #: openpilot/selfdrive/ui/layouts/settings/device.py -msgid "Preview the driver facing camera to ensure that driver monitoring has good visibility. (vehicle must be off)" -msgstr "預覽車內鏡頭以確保駕駛監控視野良好。(車輛須熄火)" +msgid "Preview the cabin camera to ensure that driver monitoring has good visibility. (vehicle must be off)" +msgstr "" #: openpilot/selfdrive/ui/widgets/pairing_dialog.py msgid "QR Code Error" @@ -498,8 +498,8 @@ msgid "Reboot and Update" msgstr "重新啟動並更新" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Record and Upload Driver Camera" -msgstr "錄製並上傳車內鏡頭" +msgid "Record and Upload Cabin Camera" +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Record and Upload Microphone Audio" @@ -638,8 +638,8 @@ msgid "Upgrade Now" msgstr "立即升級" #: openpilot/selfdrive/ui/layouts/settings/toggles.py -msgid "Upload data from the driver facing camera and help improve the driver monitoring algorithm." -msgstr "上傳車內鏡頭資料,協助改善駕駛監控演算法。" +msgid "Upload data from the cabin camera and help improve the driver monitoring algorithm." +msgstr "" #: openpilot/selfdrive/ui/layouts/settings/toggles.py msgid "Use Metric System" @@ -685,7 +685,7 @@ msgstr "您必須接受條款與細則才能使用 openpilot。" msgid "You must accept the Terms and Conditions to use openpilot. Read the latest terms at https://comma.ai/terms before continuing." msgstr "您必須接受條款與細則才能使用 openpilot。繼續前請閱讀 https://comma.ai/terms 上的最新條款。" -#: openpilot/selfdrive/ui/onroad/driver_camera_dialog.py +#: openpilot/selfdrive/ui/onroad/cabin_camera_dialog.py msgid "camera starting" msgstr "相機啟動中" diff --git a/openpilot/selfdrive/ui/ui_state.py b/openpilot/selfdrive/ui/ui_state.py index dca583d107..943ba46014 100644 --- a/openpilot/selfdrive/ui/ui_state.py +++ b/openpilot/selfdrive/ui/ui_state.py @@ -48,7 +48,7 @@ class UIState: "driverMonitoringState", "carState", "driverStateV2", - "roadCameraState", + "narrowRoadCameraState", "wideRoadCameraState", "managerState", "selfdriveState", diff --git a/openpilot/selfdrive/ui/watch3.py b/openpilot/selfdrive/ui/watch3.py index 162df82658..c601ccabe9 100755 --- a/openpilot/selfdrive/ui/watch3.py +++ b/openpilot/selfdrive/ui/watch3.py @@ -8,8 +8,8 @@ from openpilot.selfdrive.ui.onroad.cameraview import CameraView if __name__ == "__main__": gui_app.init_window("watch3") - road = CameraView("camerad", VisionStreamType.VISION_STREAM_ROAD) - driver = CameraView("camerad", VisionStreamType.VISION_STREAM_DRIVER) + road = CameraView("camerad", VisionStreamType.VISION_STREAM_NARROW_ROAD) + driver = CameraView("camerad", VisionStreamType.VISION_STREAM_CABIN) wide = CameraView("camerad", VisionStreamType.VISION_STREAM_WIDE_ROAD) for _ in gui_app.render(): road.render(rl.Rectangle(gui_app.width // 4, 0, gui_app.width // 2, gui_app.height // 2)) diff --git a/openpilot/system/camerad/cameras/camera_qcom2.cc b/openpilot/system/camerad/cameras/camera_qcom2.cc index 63640920db..4d30cd1e2c 100644 --- a/openpilot/system/camerad/cameras/camera_qcom2.cc +++ b/openpilot/system/camerad/cameras/camera_qcom2.cc @@ -234,11 +234,11 @@ void CameraState::sendState() { framed.setSensor(camera.sensor->image_sensor); // Log raw frames for road camera - if (env_log_raw_frames && camera.cc.stream_type == VISION_STREAM_ROAD && meta.frame_id % 100 == 5) { // no overlap with qlog decimation + if (env_log_raw_frames && camera.cc.stream_type == VISION_STREAM_NARROW_ROAD && meta.frame_id % 100 == 5) { // no overlap with qlog decimation framed.setImage(get_raw_frame_image(&camera.buf)); } - set_camera_exposure(calculate_exposure_value(&camera.buf, ae_xywh, 2, camera.cc.stream_type != VISION_STREAM_DRIVER ? 2 : 4)); + set_camera_exposure(calculate_exposure_value(&camera.buf, ae_xywh, 2, camera.cc.stream_type != VISION_STREAM_CABIN ? 2 : 4)); // Send the message pm->send(camera.cc.publish_name, msg); diff --git a/openpilot/system/camerad/cameras/hw.h b/openpilot/system/camerad/cameras/hw.h index 45546258a9..8f9de5bede 100644 --- a/openpilot/system/camerad/cameras/hw.h +++ b/openpilot/system/camerad/cameras/hw.h @@ -44,12 +44,12 @@ const CameraConfig WIDE_ROAD_CAMERA_CONFIG = { .staggered_sof = false, }; -const CameraConfig ROAD_CAMERA_CONFIG = { +const CameraConfig NARROW_ROAD_CAMERA_CONFIG = { .camera_num = 1, - .stream_type = VISION_STREAM_ROAD, + .stream_type = VISION_STREAM_NARROW_ROAD, .focal_len = 8.0, - .publish_name = "roadCameraState", - .init_camera_state = &cereal::Event::Builder::initRoadCameraState, + .publish_name = "narrowRoadCameraState", + .init_camera_state = &cereal::Event::Builder::initNarrowRoadCameraState, .enabled = !getenv("DISABLE_ROAD"), .phy = CAM_ISP_IFE_IN_RES_PHY_1, .vignetting_correction = true, @@ -57,12 +57,12 @@ const CameraConfig ROAD_CAMERA_CONFIG = { .staggered_sof = false, }; -const CameraConfig DRIVER_CAMERA_CONFIG = { +const CameraConfig CABIN_CAMERA_CONFIG = { .camera_num = 2, - .stream_type = VISION_STREAM_DRIVER, + .stream_type = VISION_STREAM_CABIN, .focal_len = 1.71, - .publish_name = "driverCameraState", - .init_camera_state = &cereal::Event::Builder::initDriverCameraState, + .publish_name = "cabinCameraState", + .init_camera_state = &cereal::Event::Builder::initCabinCameraState, .enabled = !getenv("DISABLE_DRIVER"), .phy = CAM_ISP_IFE_IN_RES_PHY_2, .vignetting_correction = false, @@ -70,4 +70,4 @@ const CameraConfig DRIVER_CAMERA_CONFIG = { .staggered_sof = true, }; -const CameraConfig ALL_CAMERA_CONFIGS[] = {WIDE_ROAD_CAMERA_CONFIG, ROAD_CAMERA_CONFIG, DRIVER_CAMERA_CONFIG}; +const CameraConfig ALL_CAMERA_CONFIGS[] = {WIDE_ROAD_CAMERA_CONFIG, NARROW_ROAD_CAMERA_CONFIG, CABIN_CAMERA_CONFIG}; diff --git a/openpilot/system/camerad/snapshot.py b/openpilot/system/camerad/snapshot.py index f865a452ff..622da4faef 100755 --- a/openpilot/system/camerad/snapshot.py +++ b/openpilot/system/camerad/snapshot.py @@ -9,8 +9,8 @@ from openpilot.common.realtime import DT_MDL VISION_STREAMS = { - "roadCameraState": VisionStreamType.VISION_STREAM_ROAD, - "driverCameraState": VisionStreamType.VISION_STREAM_DRIVER, + "narrowRoadCameraState": VisionStreamType.VISION_STREAM_NARROW_ROAD, + "cabinCameraState": VisionStreamType.VISION_STREAM_CABIN, "wideRoadCameraState": VisionStreamType.VISION_STREAM_WIDE_ROAD, } @@ -45,7 +45,7 @@ def extract_image(buf): return yuv_to_rgb(y, u, v) -def get_snapshots(frame="roadCameraState", front_frame="driverCameraState"): +def get_snapshots(frame="narrowRoadCameraState", front_frame="cabinCameraState"): sockets = [s for s in (frame, front_frame) if s is not None] sm = messaging.SubMaster(sockets) vipc_clients = {s: VisionIpcClient("camerad", VISION_STREAMS[s], True) for s in sockets} diff --git a/openpilot/system/camerad/test/test_camerad.py b/openpilot/system/camerad/test/test_camerad.py index 580a30683b..410ea9fdb3 100755 --- a/openpilot/system/camerad/test/test_camerad.py +++ b/openpilot/system/camerad/test/test_camerad.py @@ -13,7 +13,7 @@ from openpilot.system.camerad.snapshot import get_snapshots from openpilot.selfdrive.test.helpers import collect_logs, log_collector, processes_context TEST_TIMESPAN = 10 -CAMERAS = ('roadCameraState', 'driverCameraState', 'wideRoadCameraState') +CAMERAS = ('narrowRoadCameraState', 'cabinCameraState', 'wideRoadCameraState') EXPOSURE_STABLE_COUNT = 3 EXPOSURE_RANGE = (0.15, 0.35) MAX_TEST_TIME = 25 @@ -49,7 +49,7 @@ def _camera_session(): exposure = {cam: [] for cam in CAMERAS} start = time.monotonic() while time.monotonic() - start < MAX_TEST_TIME: - rpic, dpic = get_snapshots(frame="roadCameraState", front_frame="driverCameraState") + rpic, dpic = get_snapshots(frame="narrowRoadCameraState", front_frame="cabinCameraState") wpic, _ = get_snapshots(frame="wideRoadCameraState") for cam, img in zip(CAMERAS, [rpic, dpic, wpic], strict=True): exposure[cam].append(_exposure_stats(img)) @@ -106,8 +106,8 @@ class TestCamerad(OpenpilotTestCase): assert set(np.diff(self.logs[c]['frameId'])) == {1, }, f"{c} has frame skips" def test_frame_sync(self): - SYNCED_CAMS = ('roadCameraState', 'wideRoadCameraState') - n = range(len(self.logs['roadCameraState']['t'][:-10])) + SYNCED_CAMS = ('narrowRoadCameraState', 'wideRoadCameraState') + n = range(len(self.logs['narrowRoadCameraState']['t'][:-10])) frame_ids = {i: [self.logs[cam]['frameId'][i] for cam in CAMERAS] for i in n} assert all(len(set(v)) == 1 for v in frame_ids.values()), "frame IDs not aligned" @@ -118,10 +118,10 @@ class TestCamerad(OpenpilotTestCase): laggy_frames = {k: v for k, v in diffs.items() if v > 1.1} assert len(laggy_frames) == 0, f"Frames not synced properly: {laggy_frames=}" - # driver camera should be staggered ~25ms from road camera + # cabin camera should be staggered ~25ms from road camera for i in n: - offset_ms = abs(self.logs['driverCameraState']['timestampSof'][i] - self.logs['roadCameraState']['timestampSof'][i]) / 1e6 - assert 20 < offset_ms < 30, f"driver camera stagger out of range at frame {i}: {offset_ms:.1f}ms (expected ~25ms)" + offset_ms = abs(self.logs['cabinCameraState']['timestampSof'][i] - self.logs['narrowRoadCameraState']['timestampSof'][i]) / 1e6 + assert 20 < offset_ms < 30, f"cabin camera stagger out of range at frame {i}: {offset_ms:.1f}ms (expected ~25ms)" def test_sanity_checks(self): self._sanity_checks(self.logs) diff --git a/openpilot/system/camerad/webcam/camerad.py b/openpilot/system/camerad/webcam/camerad.py index bba982f897..4dfa5f3371 100755 --- a/openpilot/system/camerad/webcam/camerad.py +++ b/openpilot/system/camerad/webcam/camerad.py @@ -11,19 +11,19 @@ from openpilot.cereal import messaging from openpilot.system.camerad.webcam.camera import Camera from openpilot.common.realtime import Ratekeeper -ROAD_CAM = os.getenv("ROAD_CAM", "0") +NARROW_ROAD_CAM = os.getenv("NARROW_ROAD_CAM", os.getenv("ROAD_CAM", "0")) WIDE_CAM = os.getenv("WIDE_CAM") DRIVER_CAM = os.getenv("DRIVER_CAM") CameraType = namedtuple("CameraType", ["msg_name", "stream_type", "cam_id"]) CAMERAS = [ - CameraType("roadCameraState", VisionStreamType.VISION_STREAM_ROAD, ROAD_CAM) + CameraType("narrowRoadCameraState", VisionStreamType.VISION_STREAM_NARROW_ROAD, NARROW_ROAD_CAM) ] if WIDE_CAM: CAMERAS.append(CameraType("wideRoadCameraState", VisionStreamType.VISION_STREAM_WIDE_ROAD, WIDE_CAM)) if DRIVER_CAM: - CAMERAS.append(CameraType("driverCameraState", VisionStreamType.VISION_STREAM_DRIVER, DRIVER_CAM)) + CAMERAS.append(CameraType("cabinCameraState", VisionStreamType.VISION_STREAM_CABIN, DRIVER_CAM)) class Camerad: def __init__(self): diff --git a/openpilot/system/loggerd/clip_encoder.cc b/openpilot/system/loggerd/clip_encoder.cc index 884ef3f091..7e8f3a9026 100644 --- a/openpilot/system/loggerd/clip_encoder.cc +++ b/openpilot/system/loggerd/clip_encoder.cc @@ -29,11 +29,11 @@ constexpr int CLIP_FPS = 20; constexpr double PARALLEL_CLIP_MIN_DURATION = 2 * SEGMENT_DURATION; const EncoderInfo clip_encoder_info = { - .publish_name = "livestreamRoadEncodeData", + .publish_name = "livestreamNarrowRoadEncodeData", .record = false, .fps = CLIP_FPS, .get_settings = [](int) { return EncoderSettings::StreamEncoderSettings(); }, - INIT_ENCODE_FUNCTIONS(LivestreamRoadEncode), + INIT_ENCODE_FUNCTIONS(LivestreamNarrowRoadEncode), }; bool open_input(const std::string &path, AVFormatContext **ctx, int *stream_index) { diff --git a/openpilot/system/loggerd/loggerd.h b/openpilot/system/loggerd/loggerd.h index c6c7b41af1..beabd7d791 100644 --- a/openpilot/system/loggerd/loggerd.h +++ b/openpilot/system/loggerd/loggerd.h @@ -96,11 +96,11 @@ public: }; const EncoderInfo main_road_encoder_info = { - .publish_name = "roadEncodeData", + .publish_name = "narrowRoadEncodeData", .thumbnail_name = "thumbnail", .filename = "fcamera.hevc", .get_settings = [](int in_width){return EncoderSettings::MainEncoderSettings(in_width);}, - INIT_ENCODE_FUNCTIONS(RoadEncode), + INIT_ENCODE_FUNCTIONS(NarrowRoadEncode), }; const EncoderInfo main_wide_road_encoder_info = { @@ -110,23 +110,23 @@ const EncoderInfo main_wide_road_encoder_info = { INIT_ENCODE_FUNCTIONS(WideRoadEncode), }; -const EncoderInfo main_driver_encoder_info = { - .publish_name = "driverEncodeData", +const EncoderInfo main_cabin_encoder_info = { + .publish_name = "cabinEncodeData", .filename = "dcamera.hevc", .record = Params().getBool("RecordFront"), .get_settings = [](int in_width){return EncoderSettings::MainEncoderSettings(in_width);}, - INIT_ENCODE_FUNCTIONS(DriverEncode), + INIT_ENCODE_FUNCTIONS(CabinEncode), }; const EncoderInfo stream_road_encoder_info = { - .publish_name = "livestreamRoadEncodeData", + .publish_name = "livestreamNarrowRoadEncodeData", //.thumbnail_name = "thumbnail", .record = false, .is_live = true, .frame_width = livestream_width(), .frame_height = livestream_height(), .get_settings = [](int){return EncoderSettings::StreamEncoderSettings();}, - INIT_ENCODE_FUNCTIONS(LivestreamRoadEncode), + INIT_ENCODE_FUNCTIONS(LivestreamNarrowRoadEncode), }; const EncoderInfo stream_wide_road_encoder_info = { @@ -139,29 +139,29 @@ const EncoderInfo stream_wide_road_encoder_info = { INIT_ENCODE_FUNCTIONS(LivestreamWideRoadEncode), }; -const EncoderInfo stream_driver_encoder_info = { - .publish_name = "livestreamDriverEncodeData", +const EncoderInfo stream_cabin_encoder_info = { + .publish_name = "livestreamCabinEncodeData", .record = false, .is_live = true, .frame_width = livestream_width(), .frame_height = livestream_height(), .get_settings = [](int){return EncoderSettings::StreamEncoderSettings();}, - INIT_ENCODE_FUNCTIONS(LivestreamDriverEncode), + INIT_ENCODE_FUNCTIONS(LivestreamCabinEncode), }; const EncoderInfo qcam_encoder_info = { - .publish_name = "qRoadEncodeData", + .publish_name = "qNarrowRoadEncodeData", .filename = "qcamera.ts", .include_audio = Params().getBool("RecordAudio"), .frame_width = 526, .frame_height = 330, .get_settings = [](int){return EncoderSettings::QcamEncoderSettings();}, - INIT_ENCODE_FUNCTIONS(QRoadEncode), + INIT_ENCODE_FUNCTIONS(QNarrowRoadEncode), }; -const LogCameraInfo road_camera_info{ - .thread_name = "road_cam_encoder", - .stream_type = VISION_STREAM_ROAD, +const LogCameraInfo narrow_road_camera_info{ + .thread_name = "narrow_road_cam_encoder", + .stream_type = VISION_STREAM_NARROW_ROAD, .encoder_infos = {main_road_encoder_info, qcam_encoder_info} }; @@ -171,15 +171,15 @@ const LogCameraInfo wide_road_camera_info{ .encoder_infos = {main_wide_road_encoder_info} }; -const LogCameraInfo driver_camera_info{ - .thread_name = "driver_cam_encoder", - .stream_type = VISION_STREAM_DRIVER, - .encoder_infos = {main_driver_encoder_info} +const LogCameraInfo cabin_camera_info{ + .thread_name = "cabin_cam_encoder", + .stream_type = VISION_STREAM_CABIN, + .encoder_infos = {main_cabin_encoder_info} }; const LogCameraInfo stream_road_camera_info{ - .thread_name = "road_cam_encoder", - .stream_type = VISION_STREAM_ROAD, + .thread_name = "narrow_road_cam_encoder", + .stream_type = VISION_STREAM_NARROW_ROAD, .encoder_infos = {stream_road_encoder_info}, }; @@ -189,11 +189,11 @@ const LogCameraInfo stream_wide_road_camera_info{ .encoder_infos = {stream_wide_road_encoder_info}, }; -const LogCameraInfo stream_driver_camera_info{ - .thread_name = "driver_cam_encoder", - .stream_type = VISION_STREAM_DRIVER, - .encoder_infos = {stream_driver_encoder_info}, +const LogCameraInfo stream_cabin_camera_info{ + .thread_name = "cabin_cam_encoder", + .stream_type = VISION_STREAM_CABIN, + .encoder_infos = {stream_cabin_encoder_info}, }; -const LogCameraInfo cameras_logged[] = {road_camera_info, wide_road_camera_info, driver_camera_info}; -const LogCameraInfo stream_cameras_logged[] = {stream_road_camera_info, stream_wide_road_camera_info, stream_driver_camera_info}; +const LogCameraInfo cameras_logged[] = {narrow_road_camera_info, wide_road_camera_info, cabin_camera_info}; +const LogCameraInfo stream_cameras_logged[] = {stream_road_camera_info, stream_wide_road_camera_info, stream_cabin_camera_info}; diff --git a/openpilot/system/loggerd/tests/test_encoder.py b/openpilot/system/loggerd/tests/test_encoder.py index 307a89ba95..10cd586f35 100755 --- a/openpilot/system/loggerd/tests/test_encoder.py +++ b/openpilot/system/loggerd/tests/test_encoder.py @@ -22,8 +22,8 @@ SEGMENT_LENGTH = 2 FULL_SIZE = 2507572 def hevc_size(w): return FULL_SIZE // 2 if w <= 1344 else FULL_SIZE CAMERAS = [ - ("fcamera.hevc", 20, hevc_size, "roadEncodeIdx"), - ("dcamera.hevc", 20, hevc_size, "driverEncodeIdx"), + ("fcamera.hevc", 20, hevc_size, "narrowRoadEncodeIdx"), + ("dcamera.hevc", 20, hevc_size, "cabinEncodeIdx"), ("ecamera.hevc", 20, hevc_size, "wideRoadEncodeIdx"), ("qcamera.ts", 20, lambda x: 130000, None), ] diff --git a/openpilot/system/loggerd/tests/test_loggerd.py b/openpilot/system/loggerd/tests/test_loggerd.py index 333891ad91..de91cae1db 100644 --- a/openpilot/system/loggerd/tests/test_loggerd.py +++ b/openpilot/system/loggerd/tests/test_loggerd.py @@ -112,12 +112,12 @@ class TestLoggerd(OpenpilotTestCase): w, h = 320, 240 frame_spec = (w, h, w * h * 3 // 2, w, w * h) streams = [ - (VisionStreamType.VISION_STREAM_ROAD, frame_spec, "roadCameraState"), - (VisionStreamType.VISION_STREAM_DRIVER, frame_spec, "driverCameraState"), + (VisionStreamType.VISION_STREAM_NARROW_ROAD, frame_spec, "narrowRoadCameraState"), + (VisionStreamType.VISION_STREAM_CABIN, frame_spec, "cabinCameraState"), (VisionStreamType.VISION_STREAM_WIDE_ROAD, frame_spec, "wideRoadCameraState"), ] - sm = messaging.SubMaster(["roadEncodeData"]) + sm = messaging.SubMaster(["narrowRoadEncodeData"]) pm = messaging.PubMaster([s for _, _, s in streams] + ["rawAudioData"]) vipc_server = VisionIpcServer("camerad") for stream_type, frame_spec, _ in streams: @@ -128,7 +128,7 @@ class TestLoggerd(OpenpilotTestCase): os.environ["LOGGERD_SEGMENT_LENGTH"] = str(segment_length) managed_processes["loggerd"].start() managed_processes["encoderd"].start() - assert pm.wait_for_readers_to_update("roadCameraState", timeout=5) + assert pm.wait_for_readers_to_update("narrowRoadCameraState", timeout=5) fps = 20 for n in range(1, int(num_segs * segment_length * fps) + 1): @@ -322,8 +322,8 @@ class TestLoggerd(OpenpilotTestCase): self._publish_camera_and_audio_messages() - dcamera_hevc_exists = os.path.exists(os.path.join(self._get_latest_log_dir(), 'dcamera.hevc')) - assert dcamera_hevc_exists == record_front + cabin_hevc_exists = os.path.exists(os.path.join(self._get_latest_log_dir(), 'dcamera.hevc')) + assert cabin_hevc_exists == record_front @parameterized.expand([True, False]) def test_record_audio(self, record_audio): diff --git a/openpilot/system/webrtc/device/video.py b/openpilot/system/webrtc/device/video.py index c300f76485..cb85dff73e 100644 --- a/openpilot/system/webrtc/device/video.py +++ b/openpilot/system/webrtc/device/video.py @@ -32,9 +32,9 @@ class EncodedVideoFrame: class LiveStreamVideoStreamTrack(TiciVideoStreamTrack): camera_to_sock_mapping = { - "driver": "livestreamDriverEncodeData", + "driver": "livestreamCabinEncodeData", "wideRoad": "livestreamWideRoadEncodeData", - "road": "livestreamRoadEncodeData", + "road": "livestreamNarrowRoadEncodeData", } def __init__(self, camera_type: str, video_enabled: bool = True): diff --git a/openpilot/system/webrtc/tests/test_stream_session.py b/openpilot/system/webrtc/tests/test_stream_session.py index 5a9dc8772c..d64cf6aed6 100644 --- a/openpilot/system/webrtc/tests/test_stream_session.py +++ b/openpilot/system/webrtc/tests/test_stream_session.py @@ -65,7 +65,7 @@ class TestStreamSession(OpenpilotTestCase): mocked_pubmaster.reset_mock() def test_livestream_track(self, mocker): - fake_msg = messaging.new_message("livestreamDriverEncodeData") + fake_msg = messaging.new_message("livestreamCabinEncodeData") config = {"receive.return_value": fake_msg.to_bytes()} mocker.patch("msgq.SubSocket", spec=True, **config) diff --git a/openpilot/tools/cabana/README.md b/openpilot/tools/cabana/README.md index b30c29640e..fbdfbb40e5 100644 --- a/openpilot/tools/cabana/README.md +++ b/openpilot/tools/cabana/README.md @@ -15,7 +15,7 @@ Options: --auto Auto load the route from the best available source (no video): internal, openpilotci, comma_api, car_segments, testing_closet --qcam load qcamera - --ecam load wide road camera + --wide-road load wide road camera --msgq read can messages from msgq --panda read can messages from panda --panda-serial read can messages from panda with given serial @@ -55,7 +55,7 @@ Replace "5beb9b58bd12b691/0000010a--a51155e496" with your desired route identifi To run Cabana with multiple cameras, use the following command: ```shell -cabana "5beb9b58bd12b691/0000010a--a51155e496" --dcam --ecam +cabana "5beb9b58bd12b691/0000010a--a51155e496" --cabin --wide-road ``` ### Streaming CAN Messages from a comma Device diff --git a/openpilot/tools/cabana/cabana.cc b/openpilot/tools/cabana/cabana.cc index d8e21815dc..8b21143faf 100644 --- a/openpilot/tools/cabana/cabana.cc +++ b/openpilot/tools/cabana/cabana.cc @@ -19,8 +19,8 @@ struct CabanaArgs { bool demo = false; bool auto_source = false; bool qcam = false; - bool ecam = false; - bool dcam = false; + bool wide_road = false; + bool cabin = false; bool msgq = false; bool panda = false; bool no_vipc = false; @@ -44,8 +44,8 @@ void printUsage(const char *argv0) { " --auto Auto load the route from the best available source (no video):\n" " internal, openpilotci, comma_api, car_segments, testing_closet\n" " --qcam load qcamera\n" - " --ecam load wide road camera\n" - " --dcam load driver camera\n" + " --wide-road load wide road camera (alias: --ecam)\n" + " --cabin load cabin camera (alias: --dcam)\n" " --msgq read can messages from the msgq\n" " --panda read can messages from panda\n" " --panda-serial read can messages from panda with given serial\n" @@ -83,10 +83,10 @@ int parseArgs(int argc, char *argv[], CabanaArgs &args, bool &ok) { args.auto_source = true; } else if (std::strcmp(a, "--qcam") == 0) { args.qcam = true; - } else if (std::strcmp(a, "--ecam") == 0) { - args.ecam = true; - } else if (std::strcmp(a, "--dcam") == 0) { - args.dcam = true; + } else if (std::strcmp(a, "--wide-road") == 0 || std::strcmp(a, "--ecam") == 0) { + args.wide_road = true; + } else if (std::strcmp(a, "--cabin") == 0 || std::strcmp(a, "--dcam") == 0) { + args.cabin = true; } else if (std::strcmp(a, "--msgq") == 0) { args.msgq = true; } else if (std::strcmp(a, "--panda") == 0) { @@ -162,9 +162,9 @@ int main(int argc, char *argv[]) { #endif } else { uint32_t replay_flags = REPLAY_FLAG_NONE; - if (args.ecam) replay_flags |= REPLAY_FLAG_ECAM; + if (args.wide_road) replay_flags |= REPLAY_FLAG_WIDE_ROAD; if (args.qcam) replay_flags |= REPLAY_FLAG_QCAMERA; - if (args.dcam) replay_flags |= REPLAY_FLAG_DCAM; + if (args.cabin) replay_flags |= REPLAY_FLAG_CABIN_CAMERA; if (args.no_vipc) replay_flags |= REPLAY_FLAG_NO_VIPC; QString route; diff --git a/openpilot/tools/cabana/cameraview.cc b/openpilot/tools/cabana/cameraview.cc index a8df373dc4..9bd6b9be19 100644 --- a/openpilot/tools/cabana/cameraview.cc +++ b/openpilot/tools/cabana/cameraview.cc @@ -57,8 +57,8 @@ void CameraWidget::paintEvent(QPaintEvent *event) { QRect video_rect((width() - w) / 2, (height() - h) / 2, w, h); p.setRenderHint(QPainter::SmoothPixmapTransform); - if (active_stream_type == VISION_STREAM_DRIVER) { - // mirror driver camera horizontally + if (active_stream_type == VISION_STREAM_CABIN) { + // mirror cabin camera horizontally const qreal cx = video_rect.x() + video_rect.width() / 2.0; p.translate(cx, 0); p.scale(-1, 1); diff --git a/openpilot/tools/cabana/streams/replaystream.cc b/openpilot/tools/cabana/streams/replaystream.cc index dbd44b54e3..6d54369aef 100644 --- a/openpilot/tools/cabana/streams/replaystream.cc +++ b/openpilot/tools/cabana/streams/replaystream.cc @@ -46,7 +46,7 @@ void ReplayStream::mergeSegments() { } bool ReplayStream::loadRoute(const std::string &route, const std::string &data_dir, uint32_t replay_flags, bool auto_source) { - replay.reset(new Replay(route, {"can", "roadEncodeIdx", "driverEncodeIdx", "wideRoadEncodeIdx", "carParams"}, + replay.reset(new Replay(route, {"can", "narrowRoadEncodeIdx", "cabinEncodeIdx", "wideRoadEncodeIdx", "carParams"}, {}, nullptr, replay_flags, data_dir, auto_source)); replay->setSegmentCacheLimit(settings.max_cached_minutes); replay->installEventFilter([this](const Event *event) { return eventFilter(event); }); @@ -163,8 +163,8 @@ AbstractStream *OpenReplayWidget::open() { } else { auto replay_stream = std::make_unique(qApp); uint32_t flags = REPLAY_FLAG_NONE; - if (cameras[1]->isChecked()) flags |= REPLAY_FLAG_DCAM; - if (cameras[2]->isChecked()) flags |= REPLAY_FLAG_ECAM; + if (cameras[1]->isChecked()) flags |= REPLAY_FLAG_CABIN_CAMERA; + if (cameras[2]->isChecked()) flags |= REPLAY_FLAG_WIDE_ROAD; if (flags == REPLAY_FLAG_NONE && !cameras[0]->isChecked()) flags = REPLAY_FLAG_NO_VIPC; if (replay_stream->loadRoute(route.toStdString(), data_dir.toStdString(), flags)) { diff --git a/openpilot/tools/cabana/tools/routeinfo.cc b/openpilot/tools/cabana/tools/routeinfo.cc index 77a0e065cd..dc272e3d12 100644 --- a/openpilot/tools/cabana/tools/routeinfo.cc +++ b/openpilot/tools/cabana/tools/routeinfo.cc @@ -14,7 +14,7 @@ RouteInfoDlg::RouteInfoDlg(QWidget *parent) : QDialog(parent) { table->setEditTriggers(QAbstractItemView::NoEditTriggers); table->setSelectionBehavior(QAbstractItemView::SelectRows); table->setSelectionMode(QAbstractItemView::SingleSelection); - table->setHorizontalHeaderLabels({"", "rlog", "fcam", "ecam", "dcam", "qlog", "qcam"}); + table->setHorizontalHeaderLabels({"", "rlog", "narrow road", "wide road", "driver", "qlog", "qcam"}); table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); table->verticalHeader()->setVisible(false); table->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -23,9 +23,9 @@ RouteInfoDlg::RouteInfoDlg(QWidget *parent) : QDialog(parent) { for (const auto &[seg_num, seg] : replay->route().segments()) { table->setItem(row, 0, new QTableWidgetItem(QString::number(seg_num))); table->setItem(row, 1, new QTableWidgetItem(seg.rlog.empty() ? "--" : "Yes")); - table->setItem(row, 2, new QTableWidgetItem(seg.road_cam.empty() ? "--" : "Yes")); + table->setItem(row, 2, new QTableWidgetItem(seg.narrow_road_cam.empty() ? "--" : "Yes")); table->setItem(row, 3, new QTableWidgetItem(seg.wide_road_cam.empty() ? "--" : "Yes")); - table->setItem(row, 4, new QTableWidgetItem(seg.driver_cam.empty() ? "--" : "Yes")); + table->setItem(row, 4, new QTableWidgetItem(seg.cabin_cam.empty() ? "--" : "Yes")); table->setItem(row, 5, new QTableWidgetItem(seg.qlog.empty() ? "--" : "Yes")); table->setItem(row, 6, new QTableWidgetItem(seg.qcamera.empty() ? "--" : "Yes")); ++row; diff --git a/openpilot/tools/cabana/videowidget.cc b/openpilot/tools/cabana/videowidget.cc index 67b89cb080..bd61573658 100644 --- a/openpilot/tools/cabana/videowidget.cc +++ b/openpilot/tools/cabana/videowidget.cc @@ -148,7 +148,7 @@ QWidget *VideoWidget::createCameraWidget() { camera_tab->setAutoHide(true); camera_tab->setExpanding(false); - l->addWidget(cam_widget = new StreamCameraView("camerad", VISION_STREAM_ROAD)); + l->addWidget(cam_widget = new StreamCameraView("camerad", VISION_STREAM_NARROW_ROAD)); cam_widget->setMinimumHeight(MIN_VIDEO_HEIGHT); cam_widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); diff --git a/openpilot/tools/camerastream/compressed_vipc.py b/openpilot/tools/camerastream/compressed_vipc.py index 2ec538981b..e85c88d40c 100755 --- a/openpilot/tools/camerastream/compressed_vipc.py +++ b/openpilot/tools/camerastream/compressed_vipc.py @@ -19,8 +19,8 @@ V4L2_BUF_FLAG_KEYFRAME = 8 # then run this "./compressed_vipc.py " ENCODE_SOCKETS = { - VisionStreamType.VISION_STREAM_ROAD: "roadEncodeData", - VisionStreamType.VISION_STREAM_DRIVER: "driverEncodeData", + VisionStreamType.VISION_STREAM_NARROW_ROAD: "narrowRoadEncodeData", + VisionStreamType.VISION_STREAM_CABIN: "cabinEncodeData", VisionStreamType.VISION_STREAM_WIDE_ROAD: "wideRoadEncodeData", } @@ -146,8 +146,8 @@ if __name__ == "__main__": args = parser.parse_args() vision_streams = [ - VisionStreamType.VISION_STREAM_ROAD, - VisionStreamType.VISION_STREAM_DRIVER, + VisionStreamType.VISION_STREAM_NARROW_ROAD, + VisionStreamType.VISION_STREAM_CABIN, VisionStreamType.VISION_STREAM_WIDE_ROAD, ] diff --git a/openpilot/tools/clip/run.py b/openpilot/tools/clip/run.py index 6c847ca342..81145e2259 100755 --- a/openpilot/tools/clip/run.py +++ b/openpilot/tools/clip/run.py @@ -320,7 +320,7 @@ def clip(route: Route, output: str, start: int, end: int, headless: bool = True, wide_frame_queue = FrameQueue(ecamera_paths, start, end, fps=FRAMERATE) vipc = VisionIpcServer("camerad") - vipc.create_buffers(VisionStreamType.VISION_STREAM_ROAD, 4, frame_queue.frame_w, frame_queue.frame_h) + vipc.create_buffers(VisionStreamType.VISION_STREAM_NARROW_ROAD, 4, frame_queue.frame_w, frame_queue.frame_h) if wide_frame_queue: vipc.create_buffers(VisionStreamType.VISION_STREAM_WIDE_ROAD, 4, wide_frame_queue.frame_w, wide_frame_queue.frame_h) vipc.start_listener() @@ -339,7 +339,7 @@ def clip(route: Route, output: str, start: int, end: int, headless: bool = True, if frame_idx >= len(message_chunks): break _, frame_bytes = frame_queue.get() - vipc.send(VisionStreamType.VISION_STREAM_ROAD, frame_bytes, frame_idx, int(frame_idx * 5e7), int(frame_idx * 5e7)) + vipc.send(VisionStreamType.VISION_STREAM_NARROW_ROAD, frame_bytes, frame_idx, int(frame_idx * 5e7), int(frame_idx * 5e7)) if wide_frame_queue: _, wide_bytes = wide_frame_queue.get() vipc.send(VisionStreamType.VISION_STREAM_WIDE_ROAD, wide_bytes, frame_idx, int(frame_idx * 5e7), int(frame_idx * 5e7)) diff --git a/openpilot/tools/jotpluggler/app.h b/openpilot/tools/jotpluggler/app.h index b7754f51b2..9a6777ee90 100644 --- a/openpilot/tools/jotpluggler/app.h +++ b/openpilot/tools/jotpluggler/app.h @@ -87,7 +87,7 @@ enum class PaneKind : uint8_t { enum class CameraViewKind : uint8_t { Road, - Driver, + Cabin, WideRoad, QRoad, }; @@ -322,7 +322,7 @@ struct RouteData { std::vector roots; std::vector can_messages; CameraFeedIndex road_camera; - CameraFeedIndex driver_camera; + CameraFeedIndex cabin_camera; CameraFeedIndex wide_road_camera; CameraFeedIndex qroad_camera; std::vector thumbnails; diff --git a/openpilot/tools/jotpluggler/common.h b/openpilot/tools/jotpluggler/common.h index 5c68b0ed22..7149bbe54d 100644 --- a/openpilot/tools/jotpluggler/common.h +++ b/openpilot/tools/jotpluggler/common.h @@ -23,7 +23,7 @@ struct SpecialItemSpec { inline constexpr std::array kCameraViewSpecs = {{ {CameraViewKind::Road, "Road Camera", "road", "road", "camera_road", &RouteData::road_camera}, - {CameraViewKind::Driver, "Driver Camera", "driver", "driver", "camera_driver", &RouteData::driver_camera}, + {CameraViewKind::Cabin, "Cabin Camera", "driver", "driver", "camera_driver", &RouteData::cabin_camera}, {CameraViewKind::WideRoad, "Wide Road Camera", "wide", "wide_road", "camera_wide_road", &RouteData::wide_road_camera}, {CameraViewKind::QRoad, "qRoad Camera", "qroad", "qroad", "camera_qroad", &RouteData::qroad_camera}, }}; diff --git a/openpilot/tools/jotpluggler/layouts/camera-timings.json b/openpilot/tools/jotpluggler/layouts/camera-timings.json index 64decf15d3..643a7bc43a 100644 --- a/openpilot/tools/jotpluggler/layouts/camera-timings.json +++ b/openpilot/tools/jotpluggler/layouts/camera-timings.json @@ -1 +1 @@ -{"current_tab_index":0,"tabs":[{"name":"SOF / EOF (encodeIdx)","root":{"split":"vertical","sizes":[0.500885,0.499115],"children":[{"title":"...","range":{"left":0.0,"right":630.006367,"top":65000000.0,"bottom":35000000.0},"curves":[{"name":"/driverEncodeIdx/timestampSof","color":"#1f77b4","transform":"derivative","derivative_dt":1.0},{"name":"/roadEncodeIdx/timestampSof","color":"#d62728","transform":"derivative","derivative_dt":1.0},{"name":"/wideRoadEncodeIdx/timestampSof","color":"#1ac938","transform":"derivative","derivative_dt":1.0}],"y_limits":{"min":35000000.0,"max":65000000.0}},{"title":"...","range":{"left":0.0,"right":630.006367,"top":65000000.0,"bottom":35000000.0},"curves":[{"name":"/driverEncodeIdx/timestampEof","color":"#f14cc1","transform":"derivative","derivative_dt":1.0},{"name":"/roadEncodeIdx/timestampEof","color":"#9467bd","transform":"derivative","derivative_dt":1.0},{"name":"/wideRoadEncodeIdx/timestampEof","color":"#17becf","transform":"derivative","derivative_dt":1.0}],"y_limits":{"min":35000000.0,"max":65000000.0}}]}},{"name":"model timings","root":{"split":"vertical","sizes":[0.5,0.5],"children":[{"title":"...","range":{"left":0.0,"right":630.006367,"top":0.016865,"bottom":0.015143},"curves":[{"name":"/modelV2/modelExecutionTime","color":"#ff7f0e"}]},{"title":"...","range":{"left":0.0,"right":630.006367,"top":0.1,"bottom":-0.1},"curves":[{"name":"/modelV2/frameDropPerc","color":"#f14cc1"}]}]}},{"name":"sensor info","root":{"split":"vertical","sizes":[1.0],"children":[{"title":"...","range":{"left":0.0,"right":630.006367,"top":0.1,"bottom":-0.1},"curves":[{"name":"/driverCameraState/sensor","color":"#bcbd22"},{"name":"/roadCameraState/sensor","color":"#1f77b4"},{"name":"/wideRoadCameraState/sensor","color":"#d62728"}]}]}},{"name":"SOF / EOF (cameraState)","root":{"split":"vertical","sizes":[0.500885,0.499115],"children":[{"title":"...","range":{"left":0.0,"right":630.006367,"top":65000000.0,"bottom":35000000.0},"curves":[{"name":"/driverCameraState/timestampSof","color":"#1f77b4","transform":"derivative","derivative_dt":1.0},{"name":"/roadCameraState/timestampSof","color":"#d62728","transform":"derivative","derivative_dt":1.0},{"name":"/wideRoadCameraState/timestampSof","color":"#1ac938","transform":"derivative","derivative_dt":1.0}],"y_limits":{"min":35000000.0,"max":65000000.0}},{"title":"...","range":{"left":0.0,"right":630.006367,"top":65000000.0,"bottom":35000000.0},"curves":[{"name":"/driverCameraState/timestampEof","color":"#ff7f0e","transform":"derivative","derivative_dt":1.0},{"name":"/roadCameraState/timestampEof","color":"#f14cc1","transform":"derivative","derivative_dt":1.0},{"name":"/wideRoadCameraState/timestampEof","color":"#9467bd","transform":"derivative","derivative_dt":1.0}],"y_limits":{"min":35000000.0,"max":65000000.0}}]}}]} +{"current_tab_index":0,"tabs":[{"name":"SOF / EOF (encodeIdx)","root":{"split":"vertical","sizes":[0.500885,0.499115],"children":[{"title":"...","range":{"left":0.0,"right":630.006367,"top":65000000.0,"bottom":35000000.0},"curves":[{"name":"/cabinEncodeIdx/timestampSof","color":"#1f77b4","transform":"derivative","derivative_dt":1.0},{"name":"/narrowRoadEncodeIdx/timestampSof","color":"#d62728","transform":"derivative","derivative_dt":1.0},{"name":"/wideRoadEncodeIdx/timestampSof","color":"#1ac938","transform":"derivative","derivative_dt":1.0}],"y_limits":{"min":35000000.0,"max":65000000.0}},{"title":"...","range":{"left":0.0,"right":630.006367,"top":65000000.0,"bottom":35000000.0},"curves":[{"name":"/cabinEncodeIdx/timestampEof","color":"#f14cc1","transform":"derivative","derivative_dt":1.0},{"name":"/narrowRoadEncodeIdx/timestampEof","color":"#9467bd","transform":"derivative","derivative_dt":1.0},{"name":"/wideRoadEncodeIdx/timestampEof","color":"#17becf","transform":"derivative","derivative_dt":1.0}],"y_limits":{"min":35000000.0,"max":65000000.0}}]}},{"name":"model timings","root":{"split":"vertical","sizes":[0.5,0.5],"children":[{"title":"...","range":{"left":0.0,"right":630.006367,"top":0.016865,"bottom":0.015143},"curves":[{"name":"/modelV2/modelExecutionTime","color":"#ff7f0e"}]},{"title":"...","range":{"left":0.0,"right":630.006367,"top":0.1,"bottom":-0.1},"curves":[{"name":"/modelV2/frameDropPerc","color":"#f14cc1"}]}]}},{"name":"sensor info","root":{"split":"vertical","sizes":[1.0],"children":[{"title":"...","range":{"left":0.0,"right":630.006367,"top":0.1,"bottom":-0.1},"curves":[{"name":"/cabinCameraState/sensor","color":"#bcbd22"},{"name":"/narrowRoadCameraState/sensor","color":"#1f77b4"},{"name":"/wideRoadCameraState/sensor","color":"#d62728"}]}]}},{"name":"SOF / EOF (cameraState)","root":{"split":"vertical","sizes":[0.500885,0.499115],"children":[{"title":"...","range":{"left":0.0,"right":630.006367,"top":65000000.0,"bottom":35000000.0},"curves":[{"name":"/cabinCameraState/timestampSof","color":"#1f77b4","transform":"derivative","derivative_dt":1.0},{"name":"/narrowRoadCameraState/timestampSof","color":"#d62728","transform":"derivative","derivative_dt":1.0},{"name":"/wideRoadCameraState/timestampSof","color":"#1ac938","transform":"derivative","derivative_dt":1.0}],"y_limits":{"min":35000000.0,"max":65000000.0}},{"title":"...","range":{"left":0.0,"right":630.006367,"top":65000000.0,"bottom":35000000.0},"curves":[{"name":"/cabinCameraState/timestampEof","color":"#ff7f0e","transform":"derivative","derivative_dt":1.0},{"name":"/narrowRoadCameraState/timestampEof","color":"#f14cc1","transform":"derivative","derivative_dt":1.0},{"name":"/wideRoadCameraState/timestampEof","color":"#9467bd","transform":"derivative","derivative_dt":1.0}],"y_limits":{"min":35000000.0,"max":65000000.0}}]}}]} diff --git a/openpilot/tools/jotpluggler/layouts/cameras-and-map.json b/openpilot/tools/jotpluggler/layouts/cameras-and-map.json index 68c590f7bc..7e120fcd5c 100644 --- a/openpilot/tools/jotpluggler/layouts/cameras-and-map.json +++ b/openpilot/tools/jotpluggler/layouts/cameras-and-map.json @@ -1 +1 @@ -{"current_tab_index": 0, "tabs": [{"name": "tab1", "root": {"children": [{"children": [{"curves": [], "kind": "map", "title": "Map"}, {"camera_view": "road", "curves": [], "kind": "camera", "title": "Road Camera"}], "sizes": [0.5, 0.5], "split": "horizontal"}, {"children": [{"camera_view": "wide_road", "curves": [], "kind": "camera", "title": "Wide Road Camera"}, {"camera_view": "driver", "curves": [], "kind": "camera", "title": "Driver Camera"}], "sizes": [0.5, 0.5], "split": "horizontal"}], "sizes": [0.5, 0.5], "split": "vertical"}}]} +{"current_tab_index": 0, "tabs": [{"name": "tab1", "root": {"children": [{"children": [{"curves": [], "kind": "map", "title": "Map"}, {"camera_view": "road", "curves": [], "kind": "camera", "title": "Road Camera"}], "sizes": [0.5, 0.5], "split": "horizontal"}, {"children": [{"camera_view": "wide_road", "curves": [], "kind": "camera", "title": "Wide Road Camera"}, {"camera_view": "driver", "curves": [], "kind": "camera", "title": "Cabin Camera"}], "sizes": [0.5, 0.5], "split": "horizontal"}], "sizes": [0.5, 0.5], "split": "vertical"}}]} diff --git a/openpilot/tools/jotpluggler/layouts/driver-monitoring-debug.json b/openpilot/tools/jotpluggler/layouts/driver-monitoring-debug.json index 07a5c2fd6e..3197f40ad8 100644 --- a/openpilot/tools/jotpluggler/layouts/driver-monitoring-debug.json +++ b/openpilot/tools/jotpluggler/layouts/driver-monitoring-debug.json @@ -1 +1 @@ -{"current_tab_index": 0, "tabs": [{"name": "tab1", "root": {"children": [{"children": [{"camera_view": "driver", "curves": [], "kind": "camera", "title": "Driver Camera"}, {"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/alertLevel"}], "title": "..."}], "sizes": [0.5, 0.5], "split": "vertical"}, {"children": [{"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/activePolicy"}], "title": "..."}, {"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/visionPolicyState/faceDetected"}], "title": "..."}, {"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/visionPolicyState/distractedTypes/eye"}, {"color": "#dc5234", "name": "/driverMonitoringState/visionPolicyState/distractedTypes/phone"}, {"color": "#43a047", "name": "/driverMonitoringState/visionPolicyState/distractedTypes/pose"}], "title": "..."}, {"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/visionPolicyState/awarenessPercent"}], "title": "..."}], "sizes": [0.25, 0.25, 0.25, 0.25], "split": "vertical"}], "sizes": [0.5, 0.5], "split": "horizontal"}}]} +{"current_tab_index": 0, "tabs": [{"name": "tab1", "root": {"children": [{"children": [{"camera_view": "driver", "curves": [], "kind": "camera", "title": "Cabin Camera"}, {"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/alertLevel"}], "title": "..."}], "sizes": [0.5, 0.5], "split": "vertical"}, {"children": [{"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/activePolicy"}], "title": "..."}, {"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/visionPolicyState/faceDetected"}], "title": "..."}, {"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/visionPolicyState/distractedTypes/eye"}, {"color": "#dc5234", "name": "/driverMonitoringState/visionPolicyState/distractedTypes/phone"}, {"color": "#43a047", "name": "/driverMonitoringState/visionPolicyState/distractedTypes/pose"}], "title": "..."}, {"curves": [{"color": "#236bb4", "name": "/driverMonitoringState/visionPolicyState/awarenessPercent"}], "title": "..."}], "sizes": [0.25, 0.25, 0.25, 0.25], "split": "vertical"}], "sizes": [0.5, 0.5], "split": "horizontal"}}]} diff --git a/openpilot/tools/jotpluggler/runtime.cc b/openpilot/tools/jotpluggler/runtime.cc index a1e47c7e8e..d7d0fc79c4 100644 --- a/openpilot/tools/jotpluggler/runtime.cc +++ b/openpilot/tools/jotpluggler/runtime.cc @@ -39,11 +39,11 @@ const bool kLogCameraTimings = env_flag_enabled("JOTP_CAMERA_TIMINGS"); CameraType decoder_camera_type(CameraViewKind view) { switch (view) { - case CameraViewKind::Driver: return DriverCam; + case CameraViewKind::Cabin: return CabinCam; case CameraViewKind::WideRoad: return WideRoadCam; - case CameraViewKind::QRoad: return RoadCam; + case CameraViewKind::QRoad: return NarrowRoadCam; case CameraViewKind::Road: - default: return RoadCam; + default: return NarrowRoadCam; } } @@ -59,17 +59,17 @@ bool stream_batch_has_data(const StreamExtractBatch &batch) { bool should_subscribe_stream_service(const std::string &name) { static const std::array kSkippedServices = {{ - "roadEncodeIdx", - "driverEncodeIdx", + "narrowRoadEncodeIdx", + "cabinEncodeIdx", "wideRoadEncodeIdx", - "qRoadEncodeIdx", - "roadEncodeData", - "driverEncodeData", + "qNarrowRoadEncodeIdx", + "narrowRoadEncodeData", + "cabinEncodeData", "wideRoadEncodeData", - "qRoadEncodeData", + "qNarrowRoadEncodeData", "livestreamWideRoadEncodeIdx", - "livestreamRoadEncodeIdx", - "livestreamDriverEncodeIdx", + "livestreamNarrowRoadEncodeIdx", + "livestreamCabinEncodeIdx", "thumbnail", }}; if (name == "rawAudioData") return false; diff --git a/openpilot/tools/jotpluggler/sketch_layout.cc b/openpilot/tools/jotpluggler/sketch_layout.cc index ddb38fd473..5440d9dd8d 100644 --- a/openpilot/tools/jotpluggler/sketch_layout.cc +++ b/openpilot/tools/jotpluggler/sketch_layout.cc @@ -45,9 +45,9 @@ struct RouteSelection { struct SegmentLogs { std::string rlog; std::string qlog; - std::string fcamera; - std::string dcamera; - std::string ecamera; + std::string narrow_road; + std::string cabin; + std::string wide_road; std::string qcamera; }; @@ -295,11 +295,11 @@ void add_log_file_to_segments(std::map *segments, int segment_ } else if (name == "qlog.bz2" || name == "qlog.zst" || name == "qlog") { segment.qlog = file; } else if (name == "fcamera.hevc") { - segment.fcamera = file; + segment.narrow_road = file; } else if (name == "dcamera.hevc") { - segment.dcamera = file; + segment.cabin = file; } else if (name == "ecamera.hevc") { - segment.ecamera = file; + segment.wide_road = file; } else if (name == "qcamera.ts") { segment.qcamera = file; } @@ -1886,10 +1886,10 @@ RouteData load_route_data(const std::string &route_name, metadata.car_fingerprint, resolved_dbc); route_data.route_id = make_route_identifier(route, segments); - build_camera_index(segments, route_data, &SegmentLogs::fcamera, "roadEncodeIdx", &route_data.road_camera); - build_camera_index(segments, route_data, &SegmentLogs::dcamera, "driverEncodeIdx", &route_data.driver_camera); - build_camera_index(segments, route_data, &SegmentLogs::ecamera, "wideRoadEncodeIdx", &route_data.wide_road_camera); - build_camera_index(segments, route_data, &SegmentLogs::qcamera, "qRoadEncodeIdx", &route_data.qroad_camera); + build_camera_index(segments, route_data, &SegmentLogs::narrow_road, "narrowRoadEncodeIdx", &route_data.road_camera); + build_camera_index(segments, route_data, &SegmentLogs::cabin, "cabinEncodeIdx", &route_data.cabin_camera); + build_camera_index(segments, route_data, &SegmentLogs::wide_road, "wideRoadEncodeIdx", &route_data.wide_road_camera); + build_camera_index(segments, route_data, &SegmentLogs::qcamera, "qNarrowRoadEncodeIdx", &route_data.qroad_camera); stats.load_end = LoadStats::Clock::now(); stats.publish(RouteLoadStage::Finished, segments.size(), {}); stats.print_summary(route_data.series.size()); diff --git a/openpilot/tools/lib/log_time_series.py b/openpilot/tools/lib/log_time_series.py index 5e8aa4f73b..eba821bc84 100644 --- a/openpilot/tools/lib/log_time_series.py +++ b/openpilot/tools/lib/log_time_series.py @@ -80,5 +80,5 @@ if __name__ == "__main__": import sys from openpilot.tools.lib.logreader import LogReader m = msgs_to_time_series(LogReader(sys.argv[1])) - print(m['driverCameraState']['t']) - print(np.diff(m['driverCameraState']['timestampSof'])) + print(m['cabinCameraState']['t']) + print(np.diff(m['cabinCameraState']['timestampSof'])) diff --git a/openpilot/tools/plotjuggler/layouts/camera-timings.xml b/openpilot/tools/plotjuggler/layouts/camera-timings.xml index f91cbd3f53..2abff4d508 100644 --- a/openpilot/tools/plotjuggler/layouts/camera-timings.xml +++ b/openpilot/tools/plotjuggler/layouts/camera-timings.xml @@ -8,13 +8,13 @@ - - + + - - + + @@ -29,13 +29,13 @@ - - + + - - + + @@ -76,8 +76,8 @@ - - + + @@ -91,13 +91,13 @@ - - + + - - + + @@ -112,13 +112,13 @@ - - + + - - + + @@ -145,4 +145,3 @@ - diff --git a/openpilot/tools/replay/README.md b/openpilot/tools/replay/README.md index 108df08935..1d500eac96 100644 --- a/openpilot/tools/replay/README.md +++ b/openpilot/tools/replay/README.md @@ -68,8 +68,8 @@ Options: internal, openpilotci, comma_api, car_segments, testing_closet --data_dir local directory with routes --prefix set OPENPILOT_PREFIX - --dcam load driver camera - --ecam load wide road camera + --cabin load cabin camera + --wide-road load wide road camera --no-loop stop at the end of the route --no-cache turn off local cache --qcam load qcamera @@ -103,11 +103,11 @@ openpilot/tools/plotjuggler/juggle.py --stream watch all three cameras simultaneously from your comma three routes with watch3 -simply replay a route using the `--dcam` and `--ecam` flags: +simply replay a route using the `--cabin` and `--wide-road` flags: ```bash # start a replay -cd openpilot/tools/replay && ./replay --demo --dcam --ecam +cd openpilot/tools/replay && ./replay --demo --cabin --wide-road # then start watch3 cd openpilot/selfdrive/ui && ./watch3.py diff --git a/openpilot/tools/replay/camera.h b/openpilot/tools/replay/camera.h index 35fab5f7d3..81b3bb1a81 100644 --- a/openpilot/tools/replay/camera.h +++ b/openpilot/tools/replay/camera.h @@ -33,8 +33,8 @@ protected: VisionBuf *getFrame(Camera &cam, FrameReader *fr, int32_t segment_id, uint32_t frame_id); Camera cameras_[MAX_CAMERAS] = { - {.type = RoadCam, .stream_type = VISION_STREAM_ROAD}, - {.type = DriverCam, .stream_type = VISION_STREAM_DRIVER}, + {.type = NarrowRoadCam, .stream_type = VISION_STREAM_NARROW_ROAD}, + {.type = CabinCam, .stream_type = VISION_STREAM_CABIN}, {.type = WideRoadCam, .stream_type = VISION_STREAM_WIDE_ROAD}, }; std::atomic publishing_ = 0; diff --git a/openpilot/tools/replay/logreader.cc b/openpilot/tools/replay/logreader.cc index 0416413b4c..315aed9741 100644 --- a/openpilot/tools/replay/logreader.cc +++ b/openpilot/tools/replay/logreader.cc @@ -74,8 +74,8 @@ bool LogReader::load(const char *data, size_t size, std::atomic *abort, uint64_t mono_time = event.getLogMonoTime(); const Event &evt = events.emplace_back(which, mono_time, event_data); // Add encodeIdx packet again as a frame packet for the video stream - if (evt.which == cereal::Event::ROAD_ENCODE_IDX || - evt.which == cereal::Event::DRIVER_ENCODE_IDX || + if (evt.which == cereal::Event::NARROW_ROAD_ENCODE_IDX || + evt.which == cereal::Event::CABIN_ENCODE_IDX || evt.which == cereal::Event::WIDE_ROAD_ENCODE_IDX) { auto idx = capnp::AnyStruct::Reader(event).getPointerSection()[0].getAs(); if (idx.getType() == cereal::EncodeIndex::Type::FULL_H_E_V_C) { diff --git a/openpilot/tools/replay/logreader.h b/openpilot/tools/replay/logreader.h index 63f7468401..52e82c46ad 100644 --- a/openpilot/tools/replay/logreader.h +++ b/openpilot/tools/replay/logreader.h @@ -8,7 +8,7 @@ #include "openpilot/cereal/gen/cpp/log.capnp.h" #include "tools/replay/util.h" -const CameraType ALL_CAMERAS[] = {RoadCam, DriverCam, WideRoadCam}; +const CameraType ALL_CAMERAS[] = {NarrowRoadCam, CabinCam, WideRoadCam}; const int MAX_CAMERAS = std::size(ALL_CAMERAS); class Event { diff --git a/openpilot/tools/replay/main.cc b/openpilot/tools/replay/main.cc index bdb9cf4f35..50233189a1 100644 --- a/openpilot/tools/replay/main.cc +++ b/openpilot/tools/replay/main.cc @@ -26,8 +26,8 @@ Options: internal, openpilotci, comma_api, car_segments, testing_closet -d, --data_dir Local directory with routes -p, --prefix Set OPENPILOT_PREFIX - --dcam Load driver camera - --ecam Load wide road camera + --cabin Load cabin camera (alias: --dcam) + --wide-road Load wide road camera (alias: --ecam) --no-loop Stop at the end of the route --no-cache Turn off local cache --qcam Load qcamera @@ -62,8 +62,10 @@ bool parseArgs(int argc, char *argv[], ReplayConfig &config) { {"auto", no_argument, nullptr, 0}, {"data_dir", required_argument, nullptr, 'd'}, {"prefix", required_argument, nullptr, 'p'}, - {"dcam", no_argument, nullptr, 0}, - {"ecam", no_argument, nullptr, 0}, + {"cabin", no_argument, nullptr, 0}, + {"dcam", no_argument, nullptr, 0}, // deprecated alias + {"wide-road", no_argument, nullptr, 0}, + {"ecam", no_argument, nullptr, 0}, // deprecated alias {"no-loop", no_argument, nullptr, 0}, {"no-cache", no_argument, nullptr, 0}, {"qcam", no_argument, nullptr, 0}, @@ -76,8 +78,10 @@ bool parseArgs(int argc, char *argv[], ReplayConfig &config) { }; const std::map flag_map = { - {"dcam", REPLAY_FLAG_DCAM}, - {"ecam", REPLAY_FLAG_ECAM}, + {"cabin", REPLAY_FLAG_CABIN_CAMERA}, + {"dcam", REPLAY_FLAG_CABIN_CAMERA}, // deprecated alias + {"wide-road", REPLAY_FLAG_WIDE_ROAD}, + {"ecam", REPLAY_FLAG_WIDE_ROAD}, // deprecated alias {"no-loop", REPLAY_FLAG_NO_LOOP}, {"no-cache", REPLAY_FLAG_NO_FILE_CACHE}, {"qcam", REPLAY_FLAG_QCAMERA}, diff --git a/openpilot/tools/replay/replay.cc b/openpilot/tools/replay/replay.cc index 75aecfd0c2..6449fc30ea 100644 --- a/openpilot/tools/replay/replay.cc +++ b/openpilot/tools/replay/replay.cc @@ -251,13 +251,13 @@ void Replay::publishMessage(const Event *e) { void Replay::publishFrame(const Event *e) { CameraType cam; switch (e->which) { - case cereal::Event::ROAD_ENCODE_IDX: cam = RoadCam; break; - case cereal::Event::DRIVER_ENCODE_IDX: cam = DriverCam; break; + case cereal::Event::NARROW_ROAD_ENCODE_IDX: cam = NarrowRoadCam; break; + case cereal::Event::CABIN_ENCODE_IDX: cam = CabinCam; break; case cereal::Event::WIDE_ROAD_ENCODE_IDX: cam = WideRoadCam; break; default: return; // Invalid event type } - if ((cam == DriverCam && !hasFlag(REPLAY_FLAG_DCAM)) || (cam == WideRoadCam && !hasFlag(REPLAY_FLAG_ECAM))) + if ((cam == CabinCam && !hasFlag(REPLAY_FLAG_CABIN_CAMERA)) || (cam == WideRoadCam && !hasFlag(REPLAY_FLAG_WIDE_ROAD))) return; // Camera isdisabled auto seg_it = event_data_->segments.find(e->eidx_segnum); diff --git a/openpilot/tools/replay/replay.h b/openpilot/tools/replay/replay.h index ce6d75bd6d..7cd5fbecd0 100644 --- a/openpilot/tools/replay/replay.h +++ b/openpilot/tools/replay/replay.h @@ -16,8 +16,8 @@ enum REPLAY_FLAGS { REPLAY_FLAG_NONE = 0x0000, - REPLAY_FLAG_DCAM = 0x0002, - REPLAY_FLAG_ECAM = 0x0004, + REPLAY_FLAG_CABIN_CAMERA = 0x0002, + REPLAY_FLAG_WIDE_ROAD = 0x0004, REPLAY_FLAG_NO_LOOP = 0x0010, REPLAY_FLAG_NO_FILE_CACHE = 0x0020, REPLAY_FLAG_QCAMERA = 0x0040, diff --git a/openpilot/tools/replay/route.cc b/openpilot/tools/replay/route.cc index 326d28d726..f38c2b1971 100644 --- a/openpilot/tools/replay/route.cc +++ b/openpilot/tools/replay/route.cc @@ -180,9 +180,9 @@ void Route::addFileToSegment(int n, const std::string &file) { } else if (name == "qlog.bz2" || name == "qlog.zst" || name == "qlog") { segments_[n].qlog = file; } else if (name == "fcamera.hevc") { - segments_[n].road_cam = file; + segments_[n].narrow_road_cam = file; } else if (name == "dcamera.hevc") { - segments_[n].driver_cam = file; + segments_[n].cabin_cam = file; } else if (name == "ecamera.hevc") { segments_[n].wide_road_cam = file; } else if (name == "qcamera.ts") { @@ -195,11 +195,11 @@ void Route::addFileToSegment(int n, const std::string &file) { Segment::Segment(int n, const SegmentFile &files, uint32_t flags, const std::vector &filters, std::function callback) : seg_num(n), flags(flags), filters_(filters), on_load_finished_(callback) { - // [RoadCam, DriverCam, WideRoadCam, log]. fallback to qcamera/qlog + // [NarrowRoadCam, CabinCam, WideRoadCam, log]. fallback to qcamera/qlog const std::array file_list = { - (flags & REPLAY_FLAG_QCAMERA) || files.road_cam.empty() ? files.qcamera : files.road_cam, - flags & REPLAY_FLAG_DCAM ? files.driver_cam : "", - flags & REPLAY_FLAG_ECAM ? files.wide_road_cam : "", + (flags & REPLAY_FLAG_QCAMERA) || files.narrow_road_cam.empty() ? files.qcamera : files.narrow_road_cam, + flags & REPLAY_FLAG_CABIN_CAMERA ? files.cabin_cam : "", + flags & REPLAY_FLAG_WIDE_ROAD ? files.wide_road_cam : "", files.rlog.empty() ? files.qlog : files.rlog, }; for (int i = 0; i < file_list.size(); ++i) { diff --git a/openpilot/tools/replay/route.h b/openpilot/tools/replay/route.h index 50f3eba854..7a55997969 100644 --- a/openpilot/tools/replay/route.h +++ b/openpilot/tools/replay/route.h @@ -33,8 +33,8 @@ struct RouteIdentifier { struct SegmentFile { std::string rlog; std::string qlog; - std::string road_cam; - std::string driver_cam; + std::string narrow_road_cam; + std::string cabin_cam; std::string wide_road_cam; std::string qcamera; }; diff --git a/openpilot/tools/replay/ui.py b/openpilot/tools/replay/ui.py index 2c253a1364..16c050f8a6 100755 --- a/openpilot/tools/replay/ui.py +++ b/openpilot/tools/replay/ui.py @@ -57,7 +57,7 @@ def ui_thread(addr): font_path = os.path.join(BASEDIR, "openpilot/selfdrive/assets/fonts/JetBrainsMono-Medium.ttf") font = rl.load_font_ex(font_path, 32, None, 0) - camera_view = CameraView("camerad", VisionStreamType.VISION_STREAM_ROAD) + camera_view = CameraView("camerad", VisionStreamType.VISION_STREAM_NARROW_ROAD) # Overlay texture for model/lane line drawing overlay_img = np.zeros((480, 640, 4), dtype='uint8') @@ -82,7 +82,7 @@ def ui_thread(addr): 'liveTracks', 'modelV2', 'liveParameters', - 'roadCameraState', + 'narrowRoadCameraState', ], addr=addr, ) @@ -152,13 +152,13 @@ def ui_thread(addr): sm.update(0) - camera = DEVICE_CAMERAS[("tici", str(sm['roadCameraState'].sensor))] - calib_scale = camera.fcam.width / 640.0 + camera = DEVICE_CAMERAS[("tici", str(sm['narrowRoadCameraState'].sensor))] + calib_scale = camera.narrow_road.width / 640.0 if camera_view.frame: num_px = camera_view.frame.width * camera_view.frame.height - intrinsic_matrix = camera.fcam.intrinsics + intrinsic_matrix = camera.narrow_road.intrinsics w = sm['controlsState'].lateralControlState.which() if w == 'lqrStateDEPRECATED': diff --git a/openpilot/tools/replay/util.h b/openpilot/tools/replay/util.h index 45d6f7cd0b..5cffc11706 100644 --- a/openpilot/tools/replay/util.h +++ b/openpilot/tools/replay/util.h @@ -10,8 +10,8 @@ #include "openpilot/cereal/messaging/messaging.h" enum CameraType { - RoadCam = 0, - DriverCam, + NarrowRoadCam = 0, + CabinCam, WideRoadCam }; diff --git a/openpilot/tools/sim/lib/camerad.py b/openpilot/tools/sim/lib/camerad.py index d4825eada7..206e4fdf90 100644 --- a/openpilot/tools/sim/lib/camerad.py +++ b/openpilot/tools/sim/lib/camerad.py @@ -38,20 +38,20 @@ def rgb_to_nv12(rgb): class Camerad: """Simulates the camerad daemon""" def __init__(self, dual_camera): - self.pm = messaging.PubMaster(['roadCameraState', 'wideRoadCameraState']) + self.pm = messaging.PubMaster(['narrowRoadCameraState', 'wideRoadCameraState']) self.frame_road_id = 0 self.frame_wide_id = 0 self.vipc_server = VisionIpcServer("camerad") - self.vipc_server.create_buffers(VisionStreamType.VISION_STREAM_ROAD, 5, W, H) + self.vipc_server.create_buffers(VisionStreamType.VISION_STREAM_NARROW_ROAD, 5, W, H) if dual_camera: self.vipc_server.create_buffers(VisionStreamType.VISION_STREAM_WIDE_ROAD, 5, W, H) self.vipc_server.start_listener() def cam_send_yuv_road(self, yuv): - self._send_yuv(yuv, self.frame_road_id, 'roadCameraState', VisionStreamType.VISION_STREAM_ROAD) + self._send_yuv(yuv, self.frame_road_id, 'narrowRoadCameraState', VisionStreamType.VISION_STREAM_NARROW_ROAD) self.frame_road_id += 1 def cam_send_yuv_wide_road(self, yuv): diff --git a/tools/scripts/cycle_alerts.py b/tools/scripts/cycle_alerts.py index 0bd42bcd3f..cf4a1d8999 100755 --- a/tools/scripts/cycle_alerts.py +++ b/tools/scripts/cycle_alerts.py @@ -50,11 +50,11 @@ def cycle_alerts(duration=200, is_metric=False): (EventName.cameraFrameRate, ET.PERMANENT), ] - cameras = ['roadCameraState', 'wideRoadCameraState', 'driverCameraState'] + cameras = ['narrowRoadCameraState', 'wideRoadCameraState', 'cabinCameraState'] CS = car.CarState.new_message() CP = CarInterface.get_non_essential_params("HONDA_CIVIC") - sm = messaging.SubMaster(['deviceState', 'pandaStates', 'roadCameraState', 'modelV2', 'liveCalibration', + sm = messaging.SubMaster(['deviceState', 'pandaStates', 'narrowRoadCameraState', 'modelV2', 'liveCalibration', 'driverMonitoringState', 'longitudinalPlan', 'livePose', 'managerState'] + cameras)