diff --git a/common/model.h b/common/model.h index 3dc83af543..589c936bb2 100644 --- a/common/model.h +++ b/common/model.h @@ -1 +1 @@ -#define DEFAULT_MODEL "Not Too Shabby (Default)" +#define DEFAULT_MODEL "vision+policy (Default)" diff --git a/common/params_keys.h b/common/params_keys.h index 40a69ebd88..4edce35f47 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -117,4 +117,42 @@ inline static std::unordered_map keys = { {"UpdaterTargetBranch", CLEAR_ON_MANAGER_START}, {"UpdaterLastFetchTime", PERSISTENT}, {"Version", PERSISTENT}, + + // --- sunnypilot params --- // + {"ApiCache_DriveStats", PERSISTENT}, + {"CarParamsSP", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION}, + {"CarParamsSPCache", CLEAR_ON_MANAGER_START}, + {"CarParamsSPPersistent", PERSISTENT}, + {"CarPlatformBundle", PERSISTENT}, + {"EnableGithubRunner", PERSISTENT | BACKUP}, + {"ModelRunnerTypeCache", CLEAR_ON_ONROAD_TRANSITION}, + {"OffroadMode", CLEAR_ON_MANAGER_START}, + {"OffroadMode_Status", CLEAR_ON_MANAGER_START}, + + // MADS params + {"Mads", PERSISTENT | BACKUP}, + {"MadsMainCruiseAllowed", PERSISTENT | BACKUP}, + {"MadsPauseLateralOnBrake", PERSISTENT | BACKUP}, + {"MadsUnifiedEngagementMode", PERSISTENT | BACKUP}, + + // Model Manager params + {"ModelManager_ActiveBundle", PERSISTENT}, + {"ModelManager_DownloadIndex", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION}, + {"ModelManager_LastSyncTime", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION}, + {"ModelManager_ModelsCache", PERSISTENT | BACKUP}, + + // sunnylink params + {"EnableSunnylinkUploader", PERSISTENT | BACKUP}, + {"LastSunnylinkPingTime", CLEAR_ON_MANAGER_START}, + {"SunnylinkDongleId", PERSISTENT}, + {"SunnylinkdPid", PERSISTENT}, + {"SunnylinkEnabled", PERSISTENT}, + + // sunnypilot car specific params + {"HyundaiRadarTracks", PERSISTENT}, + {"HyundaiRadarTracksConfirmed", PERSISTENT}, + {"HyundaiRadarTracksPersistent", PERSISTENT}, + {"HyundaiRadarTracksToggle", PERSISTENT}, + + {"DynamicExperimentalControl", PERSISTENT}, }; diff --git a/opendbc_repo b/opendbc_repo index a2d8fdb03c..d8808f9621 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit a2d8fdb03cc36b1d36b78ee53646d14000c415f1 +Subproject commit d8808f962172c63af777c2fb07aeace4a6ecc1cf diff --git a/selfdrive/modeld/__init__.py b/selfdrive/modeld/__init__.py index 639622e827..e69de29bb2 100644 --- a/selfdrive/modeld/__init__.py +++ b/selfdrive/modeld/__init__.py @@ -1,5 +0,0 @@ -from pathlib import Path - -MODEL_PATH = Path(__file__).parent / 'models/supercombo.onnx' -MODEL_PKL_PATH = Path(__file__).parent / 'models/supercombo_tinygrad.pkl' -METADATA_PATH = Path(__file__).parent / 'models/supercombo_metadata.pkl' diff --git a/selfdrive/modeld/fill_model_msg.py b/selfdrive/modeld/fill_model_msg.py index 753ac89c78..a254d6a063 100644 --- a/selfdrive/modeld/fill_model_msg.py +++ b/selfdrive/modeld/fill_model_msg.py @@ -2,33 +2,13 @@ import os import capnp import numpy as np from cereal import log -from openpilot.selfdrive.modeld.constants import ModelConstants, Plan -from openpilot.selfdrive.controls.lib.drive_helpers import MIN_SPEED +from openpilot.selfdrive.modeld.constants import ModelConstants, Plan, Meta SEND_RAW_PRED = os.getenv('SEND_RAW_PRED') ConfidenceClass = log.ModelDataV2.ConfidenceClass -def curv_from_psis(psi_target, psi_rate, vego, delay): - vego = np.clip(vego, MIN_SPEED, np.inf) - curv_from_psi = psi_target / (vego * delay) # epsilon to prevent divide-by-zero - return 2 * curv_from_psi - psi_rate / vego - - -def get_curvature_from_plan(plan, vego, delay): - psi_target = np.interp(delay, ModelConstants.T_IDXS, plan[:, Plan.T_FROM_CURRENT_EULER][:, 2]) - psi_rate = plan[:, Plan.ORIENTATION_RATE][0, 2] - return curv_from_psis(psi_target, psi_rate, vego, delay) - - -def get_curvature_from_output(output, vego, delay): - if desired_curv := output.get('desired_curvature'): # If the model outputs the desired curvature, use that directly - return float(desired_curv[0, 0]) - - return float(get_curvature_from_plan(output['plan'][0], vego, delay)) - - class PublishState: def __init__(self): self.disengage_buffer = np.zeros(ModelConstants.CONFIDENCE_BUFFER_LEN*ModelConstants.DISENGAGE_WIDTH, dtype=np.float32) @@ -79,21 +59,19 @@ def fill_model_msg(base_msg: capnp._DynamicStructBuilder, extended_msg: capnp._D net_output_data: dict[str, np.ndarray], v_ego: float, delay: float, publish_state: PublishState, vipc_frame_id: int, vipc_frame_id_extra: int, frame_id: int, frame_drop: float, timestamp_eof: int, model_execution_time: float, - valid: bool, model_meta) -> None: + valid: bool) -> None: frame_age = frame_id - vipc_frame_id if frame_id > vipc_frame_id else 0 frame_drop_perc = frame_drop * 100 extended_msg.valid = valid base_msg.valid = valid - desired_curvature = float(get_curvature_from_output(net_output_data, v_ego, delay)) - driving_model_data = base_msg.drivingModelData driving_model_data.frameId = vipc_frame_id driving_model_data.frameIdExtra = vipc_frame_id_extra driving_model_data.frameDropPerc = frame_drop_perc driving_model_data.modelExecutionTime = model_execution_time - driving_model_data.action.desiredCurvature = desired_curvature + driving_model_data.action.desiredCurvature = float(net_output_data['desired_curvature'][0,0]) modelV2 = extended_msg.modelV2 modelV2.frameId = vipc_frame_id @@ -128,7 +106,7 @@ def fill_model_msg(base_msg: capnp._DynamicStructBuilder, extended_msg: capnp._D fill_xyz_poly(driving_model_data.path, ModelConstants.POLY_PATH_DEGREE, *net_output_data['plan'][0,:,Plan.POSITION].T) # lateral planning - modelV2.action.desiredCurvature = desired_curvature + modelV2.action.desiredCurvature = float(net_output_data['desired_curvature'][0,0]) # times at X_IDXS according to model plan PLAN_T_IDXS = [np.nan] * ModelConstants.IDX_N @@ -178,25 +156,23 @@ def fill_model_msg(base_msg: capnp._DynamicStructBuilder, extended_msg: capnp._D meta = modelV2.meta meta.desireState = net_output_data['desire_state'][0].reshape(-1).tolist() meta.desirePrediction = net_output_data['desire_pred'][0].reshape(-1).tolist() - meta.engagedProb = net_output_data['meta'][0,model_meta.ENGAGED].item() + meta.engagedProb = net_output_data['meta'][0,Meta.ENGAGED].item() meta.init('disengagePredictions') disengage_predictions = meta.disengagePredictions disengage_predictions.t = ModelConstants.META_T_IDXS - disengage_predictions.brakeDisengageProbs = net_output_data['meta'][0,model_meta.BRAKE_DISENGAGE].tolist() - disengage_predictions.gasDisengageProbs = net_output_data['meta'][0,model_meta.GAS_DISENGAGE].tolist() - disengage_predictions.steerOverrideProbs = net_output_data['meta'][0,model_meta.STEER_OVERRIDE].tolist() - disengage_predictions.brake3MetersPerSecondSquaredProbs = net_output_data['meta'][0,model_meta.HARD_BRAKE_3].tolist() - disengage_predictions.brake4MetersPerSecondSquaredProbs = net_output_data['meta'][0,model_meta.HARD_BRAKE_4].tolist() - disengage_predictions.brake5MetersPerSecondSquaredProbs = net_output_data['meta'][0,model_meta.HARD_BRAKE_5].tolist() - - if hasattr(model_meta, 'GAS_PRESS') and hasattr(model_meta, 'BRAKE_PRESS'): - disengage_predictions.gasPressProbs = net_output_data['meta'][0,model_meta.GAS_PRESS].tolist() - disengage_predictions.brakePressProbs = net_output_data['meta'][0,model_meta.BRAKE_PRESS].tolist() + disengage_predictions.brakeDisengageProbs = net_output_data['meta'][0,Meta.BRAKE_DISENGAGE].tolist() + disengage_predictions.gasDisengageProbs = net_output_data['meta'][0,Meta.GAS_DISENGAGE].tolist() + disengage_predictions.steerOverrideProbs = net_output_data['meta'][0,Meta.STEER_OVERRIDE].tolist() + disengage_predictions.brake3MetersPerSecondSquaredProbs = net_output_data['meta'][0,Meta.HARD_BRAKE_3].tolist() + disengage_predictions.brake4MetersPerSecondSquaredProbs = net_output_data['meta'][0,Meta.HARD_BRAKE_4].tolist() + disengage_predictions.brake5MetersPerSecondSquaredProbs = net_output_data['meta'][0,Meta.HARD_BRAKE_5].tolist() + disengage_predictions.gasPressProbs = net_output_data['meta'][0,Meta.GAS_PRESS].tolist() + disengage_predictions.brakePressProbs = net_output_data['meta'][0,Meta.BRAKE_PRESS].tolist() publish_state.prev_brake_5ms2_probs[:-1] = publish_state.prev_brake_5ms2_probs[1:] - publish_state.prev_brake_5ms2_probs[-1] = net_output_data['meta'][0,model_meta.HARD_BRAKE_5][0] + publish_state.prev_brake_5ms2_probs[-1] = net_output_data['meta'][0,Meta.HARD_BRAKE_5][0] publish_state.prev_brake_3ms2_probs[:-1] = publish_state.prev_brake_3ms2_probs[1:] - publish_state.prev_brake_3ms2_probs[-1] = net_output_data['meta'][0,model_meta.HARD_BRAKE_3][0] + publish_state.prev_brake_3ms2_probs[-1] = net_output_data['meta'][0,Meta.HARD_BRAKE_3][0] hard_brake_predicted = (publish_state.prev_brake_5ms2_probs > ModelConstants.FCW_THRESHOLDS_5MS2).all() and \ (publish_state.prev_brake_3ms2_probs > ModelConstants.FCW_THRESHOLDS_3MS2).all() meta.hardBrakePredicted = hard_brake_predicted.item() @@ -204,9 +180,9 @@ def fill_model_msg(base_msg: capnp._DynamicStructBuilder, extended_msg: capnp._D # confidence if vipc_frame_id % (2*ModelConstants.MODEL_FREQ) == 0: # any disengage prob - brake_disengage_probs = net_output_data['meta'][0,model_meta.BRAKE_DISENGAGE] - gas_disengage_probs = net_output_data['meta'][0,model_meta.GAS_DISENGAGE] - steer_override_probs = net_output_data['meta'][0,model_meta.STEER_OVERRIDE] + brake_disengage_probs = net_output_data['meta'][0,Meta.BRAKE_DISENGAGE] + gas_disengage_probs = net_output_data['meta'][0,Meta.GAS_DISENGAGE] + steer_override_probs = net_output_data['meta'][0,Meta.STEER_OVERRIDE] any_disengage_probs = 1-((1-brake_disengage_probs)*(1-gas_disengage_probs)*(1-steer_override_probs)) # independent disengage prob for each 2s slice ind_disengage_probs = np.r_[any_disengage_probs[0], np.diff(any_disengage_probs) / (1 - any_disengage_probs[:-1])] diff --git a/selfdrive/modeld/models/commonmodel.cc b/selfdrive/modeld/models/commonmodel.cc index 399836b0c6..9973d18588 100644 --- a/selfdrive/modeld/models/commonmodel.cc +++ b/selfdrive/modeld/models/commonmodel.cc @@ -5,14 +5,13 @@ #include "common/clutil.h" -DrivingModelFrame::DrivingModelFrame(cl_device_id device_id, cl_context context, uint8_t buffer_length) : ModelFrame(device_id, context), buffer_length(buffer_length) { +DrivingModelFrame::DrivingModelFrame(cl_device_id device_id, cl_context context) : ModelFrame(device_id, context) { input_frames = std::make_unique(buf_size); input_frames_cl = CL_CHECK_ERR(clCreateBuffer(context, CL_MEM_READ_WRITE, buf_size, NULL, &err)); - img_buffer_20hz_cl = CL_CHECK_ERR(clCreateBuffer(context, CL_MEM_READ_WRITE, buffer_length*frame_size_bytes, NULL, &err)); - region.origin = (buffer_length - 1) * frame_size_bytes; + img_buffer_20hz_cl = CL_CHECK_ERR(clCreateBuffer(context, CL_MEM_READ_WRITE, 2*frame_size_bytes, NULL, &err)); + region.origin = 1 * frame_size_bytes; region.size = frame_size_bytes; last_img_cl = CL_CHECK_ERR(clCreateSubBuffer(img_buffer_20hz_cl, CL_MEM_READ_WRITE, CL_BUFFER_CREATE_TYPE_REGION, ®ion, &err)); - // printf("Buffer length: %d, region origin: %lu, region size: %lu\n", buffer_length, region.origin, region.size); loadyuv_init(&loadyuv, context, device_id, MODEL_WIDTH, MODEL_HEIGHT); init_transform(device_id, context, MODEL_WIDTH, MODEL_HEIGHT); @@ -21,7 +20,7 @@ DrivingModelFrame::DrivingModelFrame(cl_device_id device_id, cl_context context, cl_mem* DrivingModelFrame::prepare(cl_mem yuv_cl, int frame_width, int frame_height, int frame_stride, int frame_uv_offset, const mat3& projection) { run_transform(yuv_cl, MODEL_WIDTH, MODEL_HEIGHT, frame_width, frame_height, frame_stride, frame_uv_offset, projection); - for (int i = 0; i < (buffer_length - 1); i++) { + for (int i = 0; i < 1; i++) { CL_CHECK(clEnqueueCopyBuffer(q, img_buffer_20hz_cl, img_buffer_20hz_cl, (i+1)*frame_size_bytes, i*frame_size_bytes, frame_size_bytes, 0, nullptr, nullptr)); } loadyuv_queue(&loadyuv, q, y_cl, u_cl, v_cl, last_img_cl); diff --git a/selfdrive/modeld/models/commonmodel.h b/selfdrive/modeld/models/commonmodel.h index 3b5db05c77..14409943e4 100644 --- a/selfdrive/modeld/models/commonmodel.h +++ b/selfdrive/modeld/models/commonmodel.h @@ -64,7 +64,7 @@ protected: class DrivingModelFrame : public ModelFrame { public: - DrivingModelFrame(cl_device_id device_id, cl_context context, uint8_t buffer_length); + DrivingModelFrame(cl_device_id device_id, cl_context context); ~DrivingModelFrame(); cl_mem* prepare(cl_mem yuv_cl, int frame_width, int frame_height, int frame_stride, int frame_uv_offset, const mat3& projection); @@ -73,7 +73,6 @@ public: const int MODEL_FRAME_SIZE = MODEL_WIDTH * MODEL_HEIGHT * 3 / 2; const int buf_size = MODEL_FRAME_SIZE * 2; const size_t frame_size_bytes = MODEL_FRAME_SIZE * sizeof(uint8_t); - const uint8_t buffer_length; private: LoadYUVState loadyuv; diff --git a/selfdrive/modeld/models/commonmodel.pxd b/selfdrive/modeld/models/commonmodel.pxd index f640597b80..b4f08b12aa 100644 --- a/selfdrive/modeld/models/commonmodel.pxd +++ b/selfdrive/modeld/models/commonmodel.pxd @@ -20,7 +20,7 @@ cdef extern from "selfdrive/modeld/models/commonmodel.h": cppclass DrivingModelFrame: int buf_size - DrivingModelFrame(cl_device_id, cl_context, unsigned char) + DrivingModelFrame(cl_device_id, cl_context) cppclass MonitoringModelFrame: int buf_size diff --git a/selfdrive/modeld/models/commonmodel_pyx.pyx b/selfdrive/modeld/models/commonmodel_pyx.pyx index 78a891f031..7b3a5bb342 100644 --- a/selfdrive/modeld/models/commonmodel_pyx.pyx +++ b/selfdrive/modeld/models/commonmodel_pyx.pyx @@ -4,7 +4,7 @@ import numpy as np cimport numpy as cnp from libc.string cimport memcpy -from libc.stdint cimport uintptr_t, uint8_t +from libc.stdint cimport uintptr_t from msgq.visionipc.visionipc cimport cl_mem from msgq.visionipc.visionipc_pyx cimport VisionBuf, CLContext as BaseCLContext @@ -59,8 +59,8 @@ cdef class ModelFrame: cdef class DrivingModelFrame(ModelFrame): cdef cppDrivingModelFrame * _frame - def __cinit__(self, CLContext context, int buffer_length=2): - self._frame = new cppDrivingModelFrame(context.device_id, context.context, buffer_length) + def __cinit__(self, CLContext context): + self._frame = new cppDrivingModelFrame(context.device_id, context.context) self.frame = (self._frame) self.buf_size = self._frame.buf_size diff --git a/selfdrive/ui/qt/offroad/firehose.cc b/selfdrive/ui/qt/offroad/firehose.cc index 7b48b0fd9a..5ce878131d 100644 --- a/selfdrive/ui/qt/offroad/firehose.cc +++ b/selfdrive/ui/qt/offroad/firehose.cc @@ -1,7 +1,4 @@ #include "selfdrive/ui/qt/offroad/firehose.h" -#include "selfdrive/ui/ui.h" -#include "selfdrive/ui/qt/offroad/settings.h" - #include #include #include diff --git a/selfdrive/ui/qt/offroad/firehose.h b/selfdrive/ui/qt/offroad/firehose.h index 7f5899f9f0..1b8fd378f5 100644 --- a/selfdrive/ui/qt/offroad/firehose.h +++ b/selfdrive/ui/qt/offroad/firehose.h @@ -4,9 +4,17 @@ #include #include #include -#include "selfdrive/ui/qt/widgets/controls.h" #include "common/params.h" +#ifdef SUNNYPILOT +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" +#else +#include "selfdrive/ui/qt/widgets/controls.h" +#include "selfdrive/ui/qt/offroad/settings.h" +#endif + + // Forward declarations class SettingsWindow; diff --git a/selfdrive/ui/qt/offroad/settings.cc b/selfdrive/ui/qt/offroad/settings.cc index c6d3520712..2ec7e3d2d9 100644 --- a/selfdrive/ui/qt/offroad/settings.cc +++ b/selfdrive/ui/qt/offroad/settings.cc @@ -14,7 +14,7 @@ #include "selfdrive/ui/qt/widgets/prime.h" #include "selfdrive/ui/qt/widgets/scrollview.h" #include "selfdrive/ui/qt/offroad/developer_panel.h" -#include "selfdrive/ui/qt/offroad/firehose.h" +// #include "selfdrive/ui/qt/offroad/firehose.h" TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) { // param, title, desc, icon diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc index bdf4f626d7..a27561edf6 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc @@ -9,6 +9,7 @@ #include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" #include "selfdrive/ui/qt/offroad/developer_panel.h" +#include "selfdrive/ui/qt/offroad/firehose.h" #include "selfdrive/ui/sunnypilot/qt/network/networking.h" #include "selfdrive/ui/sunnypilot/qt/offroad/settings/device_panel.h" @@ -80,6 +81,7 @@ SettingsWindowSP::SettingsWindowSP(QWidget *parent) : SettingsWindow(parent) { PanelInfo(" " + tr("sunnypilot"), new SunnypilotPanel(this), "../assets/images/button_home.png"), PanelInfo(" " + tr("Trips"), new TripsPanel(this), "../../sunnypilot/selfdrive/assets/offroad/icon_trips.png"), PanelInfo(" " + tr("Vehicle"), new VehiclePanel(this), "../../sunnypilot/selfdrive/assets/offroad/icon_vehicle.png"), + PanelInfo(" " + tr("Firehose"), new FirehosePanel(this), "../../sunnypilot/selfdrive/assets/offroad/icon_firehose.svg"), PanelInfo(" " + tr("Developer"), new DeveloperPanel(this), "../assets/offroad/icon_shell.png"), }; diff --git a/selfdrive/ui/tests/test_ui/run.py b/selfdrive/ui/tests/test_ui/run.py index 0c94c04256..0cb3b4342b 100755 --- a/selfdrive/ui/tests/test_ui/run.py +++ b/selfdrive/ui/tests/test_ui/run.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import capnp +import json import pathlib import shutil import sys @@ -35,35 +36,44 @@ DATA: dict[str, capnp.lib.capnp._DynamicStructBuilder] = dict.fromkeys( "liveCalibration", "modelV2", "radarState", "driverMonitoringState", "carState", "driverStateV2", "roadCameraState", "wideRoadCameraState", "driverCameraState"], None) -def setup_homescreen(click, pm: PubMaster): +def setup_homescreen(click, pm: PubMaster, scroll=None): pass -def setup_settings_device(click, pm: PubMaster): +def setup_settings_device(click, pm: PubMaster, scroll=None): click(100, 100) -def setup_settings_toggles(click, pm: PubMaster): +def setup_settings_network(click, pm: PubMaster, scroll=None): setup_settings_device(click, pm) - click(278, 600) + click(278, 405) + +def setup_settings_network_advanced(click, pm: PubMaster, scroll=None): + setup_settings_network(click, pm) + click(1913, 90) + +def setup_settings_toggles(click, pm: PubMaster, scroll=None): + setup_settings_device(click, pm) + click(278, 632) time.sleep(UI_DELAY) -def setup_settings_software(click, pm: PubMaster): +def setup_settings_software(click, pm: PubMaster, scroll=None): setup_settings_device(click, pm) - click(278, 720) + click(278, 742) time.sleep(UI_DELAY) -def setup_settings_firehose(click, pm: PubMaster): - click(278, 836) +def setup_settings_firehose(click, pm: PubMaster, scroll=None): + click(278, 862) -def setup_settings_developer(click, pm: PubMaster): +def setup_settings_developer(click, pm: PubMaster, scroll=None): CP = car.CarParams() CP.experimentalLongitudinalAvailable = True Params().put("CarParamsPersistent", CP.to_bytes()) setup_settings_device(click, pm) + scroll(-400, 278, 962) click(278, 970) time.sleep(UI_DELAY) -def setup_onroad(click, pm: PubMaster): +def setup_onroad(click, pm: PubMaster, scroll=None): vipc_server = VisionIpcServer("camerad") for stream_type, cam, _ in STREAMS: vipc_server.create_buffers(stream_type, 5, cam.width, cam.height) @@ -95,51 +105,52 @@ def setup_onroad(click, pm: PubMaster): packet_id += 1 time.sleep(0.05) -def setup_onroad_disengaged(click, pm: PubMaster): +def setup_onroad_disengaged(click, pm: PubMaster, scroll=None): DATA['selfdriveState'].selfdriveState.enabled = False setup_onroad(click, pm) DATA['selfdriveState'].selfdriveState.enabled = True -def setup_onroad_override(click, pm: PubMaster): +def setup_onroad_override(click, pm: PubMaster, scroll=None): DATA['selfdriveState'].selfdriveState.state = log.SelfdriveState.OpenpilotState.overriding setup_onroad(click, pm) DATA['selfdriveState'].selfdriveState.state = log.SelfdriveState.OpenpilotState.enabled -def setup_onroad_wide(click, pm: PubMaster): +def setup_onroad_wide(click, pm: PubMaster, scroll=None): DATA['selfdriveState'].selfdriveState.experimentalMode = True DATA["carState"].carState.vEgo = 1 setup_onroad(click, pm) -def setup_onroad_sidebar(click, pm: PubMaster): +def setup_onroad_sidebar(click, pm: PubMaster, scroll=None): setup_onroad(click, pm) click(500, 500) setup_onroad(click, pm) -def setup_onroad_wide_sidebar(click, pm: PubMaster): +def setup_onroad_wide_sidebar(click, pm: PubMaster, scroll=None): setup_onroad_wide(click, pm) click(500, 500) setup_onroad_wide(click, pm) -def setup_body(click, pm: PubMaster): +def setup_body(click, pm: PubMaster, scroll=None): DATA['carParams'].carParams.brand = "body" DATA['carParams'].carParams.notCar = True DATA['carState'].carState.charging = True DATA['carState'].carState.fuelGauge = 50.0 setup_onroad(click, pm) -def setup_keyboard(click, pm: PubMaster): +def setup_keyboard(click, pm: PubMaster, scroll=None): setup_settings_device(click, pm) - click(250, 965) - click(1930, 420) + scroll(-400, 278, 962) + click(278, 970) + click(1930, 390) -def setup_keyboard_uppercase(click, pm: PubMaster): - setup_keyboard(click, pm) +def setup_keyboard_uppercase(click, pm: PubMaster, scroll=None): + setup_keyboard(click, pm, scroll) click(200, 800) -def setup_driver_camera(click, pm: PubMaster): +def setup_driver_camera(click, pm: PubMaster, scroll=None): setup_settings_device(click, pm) - click(1950, 435) + click(950, 620) DATA['deviceState'].deviceState.started = False setup_onroad(click, pm) DATA['deviceState'].deviceState.started = True @@ -157,24 +168,24 @@ def setup_onroad_alert(click, pm: PubMaster, text1, text2, size, status=log.Self setup_onroad(click, pm) DATA['selfdriveState'] = log_from_bytes(origin_state_bytes).as_builder() -def setup_onroad_alert_small(click, pm: PubMaster): +def setup_onroad_alert_small(click, pm: PubMaster, scroll=None): setup_onroad_alert(click, pm, 'This is a small alert message', '', log.SelfdriveState.AlertSize.small) -def setup_onroad_alert_mid(click, pm: PubMaster): +def setup_onroad_alert_mid(click, pm: PubMaster, scroll=None): setup_onroad_alert(click, pm, 'Medium Alert', 'This is a medium alert message', log.SelfdriveState.AlertSize.mid) -def setup_onroad_alert_full(click, pm: PubMaster): +def setup_onroad_alert_full(click, pm: PubMaster, scroll=None): setup_onroad_alert(click, pm, 'Full Alert', 'This is a full alert message', log.SelfdriveState.AlertSize.full) -def setup_offroad_alert(click, pm: PubMaster): +def setup_offroad_alert(click, pm: PubMaster, scroll=None): for alert in OFFROAD_ALERTS: set_offroad_alert(alert, True) # Toggle between settings and home to refresh the offroad alert widget setup_settings_device(click, pm) - click(240, 216) + click(100, 100) -def setup_update_available(click, pm: PubMaster): +def setup_update_available(click, pm: PubMaster, scroll=None): Params().put_bool("UpdateAvailable", True) release_notes_path = os.path.join(BASEDIR, "RELEASES.md") with open(release_notes_path) as file: @@ -182,17 +193,57 @@ def setup_update_available(click, pm: PubMaster): Params().put("UpdaterNewReleaseNotes", release_notes + "\n") setup_settings_device(click, pm) - click(240, 216) + click(100, 100) -def setup_pair_device(click, pm: PubMaster): +def setup_pair_device(click, pm: PubMaster, scroll=None): click(1950, 435) click(1800, 900) +def setup_settings_sunnylink(click, pm: PubMaster, scroll=None): + Params().put_bool("SunnylinkEnabled", True) + + setup_settings_device(click, pm) + click(278, 522) + time.sleep(UI_DELAY) + +def setup_settings_sunnypilot(click, pm: PubMaster, scroll=None): + setup_settings_device(click, pm) + click(278, 852) + time.sleep(UI_DELAY) + +def setup_settings_sunnypilot_mads(click, pm: PubMaster, scroll=None): + Params().put_bool("Mads", True) + + setup_settings_device(click, pm) + click(278, 852) + click(970, 455) + time.sleep(UI_DELAY) + +def setup_settings_trips(click, pm: PubMaster, scroll=None): + setup_settings_device(click, pm) + click(278, 962) + time.sleep(UI_DELAY) + +def setup_settings_vehicle(click, pm: PubMaster, scroll=None): + Params().put("CarPlatformBundle", json.dumps( + { + "platform": "HONDA_CIVIC_2022", + "name": "Honda Civic 2022-24" + } + )) + + setup_settings_device(click, pm) + scroll(-400, 278, 862) + click(278, 770) + time.sleep(UI_DELAY) + CASES = { "homescreen": setup_homescreen, "prime": setup_homescreen, "pair_device": setup_pair_device, "settings_device": setup_settings_device, + "settings_network": setup_settings_network, + "settings_network_advanced": setup_settings_network_advanced, "settings_toggles": setup_settings_toggles, "settings_software": setup_settings_software, "settings_firehose": setup_settings_firehose, @@ -214,6 +265,14 @@ CASES = { "keyboard_uppercase": setup_keyboard_uppercase } +CASES.update({ + "settings_sunnylink": setup_settings_sunnylink, + "settings_sunnypilot": setup_settings_sunnypilot, + "settings_sunnypilot_mads": setup_settings_sunnypilot_mads, + "settings_trips": setup_settings_trips, + "settings_vehicle": setup_settings_vehicle, +}) + TEST_DIR = pathlib.Path(__file__).parent TEST_OUTPUT_DIR = TEST_DIR / "report_1" @@ -248,10 +307,14 @@ class TestUI: pyautogui.click(self.ui.left + x, self.ui.top + y, *args, **kwargs) time.sleep(UI_DELAY) # give enough time for the UI to react + def scroll(self, clicks, x, y, *args, **kwargs): + pyautogui.scroll(clicks, self.ui.left + x, self.ui.top + y, *args, **kwargs) + time.sleep(UI_DELAY) + @with_processes(["ui"]) def test_ui(self, name, setup_case): self.setup() - setup_case(self.click, self.pm) + setup_case(self.click, self.pm, self.scroll) self.screenshot(name) def create_screenshots(): @@ -298,6 +361,7 @@ def create_screenshots(): with OpenpilotPrefix(): params = Params() params.put("DongleId", "123456789012345") + params.put("SunnylinkDongleId", "123456789012345") if name == 'prime': params.put('PrimeType', '1') elif name == 'pair_device': diff --git a/selfdrive/ui/translations/main_ar.ts b/selfdrive/ui/translations/main_ar.ts index 8c01a63187..fef0013068 100644 --- a/selfdrive/ui/translations/main_ar.ts +++ b/selfdrive/ui/translations/main_ar.ts @@ -415,6 +415,31 @@ تشغيل وضع الراحة + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -890,6 +915,10 @@ This may take up to a minute. Developer المطور + + Firehose + + SettingsWindowSP @@ -933,6 +962,10 @@ This may take up to a minute. Developer المطور + + Firehose + + Setup @@ -1553,14 +1586,6 @@ This may take up to a minute. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1600,24 +1625,16 @@ This may take up to a minute. WiFiPromptWidget - Setup Wi-Fi - إعداد شبكة الواي فاي + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> + - Connect to Wi-Fi to upload driving data and help improve openpilot - الاتصال بشبكة الواي فاي لتحميل بيانات القيادة والمساهمة في تحسين openpilot + Maximize your training data uploads to improve openpilot's driving models. + - Open Settings - فتح الإعدادات - - - Ready to upload - جاهز للتحميل - - - Training data will be pulled periodically while your device is on Wi-Fi - سيتم سحب بيانات التدريب دورياً عندما يكون جهازك متصل بشبكة واي فاي + Open + diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts index 9543cb58d9..b30fd68902 100644 --- a/selfdrive/ui/translations/main_de.ts +++ b/selfdrive/ui/translations/main_de.ts @@ -415,6 +415,31 @@ ENTSPANNTER MODUS AN + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -872,6 +897,10 @@ This may take up to a minute. Developer + + Firehose + + SettingsWindowSP @@ -915,6 +944,10 @@ This may take up to a minute. Vehicle + + Firehose + + Setup @@ -1537,14 +1570,6 @@ This may take up to a minute. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1584,23 +1609,15 @@ This may take up to a minute. WiFiPromptWidget - Setup Wi-Fi + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> - Connect to Wi-Fi to upload driving data and help improve openpilot + Maximize your training data uploads to improve openpilot's driving models. - Open Settings - - - - Ready to upload - - - - Training data will be pulled periodically while your device is on Wi-Fi + Open diff --git a/selfdrive/ui/translations/main_es.ts b/selfdrive/ui/translations/main_es.ts index cba2a915d9..2560117e5c 100644 --- a/selfdrive/ui/translations/main_es.ts +++ b/selfdrive/ui/translations/main_es.ts @@ -415,6 +415,31 @@ MODO CHILL + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -874,6 +899,10 @@ Esto puede tardar un minuto. Developer Desarrollador + + Firehose + + SettingsWindowSP @@ -917,6 +946,10 @@ Esto puede tardar un minuto. Vehicle + + Firehose + + Setup @@ -1537,14 +1570,6 @@ Esto puede tardar un minuto. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1584,24 +1609,16 @@ Esto puede tardar un minuto. WiFiPromptWidget - Setup Wi-Fi - Configurar Wi-Fi + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> + - Connect to Wi-Fi to upload driving data and help improve openpilot - Conectarse al Wi-Fi para subir los datos de conducción y mejorar openpilot + Maximize your training data uploads to improve openpilot's driving models. + - Open Settings - Abrir Configuraciones - - - Ready to upload - Listo para subir - - - Training data will be pulled periodically while your device is on Wi-Fi - Los datos de entrenamiento se extraerán periódicamente mientras tu dispositivo esté conectado a Wi-Fi + Open + diff --git a/selfdrive/ui/translations/main_fr.ts b/selfdrive/ui/translations/main_fr.ts index 3358af2f3a..8ac4cb5e4b 100644 --- a/selfdrive/ui/translations/main_fr.ts +++ b/selfdrive/ui/translations/main_fr.ts @@ -415,6 +415,31 @@ MODE DÉTENTE ACTIVÉ + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -874,6 +899,10 @@ Cela peut prendre jusqu'à une minute. Developer Dév. + + Firehose + + SettingsWindowSP @@ -917,6 +946,10 @@ Cela peut prendre jusqu'à une minute. Vehicle + + Firehose + + Setup @@ -1537,14 +1570,6 @@ Cela peut prendre jusqu'à une minute. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1584,24 +1609,16 @@ Cela peut prendre jusqu'à une minute. WiFiPromptWidget - Setup Wi-Fi - Configurer Wi-Fi + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> + - Connect to Wi-Fi to upload driving data and help improve openpilot - Connectez-vous au Wi-Fi pour publier les données de conduite et aider à améliorer openpilot + Maximize your training data uploads to improve openpilot's driving models. + - Open Settings - Ouvrir les paramètres - - - Ready to upload - Prêt à uploader - - - Training data will be pulled periodically while your device is on Wi-Fi - Les données d'entraînement seront envoyées périodiquement lorsque votre appareil est connecté au réseau Wi-Fi + Open + diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index 6023796b70..16d46c89c8 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -415,6 +415,31 @@ CHILLモード + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -870,6 +895,10 @@ This may take up to a minute. Developer 開発 + + Firehose + + SettingsWindowSP @@ -913,6 +942,10 @@ This may take up to a minute. Vehicle + + Firehose + + Setup @@ -1533,14 +1566,6 @@ This may take up to a minute. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1580,24 +1605,16 @@ This may take up to a minute. WiFiPromptWidget - Setup Wi-Fi - Wi-Fiセットアップ + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> + - Connect to Wi-Fi to upload driving data and help improve openpilot - ドライブデータをアップロードしてopenpilotの改善に役立てるためにWi-Fi接続してください + Maximize your training data uploads to improve openpilot's driving models. + - Open Settings - 設定を開く - - - Ready to upload - アップロード準備完了 - - - Training data will be pulled periodically while your device is on Wi-Fi - デバイスがWi-Fiに接続されている間、トレーニングデータが定期的に送信されます + Open + diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 4b0bedfc87..316b1b77fd 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -415,6 +415,31 @@ 안정 모드 사용 + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -870,6 +895,10 @@ This may take up to a minute. Developer 개발자 + + Firehose + + SettingsWindowSP @@ -913,6 +942,10 @@ This may take up to a minute. Vehicle + + Firehose + + Setup @@ -1533,14 +1566,6 @@ This may take up to a minute. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1580,24 +1605,16 @@ This may take up to a minute. WiFiPromptWidget - Setup Wi-Fi - Wi-Fi 설정 + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> + - Connect to Wi-Fi to upload driving data and help improve openpilot - Wi-Fi에 연결하여 주행 데이터를 업로드하고 openpilot 개선에 기여하세요 + Maximize your training data uploads to improve openpilot's driving models. + - Open Settings - 설정 열기 - - - Ready to upload - 업로드 준비 완료 - - - Training data will be pulled periodically while your device is on Wi-Fi - 기기가 Wi-Fi에 연결되어 있는 동안 트레이닝 데이터를 주기적으로 전송합니다 + Open + diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts index de663d589e..2344f866d1 100644 --- a/selfdrive/ui/translations/main_pt-BR.ts +++ b/selfdrive/ui/translations/main_pt-BR.ts @@ -415,6 +415,31 @@ MODO CHILL ON + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -874,6 +899,10 @@ Isso pode levar até um minuto. Developer Desenvdor + + Firehose + + SettingsWindowSP @@ -917,6 +946,10 @@ Isso pode levar até um minuto. Vehicle + + Firehose + + Setup @@ -1537,14 +1570,6 @@ Isso pode levar até um minuto. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1584,24 +1609,16 @@ Isso pode levar até um minuto. WiFiPromptWidget - Setup Wi-Fi - Configurar Wi-Fi + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> + - Connect to Wi-Fi to upload driving data and help improve openpilot - Conecte se ao Wi-Fi para realizar upload de dados de condução e ajudar a melhorar o openpilot + Maximize your training data uploads to improve openpilot's driving models. + - Open Settings - Abrir Configurações - - - Ready to upload - Pronto para upload - - - Training data will be pulled periodically while your device is on Wi-Fi - Os dados de treinamento serão extraídos periodicamente enquanto o dispositivo estiver no Wi-Fi + Open + diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts index 62df4cc1ad..9df280dc05 100644 --- a/selfdrive/ui/translations/main_th.ts +++ b/selfdrive/ui/translations/main_th.ts @@ -415,6 +415,31 @@ คุณกำลังใช้โหมดชิล + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -870,6 +895,10 @@ This may take up to a minute. Developer + + Firehose + + SettingsWindowSP @@ -913,6 +942,10 @@ This may take up to a minute. Vehicle + + Firehose + + Setup @@ -1533,14 +1566,6 @@ This may take up to a minute. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1580,24 +1605,16 @@ This may take up to a minute. WiFiPromptWidget - Setup Wi-Fi - ตั้งค่า Wi-Fi + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> + - Connect to Wi-Fi to upload driving data and help improve openpilot - เชื่อมต่อกับ Wi-Fi เพื่ออัปโหลดข้อมูลการขับขี่และช่วยปรับปรุง openpilot + Maximize your training data uploads to improve openpilot's driving models. + - Open Settings - เปิดการตั้งค่า - - - Ready to upload - พร้อมจะอัปโหลด - - - Training data will be pulled periodically while your device is on Wi-Fi - ข้อมูลการฝึกฝนจะถูกดึงเป็นระยะระหว่างที่อุปกรณ์ของคุณเชื่อมต่อกับ Wi-Fi + Open + diff --git a/selfdrive/ui/translations/main_tr.ts b/selfdrive/ui/translations/main_tr.ts index 8661d669be..501c242665 100644 --- a/selfdrive/ui/translations/main_tr.ts +++ b/selfdrive/ui/translations/main_tr.ts @@ -415,6 +415,31 @@ + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -868,6 +893,10 @@ This may take up to a minute. Developer + + Firehose + + SettingsWindowSP @@ -911,6 +940,10 @@ This may take up to a minute. Vehicle + + Firehose + + Setup @@ -1531,14 +1564,6 @@ This may take up to a minute. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1578,23 +1603,15 @@ This may take up to a minute. WiFiPromptWidget - Setup Wi-Fi + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> - Connect to Wi-Fi to upload driving data and help improve openpilot + Maximize your training data uploads to improve openpilot's driving models. - Open Settings - - - - Ready to upload - - - - Training data will be pulled periodically while your device is on Wi-Fi + Open diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index ae26436612..2ac12e34ee 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -415,6 +415,31 @@ 轻松模式运行 + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -870,6 +895,10 @@ This may take up to a minute. Developer + + Firehose + + SettingsWindowSP @@ -913,6 +942,10 @@ This may take up to a minute. Vehicle + + Firehose + + Setup @@ -1533,14 +1566,6 @@ This may take up to a minute. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1580,24 +1605,16 @@ This may take up to a minute. WiFiPromptWidget - Setup Wi-Fi - 设置 Wi-Fi 连接 + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> + - Connect to Wi-Fi to upload driving data and help improve openpilot - 请连接至 Wi-Fi 上传驾驶数据以协助改进openpilot + Maximize your training data uploads to improve openpilot's driving models. + - Open Settings - 打开设置 - - - Ready to upload - 准备好上传 - - - Training data will be pulled periodically while your device is on Wi-Fi - 训练数据将定期通过 Wi-Fi 上载 + Open + diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index d967a33d6c..59c90e4bef 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -415,6 +415,31 @@ 輕鬆模式 ON + + FirehosePanel + + 🔥 Firehose Mode 🔥 + + + + openpilot learns to drive by watching humans, like you, drive. + +Firehose Mode allows you to maximize your training data uploads to improve openpilot's driving models. More data means bigger models with better Experimental Mode. + + + + Enable Firehose Mode + + + + 0% + 5G {0%?} + + + Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable the toggle<br> 4. Leave it connected for at least 30 minutes<br><br>The toggle turns off once you restart your device. Repeat at least once a week for maximum effectiveness.<br><br><b>FAQ</b><br><i>Does it matter how or where I drive?</i> Nope, just drive as you normally would.<br><i>What's a good USB-C adapter?</i> Any fast phone or laptop charger should be fine.<br><i>Do I need to be on Wi-Fi?</i> Yes.<br><i>Do I need to bring the device inside?</i> No, you can enable once you're parked, however your uploads will be limited by your car's battery.<br> + + + HudRenderer @@ -870,6 +895,10 @@ This may take up to a minute. Developer + + Firehose + + SettingsWindowSP @@ -913,6 +942,10 @@ This may take up to a minute. Vehicle + + Firehose + + Setup @@ -1533,14 +1566,6 @@ This may take up to a minute. Enable toggle to allow the model to determine when to use sunnypilot ACC or sunnypilot End to End Longitudinal. - - FIREHOSE Mode - - - - Enable <b>FIREHOSE Mode</b> to get your driving data in the training set.<br><br>Follow these steps to get your device ready:<br> 1. Bring your device inside and connect to a good USB-C adapter<br> 2. Connect to Wi-Fi<br> 3. Enable this toggle<br> 4. Leave it connected for at least 30 minutes<br><br>This toggle turns off once you restart your device. Repeat once a week for maximum effectiveness. - - Updater @@ -1580,24 +1605,16 @@ This may take up to a minute. WiFiPromptWidget - Setup Wi-Fi - 設置 Wi-Fi 連接 + <span style='font-family: "Noto Color Emoji";'>🔥</span> Firehose Mode <span style='font-family: Noto Color Emoji;'>🔥</span> + - Connect to Wi-Fi to upload driving data and help improve openpilot - 請連接至 Wi-Fi 傳駕駛數據以協助改進 openpilot + Maximize your training data uploads to improve openpilot's driving models. + - Open Settings - 開啟設置 - - - Ready to upload - 準備好上傳 - - - Training data will be pulled periodically while your device is on Wi-Fi - 訓練數據將定期經過 Wi-Fi 上傳 + Open + diff --git a/sunnypilot/mads/mads.py b/sunnypilot/mads/mads.py index 6335517a43..6298ffd9da 100644 --- a/sunnypilot/mads/mads.py +++ b/sunnypilot/mads/mads.py @@ -27,7 +27,6 @@ Last updated: July 29, 2024 from cereal import car, log, custom from opendbc.car.hyundai.values import HyundaiFlags -from opendbc.sunnypilot.car.hyundai.values import HyundaiFlagsSP from openpilot.sunnypilot.mads.helpers import MadsParams from openpilot.sunnypilot.mads.state import StateMachine, GEARS_ALLOW_PAUSED_SILENT @@ -57,7 +56,7 @@ class ModularAssistiveDrivingSystem: self.events_sp = self.selfdrive.events_sp if self.selfdrive.CP.brand == "hyundai": - if (self.selfdrive.CP_SP.flags & HyundaiFlagsSP.HAS_LFA_BUTTON) or \ + if (self.selfdrive.CP.flags & HyundaiFlags.HAS_LDA_BUTTON) or \ (self.selfdrive.CP.flags & HyundaiFlags.CANFD): self.allow_always = True diff --git a/sunnypilot/modeld/tests/model_hash b/sunnypilot/modeld/tests/model_hash deleted file mode 100644 index 5121e0f7eb..0000000000 --- a/sunnypilot/modeld/tests/model_hash +++ /dev/null @@ -1 +0,0 @@ -d21daa542227ecc5972da45df4e26f018ba113c0461f270e367d57e3ad89221a \ No newline at end of file diff --git a/sunnypilot/modeld/tests/test_default_model.py b/sunnypilot/modeld/tests/test_default_model.py deleted file mode 100644 index 3e3c14523c..0000000000 --- a/sunnypilot/modeld/tests/test_default_model.py +++ /dev/null @@ -1,11 +0,0 @@ -from openpilot.sunnypilot.modeld.default_model import get_hash, MODEL_HASH_PATH, ONNX_PATH - - -class TestDefaultModel: - def test_compare_onnx_hashes(self): - new_hash = get_hash(ONNX_PATH) - - with open(MODEL_HASH_PATH) as f: - current_hash = f.read().strip() - - assert new_hash == current_hash, "Run sunnypilot/modeld/default_model.py to update the default model name and hash" diff --git a/sunnypilot/modeld/default_model.py b/sunnypilot/models/default_model.py old mode 100644 new mode 100755 similarity index 64% rename from sunnypilot/modeld/default_model.py rename to sunnypilot/models/default_model.py index 21f73ee8b4..66cfab11b4 --- a/sunnypilot/modeld/default_model.py +++ b/sunnypilot/models/default_model.py @@ -5,11 +5,13 @@ import hashlib from openpilot.common.basedir import BASEDIR DEFAULT_MODEL_NAME_PATH = os.path.join(BASEDIR, "common", "model.h") -MODEL_HASH_PATH = os.path.join(BASEDIR, "sunnypilot", "modeld", "tests", "model_hash") -ONNX_PATH = os.path.join(BASEDIR, "selfdrive", "modeld", "models", "supercombo.onnx") +MODEL_HASH_PATH = os.path.join(BASEDIR, "sunnypilot", "models", "tests", "model_hash") +VISION_ONNX_PATH = os.path.join(BASEDIR, "selfdrive", "modeld", "models", "driving_vision.onnx") +POLICY_ONNX_PATH = os.path.join(BASEDIR, "selfdrive", "modeld", "models", "driving_policy.onnx") -def get_hash(path: str) -> str: +def get_file_hash(path: str) -> str: + """Compute SHA-256 hash of a file.""" sha256_hash = hashlib.sha256() with open(path, "rb") as f: for byte_block in iter(lambda: f.read(4096), b""): @@ -18,13 +20,21 @@ def get_hash(path: str) -> str: def update_model_hash(): - new_hash = get_hash(ONNX_PATH) + """Compute and update the combined hash for both ONNX models.""" + vision_hash = get_file_hash(VISION_ONNX_PATH) + policy_hash = get_file_hash(POLICY_ONNX_PATH) + + # Combine both hashes into a single hash for consistency + combined_hash = hashlib.sha256((vision_hash + policy_hash).encode()).hexdigest() + with open(MODEL_HASH_PATH, "w") as f: - f.write(new_hash) - print(f"Generated and updated new hash to {MODEL_HASH_PATH}") + f.write(combined_hash) + + print(f"Generated and updated new combined model hash to {MODEL_HASH_PATH}") def get_current_default_model_name(): + """Read the current default model name from the header file.""" print("[GET DEFAULT MODEL NAME]") with open(DEFAULT_MODEL_NAME_PATH) as f: name = f.read().split('"')[1] @@ -34,6 +44,7 @@ def get_current_default_model_name(): def update_default_model_name(name: str): + """Update the model name in the header file.""" print("[CHANGE DEFAULT MODEL NAME]") with open(DEFAULT_MODEL_NAME_PATH, "w") as f: f.write(f'#define DEFAULT_MODEL "{name}"\n') @@ -53,9 +64,10 @@ if __name__ == "__main__": current_name = get_current_default_model_name() new_name = f"{args.new_name} (Default)" + if current_name == new_name: print(f'Proposed default model name: "{new_name}"') - confirm = input("Proposed default model name is the same as the current default model name. Confirm? (y/n):").upper().strip() + confirm = input("Proposed default model name is the same as the current default model name. Confirm? (y/n): ").upper().strip() if confirm != "Y": print("Default model name and hash will not be updated! (aborted)") exit(0) diff --git a/sunnypilot/models/tests/model_hash b/sunnypilot/models/tests/model_hash new file mode 100644 index 0000000000..1f2d773fab --- /dev/null +++ b/sunnypilot/models/tests/model_hash @@ -0,0 +1 @@ +c0636e407aa49a3e227d63dd7bc9c625fa681c10a11af1ab4e11214cface123e \ No newline at end of file diff --git a/sunnypilot/models/tests/test_default_model.py b/sunnypilot/models/tests/test_default_model.py new file mode 100644 index 0000000000..9f6f52700e --- /dev/null +++ b/sunnypilot/models/tests/test_default_model.py @@ -0,0 +1,19 @@ +from openpilot.sunnypilot.models.default_model import get_file_hash, MODEL_HASH_PATH, VISION_ONNX_PATH, POLICY_ONNX_PATH +import hashlib + + +class TestDefaultModel: + def test_compare_onnx_hashes(self): + # Compute hashes for both ONNX models + vision_hash = get_file_hash(VISION_ONNX_PATH) + policy_hash = get_file_hash(POLICY_ONNX_PATH) + + # Generate combined hash + combined_hash = hashlib.sha256((vision_hash + policy_hash).encode()).hexdigest() + + # Read stored model hash + with open(MODEL_HASH_PATH) as f: + current_hash = f.read().strip() + + # Assert combined hash matches the stored hash + assert combined_hash == current_hash, "Run sunnypilot/models/default_model.py to update the default model name and hash" diff --git a/sunnypilot/selfdrive/assets/offroad/icon_firehose.svg b/sunnypilot/selfdrive/assets/offroad/icon_firehose.svg new file mode 100644 index 0000000000..9e5353da30 --- /dev/null +++ b/sunnypilot/selfdrive/assets/offroad/icon_firehose.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fefe69ef501c2c18ddba6d946ac0646c9b07d408ee03bcebbf2e91195b6ccb76 +size 1914