mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-21 11:23:47 +08:00
Remove unused code (#38598)
This commit is contained in:
@@ -31,12 +31,3 @@ def get_origin(cwd: str | None = None) -> str:
|
||||
return run_cmd(["git", "config", "remote." + tracking_remote + ".url"], cwd=cwd)
|
||||
except subprocess.CalledProcessError: # Not on a branch, fallback
|
||||
return run_cmd_default(["git", "config", "--get", "remote.origin.url"], cwd=cwd)
|
||||
|
||||
|
||||
@cache
|
||||
def get_normalized_origin(cwd: str | None = None) -> str:
|
||||
return get_origin(cwd) \
|
||||
.replace("git@", "", 1) \
|
||||
.replace(".git", "", 1) \
|
||||
.replace("https://", "", 1) \
|
||||
.replace(":", "/", 1)
|
||||
|
||||
@@ -48,9 +48,6 @@ class RunningStat:
|
||||
def std(self):
|
||||
return np.sqrt(self.variance())
|
||||
|
||||
def params_to_save(self):
|
||||
return [self.M, self.S, self.n]
|
||||
|
||||
class RunningStatFilter:
|
||||
def __init__(self, raw_priors=None, filtered_priors=None, max_trackable=-1):
|
||||
self.raw_stat = RunningStat(raw_priors, -1)
|
||||
|
||||
@@ -7,7 +7,6 @@ CONTROL_N = 17
|
||||
CAR_ROTATION_RADIUS = 0.0
|
||||
# This is a turn radius smaller than most cars can achieve
|
||||
MAX_CURVATURE = 0.2
|
||||
MAX_VEL_ERR = 5.0 # m/s
|
||||
MIN_STABLE_DELAY = 0.3
|
||||
|
||||
# EU guidelines
|
||||
|
||||
@@ -178,8 +178,6 @@ def get_lead(v_ego: float, ready: bool, tracks: dict[int, Track], lead_msg: capn
|
||||
|
||||
class RadarD:
|
||||
def __init__(self, delay: float = 0.0):
|
||||
self.current_time = 0.0
|
||||
|
||||
self.tracks: dict[int, Track] = {}
|
||||
self.kalman_params = KalmanParams(DT_MDL)
|
||||
self.lead_prob_filters = [FirstOrderFilter(0.0, 0.2, DT_MDL) for _ in range(2)]
|
||||
@@ -195,7 +193,6 @@ class RadarD:
|
||||
|
||||
def update(self, sm: messaging.SubMaster, rr: car.RadarData):
|
||||
self.ready = sm.seen['modelV2']
|
||||
self.current_time = 1e-9*max(sm.logMonoTime.values())
|
||||
|
||||
if sm.recv_frame['carState'] != self.last_v_ego_frame:
|
||||
self.v_ego = sm['carState'].vEgo
|
||||
|
||||
@@ -339,11 +339,6 @@ def low_memory_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaste
|
||||
return NormalPermanentAlert("Low Memory", f"{sm['deviceState'].memoryUsagePercent}% used")
|
||||
|
||||
|
||||
def high_cpu_usage_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert:
|
||||
x = max(sm['deviceState'].cpuUsagePercent, default=0.)
|
||||
return NormalPermanentAlert("High CPU Usage", f"{x}% used")
|
||||
|
||||
|
||||
def modeld_lagging_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert:
|
||||
return NormalPermanentAlert("Driving Model Lagging", f"{sm['modelV2'].frameDropPerc:.1f}% frames dropped")
|
||||
|
||||
|
||||
@@ -87,21 +87,12 @@ BROW_LOWERED = [
|
||||
(2, 0)
|
||||
]
|
||||
BROW_STRAIGHT = [(1, 0), (1, 1), (1, 2)]
|
||||
BROW_DOWN = [
|
||||
(0, 1), (0, 2),
|
||||
(1, 3)
|
||||
]
|
||||
|
||||
# Mouths (centered, not mirrored)
|
||||
MOUTH_SMILE = [
|
||||
(6, 6), (6, 9),
|
||||
(7, 7), (7, 8),
|
||||
]
|
||||
MOUTH_NORMAL = [(7, 7), (7, 8)]
|
||||
MOUTH_SAD = [
|
||||
(6, 7), (6, 8),
|
||||
(7, 6), (7, 9)
|
||||
]
|
||||
|
||||
# --- Animations ---
|
||||
|
||||
@@ -168,16 +159,6 @@ INQUISITIVE = Animation(
|
||||
repeat_interval=10
|
||||
)
|
||||
|
||||
WINK = Animation(
|
||||
frames=[
|
||||
_make_frame(EYE_OPEN, _mirror(EYE_OPEN), BROW_HIGH, _mirror(BROW_HIGH), MOUTH_SMILE),
|
||||
_make_frame(EYE_OPEN, _mirror(EYE_CLOSED), BROW_HIGH, _mirror(_shift(BROW_DOWN, (0, 2))), MOUTH_SMILE),
|
||||
],
|
||||
mode=AnimationMode.ONCE_FORWARD_BACKWARD,
|
||||
frame_duration=0.75,
|
||||
)
|
||||
|
||||
|
||||
# --- Face Animator Class ---
|
||||
|
||||
class FaceAnimator:
|
||||
|
||||
@@ -50,7 +50,6 @@ class SettingsLayout(NavScroller):
|
||||
device_btn,
|
||||
software_btn,
|
||||
PairBigButton(),
|
||||
#BigDialogButton("manual", "", "icons_mici/settings/manual_icon.png", "Check out the mici user\nmanual at comma.ai/setup"),
|
||||
firehose_btn,
|
||||
developer_btn,
|
||||
])
|
||||
|
||||
@@ -17,7 +17,6 @@ else:
|
||||
except (ImportError, OSError):
|
||||
Params = None
|
||||
|
||||
SCROLLING_SPEED_PX_S = 50
|
||||
COMPLICATION_SIZE = 36
|
||||
LABEL_COLOR = rl.Color(255, 255, 255, int(255 * 0.9))
|
||||
COMPLICATION_GREY = rl.Color(0xAA, 0xAA, 0xAA, 255)
|
||||
|
||||
@@ -10,7 +10,7 @@ from openpilot.system.ui.lib.text_measure import measure_text_cached
|
||||
from openpilot.system.ui.lib.application import gui_app, FontWeight, MousePos
|
||||
from openpilot.system.ui.widgets.slider import RedBigSlider, BigSlider
|
||||
from openpilot.common.filter_simple import FirstOrderFilter
|
||||
from openpilot.selfdrive.ui.mici.widgets.button import BigCircleButton, BigButton, GreyBigButton
|
||||
from openpilot.selfdrive.ui.mici.widgets.button import BigCircleButton, GreyBigButton
|
||||
|
||||
DEBUG = False
|
||||
|
||||
@@ -216,18 +216,6 @@ class BigInputDialog(BigDialogBase):
|
||||
self._confirm_callback()
|
||||
|
||||
|
||||
class BigDialogButton(BigButton):
|
||||
def __init__(self, text: str, value: str = "", icon: Union[str, rl.Texture] = "", description: str = ""):
|
||||
super().__init__(text, value, icon)
|
||||
self._description = description
|
||||
|
||||
def _handle_mouse_release(self, mouse_pos: MousePos):
|
||||
super()._handle_mouse_release(mouse_pos)
|
||||
|
||||
dlg = BigDialog(self.text, self._description)
|
||||
gui_app.push_widget(dlg)
|
||||
|
||||
|
||||
class BigConfirmationCircleButton(BigCircleButton):
|
||||
def __init__(self, title: str, icon: rl.Texture, confirm_callback: Callable[[], None], exit_on_confirm: bool = True,
|
||||
red: bool = False, icon_offset: tuple[int, int] = (0, 0)):
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
|
||||
def get_consistent_flag(path: str) -> bool:
|
||||
consistent_file = pathlib.Path(os.path.join(path, ".overlay_consistent"))
|
||||
return consistent_file.is_file()
|
||||
|
||||
def set_consistent_flag(path: str, consistent: bool) -> None:
|
||||
os.sync()
|
||||
consistent_file = pathlib.Path(os.path.join(path, ".overlay_consistent"))
|
||||
if consistent:
|
||||
consistent_file.touch()
|
||||
elif not consistent:
|
||||
consistent_file.unlink(missing_ok=True)
|
||||
os.sync()
|
||||
@@ -1,39 +0,0 @@
|
||||
diff --git a/src/logger.cpp b/src/logger.cpp
|
||||
index a63c6dd..a1d9860 100644
|
||||
--- a/src/logger.cpp
|
||||
+++ b/src/logger.cpp
|
||||
@@ -24,34 +24,22 @@ logger::~logger()
|
||||
|
||||
void logger::print(string str)
|
||||
{
|
||||
- cout << str;
|
||||
- cout.flush();
|
||||
}
|
||||
|
||||
void logger::print(double val)
|
||||
{
|
||||
- cout << setprecision(2) << fixed;
|
||||
- cout << val;
|
||||
- cout.flush();
|
||||
}
|
||||
|
||||
void logger::print(float val)
|
||||
{
|
||||
- cout << setprecision(2) << fixed;
|
||||
- cout << val;
|
||||
- cout.flush();
|
||||
}
|
||||
|
||||
void logger::print(int val)
|
||||
{
|
||||
- cout << val;
|
||||
- cout.flush();
|
||||
}
|
||||
|
||||
void logger::print(unsigned int val)
|
||||
{
|
||||
- cout << val;
|
||||
- cout.flush();
|
||||
}
|
||||
|
||||
void logger::xmlOpenTag(string tag)
|
||||
@@ -12,7 +12,6 @@ from openpilot.tools.lib.logreader import LogReader, ReadMode
|
||||
from openpilot.tools.lib.route import SegmentRange
|
||||
|
||||
|
||||
NO_API = "NO_API" in os.environ
|
||||
SUPPORTED_BRANDS = VERSIONS.keys()
|
||||
SUPPORTED_CARS = [brand for brand in SUPPORTED_BRANDS for brand in interface_names[brand]]
|
||||
UNKNOWN_BRAND = "unknown"
|
||||
@@ -178,4 +177,3 @@ if __name__ == "__main__":
|
||||
print(f"Correct fuzzy matches: {good_fuzzy}")
|
||||
print(f"Wrong fuzzy matches: {wrong_fuzzy}")
|
||||
print()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user