From f015a8368b86a3c42dca09fa1e7c52db1c561a23 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 5 May 2024 05:10:06 -0500 Subject: [PATCH] wip --- ...e.txt => clearpiliot_devqueue_zbacklog.txt | 0 clearpilot_devqueue_amain.txt | 22 ++++++++++++ clearpilot_feature_documentation.txt | 10 ++++++ selfdrive/car/hyundai/carstate.py | 14 ++++++++ .../controls/lib/frogpilot_functions.py | 19 ++++++----- selfdrive/frogpilot/frogpilot_process.py | 34 +++++++++++-------- selfdrive/manager/manager.py | 2 ++ selfdrive/manager/process_config.py | 6 ++-- selfdrive/ui/qt/onroad.cc | 4 +-- selfdrive/ui/qt/ready.cc | 2 +- selfdrive/ui/ui.h | 10 +++--- 11 files changed, 89 insertions(+), 34 deletions(-) rename clearpiliot_devqueue.txt => clearpiliot_devqueue_zbacklog.txt (100%) create mode 100644 clearpilot_devqueue_amain.txt create mode 100644 clearpilot_feature_documentation.txt diff --git a/clearpiliot_devqueue.txt b/clearpiliot_devqueue_zbacklog.txt similarity index 100% rename from clearpiliot_devqueue.txt rename to clearpiliot_devqueue_zbacklog.txt diff --git a/clearpilot_devqueue_amain.txt b/clearpilot_devqueue_amain.txt new file mode 100644 index 0000000..2d30be2 --- /dev/null +++ b/clearpilot_devqueue_amain.txt @@ -0,0 +1,22 @@ +- If possible, debug what happened to frogpilot process on may 4th +- See where disk free is going with NCDU and add smarter log rotation + - Maybe this has logs where it could show what happened to frogpilot process? +- Test supress cruise icon on long paused +- Move pac man ghost logo up 10% +- increase center lane brightness 50% and make it blueish +- make drive mode color much brighter and 30% more white +- maintain lateral on icon on stop on dash +- prevent engagement if disengaged and brakes are applied, just enable lateral +- edit manager to log all stderr output +- write a debug function for python that cats data to a screen terminal and optionally a log file +- if cruise already engaged when boot, just enable lateral +- reengage lateral if changing lanes and changing the wrong way +- speed limit display / over speed display / trigger set +- hack the buttons so we can press them +- auto set speed limit +- conditional experimenal mode +- ui conditional experimental mode, orange lines, show large font of desired speed in lower left +- hold down button to turn off screen, remember setting +- bluetooth dummy device +- dash cam +- change disk used on sidebar to disk free / percent used diff --git a/clearpilot_feature_documentation.txt b/clearpilot_feature_documentation.txt new file mode 100644 index 0000000..d76df26 --- /dev/null +++ b/clearpilot_feature_documentation.txt @@ -0,0 +1,10 @@ +- Pause lateral on lane change +- Updated color scheme +- Updated boot / ready logo +- Go straight to settings from drive +- Show full screen splasn on offroad until tapped +- Updated LFA icons on dashboard +- Removed a lot of icons from UI +- Monitor never fully fatals +- Engage / Disengage sounds silenced +- \ No newline at end of file diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index ad1dc34..208b75c 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -277,6 +277,20 @@ class CarState(CarStateBase): self.cruise_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["CRUISE_BUTTONS"]) self.prev_main_buttons = self.main_buttons[-1] self.main_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["ADAPTIVE_CRUISE_MAIN_BTN"]) + + # testme + # if ret.cruiseState.speed > 1 and self.main_enabled == False: + # self.main_enabled = True + + # test if this blocks trying to engage while pressin brakes + if self.main_buttons[-1] != 0 and ret.brakePressed and self.main_enabled == False: + self.main_buttons[-1] = 0 + # But enable always on lateral if self.main_enabled = false + # I think this may require an override variable? + # It looks like always on lat is only set when cruise control is enabled + # We need a temp version that enables or disables it if cruise is off via button + # and then the temp state removes when the button is pressed again + if self.prev_main_buttons == 0 and self.main_buttons[-1] != 0: self.main_enabled = not self.main_enabled # if self.fix_main_enabled_check: diff --git a/selfdrive/frogpilot/controls/lib/frogpilot_functions.py b/selfdrive/frogpilot/controls/lib/frogpilot_functions.py index d7cc14a..99ca288 100644 --- a/selfdrive/frogpilot/controls/lib/frogpilot_functions.py +++ b/selfdrive/frogpilot/controls/lib/frogpilot_functions.py @@ -31,15 +31,14 @@ def calculate_lane_width(lane, current_lane, road_edge): return min(distance_to_lane, distance_to_road_edge) +# Clearpilot added default value 0 def calculate_road_curvature(modelData, v_ego): - predicted_velocities = np.array(modelData.velocity.x) - # clearpilot fix - # /data/openpilot/openpilot/selfdrive/frogpilot/controls/lib/frogpilot_functions.py:36: RuntimeWarning: divide by zero encountered in divide - # curvature_ratios = np.abs(np.array(modelData.acceleration.y)) / (predicted_velocities**2) - curvature_ratios = np.abs(np.array(modelData.acceleration.y)) / (predicted_velocities**2) - # /data/openpilot/openpilot/selfdrive/frogpilot/controls/lib/frogpilot_functions.py:37: RuntimeWarning: invalid value encountered in multiply - # return np.amax(curvature_ratios * (v_ego**2)) - return np.amax(curvature_ratios * (v_ego**2)) + try: + predicted_velocities = np.array(modelData.velocity.x) + curvature_ratios = np.abs(np.array(modelData.acceleration.y)) / (predicted_velocities**2) + return np.amax(curvature_ratios * (v_ego**2)) + except: + return 0 class MovingAverageCalculator: def __init__(self): @@ -141,6 +140,10 @@ class FrogPilotFunctions: except OSError: pass + @classmethod + def prune_recordings(): + return + @classmethod def setup_frogpilot(cls): remount_cmd = ['sudo', 'mount', '-o', 'remount,rw', '/persist'] diff --git a/selfdrive/frogpilot/frogpilot_process.py b/selfdrive/frogpilot/frogpilot_process.py index eb2b5f9..c3018bf 100644 --- a/selfdrive/frogpilot/frogpilot_process.py +++ b/selfdrive/frogpilot/frogpilot_process.py @@ -21,17 +21,19 @@ from openpilot.selfdrive.frogpilot.controls.lib.theme_manager import ThemeManage WIFI = log.DeviceState.NetworkType.wifi +# clearpilot disabled def automatic_update_check(params): - update_available = params.get_bool("UpdaterFetchAvailable") - update_ready = params.get_bool("UpdateAvailable") - update_state = params.get("UpdaterState", encoding='utf8') + return + # update_available = params.get_bool("UpdaterFetchAvailable") + # update_ready = params.get_bool("UpdateAvailable") + # update_state = params.get("UpdaterState", encoding='utf8') - if update_ready: - HARDWARE.reboot() - elif update_available: - os.system("pkill -SIGHUP -f selfdrive.updated.updated") - elif update_state == "idle": - os.system("pkill -SIGUSR1 -f selfdrive.updated.updated") + # if update_ready: + # HARDWARE.reboot() + # elif update_available: + # os.system("pkill -SIGHUP -f selfdrive.updated.updated") + # elif update_state == "idle": + # os.system("pkill -SIGUSR1 -f selfdrive.updated.updated") def github_pinged(url="https://github.com", timeout=5): try: @@ -40,15 +42,17 @@ def github_pinged(url="https://github.com", timeout=5): except (urllib.error.URLError, socket.timeout, http.client.RemoteDisconnected): return False +# clearpilot disabled def time_checks(automatic_updates, deviceState, params): - if github_pinged(): - populate_models() + return + # if github_pinged(): + # populate_models() - screen_off = deviceState.screenBrightnessPercent == 0 - wifi_connection = deviceState.networkType == WIFI + # screen_off = deviceState.screenBrightnessPercent == 0 + # wifi_connection = deviceState.networkType == WIFI - if automatic_updates and screen_off and wifi_connection: - automatic_update_check(params) + # if automatic_updates and screen_off and wifi_connection: + # automatic_update_check(params) def frogpilot_thread(): config_realtime_process(5, Priority.CTRL_LOW) diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index d7f736d..cd28629 100755 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -400,6 +400,8 @@ def manager_thread(frogpilot_functions) -> None: if openpilot_crashed: frogpilot_functions.delete_logs() + frogpilot_functions.prune_logs() + started = sm['deviceState'].started if started and not started_prev: diff --git a/selfdrive/manager/process_config.py b/selfdrive/manager/process_config.py index b4c8b4f..37e92a2 100644 --- a/selfdrive/manager/process_config.py +++ b/selfdrive/manager/process_config.py @@ -89,8 +89,8 @@ procs = [ PythonProcess("radard", "selfdrive.controls.radard", only_onroad), PythonProcess("thermald", "selfdrive.thermald.thermald", always_run), PythonProcess("tombstoned", "selfdrive.tombstoned", always_run, enabled=not PC), - PythonProcess("updated", "selfdrive.updated.updated", always_run, enabled=not PC), - PythonProcess("uploader", "system.loggerd.uploader", allow_uploads), + # PythonProcess("updated", "selfdrive.updated.updated", always_run, enabled=not PC), + # PythonProcess("uploader", "system.loggerd.uploader", allow_uploads), PythonProcess("statsd", "selfdrive.statsd", allow_logging), # debug procs @@ -100,7 +100,7 @@ procs = [ # FrogPilot processes PythonProcess("fleet_manager", "selfdrive.frogpilot.fleetmanager.fleet_manager", always_run), - PythonProcess("frogpilot_process", "selfdrive.frogpilot.frogpilot_process", always_run), + # PythonProcess("frogpilot_process", "selfdrive.frogpilot.frogpilot_process", always_run), PythonProcess("mapd", "selfdrive.frogpilot.navigation.mapd", always_run), ] diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 32fb152..a38d6a9 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -907,8 +907,8 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { if (edgeColor != bg_colors[STATUS_DISENGAGED]) { QLinearGradient edge_gradient; edge_gradient.setColorAt(0.0, QColor(edgeColor.red(), edgeColor.green(), edgeColor.blue(), static_cast(255))); - edge_gradient.setColorAt(0.5, QColor(edgeColor.red(), edgeColor.green(), edgeColor.blue(), static_cast(255 * 0.7) )); - edge_gradient.setColorAt(1.0, QColor(edgeColor.red(), edgeColor.green(), edgeColor.blue(), static_cast(255 * 0.5))); + edge_gradient.setColorAt(0.5, QColor(edgeColor.red(), edgeColor.green(), edgeColor.blue(), static_cast(255 * 0.8) )); + edge_gradient.setColorAt(1.0, QColor(edgeColor.red(), edgeColor.green(), edgeColor.blue(), static_cast(255 * 0.7))); QPainterPath path; path.addPolygon(scene.track_vertices); diff --git a/selfdrive/ui/qt/ready.cc b/selfdrive/ui/qt/ready.cc index 40d1e39..fdf5604 100644 --- a/selfdrive/ui/qt/ready.cc +++ b/selfdrive/ui/qt/ready.cc @@ -42,7 +42,7 @@ void ReadyWindow::paintEvent(QPaintEvent *event) { // Calculate the top-left position to center the image in the window. int x = (this->width() - comma_img.width()) / 2; - int y = (this->height() - comma_img.height()) / 2; + int y = ((this->height() - comma_img.height()) / 20) * 9; // Draw the pixmap at the calculated position. painter.drawPixmap(x, y, comma_img); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index ab28c73..2ddb448 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -33,18 +33,18 @@ typedef enum UIStatus { } UIStatus; // Clearpilot new alpha constants -const float CENTER_LANE_ALPHA = 0.55; +const float CENTER_LANE_ALPHA = 0.75; const float OTHER_LANE_ALPHA = 0.75; -const int CENTER_LANE_WIDTH = 50; +const int CENTER_LANE_WIDTH = 75; const int OTHER_LANE_WIDTH = 16; // Clearpilot custom colors const QColor bg_colors [] = { [STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8), - [STATUS_OVERRIDE] = QColor(64, 85, 245, 0xd1), // When you nudge the steering wheel while engaged - [STATUS_ENGAGED] = QColor(64, 85, 245, 0xd1), // Bright Blue - [STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(162, 221, 235, 0xd1), // Lighter Blue + [STATUS_OVERRIDE] = QColor(94, 112, 255, 0xd1), // When you nudge the steering wheel while engaged + [STATUS_ENGAGED] = QColor(94, 112, 255, 0xd1), // Bright Blue + [STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(143, 204, 235, 0xd1), // Lighter Blue [STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xd1), // ? unused? [STATUS_EXPERIMENTAL_ACTIVE] = QColor(201, 41, 204, 0xd1), // Magenta [CENTER_LANE_COLOR] = QColor(150, 150, 150, 0xd1), // Gray