Skip to content

Commit

Permalink
dragonpilot mod for 0.8.7-3
Browse files Browse the repository at this point in the history
  • Loading branch information
eFiniLan committed Aug 20, 2021
1 parent 444aace commit 06b969f
Show file tree
Hide file tree
Showing 262 changed files with 13,757 additions and 9,649 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ selfdrive/boardd/boardd
selfdrive/logcatd/logcatd
selfdrive/mapd/default_speeds_by_region.json
selfdrive/proclogd/proclogd
selfdrive/ui/_ui
selfdrive/ui/_soundd


selfdrive/test/longitudinal_maneuvers/out
selfdrive/visiond/visiond
selfdrive/loggerd/loggerd
Expand Down
703 changes: 703 additions & 0 deletions CHANGELOGS-DEV.md

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# CONTRIBUTORS

Due to the way we manage the source code, it is not possible to see all the contributors' info, hence we create a list here.
If you have contributed to DP project before and your name is not listed here, feel free to send us a PR to update this!

### TEAM
Name | github | Role
------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------
cafe | [cafe](https://github.com/coffice12) | Resource Provider
kumar | [rav4kumar](https://github.com/rav4kumar) | Release Maintainer
loveloveses | [loveloveses](https://github.com/loveloveses) | Wiki Maintainer
Rick Lan | [efinilan](https://github.com/efinilan) | Release Maintainer

### CONTRIBUTORS
Name | github
------------------------------------------------------------ | ------------------------------------------------------------
andy741217 | [andy741217](https://github.com/andy741217)
Arne Schwarck | [arne182](https://github.com/arne182)
berno22 | [berno22](https://github.com/berno22)
Bobbydough | [Bobbydough](https://github.com/bobbydough)
cgw1968 | [cgw1968](https://github.com/cgw1968-5779)
Curtis Jenkins | [actuallylemoncurd](https://github.com/actuallylemoncurd)
DFyffe | [donfyffe](https://github.com/donfyffe)
dinglx | [dingliangxue](https://github.com/dingliangxue)
eyezenheim | [eyezenheim](https://github.com/eyezenheim)
kegman | [kegman](https://github.com/kegman)
lijunhao731 | [lijunhao731](https://github.com/lijunhao731)
lirudy | [lirudy](https://github.com/lirudy)
LOVEChen | [LOVEChen](https://github.com/LOVEChen)
menwenliang | [menwenliang](https://github.com/menwenliang)
Nelson Chen | [nelsonjchen](https://github.com/nelsonjchen)
rming | [Rming](https://github.com/rming)
sebastian4k | [sebastian4k](https://github.com/sebastian4k)
Shane Smiskol | [sshane](https://github.com/sshane)
toyboxZ | [toyboxZ](https://github.com/toyboxZ)
25 changes: 25 additions & 0 deletions HOWTO-ONEPLUS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
How to install on Oneplus 3t?
------
1. clone dragonpilot to /data/ and make sure it's named openpilot:
(手動安裝切換至 dp)
```
cd /data/ && rm -fr openpilot ; git clone https://github.com/dragonpilot-community/dragonpilot.git openpilot -b 0.8.7
```

2. run command:
(在 ssh 畫面下,輸入)
```
cd /data/openpilot/scripts/ && ./oneplus_update_neos.sh
```

3. Let it download and complete it update, after a couple of reboot, your screen will then stay in fastboot mode.
(等待下載並讓它重新開機,沒錯誤的話會進入 Android 機器人更新畫面,等自動重新開機)

4. In fastboot mode, select use volume button to select to `Recovery mode` then press power button.
(在 fastboot 模式,用音量鍵上下選到 Recovery mode 再按下電源鍵)

5. In Recovery mode, tap `apply update` -> `Choose from emulated` -> `0/` -> `update.zip` -> `Reboot system now`
(在 Recovery mode,點選 `apply update` -> `Choose from emulated` -> `0/` -> `update.zip` -> `Reboot system now`)

6. You should be able to boot into openpilot, if touch screen is not working, try to reboot again.
(你現在應該可以進入 openpilot 畫面,如果點擊畫面沒有反應,請再重新開機一次)
10 changes: 10 additions & 0 deletions JETSON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set_core_affinity
------
Jetson Xavier NX has 6 cores running at 1.9 GHz, here is what I've defined

0 = (not specified)
1 = plannerd / radard
2 = boardd
3 = controlsd
4 = camerad
5 = modeld
29 changes: 24 additions & 5 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import platform
import numpy as np

TICI = os.path.isfile('/TICI')
JETSON = os.path.isfile('/JETSON')

Decider('MD5-timestamp')

AddOption('--test',
Expand Down Expand Up @@ -65,6 +67,10 @@ if arch == "aarch64" and TICI:

USE_WEBCAM = os.getenv("USE_WEBCAM") is not None

USE_MIPI = os.getenv("USE_MIPI") is not None
if arch == "aarch64" and JETSON:
arch = "jarch64"

lenv = {
"PATH": os.environ['PATH'],
}
Expand Down Expand Up @@ -114,8 +120,19 @@ else:
cflags = []
cxxflags = []
cpppath = []
rpath = []

if arch == "Darwin":
if arch == "jarch64":
libpath = [
"#phonelibs/libyuv/larch64/lib",
"#selfdrive/common",
"/usr/lib",
"/usr/local/lib",
]
cflags = ["-DXNX", "-march=armv8.2-a"]
cxxflags = ["-DXNX", "-march=armv8.2-a"]
rpath += ["/usr/local/lib"]
elif arch == "Darwin":
yuv_dir = "mac" if real_arch != "arm64" else "mac_arm64"
libpath = [
f"#phonelibs/libyuv/{yuv_dir}/lib",
Expand Down Expand Up @@ -143,8 +160,9 @@ else:
"/usr/local/lib",
]

rpath = [
"phonelibs/snpe/x86_64-linux-clang",
if arch != "jarch64":
rpath += ["phonelibs/snpe/x86_64-linux-clang"]
rpath += [
"cereal",
"selfdrive/common"
]
Expand Down Expand Up @@ -309,7 +327,7 @@ else:
qt_dirs += [f"/usr/include/{real_arch}-linux-gnu/qt5/Qt{m}" for m in qt_modules]

qt_libs = [f"Qt5{m}" for m in qt_modules]
if arch == "larch64":
if arch == "larch64" or arch == "jarch64":
qt_libs += ["GLESv2", "wayland-client"]
elif arch != "Darwin":
qt_libs += ["GL"]
Expand Down Expand Up @@ -342,7 +360,8 @@ if GetOption("clazy"):
qt_env['ENV']['CLAZY_IGNORE_DIRS'] = qt_dirs[0]
qt_env['ENV']['CLAZY_CHECKS'] = ','.join(checks)

Export('env', 'qt_env', 'arch', 'real_arch', 'SHARED', 'USE_WEBCAM')
zmq = 'zmq'
Export('env', 'qt_env', 'arch', 'real_arch', 'SHARED', 'USE_WEBCAM', 'zmq', 'USE_MIPI')

# cereal and messaging are shared with the system
SConscript(['cereal/SConscript'])
Expand Down
11 changes: 9 additions & 2 deletions cereal/SConscript
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Import('env', 'envCython', 'arch')
Import('env', 'envCython', 'arch', 'zmq')

import shutil

Expand All @@ -8,7 +8,7 @@ messaging_dir = Dir('messaging')

# Build cereal

schema_files = ['log.capnp', 'car.capnp', 'legacy.capnp']
schema_files = ['log.capnp', 'car.capnp', 'legacy.capnp', 'dp.capnp']
env.Command(["gen/c/include/c++.capnp.h", "gen/c/include/java.capnp.h"], [], "mkdir -p " + gen_dir.path + "/c/include && touch $TARGETS")
env.Command([f'gen/cpp/{s}.c++' for s in schema_files] + [f'gen/cpp/{s}.h' for s in schema_files],
schema_files,
Expand Down Expand Up @@ -40,6 +40,13 @@ messaging_objects = env.SharedObject([
messaging_lib = env.Library('messaging', messaging_objects)
Depends('messaging/impl_zmq.cc', services_h)

# note, this rebuilds the deps shared, zmq is statically linked to make APK happy
# TODO: get APK to load system zmq to remove the static link
if arch == "aarch64":
zmq_static = FindFile("libzmq.a", "/usr/lib")
shared_lib_shared_lib = [zmq_static, 'm', 'stdc++', "gnustl_shared", "kj", "capnp"]
env.SharedLibrary('messaging_shared', messaging_objects, LIBS=shared_lib_shared_lib)

env.Program('messaging/bridge', ['messaging/bridge.cc'], LIBS=[messaging_lib, 'zmq'])
Depends('messaging/bridge.cc', services_h)

Expand Down
73 changes: 73 additions & 0 deletions cereal/_SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import os
import platform
import subprocess
import sysconfig

arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
if platform.system() == "Darwin":
arch = "Darwin"

cereal_dir = Dir('.')
messaging_dir = Dir('./messaging')

cpppath = [
cereal_dir,
messaging_dir,
'/usr/lib/include',
'/opt/homebrew/include',
sysconfig.get_paths()['include'],
]

libpath = [
'/opt/homebrew/lib',
]

AddOption('--test',
action='store_true',
help='build test files')

AddOption('--asan',
action='store_true',
help='turn on ASAN')

ccflags_asan = ["-fsanitize=address", "-fno-omit-frame-pointer"] if GetOption('asan') else []
ldflags_asan = ["-fsanitize=address"] if GetOption('asan') else []

env = Environment(
ENV=os.environ,
CC='clang',
CXX='clang++',
CCFLAGS=[
"-g",
"-fPIC",
"-O2",
"-Wunused",
"-Werror",
] + ccflags_asan,
LDFLAGS=ldflags_asan,
LINKFLAGS=ldflags_asan,

CFLAGS="-std=gnu11",
CXXFLAGS="-std=c++1z",
CPPPATH=cpppath,
LIBPATH=libpath,
CYTHONCFILESUFFIX=".cpp",
tools=["default", "cython"]
)

Export('env', 'arch')

envCython = env.Clone(LIBS=[])
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-deprecated-declarations"]
if arch == "Darwin":
envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"]
elif arch == "aarch64":
envCython["LINKFLAGS"] = ["-shared"]
envCython["LIBS"] = [os.path.basename(sysconfig.get_paths()['include'])]
else:
envCython["LINKFLAGS"] = ["-pthread", "-shared"]

Export('envCython')


SConscript(['SConscript'])
20 changes: 19 additions & 1 deletion cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ struct CarEvent @0x9b1657f34caf3ad3 {
neosUpdateRequiredDEPRECATED @88;
modelLagWarningDEPRECATED @93;
startupOneplusDEPRECATED @82;

#dp
preLaneChangeLeftALC @105;
preLaneChangeRightALC @106;
manualSteeringRequired @107;
manualSteeringRequiredBlinkersOn @108;
leadCarMoving @109;

# timebomb assist
timebombWarn @110;
timebombBypassing @111;
timebombBypassed @112;
mapdAlert @113;
}
}

Expand Down Expand Up @@ -194,6 +207,11 @@ struct CarState {
leftBlindspot @33 :Bool; # Is there something blocking the left lane change
rightBlindspot @34 :Bool; # Is there something blocking the right lane change

# dp
lkMode @37 :Bool;
stopSteering @38 :Bool; # timebomb - stopSteering
engineRPM @39 :Float32;

struct WheelSpeeds {
# optional wheel speeds
fl @0 :Float32;
Expand Down Expand Up @@ -246,7 +264,7 @@ struct CarState {
}

errorsDEPRECATED @0 :List(CarEvent.EventName);
brakeLightsDEPRECATED @19 :Bool;
brakeLights @19 :Bool;
}

# ******* radar state @ 20hz *******
Expand Down
61 changes: 61 additions & 0 deletions cereal/dp.capnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Cxx = import "./include/c++.capnp";
$Cxx.namespace("cereal");

using Java = import "./include/java.capnp";
$Java.package("ai.comma.openpilot.cereal");
$Java.outerClassname("dp");

@0xbfa7e645486440c7;

# dp.capnp: a home for deprecated structs

# dp
struct DragonConf {
dpThermalStarted @0 :Bool;
dpThermalOverheat @1 :Bool;
dpAtl @2 :Bool;
dpDashcamd @3 :Bool;
dpAutoShutdown @4 :Bool;
dpAthenad @5 :Bool;
dpUploader @6 :Bool;
dpLateralMode @7 :UInt8;
dpSignalOffDelay @8 :Float32;
dpLcMinMph @9 :UInt8;
dpLcAutoCont @10 :Bool;
dpLcAutoMinMph @11 :UInt8;
dpLcAutoDelay @12 :Float32;
dpAllowGas @13 :Bool;
dpFollowingProfileCtrl @14 :Bool;
dpFollowingProfile @15 :UInt8;
dpAccelProfileCtrl @16 :Bool;
dpAccelProfile @17 :UInt8;
dpGearCheck @18 :Bool;
dpSpeedCheck @19 :Bool;
dpUiDisplayMode @20 :UInt8;
dpUiSpeed @21 :Bool;
dpUiEvent @22 :Bool;
dpUiMaxSpeed @23 :Bool;
dpUiFace @24 :Bool;
dpUiLane @25 :Bool;
dpUiLead @26 :Bool;
dpUiDev @27 :Bool;
dpUiDevMini @28 :Bool;
dpUiBlinker @29 :Bool;
dpUiBrightness @30 :UInt8;
dpUiVolume @31 :Int8;
dpToyotaLdw @32 :Bool;
dpToyotaSng @33 :Bool;
dpToyotaCruiseOverride @34 :Bool;
dpToyotaCruiseOverrideVego @35 :Bool;
dpToyotaCruiseOverrideAt @36 :Float32;
dpToyotaCruiseOverrideSpeed @37 :Float32;
dpVwTimebombAssist @38 :Bool;
dpIpAddr @39 :Text;
dpCameraOffset @40 :Int8;
dpPathOffset @41 :Int8;
dpLocale @42 :Text;
dpSrLearner @43 :Bool;
dpSrCustom @44 :Float32;
dpAppd @45 :Bool;
dpMapd @46 :Bool;
}
Loading

0 comments on commit 06b969f

Please sign in to comment.