Skip to content

Commit

Permalink
Merge branch 'master-ci' of https://github.com/xps-genesis/openpilot
Browse files Browse the repository at this point in the history
…into xps-master-ci-debugged
  • Loading branch information
debugged-tech committed Feb 9, 2022
2 parents 689a376 + 410a970 commit 8bc29e3
Show file tree
Hide file tree
Showing 204 changed files with 3,376 additions and 24,302 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
venv/
.env
.clang-format
.DS_Store
.tags
Expand Down
4 changes: 4 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
Version 0.8.13 (2022-XX-XX)
========================
* Improved driver monitoring
* Roll compensation
* Improved camera focus on the comma two
* Subaru ECU firmware fingerprinting thanks to martinl!
* Hyundai Santa Fe Plug-in Hybrid 2022 support thanks to sunnyhaibin!
* Subaru Impreza 2020 support thanks to martinl!
* Toyota Avalon 2022 support thanks to sshane!

Version 0.8.12 (2021-12-15)
========================
Expand Down
9 changes: 8 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ lenv = {
"LD_LIBRARY_PATH": [Dir(f"#third_party/acados/{arch}/lib").abspath],
"PYTHONPATH": Dir("#").abspath + ":" + Dir("#pyextra/").abspath,

"ACADOS_SOURCE_DIR": Dir("#third_party/acados/acados").abspath,
"ACADOS_SOURCE_DIR": Dir("#third_party/acados/include/acados").abspath,
"ACADOS_PYTHON_INTERFACE_PATH": Dir("#pyextra/acados_template").abspath,
"TERA_PATH": Dir("#").abspath + f"/third_party/acados/{arch}/t_renderer",
}
Expand Down Expand Up @@ -125,15 +125,18 @@ else:
f"#third_party/libyuv/{yuv_dir}/lib",
"/usr/local/lib",
"/opt/homebrew/lib",
"/usr/local/Homebrew/Library",
"/usr/local/opt/openssl/lib",
"/opt/homebrew/opt/openssl/lib",
"/usr/local/Cellar",
f"#third_party/acados/{arch}/lib",
"/System/Library/Frameworks/OpenGL.framework/Libraries",
]
cflags += ["-DGL_SILENCE_DEPRECATION"]
cxxflags += ["-DGL_SILENCE_DEPRECATION"]
cpppath += [
"/opt/homebrew/include",
"/usr/local/include",
"/usr/local/opt/openssl/include",
"/opt/homebrew/opt/openssl/include"
]
Expand Down Expand Up @@ -235,6 +238,9 @@ env = Environment(
tools=["default", "cython", "compilation_db"],
)

if arch == "Darwin":
env['RPATHPREFIX'] = "-rpath "

if GetOption('compile_db'):
env.CompilationDatabase('compile_commands.json')

Expand Down Expand Up @@ -299,6 +305,7 @@ if arch == "Darwin":
qt_dirs += [f"{qt_env['QTDIR']}/include/Qt{m}" for m in qt_modules]
qt_env["LINKFLAGS"] += ["-F" + os.path.join(qt_env['QTDIR'], "lib")]
qt_env["FRAMEWORKS"] += [f"Qt{m}" for m in qt_modules] + ["OpenGL"]
qt_env.AppendENVPath('PATH', os.path.join(qt_env['QTDIR'], "bin"))
elif arch == "aarch64":
qt_env['QTDIR'] = "/system/comma/usr"
qt_dirs = [
Expand Down
13 changes: 7 additions & 6 deletions cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
localizerMalfunction @103;
highCpuUsage @105;
cruiseMismatch @106;
hightorqsteerUnavailable @ 107;
lkasDisabled @107;
hightorqsteerUnavailable @ 108;

driverMonitorLowAccDEPRECATED @68;
radarCanErrorDEPRECATED @15;
Expand Down Expand Up @@ -169,7 +170,6 @@ struct CarState {
stockAeb @30 :Bool;
stockFcw @31 :Bool;
espDisabled @32 :Bool;

hightorqUnavailable @39 :Bool;
accgasOverride @40 :Bool;

Expand Down Expand Up @@ -325,7 +325,8 @@ struct CarControl {
off @0;
pid @1;
stopping @2;
starting @3;

startingDEPRECATED @3;
}

}
Expand Down Expand Up @@ -439,13 +440,11 @@ struct CarParams {
vEgoStarting @59 :Float32; # Speed at which the car goes into starting state
directAccelControl @30 :Bool; # Does the car have direct accel control or just gas/brake
stoppingControl @31 :Bool; # Does the car allows full control even at lows speeds when stopping
startAccel @32 :Float32; # Required acceleraton to overcome creep braking
stopAccel @60 :Float32; # Required acceleraton to keep vehicle stationary
steerRateCost @33 :Float32; # Lateral MPC cost on steering rate
steerControlType @34 :SteerControlType;
radarOffCan @35 :Bool; # True when radar objects aren't visible on CAN
stoppingDecelRate @52 :Float32; # m/s^2/s while trying to stop
startingAccelRate @53 :Float32; # m/s^2/s while trying to start

steerActuatorDelay @36 :Float32; # Steering wheel actuator delay in seconds
longitudinalActuatorDelayLowerBound @61 :Float32; # Gas/Brake actuator delay in seconds, lower bound
Expand Down Expand Up @@ -611,10 +610,12 @@ struct CarParams {
}

enableCameraDEPRECATED @4 :Bool;
isPandaBlackDEPRECATED @39: Bool;
isPandaBlackDEPRECATED @39 :Bool;
hasStockCameraDEPRECATED @57 :Bool;
safetyParamDEPRECATED @10 :Int16;
safetyModelDEPRECATED @9 :SafetyModel;
safetyModelPassiveDEPRECATED @42 :SafetyModel = silent;
minSpeedCanDEPRECATED @51 :Float32;
startAccelDEPRECATED @32 :Float32;
startingAccelRateDEPRECATED @53 :Float32;
}
7 changes: 6 additions & 1 deletion cereal/log.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ struct InitData {
kernelVersion @15 :Text;
osVersion @18 :Text;

gctx @1 :Text;
dongleId @2 :Text;

deviceType @3 :DeviceType;
Expand Down Expand Up @@ -55,6 +54,7 @@ struct InitData {
}

# ***** deprecated stuff *****
gctxDEPRECATED @1 :Text;
androidBuildInfo @5 :AndroidBuildInfo;
androidSensorsDEPRECATED @6 :List(AndroidSensor);
chffrAndroidExtraDEPRECATED @7 :ChffrAndroidExtra;
Expand Down Expand Up @@ -825,6 +825,8 @@ struct LongitudinalPlan @0xe00b5b3eba12876c {
speeds @33 :List(Float32);
jerks @34 :List(Float32);

solverExecutionTime @35 :Float32;

enum LongitudinalPlanSource {
cruise @0;
lead0 @1;
Expand Down Expand Up @@ -886,6 +888,8 @@ struct LateralPlan @0xe1e9318e2ae8b51e {
curvatures @27 :List(Float32);
curvatureRates @28 :List(Float32);

solverExecutionTime @30 :Float32;

enum Desire {
none @0;
turnLeft @1;
Expand Down Expand Up @@ -1482,6 +1486,7 @@ struct Event {
clocks @35 :Clocks;
deviceState @6 :DeviceState;
logMessage @18 :Text;
errorLogMessage @85 :Text;

# navigation
navInstruction @82 :NavInstruction;
Expand Down
7 changes: 4 additions & 3 deletions cereal/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,19 @@ def __init__(self, port: int, should_log: bool, frequency: float, decimation: Op
"liveTracks": (True, 20.),
"sendcan": (True, 100., 139),
"logMessage": (True, 0.),
"errorLogMessage": (True, 0., 1),
"liveCalibration": (True, 4., 4),
"androidLog": (True, 0.),
"carState": (True, 100., 10),
"carControl": (True, 100., 10),
"longitudinalPlan": (True, 20., 5),
"procLog": (True, 0.5),
"gpsLocationExternal": (True, 10., 1),
"gpsLocationExternal": (True, 10., 10),
"ubloxGnss": (True, 10.),
"clocks": (True, 1., 1),
"ubloxRaw": (True, 20.),
"liveLocationKalman": (True, 20., 2),
"liveParameters": (True, 20., 2),
"liveLocationKalman": (True, 20., 5),
"liveParameters": (True, 20., 5),
"cameraOdometry": (True, 20., 5),
"lateralPlan": (True, 20., 5),
"thumbnail": (True, 0.2, 1),
Expand Down
13 changes: 13 additions & 0 deletions common/file_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,25 @@ def _get_fileobject():
return writer.get_fileobject(dir=temp_dir)
return _get_fileobject

def monkeypatch_os_link():
# This is neccesary on EON/C2, where os.link is patched out of python
if not hasattr(os, 'link'):
from cffi import FFI
ffi = FFI()
ffi.cdef("int link(const char *oldpath, const char *newpath);")
libc = ffi.dlopen(None)

def link(src, dest):
return libc.link(src.encode(), dest.encode())
os.link = link

def atomic_write_on_fs_tmp(path, **kwargs):
"""Creates an atomic writer using a temporary file in a temporary directory
on the same filesystem as path.
"""
# TODO(mgraczyk): This use of AtomicWriter relies on implementation details to set the temp
# directory.
monkeypatch_os_link()
writer = AtomicWriter(path, **kwargs)
return writer._open(_get_fileobject_func(writer, get_tmpdir_on_same_filesystem(path)))

Expand All @@ -96,5 +108,6 @@ def atomic_write_in_dir(path, **kwargs):
"""Creates an atomic writer using a temporary file in the same directory
as the destination file.
"""
monkeypatch_os_link()
writer = AtomicWriter(path, **kwargs)
return writer._open(_get_fileobject_func(writer, os.path.dirname(path)))
1 change: 0 additions & 1 deletion common/params_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ cdef extern from "selfdrive/common/params.h":
cpdef enum ParamKeyType:
PERSISTENT
CLEAR_ON_MANAGER_START
CLEAR_ON_PANDA_DISCONNECT
CLEAR_ON_IGNITION_ON
CLEAR_ON_IGNITION_OFF
ALL
Expand Down
2 changes: 1 addition & 1 deletion common/realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def set_realtime_priority(level: int) -> None:

def set_core_affinity(core: int) -> None:
if not PC:
os.sched_setaffinity(0, [core,])
os.sched_setaffinity(0, [core,]) # type: ignore[attr-defined]


def config_realtime_process(core: int, priority: int) -> None:
Expand Down
2 changes: 1 addition & 1 deletion common/spinner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def update(self, spinner_text: str):
except BrokenPipeError:
pass

def update_progress(self, cur: int, total: int):
def update_progress(self, cur: float, total: float):
self.update(str(round(100 * cur / total)))

def close(self):
Expand Down
12 changes: 7 additions & 5 deletions common/transformations/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,20 @@ def normalize(img_pts, intrinsics=fcam_intrinsics):
return img_pts_normalized[:, :2].reshape(input_shape)


def denormalize(img_pts, intrinsics=fcam_intrinsics, width=W, height=H):
def denormalize(img_pts, intrinsics=fcam_intrinsics, width=np.inf, height=np.inf):
# denormalizes image coordinates
# accepts single pt or array of pts
img_pts = np.array(img_pts)
input_shape = img_pts.shape
img_pts = np.atleast_2d(img_pts)
img_pts = np.hstack((img_pts, np.ones((img_pts.shape[0], 1), dtype=img_pts.dtype)))
img_pts_denormalized = img_pts.dot(intrinsics.T)
img_pts_denormalized[img_pts_denormalized[:, 0] > width] = np.nan
img_pts_denormalized[img_pts_denormalized[:, 0] < 0] = np.nan
img_pts_denormalized[img_pts_denormalized[:, 1] > height] = np.nan
img_pts_denormalized[img_pts_denormalized[:, 1] < 0] = np.nan
if np.isfinite(width):
img_pts_denormalized[img_pts_denormalized[:, 0] > width] = np.nan
img_pts_denormalized[img_pts_denormalized[:, 0] < 0] = np.nan
if np.isfinite(height):
img_pts_denormalized[img_pts_denormalized[:, 1] > height] = np.nan
img_pts_denormalized[img_pts_denormalized[:, 1] < 0] = np.nan
return img_pts_denormalized[:, :2].reshape(input_shape)


Expand Down
Loading

0 comments on commit 8bc29e3

Please sign in to comment.