wip
This commit is contained in:
@@ -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']
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user