Compare commits

...

55 Commits

Author SHA1 Message Date
Jason Wen 21c490e807 try the gm method 2026-04-07 00:25:07 -04:00
Jason Wen e0f0906e56 actually new tune 2026-04-07 00:05:12 -04:00
Jason Wen 5a76a6ee0b prevents 360+ faults 2026-04-06 23:52:01 -04:00
Jason Wen f4c38a60d7 fwdRadar got updated via OTA???!! 2026-04-06 23:07:14 -04:00
Jason Wen a59f006379 Merge remote-tracking branch 'commaai/openpilot/master' into gv80-2025
# Conflicts:
#	opendbc_repo
2026-04-06 23:02:01 -04:00
Kacper Rączy 08401a96c2 modeld: frame delay (#37731)
* Frame delay

* Multiply

* If replay

* For long too

* DT_MDL / 2

* Shorten comment

* Just 50ms

* Remove REPLAY const
2026-04-06 21:15:38 +00:00
DevTekVE f37fd3ea34 Fixes the debugging of safety after scons removal (#37769)
Fixes the debugging after scons removal
2026-04-06 09:46:14 -07:00
Shane Smiskol dc4dae6794 replay/ui: color lines, use aTarget (#37764)
* color lines, use aTarget

* only scroll when updated
2026-04-04 20:28:16 -07:00
Jason Wen f170440f4a safety: add reserved controls_allowed fields for forks (like MADS) (#37747) 2026-04-04 15:30:34 -07:00
Shane Smiskol 310ba9d2c0 replay/ui: fix Qt threading issue (#37762)
* fix ui

* fix

* clean up
2026-04-03 20:01:33 -07:00
Test User ed061351f1 signed 2026-04-02 06:08:08 -04:00
Test User 85b188f1c2 bump 2026-04-02 04:30:19 -04:00
Jason Wen 9750193726 bump 2026-03-29 00:41:49 -07:00
Jason Wen 56bd3b8442 needs to be 360 2026-03-28 21:25:37 -07:00
Jason Wen ed5a01f2cd steer limit by safety for hyundai and round incoming desired angle to 1 decimal 2026-03-28 21:05:51 -07:00
Jason Wen 9ff6b87e09 bump 2026-03-28 20:49:42 -07:00
Jason Wen 5aad672484 bump 2026-03-28 20:03:21 -07:00
Jason Wen 8630beaf86 bump 2026-03-28 19:49:17 -07:00
Jason Wen ae5c8de39d bump 2026-03-28 19:09:34 -07:00
Jason Wen 418cb2045f new smoothing 2026-03-28 15:12:34 -07:00
Jason Wen b77e4309f2 revert 2026-03-28 14:22:51 -07:00
Jason Wen 211b6b18f2 todo 2026-03-28 13:48:34 -07:00
Jason Wen 48a0870713 bump 2026-03-28 13:38:00 -07:00
Jason Wen e78cb05f35 update speed-based EPS gain ceiling and override factor for improved low-speed stability 2026-03-28 12:40:32 -07:00
Jason Wen 3765ec7ea4 refine dangle handling with adjusted breakpoints and added winding logic 2026-03-28 11:50:31 -07:00
Jason Wen 228fcaaeab Merge remote-tracking branch 'sunnypilot/sunnypilot/gv80-2025' into gv80-2025
# Conflicts:
#	opendbc_repo
2026-03-28 11:34:43 -07:00
Jason Wen ba02401945 adjust override factor and dangle handling for smoother EPS control 2026-03-28 11:33:19 -07:00
Jason Wen 10f0c9964a mdps angle just angle steering for now 2026-03-28 11:18:50 -07:00
Jason Wen 6ec7e60231 gain based EPS force control 2026-03-28 10:39:51 -07:00
Jason Wen 5da7f18869 don't do this 2026-03-28 03:41:49 -07:00
Jason Wen c75c8bd27d separate gains 2026-03-28 03:28:14 -07:00
Jason Wen 61ae38b816 ignore road noise 2026-03-28 03:20:41 -07:00
Jason Wen c7ba469bad different ramp up and down 2026-03-28 02:43:52 -07:00
Jason Wen a4fe9d694d update torque reduction gain logic and parameters 2026-03-28 01:56:20 -07:00
Jason Wen 226ee3f1f1 test fix 2026-03-28 00:25:03 -07:00
Jason Wen 35ef6017f8 fix 2026-03-28 00:20:32 -07:00
Jason Wen 73e965ebcb try this out 2026-03-28 00:16:59 -07:00
Jason Wen 297f5fc499 bump 2026-03-27 23:55:43 -07:00
Jason Wen 86d97b075e bump steer threshold to 250 2026-03-27 23:28:23 -07:00
Jason Wen 60ea54fd15 new harness 2026-03-27 21:25:13 -07:00
Jason Wen c9e6ba1e51 Merge remote-tracking branch 'commaai/openpilot/master' into gv80-2025
# Conflicts:
#	opendbc_repo
2026-03-27 21:01:25 -07:00
Jason Wen 580014b2ec bump 2026-03-27 20:45:01 -07:00
Jason Wen a90b7bfb9f fix 2026-03-27 20:02:00 -07:00
Jason Wen a3fcf28da1 bump 2026-03-27 19:14:53 -07:00
royjr a0e1f722e2 Update opendbc_repo 2026-03-27 18:21:26 -07:00
royjr 6b2d4800c9 Update opendbc_repo 2026-03-27 17:59:38 -07:00
Jason Wen ffbead1711 bump 2026-03-27 17:48:35 -07:00
Jason Wen c734e44a39 bump 2026-03-27 17:39:15 -07:00
Jason Wen b60c3d2f10 more 2026-03-26 16:24:56 -07:00
Jason Wen 407d27d634 more 2026-03-26 16:20:11 -07:00
Jason Wen 11ab53854f more 2026-03-26 16:07:57 -07:00
Jason Wen 5273502b56 bump 2026-03-26 16:06:48 -07:00
Jason Wen 737ce31016 dbc 2026-03-26 15:58:03 -07:00
Jason Wen 360f863354 update them manually 2026-03-26 15:56:02 -07:00
Jason Wen 61bc7e5cb1 2025-26 gv80/gv80 coupe init 2026-03-26 15:28:33 -07:00
6 changed files with 56 additions and 47 deletions
+3
View File
@@ -52,6 +52,9 @@
"type": "lldb",
"request": "attach",
"pid": "${command:pickMyProcess}",
"sourceMap": {
".": "${workspaceFolder}/opendbc/safety"
},
"initCommands": [
"script import time; time.sleep(3)"
]
+5
View File
@@ -613,6 +613,11 @@ struct PandaState @0xa7649e2575e4591e {
voltage @0 :UInt32;
current @1 :UInt32;
# these fields are not used by openpilot, but they're
# reserved for forks building alternate experiences.
controlsAllowedRESERVED1 @38 :Bool;
controlsAllowedRESERVED2 @39 :Bool;
enum FaultStatus {
none @0;
faultTemp @1;
+3 -1
View File
@@ -405,7 +405,9 @@ def main(demo=False):
drivingdata_send = messaging.new_message('drivingModelData')
posenet_send = messaging.new_message('cameraOdometry')
action = get_action_from_model(model_output, prev_action, lat_delay + DT_MDL, long_delay + DT_MDL, v_ego)
frame_delay = DT_MDL # compensate for time passed since the frame was captured: current_time - timestamp_eof is 50ms on average
action_delay = DT_MDL / 2 # middle of the interval between model output (current state) and next frame (expected state)
action = get_action_from_model(model_output, prev_action, lat_delay + frame_delay + action_delay, long_delay + frame_delay + action_delay, v_ego)
prev_action = action
fill_model_msg(drivingdata_send, modelv2_send, model_output, action,
publish_state, meta_main.frame_id, meta_extra.frame_id, frame_id,
+12 -2
View File
@@ -5,6 +5,7 @@ import numpy as np
import pyray as rl
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.offsetbox import AnchoredOffsetbox, HPacker, TextArea
from openpilot.common.transformations.camera import get_view_frame_from_calib_frame
from openpilot.selfdrive.controls.radard import RADAR_TO_CAMERA
@@ -94,6 +95,7 @@ def draw_path(path, color, img, calibration, top_down, lid_color=None, z_off=0):
def init_plots(arr, name_to_arr_idx, plot_xlims, plot_ylims, plot_names, plot_colors, plot_styles):
color_palette = {"r": (1, 0, 0), "g": (0, 1, 0), "b": (0, 0, 1), "k": (0, 0, 0), "y": (1, 1, 0), "p": (0, 1, 1), "m": (1, 0, 1)}
label_palette = {**color_palette, "b": (43/255, 114/255, 1.0)}
dpi = 90
fig = plt.figure(figsize=(575 / dpi, 600 / dpi), dpi=dpi)
@@ -116,10 +118,18 @@ def init_plots(arr, name_to_arr_idx, plot_xlims, plot_ylims, plot_names, plot_co
plots.append(plot)
idxs.append(name_to_arr_idx[item])
plot_select.append(i)
axs[i].set_title(", ".join(f"{nm} ({cl})" for (nm, cl) in zip(pl_list, plot_colors[i], strict=False)), fontsize=10)
# Build colored title: each label colored to match its plot line
title_texts = []
for j2, (nm, cl) in enumerate(zip(pl_list, plot_colors[i], strict=False)):
if j2 > 0:
title_texts.append(TextArea(", ", textprops=dict(color="white", fontsize=10)))
title_texts.append(TextArea(nm, textprops=dict(color=label_palette[cl], fontsize=10)))
packed = HPacker(children=title_texts, pad=0, sep=0)
ab = AnchoredOffsetbox(loc='lower center', child=packed, bbox_to_anchor=(0.5, 1.0),
bbox_transform=axs[i].transAxes, frameon=False, pad=0)
axs[i].add_artist(ab)
axs[i].tick_params(axis="x", colors="white")
axs[i].tick_params(axis="y", colors="white")
axs[i].title.set_color("white")
if i < len(plot_ylims) - 1:
axs[i].set_xticks([])
+32 -43
View File
@@ -3,7 +3,6 @@ import argparse
import os
import sys
import cv2
import numpy as np
import pyray as rl
@@ -22,7 +21,8 @@ from openpilot.tools.replay.lib.ui_helpers import (
plot_lead,
plot_model,
)
from msgq.visionipc import VisionIpcClient, VisionStreamType
from msgq.visionipc import VisionStreamType
from openpilot.selfdrive.ui.mici.onroad.cameraview import CameraView
os.environ['BASEDIR'] = BASEDIR
@@ -30,8 +30,6 @@ ANGLE_SCALE = 5.0
def ui_thread(addr):
cv2.setNumThreads(1)
# Get monitor info before creating window
rl.set_config_flags(rl.ConfigFlags.FLAG_MSAA_4X_HINT)
rl.init_window(1, 1, "")
@@ -59,14 +57,15 @@ def ui_thread(addr):
font_path = os.path.join(BASEDIR, "selfdrive/assets/fonts/JetBrainsMono-Medium.ttf")
font = rl.load_font_ex(font_path, 32, None, 0)
# Create textures for camera and top-down view
camera_image = rl.gen_image_color(640, 480, rl.BLACK)
camera_texture = rl.load_texture_from_image(camera_image)
rl.unload_image(camera_image)
camera_view = CameraView("camerad", VisionStreamType.VISION_STREAM_ROAD)
# Overlay texture for model/lane line drawing
overlay_img = np.zeros((480, 640, 4), dtype='uint8')
overlay_image = rl.gen_image_color(640, 480, rl.BLANK)
overlay_texture = rl.load_texture_from_image(overlay_image)
rl.unload_image(overlay_image)
# lid_overlay array is (lidar_x, lidar_y) = (384, 960)
# pygame treats first axis as width, so texture is 384 wide x 960 tall
# For raylib, we need to transpose to get (height, width) = (960, 384) for the RGBA array
top_down_image = rl.gen_image_color(UP.lidar_x, UP.lidar_y, rl.BLACK)
top_down_texture = rl.load_texture_from_image(top_down_image)
rl.unload_image(top_down_image)
@@ -89,7 +88,6 @@ def ui_thread(addr):
)
img = np.zeros((480, 640, 3), dtype='uint8')
imgff = None
num_px = 0
calibration = None
@@ -116,7 +114,7 @@ def ui_thread(addr):
plot_arr = np.zeros((100, len(name_to_arr_idx.values())))
plot_xlims = [(0, plot_arr.shape[0]), (0, plot_arr.shape[0]), (0, plot_arr.shape[0]), (0, plot_arr.shape[0])]
plot_ylims = [(-0.1, 1.1), (-ANGLE_SCALE, ANGLE_SCALE), (0.0, 75.0), (-3.0, 2.0)]
plot_ylims = [(-0.1, 1.1), (-ANGLE_SCALE, ANGLE_SCALE), (0.0, 75.0), (-3.5, 2.0)]
plot_names = [
["gas", "computer_gas", "user_brake", "computer_brake"],
["angle_steers", "angle_steers_des", "angle_steers_k", "steer_torque"],
@@ -138,20 +136,16 @@ def ui_thread(addr):
palette[110] = [110, 110, 110, 255] # car_color (gray)
palette[255] = [255, 255, 255, 255] # WHITE
vipc_client = VisionIpcClient("camerad", VisionStreamType.VISION_STREAM_ROAD, True)
while not rl.window_should_close():
# ***** frame *****
if not vipc_client.is_connected():
vipc_client.connect(False)
rl.begin_drawing()
rl.clear_background(rl.Color(64, 64, 64, 255))
yuv_img_raw = vipc_client.recv()
if yuv_img_raw is None or not yuv_img_raw.data.any():
rl.draw_text_ex(font, "waiting for frames", rl.Vector2(200, 200), 30, 0, rl.WHITE)
rl.end_drawing()
continue
# Render camera (NV12->RGB on GPU via shader)
if camera_view.frame:
cam_h = 640.0 * camera_view.frame.height / camera_view.frame.width
else:
cam_h = 480.0
camera_view.render(rl.Rectangle(0, 0, 640, cam_h))
lid_overlay = lid_overlay_blank.copy()
top_down = top_down_texture, lid_overlay
@@ -159,19 +153,10 @@ def ui_thread(addr):
sm.update(0)
camera = DEVICE_CAMERAS[("tici", str(sm['roadCameraState'].sensor))]
# Use received buffer dimensions (full HEVC can have stride != buffer_len/rows due to VENUS padding)
h, w, stride = yuv_img_raw.height, yuv_img_raw.width, yuv_img_raw.stride
nv12_size = h * 3 // 2 * stride
imgff = np.frombuffer(yuv_img_raw.data, dtype=np.uint8, count=nv12_size).reshape((h * 3 // 2, stride))
num_px = w * h
rgb = cv2.cvtColor(imgff[: h * 3 // 2, : w], cv2.COLOR_YUV2RGB_NV12)
qcam = "QCAM" in os.environ
bb_scale = (528 if qcam else camera.fcam.width) / 640.0
calib_scale = camera.fcam.width / 640.0
zoom_matrix = np.asarray([[bb_scale, 0.0, 0.0], [0.0, bb_scale, 0.0], [0.0, 0.0, 1.0]])
cv2.warpAffine(rgb, zoom_matrix[:2], (img.shape[1], img.shape[0]), dst=img, flags=cv2.WARP_INVERSE_MAP)
if camera_view.frame:
num_px = camera_view.frame.width * camera_view.frame.height
intrinsic_matrix = camera.fcam.intrinsics
@@ -183,7 +168,8 @@ def ui_thread(addr):
else:
angle_steers_k = np.inf
plot_arr[:-1] = plot_arr[1:]
if sm.updated['carState']:
plot_arr[:-1] = plot_arr[1:]
plot_arr[-1, name_to_arr_idx['angle_steers']] = sm['carState'].steeringAngleDeg
plot_arr[-1, name_to_arr_idx['angle_steers_des']] = sm['carControl'].actuators.steeringAngleDeg
plot_arr[-1, name_to_arr_idx['angle_steers_k']] = angle_steers_k
@@ -198,9 +184,10 @@ def ui_thread(addr):
plot_arr[-1, name_to_arr_idx['v_cruise']] = sm['carState'].cruiseState.speed
plot_arr[-1, name_to_arr_idx['a_ego']] = sm['carState'].aEgo
if len(sm['longitudinalPlan'].accels):
plot_arr[-1, name_to_arr_idx['a_target']] = sm['longitudinalPlan'].accels[0]
plot_arr[-1, name_to_arr_idx['a_target']] = sm['longitudinalPlan'].aTarget
# Draw model overlays onto img, then blit as transparent overlay
img[:] = 0
if sm.recv_frame['modelV2']:
plot_model(sm['modelV2'], img, calibration, top_down)
@@ -214,11 +201,12 @@ def ui_thread(addr):
rpyCalib = np.asarray(sm['liveCalibration'].rpyCalib)
calibration = Calibration(num_px, rpyCalib, intrinsic_matrix, calib_scale)
# *** blits ***
# Update camera texture from numpy array
img_rgba = cv2.cvtColor(img, cv2.COLOR_RGB2RGBA)
rl.update_texture(camera_texture, rl.ffi.cast("void *", img_rgba.ctypes.data))
rl.draw_texture(camera_texture, 0, 0, rl.WHITE) # noqa: TID251
# Update overlay texture (RGB img -> RGBA with non-black pixels visible)
mask = np.any(img > 0, axis=2)
overlay_img[:, :, :3] = img
overlay_img[:, :, 3] = mask * 255
rl.update_texture(overlay_texture, rl.ffi.cast("void *", overlay_img.ctypes.data))
rl.draw_texture(overlay_texture, 0, 0, rl.WHITE) # noqa: TID251
# display alerts
rl.draw_text_ex(font, sm['selfdriveState'].alertText1, rl.Vector2(180, 150), 30, 0, rl.RED)
@@ -257,9 +245,10 @@ def ui_thread(addr):
rl.end_drawing()
rl.unload_texture(camera_texture)
rl.unload_texture(overlay_texture)
rl.unload_texture(top_down_texture)
rl.unload_font(font)
camera_view.close()
rl.close_window()