mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-26 05:12:19 +08:00
Compare commits
3 Commits
wgpu
...
master-dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a05c03079 | |||
| fd22de1c9a | |||
| ee3583df33 |
@@ -1,39 +0,0 @@
|
|||||||
name: prebuilt
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 * * * *'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOCKER_LOGIN: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
BUILD: release/ci/docker_build_sp.sh
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_prebuilt:
|
|
||||||
name: build prebuilt
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.repository == 'sunnypilot/sunnypilot'
|
|
||||||
env:
|
|
||||||
PUSH_IMAGE: true
|
|
||||||
permissions:
|
|
||||||
checks: read
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Wait for green check mark
|
|
||||||
if: ${{ github.event_name != 'workflow_dispatch' }}
|
|
||||||
uses: lewagon/wait-on-check-action@ccfb013c15c8afb7bf2b7c028fb74dc5a068cccc
|
|
||||||
with:
|
|
||||||
ref: master
|
|
||||||
wait-interval: 30
|
|
||||||
running-workflow-name: 'build prebuilt'
|
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
check-regexp: ^((?!.*(build master-ci|create badges).*).)*$
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- run: git lfs pull
|
|
||||||
- name: Build and Push docker image
|
|
||||||
run: |
|
|
||||||
$DOCKER_LOGIN
|
|
||||||
eval "$BUILD"
|
|
||||||
@@ -43,7 +43,7 @@ class ModelsLayout(Widget):
|
|||||||
self._initialize_items()
|
self._initialize_items()
|
||||||
|
|
||||||
self.clear_cache_item.action_item.set_value(f"{self.calculate_cache_size():.2f} MB")
|
self.clear_cache_item.action_item.set_value(f"{self.calculate_cache_size():.2f} MB")
|
||||||
for ctrl, key in [(self.lane_turn_value_control, "LaneTurnValue"), (self.delay_control, "LagdToggleDelay")]:
|
for ctrl, key in [(self.lane_turn_value_control, "LaneTurnValue"), (self.delay_control, "LagdToggleDelay"), (self.camera_offset, "CameraOffset")]:
|
||||||
ctrl.action_item.set_value(int(float(ui_state.params.get(key, return_default=True)) * 100))
|
ctrl.action_item.set_value(int(float(ui_state.params.get(key, return_default=True)) * 100))
|
||||||
|
|
||||||
self._scroller = Scroller(self.items, line_separator=True, spacing=0)
|
self._scroller = Scroller(self.items, line_separator=True, spacing=0)
|
||||||
@@ -93,9 +93,14 @@ class ModelsLayout(Widget):
|
|||||||
|
|
||||||
self.lagd_toggle = toggle_item_sp(tr("Live Learning Steer Delay"), "", param="LagdToggle")
|
self.lagd_toggle = toggle_item_sp(tr("Live Learning Steer Delay"), "", param="LagdToggle")
|
||||||
|
|
||||||
|
self.camera_offset = option_item_sp(tr("Adjust Camera Offset"), "CameraOffset", -35, 35,
|
||||||
|
tr("Virtually shift camera's perspective to move model's center to Left(+ values) or Right (- values)"),
|
||||||
|
1, None, True, "", style.BUTTON_ACTION_WIDTH, None, True,
|
||||||
|
lambda v: f"{v / 100:.2f} m")
|
||||||
|
|
||||||
self.items = [self.current_model_item, self.cancel_download_item, self.supercombo_label, self.vision_label,
|
self.items = [self.current_model_item, self.cancel_download_item, self.supercombo_label, self.vision_label,
|
||||||
self.policy_label, self.off_policy_label, self.on_policy_label, self.refresh_item, self.clear_cache_item, self.lane_turn_desire_toggle,
|
self.policy_label, self.off_policy_label, self.on_policy_label, self.refresh_item, self.clear_cache_item,
|
||||||
self.lane_turn_value_control, self.lagd_toggle, self.delay_control]
|
self.lane_turn_desire_toggle, self.lane_turn_value_control, self.lagd_toggle, self.delay_control, self.camera_offset]
|
||||||
|
|
||||||
def _update_lagd_description(self, lagd_toggle: bool):
|
def _update_lagd_description(self, lagd_toggle: bool):
|
||||||
desc = tr("Enable this for the car to learn and adapt its steering response time. Disable to use a fixed steering response time. " +
|
desc = tr("Enable this for the car to learn and adapt its steering response time. Disable to use a fixed steering response time. " +
|
||||||
@@ -232,6 +237,7 @@ class ModelsLayout(Widget):
|
|||||||
advanced_controls: bool = ui_state.params.get_bool("ShowAdvancedControls")
|
advanced_controls: bool = ui_state.params.get_bool("ShowAdvancedControls")
|
||||||
turn_desire: bool = ui_state.params.get_bool("LaneTurnDesire")
|
turn_desire: bool = ui_state.params.get_bool("LaneTurnDesire")
|
||||||
live_delay: bool = ui_state.params.get_bool("LagdToggle")
|
live_delay: bool = ui_state.params.get_bool("LagdToggle")
|
||||||
|
camera_offset: bool = ui_state.params.get("ModelManager_ActiveBundle") is not None
|
||||||
|
|
||||||
self.lane_turn_desire_toggle.action_item.set_state(turn_desire)
|
self.lane_turn_desire_toggle.action_item.set_state(turn_desire)
|
||||||
self.lane_turn_value_control.set_visible(turn_desire and advanced_controls)
|
self.lane_turn_value_control.set_visible(turn_desire and advanced_controls)
|
||||||
@@ -240,6 +246,7 @@ class ModelsLayout(Widget):
|
|||||||
new_step = int(round(100 / CV.MPH_TO_KPH)) if ui_state.is_metric else 100
|
new_step = int(round(100 / CV.MPH_TO_KPH)) if ui_state.is_metric else 100
|
||||||
if self.lane_turn_value_control.action_item is not None and self.lane_turn_value_control.action_item.value_change_step != new_step:
|
if self.lane_turn_value_control.action_item is not None and self.lane_turn_value_control.action_item.value_change_step != new_step:
|
||||||
self.lane_turn_value_control.action_item.value_change_step = new_step
|
self.lane_turn_value_control.action_item.value_change_step = new_step
|
||||||
|
self.camera_offset.set_visible(camera_offset)
|
||||||
|
|
||||||
self._update_lagd_description(live_delay)
|
self._update_lagd_description(live_delay)
|
||||||
self.model_manager = ui_state.sm["modelManagerSP"]
|
self.model_manager = ui_state.sm["modelManagerSP"]
|
||||||
|
|||||||
@@ -151,8 +151,8 @@ class SmartCruiseControlMap:
|
|||||||
a = 0.5 * TARGET_JERK
|
a = 0.5 * TARGET_JERK
|
||||||
b = self.a_ego
|
b = self.a_ego
|
||||||
c = self.v_ego - tv
|
c = self.v_ego - tv
|
||||||
t_a = -1 * ((b**2 - 4 * a * c) ** 0.5 + b) / 2 * a
|
t_a = -1 * ((b**2 - 4 * a * c) ** 0.5 + b) / (2 * a)
|
||||||
t_b = ((b**2 - 4 * a * c) ** 0.5 - b) / 2 * a
|
t_b = ((b**2 - 4 * a * c) ** 0.5 - b) / (2 * a)
|
||||||
if not isinstance(t_a, complex) and t_a > 0:
|
if not isinstance(t_a, complex) and t_a > 0:
|
||||||
t = t_a
|
t = t_a
|
||||||
else:
|
else:
|
||||||
|
|||||||
+18
-1
@@ -4,13 +4,17 @@ Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
|
|||||||
This file is part of sunnypilot and is licensed under the MIT License.
|
This file is part of sunnypilot and is licensed under the MIT License.
|
||||||
See the LICENSE.md file in the root directory for more details.
|
See the LICENSE.md file in the root directory for more details.
|
||||||
"""
|
"""
|
||||||
|
import json
|
||||||
|
import math
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from openpilot.cereal import custom
|
from openpilot.cereal import custom
|
||||||
from openpilot.common.params import Params
|
from openpilot.common.params import Params
|
||||||
from openpilot.common.realtime import DT_MDL
|
from openpilot.common.realtime import DT_MDL
|
||||||
from openpilot.selfdrive.car.cruise import V_CRUISE_UNSET
|
from openpilot.selfdrive.car.cruise import V_CRUISE_UNSET
|
||||||
from openpilot.sunnypilot.selfdrive.controls.lib.smart_cruise_control.map_controller import SmartCruiseControlMap
|
from openpilot.sunnypilot.selfdrive.controls.lib.smart_cruise_control.map_controller import R, SmartCruiseControlMap
|
||||||
|
|
||||||
MapState = VisionState = custom.LongitudinalPlanSP.SmartCruiseControl.MapState
|
MapState = VisionState = custom.LongitudinalPlanSP.SmartCruiseControl.MapState
|
||||||
|
|
||||||
@@ -55,4 +59,17 @@ class TestSmartCruiseControlMap:
|
|||||||
self.scc_m.update(True, False, 0., 0., 0.)
|
self.scc_m.update(True, False, 0., 0., 0.)
|
||||||
assert self.scc_m.state == VisionState.enabled
|
assert self.scc_m.state == VisionState.enabled
|
||||||
|
|
||||||
|
def test_moderate_curve(self):
|
||||||
|
# Regression: `... / 2 * a` parsed as `(.../2)*a` instead of `.../(2*a)`,
|
||||||
|
# making max_d ~11x too small so the moderate-curve branch never tripped.
|
||||||
|
# v_ego=25, a_ego=0, tv=24: fixed max_d≈45m vs buggy ≈4m at a 40m waypoint.
|
||||||
|
waypoint_lon_deg = (40.0 / R) * (180.0 / math.pi)
|
||||||
|
self.mem_params.put("LastGPSPosition", json.dumps({"latitude": 0.0, "longitude": 0.0}), block=True)
|
||||||
|
self.mem_params.put("MapTargetVelocities",
|
||||||
|
json.dumps([{"latitude": 0.0, "longitude": waypoint_lon_deg, "velocity": 24.0}]), block=True)
|
||||||
|
|
||||||
|
self.scc_m.update(True, False, 25.0, 0.0, 30.0)
|
||||||
|
|
||||||
|
assert self.scc_m.v_target == pytest.approx(24.0)
|
||||||
|
|
||||||
# TODO-SP: mock data from modelV2 to test other states
|
# TODO-SP: mock data from modelV2 to test other states
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
SCRIPT_DIR=$(dirname "$0")
|
|
||||||
OPENPILOT_DIR=$SCRIPT_DIR/../../
|
|
||||||
|
|
||||||
DOCKER_IMAGE=sunnypilot
|
|
||||||
DOCKER_FILE=Dockerfile.openpilot
|
|
||||||
DOCKER_REGISTRY=ghcr.io/sunnypilot
|
|
||||||
COMMIT_SHA=$(git rev-parse HEAD)
|
|
||||||
|
|
||||||
if [ -n "$TARGET_ARCHITECTURE" ]; then
|
|
||||||
PLATFORM="linux/$TARGET_ARCHITECTURE"
|
|
||||||
TAG_SUFFIX="-$TARGET_ARCHITECTURE"
|
|
||||||
else
|
|
||||||
PLATFORM="linux/$(uname -m)"
|
|
||||||
TAG_SUFFIX=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
LOCAL_TAG=$DOCKER_IMAGE$TAG_SUFFIX
|
|
||||||
REMOTE_TAG=$DOCKER_REGISTRY/$LOCAL_TAG
|
|
||||||
REMOTE_SHA_TAG=$DOCKER_REGISTRY/$LOCAL_TAG:$COMMIT_SHA
|
|
||||||
|
|
||||||
DOCKER_BUILDKIT=1 docker buildx build --provenance false --pull --platform $PLATFORM --load -t $DOCKER_IMAGE:latest -t $REMOTE_TAG -t $LOCAL_TAG -f $OPENPILOT_DIR/$DOCKER_FILE $OPENPILOT_DIR
|
|
||||||
|
|
||||||
if [ -n "$PUSH_IMAGE" ]; then
|
|
||||||
docker push $REMOTE_TAG
|
|
||||||
docker tag $REMOTE_TAG $REMOTE_SHA_TAG
|
|
||||||
docker push $REMOTE_SHA_TAG
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user