openpilot v0.8.8 release

This commit is contained in:
Vehicle Researcher
2021-08-22 22:13:11 -07:00
parent 444aace15f
commit baffaeee93
193 changed files with 60566 additions and 1933 deletions
+4 -3
View File
@@ -1,9 +1,12 @@
import jwt
import os
import requests
from datetime import datetime, timedelta
from common.basedir import PERSIST
from selfdrive.version import version
API_HOST = os.getenv('API_HOST', 'https://api.commadotai.com')
class Api():
def __init__(self, dongle_id):
self.dongle_id = dongle_id
@@ -34,12 +37,10 @@ class Api():
def api_get(endpoint, method='GET', timeout=None, access_token=None, **params):
backend = "https://api.commadotai.com/"
headers = {}
if access_token is not None:
headers['Authorization'] = "JWT "+access_token
headers['User-Agent'] = "openpilot-" + version
return requests.request(method, backend+endpoint, timeout=timeout, headers=headers, params=params)
return requests.request(method, API_HOST + "/" + endpoint, timeout=timeout, headers=headers, params=params)
+19
View File
@@ -79,6 +79,25 @@ class NamedTemporaryDir():
self.close()
class CallbackReader:
"""Wraps a file, but overrides the read method to also
call a callback function with the number of bytes read so far."""
def __init__(self, f, callback, *args):
self.f = f
self.callback = callback
self.cb_args = args
self.total_read = 0
def __getattr__(self, attr):
return getattr(self.f, attr)
def read(self, *args, **kwargs):
chunk = self.f.read(*args, **kwargs)
self.total_read += len(chunk)
self.callback(*self.cb_args, self.total_read)
return chunk
def _get_fileobject_func(writer, temp_dir):
def _get_fileobject():
file_obj = writer.get_fileobject(dir=temp_dir)
+8 -4
View File
@@ -1,9 +1,13 @@
class FirstOrderFilter():
class FirstOrderFilter:
# first order filter
def __init__(self, x0, ts, dt):
self.k = (dt / ts) / (1. + dt / ts)
def __init__(self, x0, rc, dt):
self.x = x0
self.dt = dt
self.update_alpha(rc)
def update_alpha(self, rc):
self.alpha = self.dt / (rc + self.dt)
def update(self, x):
self.x = (1. - self.k) * self.x + self.k * x
self.x = (1. - self.alpha) * self.x + self.alpha * x
return self.x
+1 -1
View File
@@ -17,7 +17,7 @@ cdef extern from "selfdrive/common/params.h":
ALL
cdef cppclass Params:
Params(bool) nogil
Params() nogil
Params(string) nogil
string get(string, bool) nogil
bool getBool(string) nogil
+2 -2
View File
@@ -30,11 +30,11 @@ class UnknownKeyName(Exception):
cdef class Params:
cdef c_Params* p
def __cinit__(self, d=None, bool persistent_params=False):
def __cinit__(self, d=None):
cdef string path
if d is None:
with nogil:
self.p = new c_Params(persistent_params)
self.p = new c_Params()
else:
path = <string>d.encode()
with nogil: