This commit is contained in:
Your Name
2024-05-05 05:10:06 -05:00
parent 38fb8ffde0
commit f015a8368b
11 changed files with 89 additions and 34 deletions

View File

@@ -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:

View File

@@ -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']

View File

@@ -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)

View File

@@ -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:

View File

@@ -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),
]

View File

@@ -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<int>(255)));
edge_gradient.setColorAt(0.5, QColor(edgeColor.red(), edgeColor.green(), edgeColor.blue(), static_cast<int>(255 * 0.7) ));
edge_gradient.setColorAt(1.0, QColor(edgeColor.red(), edgeColor.green(), edgeColor.blue(), static_cast<int>(255 * 0.5)));
edge_gradient.setColorAt(0.5, QColor(edgeColor.red(), edgeColor.green(), edgeColor.blue(), static_cast<int>(255 * 0.8) ));
edge_gradient.setColorAt(1.0, QColor(edgeColor.red(), edgeColor.green(), edgeColor.blue(), static_cast<int>(255 * 0.7)));
QPainterPath path;
path.addPolygon(scene.track_vertices);

View File

@@ -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);

View File

@@ -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