mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-12 05:44:14 +08:00
Compare commits
117 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2861467183 | ||
|
|
d478d6a931 | ||
|
|
dc77655e2a | ||
|
|
f5d88c5813 | ||
|
|
043d2e9f36 | ||
|
|
3f78957ccc | ||
|
|
8bcb9331fd | ||
|
|
af3234f1d7 | ||
|
|
e2ff61da9b | ||
|
|
80e87ee0ae | ||
|
|
bcb3f6077c | ||
|
|
87679a75b8 | ||
|
|
c6c41f1a29 | ||
|
|
5d57078474 | ||
|
|
11229fc9c0 | ||
|
|
1727b59882 | ||
|
|
0ecaf72ed4 | ||
|
|
3300143b1b | ||
|
|
902413200a | ||
|
|
ce57ac073b | ||
|
|
91bf49bdd4 | ||
|
|
017cbbfa51 | ||
|
|
8773fbf7d9 | ||
|
|
8d4ff30c60 | ||
|
|
be2ba93ca0 | ||
|
|
48425a1fc1 | ||
|
|
84c8790192 | ||
|
|
25681a31e5 | ||
|
|
c9270bfa2f | ||
|
|
0a7d2f4343 | ||
|
|
dc6107dac3 | ||
|
|
5eacdcee9d | ||
|
|
978839a861 | ||
|
|
fbc243aa94 | ||
|
|
194d4d7f71 | ||
|
|
5b596aec6f | ||
|
|
09533fee0c | ||
|
|
6ee6161d23 | ||
|
|
4e16a1454d | ||
|
|
d0bdd513cd | ||
|
|
54b920eb79 | ||
|
|
e453e79bc8 | ||
|
|
b02e848395 | ||
|
|
ed9d5615ba | ||
|
|
8264fd8b93 | ||
|
|
532e7710f3 | ||
|
|
62bd6cee67 | ||
|
|
e8af5d6364 | ||
|
|
386ec39885 | ||
|
|
2a99c660c3 | ||
|
|
15cb2f05c7 | ||
|
|
3595162d1a | ||
|
|
8e97f70b92 | ||
|
|
a9a35894ad | ||
|
|
c3a1a438d8 | ||
|
|
99da7077ab | ||
|
|
3d941253a5 | ||
|
|
0d41146fa8 | ||
|
|
7f04682b4c | ||
|
|
a6545b1604 | ||
|
|
2db4cb0e8c | ||
|
|
26d0b8d4ee | ||
|
|
323660961f | ||
|
|
88966b488a | ||
|
|
41fc9c55a0 | ||
|
|
8c2b3d5e37 | ||
|
|
22fc7e9dae | ||
|
|
9f53e446d9 | ||
|
|
7e0ba31ceb | ||
|
|
fe46b24be5 | ||
|
|
a9e94ef9bb | ||
|
|
c9db3ef937 | ||
|
|
9a3dc91b35 | ||
|
|
c5e71d2f37 | ||
|
|
61ce864e28 | ||
|
|
36d0a70b69 | ||
|
|
20a2007d10 | ||
|
|
64701acb68 | ||
|
|
17922bd096 | ||
|
|
5eda5fc81b | ||
|
|
71e65750d1 | ||
|
|
2ce741275b | ||
|
|
8cb09e1329 | ||
|
|
17f21c5b6f | ||
|
|
0992311f83 | ||
|
|
a42fea2041 | ||
|
|
4aaf4f437b | ||
|
|
610bb58845 | ||
|
|
4c77b9162e | ||
|
|
cd096d1c2e | ||
|
|
11a7b2d9bf | ||
|
|
7fa09edc03 | ||
|
|
13ae651f46 | ||
|
|
c345bb1d8f | ||
|
|
a2b00731cb | ||
|
|
d36b78e273 | ||
|
|
6ab7c27d9b | ||
|
|
a90c3bc8be | ||
|
|
8b3c922cf0 | ||
|
|
d460e0e735 | ||
|
|
a52b947ce2 | ||
|
|
c75137b262 | ||
|
|
6fd3f9bad8 | ||
|
|
00c48f0ba3 | ||
|
|
f78b6fdd17 | ||
|
|
7c537ee201 | ||
|
|
e2d77db22a | ||
|
|
bf5e361b26 | ||
|
|
a7ad4488b9 | ||
|
|
f7fbcfe59d | ||
|
|
1efed2ed00 | ||
|
|
15c43ad722 | ||
|
|
5fcbfcc359 | ||
|
|
672d80735f | ||
|
|
2f5e35035d | ||
|
|
1aafc5b0ef | ||
|
|
9f66b533e2 |
Binary file not shown.
@@ -78,6 +78,8 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
||||
commIssue @53;
|
||||
tooDistracted @54;
|
||||
posenetInvalid @55;
|
||||
manualSteeringRequired @56;
|
||||
manualSteeringRequiredBlinkersOn @57;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,31 @@ keys = {
|
||||
"TermsVersion": [TxType.PERSISTENT],
|
||||
"TrainingVersion": [TxType.PERSISTENT],
|
||||
"Version": [TxType.PERSISTENT],
|
||||
#dragonpilot config
|
||||
"DragonEnableDashcam": [TxType.PERSISTENT],
|
||||
"DragonDisableDriverSafetyCheck": [TxType.PERSISTENT], # deprecated
|
||||
"DragonEnableDriverSafetyCheck": [TxType.PERSISTENT],
|
||||
"DragonAutoShutdownAt": [TxType.PERSISTENT],
|
||||
"DragonTempDisableSteerOnSignal": [TxType.PERSISTENT], # deprecated
|
||||
"DragonEnableSteeringOnSignal": [TxType.PERSISTENT],
|
||||
"DragonDisableLogger": [TxType.PERSISTENT], # deprecated
|
||||
"DragonEnableLogger": [TxType.PERSISTENT],
|
||||
"DragonDisableUploader": [TxType.PERSISTENT], # deprecated
|
||||
"DragonEnableUploader": [TxType.PERSISTENT],
|
||||
"DragonNoctuaMode": [TxType.PERSISTENT],
|
||||
"DragonCacheCar": [TxType.PERSISTENT],
|
||||
"DragonCachedModel": [TxType.PERSISTENT],
|
||||
"DragonCachedFP": [TxType.PERSISTENT],
|
||||
"DragonCachedVIN": [TxType.PERSISTENT],
|
||||
"DragonAllowGas": [TxType.PERSISTENT],
|
||||
"DragonBBUI": [TxType.PERSISTENT], # deprecated
|
||||
"DragonToyotaStockDSU": [TxType.PERSISTENT],
|
||||
"DragonLatCtrl": [TxType.PERSISTENT],
|
||||
"DragonUIEvent": [TxType.PERSISTENT],
|
||||
"DragonUIMaxSpeed": [TxType.PERSISTENT],
|
||||
"DragonUIFace": [TxType.PERSISTENT],
|
||||
"DragonUIDev": [TxType.PERSISTENT],
|
||||
"DragonUIDevMini": [TxType.PERSISTENT],
|
||||
}
|
||||
|
||||
|
||||
|
||||
BIN
dragonpilot/chinese-fonts/Miui-Bold.ttf
Normal file
BIN
dragonpilot/chinese-fonts/Miui-Bold.ttf
Normal file
Binary file not shown.
BIN
dragonpilot/chinese-fonts/Miui-Regular.ttf
Normal file
BIN
dragonpilot/chinese-fonts/Miui-Regular.ttf
Normal file
Binary file not shown.
371
dragonpilot/chinese-fonts/fonts.xml
Normal file
371
dragonpilot/chinese-fonts/fonts.xml
Normal file
@@ -0,0 +1,371 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
NOTE: this is the newer (L) version of the system font configuration,
|
||||
supporting richer weight selection. Some apps will expect the older
|
||||
version, so please keep system_fonts.xml and fallback_fonts.xml in sync
|
||||
with any changes, even though framework will only read this file.
|
||||
|
||||
All fonts withohut names are added to the default list. Fonts are chosen
|
||||
based on a match: full BCP-47 language tag including script, then just
|
||||
language, and finally order (the first font containing the glyph).
|
||||
|
||||
Order of appearance is also the tiebreaker for weight matching. This is
|
||||
the reason why the 900 weights of Roboto precede the 700 weights - we
|
||||
prefer the former when an 800 weight is requested. Since bold spans
|
||||
effectively add 300 to the weight, this ensures that 900 is the bold
|
||||
paired with the 500 weight, ensuring adequate contrast.
|
||||
-->
|
||||
<familyset version="22">
|
||||
<!-- first font is default -->
|
||||
<family name="sans-serif">
|
||||
<font weight="100" style="normal">Roboto-Thin.ttf</font>
|
||||
<font weight="100" style="italic">Roboto-ThinItalic.ttf</font>
|
||||
<font weight="300" style="normal">Roboto-Light.ttf</font>
|
||||
<font weight="300" style="italic">Roboto-LightItalic.ttf</font>
|
||||
<font weight="400" style="normal">Roboto-Regular.ttf</font>
|
||||
<font weight="400" style="italic">Roboto-Italic.ttf</font>
|
||||
<font weight="500" style="normal">Roboto-Medium.ttf</font>
|
||||
<font weight="500" style="italic">Roboto-MediumItalic.ttf</font>
|
||||
<font weight="900" style="normal">Roboto-Black.ttf</font>
|
||||
<font weight="900" style="italic">Roboto-BlackItalic.ttf</font>
|
||||
<font weight="700" style="normal">Roboto-Bold.ttf</font>
|
||||
<font weight="700" style="italic">Roboto-BoldItalic.ttf</font>
|
||||
</family>
|
||||
|
||||
<!-- Note that aliases must come after the fonts they reference. -->
|
||||
<alias name="sans-serif-thin" to="sans-serif" weight="100" />
|
||||
<alias name="sans-serif-light" to="sans-serif" weight="300" />
|
||||
<alias name="sans-serif-medium" to="sans-serif" weight="500" />
|
||||
<alias name="sans-serif-black" to="sans-serif" weight="900" />
|
||||
<alias name="arial" to="sans-serif" />
|
||||
<alias name="helvetica" to="sans-serif" />
|
||||
<alias name="tahoma" to="sans-serif" />
|
||||
<alias name="verdana" to="sans-serif" />
|
||||
|
||||
<family name="sans-serif-condensed">
|
||||
<font weight="300" style="normal">RobotoCondensed-Light.ttf</font>
|
||||
<font weight="300" style="italic">RobotoCondensed-LightItalic.ttf</font>
|
||||
<font weight="400" style="normal">RobotoCondensed-Regular.ttf</font>
|
||||
<font weight="400" style="italic">RobotoCondensed-Italic.ttf</font>
|
||||
<font weight="700" style="normal">RobotoCondensed-Bold.ttf</font>
|
||||
<font weight="700" style="italic">RobotoCondensed-BoldItalic.ttf</font>
|
||||
</family>
|
||||
<alias name="sans-serif-condensed-light" to="sans-serif-condensed" weight="300" />
|
||||
|
||||
<family name="serif">
|
||||
<font weight="400" style="normal">NotoSerif-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSerif-Bold.ttf</font>
|
||||
<font weight="400" style="italic">NotoSerif-Italic.ttf</font>
|
||||
<font weight="700" style="italic">NotoSerif-BoldItalic.ttf</font>
|
||||
</family>
|
||||
<alias name="times" to="serif" />
|
||||
<alias name="times new roman" to="serif" />
|
||||
<alias name="palatino" to="serif" />
|
||||
<alias name="georgia" to="serif" />
|
||||
<alias name="baskerville" to="serif" />
|
||||
<alias name="goudy" to="serif" />
|
||||
<alias name="fantasy" to="serif" />
|
||||
<alias name="ITC Stone Serif" to="serif" />
|
||||
|
||||
<family name="monospace">
|
||||
<font weight="400" style="normal">DroidSansMono.ttf</font>
|
||||
</family>
|
||||
<alias name="sans-serif-monospace" to="monospace" />
|
||||
<alias name="monaco" to="monospace" />
|
||||
|
||||
<family name="serif-monospace">
|
||||
<font weight="400" style="normal">CutiveMono.ttf</font>
|
||||
</family>
|
||||
<alias name="courier" to="serif-monospace" />
|
||||
<alias name="courier new" to="serif-monospace" />
|
||||
|
||||
<family name="casual">
|
||||
<font weight="400" style="normal">ComingSoon.ttf</font>
|
||||
</family>
|
||||
|
||||
<family name="cursive">
|
||||
<font weight="400" style="normal">DancingScript-Regular.ttf</font>
|
||||
<font weight="700" style="normal">DancingScript-Bold.ttf</font>
|
||||
</family>
|
||||
|
||||
<family name="sans-serif-smallcaps">
|
||||
<font weight="400" style="normal">CarroisGothicSC-Regular.ttf</font>
|
||||
</family>
|
||||
|
||||
<!-- fallback fonts -->
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoNaskhArabic-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoNaskhArabic-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoNaskhArabicUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoNaskhArabicUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansEthiopic-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansEthiopic-Bold.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansHebrew-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansHebrew-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansThai-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansThai-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansThaiUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansThaiUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansArmenian-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansArmenian-Bold.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansGeorgian-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansGeorgian-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansDevanagari-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansDevanagari-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansDevanagariUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansDevanagariUI-Bold.ttf</font>
|
||||
</family>
|
||||
<!-- Gujarati should come after Devanagari -->
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansGujarati-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansGujarati-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansGujaratiUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansGujaratiUI-Bold.ttf</font>
|
||||
</family>
|
||||
<!-- Gurmukhi should come after Devanagari -->
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansGurmukhi-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansGurmukhi-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansGurmukhiUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansGurmukhiUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansTamil-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansTamil-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansTamilUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansTamilUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansMalayalam-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansMalayalam-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansMalayalamUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansMalayalamUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansBengali-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansBengali-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansBengaliUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansBengaliUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansTelugu-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansTelugu-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansTeluguUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansTeluguUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansKannada-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansKannada-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansKannadaUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansKannadaUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansOriya-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansOriya-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansOriyaUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansOriyaUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansSinhala-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansSinhala-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansKhmer-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansKhmer-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansKhmerUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansKhmerUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansLao-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansLao-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansLaoUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansLaoUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansMyanmar-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansMyanmar-Bold.ttf</font>
|
||||
</family>
|
||||
<family variant="compact">
|
||||
<font weight="400" style="normal">NotoSansMyanmarUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansMyanmarUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansThaana-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansThaana-Bold.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansCham-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansCham-Bold.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansBalinese-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansBamum-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansBatak-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansBuginese-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansBuhid-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansCanadianAboriginal-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansCherokee-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansCoptic-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansGlagolitic-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansHanunoo-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansJavanese-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansKayahLi-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansLepcha-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansLimbu-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansLisu-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansMandaic-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansMeeteiMayek-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansNewTaiLue-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansNKo-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansOlChiki-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansRejang-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansSaurashtra-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansSundanese-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansSylotiNagri-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansSyriacEstrangela-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansTagbanwa-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansTaiTham-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansTaiViet-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansTibetan-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansTifinagh-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansVai-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansYi-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansSymbols-Regular-Subsetted.ttf</font>
|
||||
</family>
|
||||
<family lang="zh-Hans">
|
||||
<font weight="400" style="normal">NotoSansSC-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="zh-Hant">
|
||||
<font weight="400" style="normal">NotoSansTC-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="ja">
|
||||
<font weight="400" style="normal">NotoSansJP-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="ko">
|
||||
<font weight="400" style="normal">NotoSansKR-Regular.otf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NanumGothic.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoColorEmoji.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">Miui-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="ja">
|
||||
<font weight="400" style="normal">MTLmr3m.ttf</font>
|
||||
</family>
|
||||
<!--
|
||||
Tai Le and Mongolian are intentionally kept last, to make sure they don't override
|
||||
the East Asian punctuation for Chinese.
|
||||
-->
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansTaiLe-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansMongolian-Regular.ttf</font>
|
||||
</family>
|
||||
</familyset>
|
||||
50
dragonpilot/chinese-fonts/installer.sh
Executable file
50
dragonpilot/chinese-fonts/installer.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Anndroid system locale, zh-TW = Traditional Chinese, zh-CN = Simplified Chinese
|
||||
lang=en
|
||||
|
||||
update_font_reg=0
|
||||
update_font_bold=0
|
||||
remove_old_font=0
|
||||
|
||||
# check regular font
|
||||
if [ ! -f "/system/fonts/Miui-Regular.ttf" ]; then
|
||||
update_font_reg=1
|
||||
fi
|
||||
|
||||
# check bold font
|
||||
if [ ! -f "/system/fonts/Miui-Bold.ttf" ]; then
|
||||
update_font_bold=1
|
||||
fi
|
||||
|
||||
# check droidsans font
|
||||
if ls /system/fonts/DroidSansFallback*.ttf 1> /dev/null 2>&1; then
|
||||
remove_old_font=1
|
||||
fi
|
||||
|
||||
if [ $update_font_reg -eq "1" ] || [ $update_font_bold -eq "1" ] || [ $remove_old_font -eq "1" ]; then
|
||||
# sleep 5 secs in case, make sure the /system is remountable
|
||||
sleep 5
|
||||
mount -o remount,rw /system
|
||||
if [ $update_font_reg -eq "1" ] || [ $update_font_bold -eq "1" ]; then
|
||||
# download regular font
|
||||
if [ $update_font_reg -eq "1" ]; then
|
||||
yes | cp -rf /data/openpilot/dragonpilot/chinese-fonts/Miui-Regular.ttf /system/fonts/Miui-Regular.ttf
|
||||
fi
|
||||
# download bold font
|
||||
if [ $update_font_bold -eq "1" ]; then
|
||||
yes | cp -rf /data/openpilot/dragonpilot/chinese-fonts/Miui-Bold.ttf /system/fonts/Miui-Bold.ttf
|
||||
fi
|
||||
# dont new font mapping
|
||||
yes | cp -rf /data/openpilot/dragonpilot/chinese-fonts/fonts.xml /system/etc/fonts.xml
|
||||
chmod 644 /system/etc/fonts.xml
|
||||
chmod 644 /system/fonts/Miui-*
|
||||
fi
|
||||
# remove driodsans font
|
||||
if [ $remove_old_font -eq "1" ]; then
|
||||
rm -fr /system/fonts/DroidSansFallback*.ttf
|
||||
fi
|
||||
mount -o remount,r /system
|
||||
# change system locale
|
||||
setprop persist.sys.locale $lang
|
||||
fi
|
||||
@@ -12,18 +12,18 @@ fi
|
||||
|
||||
function launch {
|
||||
# apply update
|
||||
if [ "$(git rev-parse HEAD)" != "$(git rev-parse @{u})" ]; then
|
||||
git reset --hard @{u} &&
|
||||
git clean -xdf &&
|
||||
|
||||
# Touch all files on release2 after checkout to prevent rebuild
|
||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [[ "$BRANCH" == "release2" ]]; then
|
||||
touch **
|
||||
fi
|
||||
|
||||
exec "${BASH_SOURCE[0]}"
|
||||
fi
|
||||
# if [ "$(git rev-parse HEAD)" != "$(git rev-parse @{u})" ]; then
|
||||
# git reset --hard @{u} &&
|
||||
# git clean -xdf &&
|
||||
#
|
||||
# # Touch all files on release2 after checkout to prevent rebuild
|
||||
# BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
# if [[ "$BRANCH" == "release2" ]]; then
|
||||
# touch **
|
||||
# fi
|
||||
#
|
||||
# exec "${BASH_SOURCE[0]}"
|
||||
# fi
|
||||
|
||||
# no cpu rationing for now
|
||||
echo 0-3 > /dev/cpuset/background/cpus
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
/usr/bin/sh /data/openpilot/dragonpilot/chinese-fonts/installer.sh &
|
||||
export PASSIVE="0"
|
||||
exec ./launch_chffrplus.sh
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ bool honda_alt_brake_msg = false;
|
||||
static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
|
||||
int addr = GET_ADDR(to_push);
|
||||
int len = GET_LEN(to_push);
|
||||
//int len = GET_LEN(to_push);
|
||||
|
||||
// sample speed
|
||||
if (addr == 0x158) {
|
||||
@@ -60,7 +60,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
|
||||
// exit controls on rising edge of gas press if interceptor (0x201 w/ len = 6)
|
||||
// length check because bosch hardware also uses this id (0x201 w/ len = 8)
|
||||
if ((addr == 0x201) && (len == 6)) {
|
||||
if (false) {
|
||||
gas_interceptor_detected = 1;
|
||||
int gas_interceptor = GET_INTERCEPTOR(to_push);
|
||||
if ((gas_interceptor > HONDA_GAS_INTERCEPTOR_THRESHOLD) &&
|
||||
@@ -72,7 +72,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
}
|
||||
|
||||
// exit controls on rising edge of gas press if no interceptor
|
||||
if (!gas_interceptor_detected) {
|
||||
if (false) {
|
||||
if (addr == 0x17C) {
|
||||
int gas = GET_BYTE(to_push, 0);
|
||||
if (gas && !(honda_gas_prev) && long_controls_allowed) {
|
||||
|
||||
@@ -67,7 +67,7 @@ static void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
}
|
||||
|
||||
// exit controls on rising edge of interceptor gas press
|
||||
if (addr == 0x201) {
|
||||
if (false) {
|
||||
gas_interceptor_detected = 1;
|
||||
int gas_interceptor = GET_INTERCEPTOR(to_push);
|
||||
if ((gas_interceptor > TOYOTA_GAS_INTERCEPTOR_THRESHOLD) &&
|
||||
@@ -79,7 +79,7 @@ static void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
}
|
||||
|
||||
// exit controls on rising edge of gas press
|
||||
if (addr == 0x2C1) {
|
||||
if (false) {
|
||||
int gas = GET_BYTE(to_push, 6) & 0xFF;
|
||||
if ((gas > 0) && (toyota_gas_prev == 0) && !gas_interceptor_detected && long_controls_allowed) {
|
||||
controls_allowed = 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,8 @@ from common.basedir import BASEDIR
|
||||
from common.fingerprints import eliminate_incompatible_cars, all_known_cars
|
||||
from selfdrive.swaglog import cloudlog
|
||||
import selfdrive.messaging as messaging
|
||||
import pickle
|
||||
import selfdrive.crash as crash
|
||||
|
||||
|
||||
def get_startup_alert(car_recognized, controller_available):
|
||||
@@ -78,45 +80,55 @@ def fingerprint(logcan, sendcan, is_panda_black):
|
||||
cloudlog.warning("VIN %s", vin)
|
||||
Params().put("CarVin", vin)
|
||||
|
||||
finger = {i: {} for i in range(0, 4)} # collect on all buses
|
||||
candidate_cars = {i: all_known_cars() for i in [0, 1]} # attempt fingerprint on both bus 0 and 1
|
||||
frame = 0
|
||||
frame_fingerprint = 10 # 0.1s
|
||||
car_fingerprint = None
|
||||
done = False
|
||||
if params.get("DragonCacheCar") == "1" and params.get("DragonCachedFP") != "" and params.get("DragonCachedModel") != "":
|
||||
car_fingerprint = pickle.loads(params.get("DragonCachedModel"))
|
||||
finger = pickle.loads(params.get("DragonCachedFP"))
|
||||
vin = pickle.loads(params.get("DragonCachedVIN"))
|
||||
else:
|
||||
finger = {i: {} for i in range(0, 4)} # collect on all buses
|
||||
candidate_cars = {i: all_known_cars() for i in [0, 1]} # attempt fingerprint on both bus 0 and 1
|
||||
frame = 0
|
||||
frame_fingerprint = 10 # 0.1s
|
||||
car_fingerprint = None
|
||||
done = False
|
||||
|
||||
while not done:
|
||||
a = messaging.recv_one(logcan)
|
||||
while not done:
|
||||
a = messaging.recv_one(logcan)
|
||||
|
||||
for can in a.can:
|
||||
# need to independently try to fingerprint both bus 0 and 1 to work
|
||||
# for the combo black_panda and honda_bosch. Ignore extended messages
|
||||
# and VIN query response.
|
||||
# Include bus 2 for toyotas to disambiguate cars using camera messages
|
||||
# (ideally should be done for all cars but we can't for Honda Bosch)
|
||||
for can in a.can:
|
||||
# need to independently try to fingerprint both bus 0 and 1 to work
|
||||
# for the combo black_panda and honda_bosch. Ignore extended messages
|
||||
# and VIN query response.
|
||||
# Include bus 2 for toyotas to disambiguate cars using camera messages
|
||||
# (ideally should be done for all cars but we can't for Honda Bosch)
|
||||
for b in candidate_cars:
|
||||
if (can.src == b or (only_toyota_left(candidate_cars[b]) and can.src == 2)) and \
|
||||
can.address < 0x800 and can.address not in [0x7df, 0x7e0, 0x7e8]:
|
||||
finger[can.src][can.address] = len(can.dat)
|
||||
candidate_cars[b] = eliminate_incompatible_cars(can, candidate_cars[b])
|
||||
|
||||
# if we only have one car choice and the time since we got our first
|
||||
# message has elapsed, exit
|
||||
for b in candidate_cars:
|
||||
if (can.src == b or (only_toyota_left(candidate_cars[b]) and can.src == 2)) and \
|
||||
can.address < 0x800 and can.address not in [0x7df, 0x7e0, 0x7e8]:
|
||||
finger[can.src][can.address] = len(can.dat)
|
||||
candidate_cars[b] = eliminate_incompatible_cars(can, candidate_cars[b])
|
||||
# Toyota needs higher time to fingerprint, since DSU does not broadcast immediately
|
||||
if only_toyota_left(candidate_cars[b]):
|
||||
frame_fingerprint = 100 # 1s
|
||||
if len(candidate_cars[b]) == 1:
|
||||
if frame > frame_fingerprint:
|
||||
# fingerprint done
|
||||
car_fingerprint = candidate_cars[b][0]
|
||||
|
||||
# if we only have one car choice and the time since we got our first
|
||||
# message has elapsed, exit
|
||||
for b in candidate_cars:
|
||||
# Toyota needs higher time to fingerprint, since DSU does not broadcast immediately
|
||||
if only_toyota_left(candidate_cars[b]):
|
||||
frame_fingerprint = 100 # 1s
|
||||
if len(candidate_cars[b]) == 1:
|
||||
if frame > frame_fingerprint:
|
||||
# fingerprint done
|
||||
car_fingerprint = candidate_cars[b][0]
|
||||
# bail if no cars left or we've been waiting for more than 2s
|
||||
failed = all(len(cc) == 0 for cc in candidate_cars.itervalues()) or frame > 200
|
||||
succeeded = car_fingerprint is not None
|
||||
done = failed or succeeded
|
||||
|
||||
# bail if no cars left or we've been waiting for more than 2s
|
||||
failed = all(len(cc) == 0 for cc in candidate_cars.itervalues()) or frame > 200
|
||||
succeeded = car_fingerprint is not None
|
||||
done = failed or succeeded
|
||||
frame += 1
|
||||
|
||||
frame += 1
|
||||
if succeeded:
|
||||
params.put("DragonCachedModel", pickle.dumps(car_fingerprint))
|
||||
params.put("DragonCachedFP", pickle.dumps(finger))
|
||||
params.put("DragonCachedVIN", pickle.dumps(vin))
|
||||
|
||||
cloudlog.warning("fingerprinted %s", car_fingerprint)
|
||||
return car_fingerprint, finger, vin
|
||||
@@ -129,6 +141,12 @@ def get_car(logcan, sendcan, is_panda_black=False):
|
||||
if candidate is None:
|
||||
cloudlog.warning("car doesn't match any fingerprints: %r", fingerprints)
|
||||
candidate = "mock"
|
||||
else:
|
||||
cloudlog.warning("car does match fingerprint: %r", fingerprints)
|
||||
try:
|
||||
crash.capture_warning("fingerprinted %s" % candidate)
|
||||
except: # fixes occasional travis errors
|
||||
pass
|
||||
|
||||
CarInterface, CarController = interfaces[candidate]
|
||||
car_params = CarInterface.get_params(candidate, fingerprints[0], vin, is_panda_black)
|
||||
|
||||
@@ -6,6 +6,8 @@ from selfdrive.car import create_gas_command
|
||||
from selfdrive.car.honda import hondacan
|
||||
from selfdrive.car.honda.values import AH, CruiseButtons, CAR
|
||||
from selfdrive.can.packer import CANPacker
|
||||
from common.params import Params
|
||||
params = Params()
|
||||
|
||||
|
||||
def actuator_hystereses(brake, braking, brake_steady, v_ego, car_fingerprint):
|
||||
@@ -70,7 +72,7 @@ def process_hud_alert(hud_alert):
|
||||
|
||||
HUDData = namedtuple("HUDData",
|
||||
["pcm_accel", "v_cruise", "mini_car", "car", "X4",
|
||||
"lanes", "beep", "chime", "fcw", "acc_alert", "steer_required"])
|
||||
"lanes", "beep", "chime", "fcw", "acc_alert", "steer_required", "dashed_lanes"])
|
||||
|
||||
|
||||
class CarController(object):
|
||||
@@ -83,10 +85,21 @@ class CarController(object):
|
||||
self.packer = CANPacker(dbc_name)
|
||||
self.new_radar_config = False
|
||||
|
||||
# dragonpilot
|
||||
self.turning_signal_timer = 0
|
||||
self.dragon_enable_steering_on_signal = False
|
||||
self.dragon_allow_gas = False
|
||||
self.dragon_lat_ctrl = True
|
||||
|
||||
def update(self, enabled, CS, frame, actuators, \
|
||||
pcm_speed, pcm_override, pcm_cancel_cmd, pcm_accel, \
|
||||
hud_v_cruise, hud_show_lanes, hud_show_car, \
|
||||
hud_alert, snd_beep, snd_chime):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
if frame % 100 == 0:
|
||||
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
|
||||
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl") == "0" else True
|
||||
|
||||
# *** apply brake hysteresis ***
|
||||
brake, self.braking, self.brake_steady = actuator_hystereses(actuators.brake, self.braking, self.brake_steady, CS.v_ego, CS.CP.carFingerprint)
|
||||
@@ -121,7 +134,7 @@ class CarController(object):
|
||||
fcw_display, steer_required, acc_alert = process_hud_alert(hud_alert)
|
||||
|
||||
hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), 1, hud_car,
|
||||
0xc1, hud_lanes, int(snd_beep), snd_chime, fcw_display, acc_alert, steer_required)
|
||||
0xc1, hud_lanes, int(snd_beep), snd_chime, fcw_display, acc_alert, steer_required, CS.lkMode)
|
||||
|
||||
# **** process the car messages ****
|
||||
|
||||
@@ -141,11 +154,22 @@ class CarController(object):
|
||||
apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX - 1))
|
||||
apply_steer = int(clip(-actuators.steer * STEER_MAX, -STEER_MAX, STEER_MAX))
|
||||
|
||||
lkas_active = enabled and not CS.steer_not_allowed
|
||||
lkas_active = enabled and not CS.steer_not_allowed and CS.lkMode
|
||||
|
||||
# Send CAN commands.
|
||||
can_sends = []
|
||||
|
||||
# dragonpilot
|
||||
if enabled and (CS.left_blinker_on > 0 or CS.right_blinker_on > 0) and self.dragon_enable_steering_on_signal:
|
||||
self.turning_signal_timer = 100
|
||||
|
||||
if self.turning_signal_timer > 0:
|
||||
self.turning_signal_timer -= 1
|
||||
lkas_active = False
|
||||
|
||||
if not self.dragon_lat_ctrl:
|
||||
lkas_active = False
|
||||
|
||||
# Send steering command.
|
||||
idx = frame % 4
|
||||
can_sends.append(hondacan.create_steering_control(self.packer, apply_steer,
|
||||
@@ -169,6 +193,16 @@ class CarController(object):
|
||||
idx = frame // 2
|
||||
ts = frame * DT_CTRL
|
||||
pump_on, self.last_pump_ts = brake_pump_hysteresis(apply_brake, self.apply_brake_last, self.last_pump_ts, ts)
|
||||
# DragonAllowGas
|
||||
# if we detect gas pedal pressed, we do not want OP to apply gas or brake
|
||||
# gasPressed code from interface.py
|
||||
if not CS.CP.enableGasInterceptor:
|
||||
gasPressed = CS.pedal_gas > 0
|
||||
else:
|
||||
gasPressed = CS.user_gas_pressed
|
||||
if self.dragon_allow_gas and gasPressed:
|
||||
apply_brake = 0
|
||||
apply_gas = 0
|
||||
can_sends.append(hondacan.create_brake_command(self.packer, apply_brake, pump_on,
|
||||
pcm_override, pcm_cancel_cmd, hud.chime, hud.fcw, idx, CS.CP.carFingerprint, CS.CP.isPandaBlack))
|
||||
self.apply_brake_last = apply_brake
|
||||
|
||||
@@ -199,6 +199,8 @@ class CarState(object):
|
||||
K=[[0.12287673], [0.29666309]])
|
||||
self.v_ego = 0.0
|
||||
|
||||
self.lkMode = True
|
||||
|
||||
def update(self, cp, cp_cam):
|
||||
|
||||
# car params
|
||||
@@ -269,6 +271,13 @@ class CarState(object):
|
||||
self.angle_steers = cp.vl["STEERING_SENSORS"]['STEER_ANGLE']
|
||||
self.angle_steers_rate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE']
|
||||
|
||||
# when user presses LKAS button on steering wheel
|
||||
if self.cruise_setting == 1:
|
||||
if cp.vl["SCM_BUTTONS"]["CRUISE_SETTING"] == 0:
|
||||
if self.lkMode:
|
||||
self.lkMode = False
|
||||
else:
|
||||
self.lkMode = True
|
||||
self.cruise_setting = cp.vl["SCM_BUTTONS"]['CRUISE_SETTING']
|
||||
self.cruise_buttons = cp.vl["SCM_BUTTONS"]['CRUISE_BUTTONS']
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, is_metric, idx,
|
||||
'SET_ME_X48': 0x48,
|
||||
'STEERING_REQUIRED': hud.steer_required,
|
||||
'SOLID_LANES': hud.lanes,
|
||||
'DASHED_LANES': hud.dashed_lanes,
|
||||
'BEEP': hud.beep,
|
||||
}
|
||||
commands.append(packer.make_can_msg('LKAS_HUD', bus_lkas, lkas_hud_values, idx))
|
||||
|
||||
@@ -12,6 +12,8 @@ from selfdrive.car.honda.carstate import CarState, get_can_parser, get_cam_can_p
|
||||
from selfdrive.car.honda.values import CruiseButtons, CAR, HONDA_BOSCH, AUDIO_HUD, VISUAL_HUD, CAMERA_MSGS
|
||||
from selfdrive.car import STD_CARGO_KG, CivicParams, scale_rot_inertia, scale_tire_stiffness
|
||||
from selfdrive.controls.lib.planner import _A_CRUISE_MAX_V_FOLLOWING
|
||||
from common.params import Params
|
||||
params = Params()
|
||||
|
||||
A_ACC_MAX = max(_A_CRUISE_MAX_V_FOLLOWING)
|
||||
|
||||
@@ -96,6 +98,11 @@ class CarInterface(object):
|
||||
else:
|
||||
self.compute_gb = compute_gb_honda
|
||||
|
||||
# dragonpilot
|
||||
self.dragon_enable_steering_on_signal = False
|
||||
self.dragon_allow_gas = False
|
||||
self.ts_last_check = 0.
|
||||
|
||||
@staticmethod
|
||||
def calc_accel_override(a_ego, a_target, v_ego, v_target):
|
||||
|
||||
@@ -360,6 +367,13 @@ class CarInterface(object):
|
||||
|
||||
# returns a car.CarState
|
||||
def update(self, c, can_strings):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
ts = sec_since_boot()
|
||||
if ts - self.ts_last_check > 1.:
|
||||
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
|
||||
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
|
||||
self.ts_last_check = ts
|
||||
|
||||
# ******************* do can recv *******************
|
||||
self.cp.update_strings(int(sec_since_boot() * 1e9), can_strings)
|
||||
self.cp_cam.update_strings(int(sec_since_boot() * 1e9), can_strings)
|
||||
@@ -473,7 +487,11 @@ class CarInterface(object):
|
||||
# wait 1.0s before throwing the alert to avoid it popping when you turn off the car
|
||||
if self.cp_cam.can_invalid_cnt >= 100 and self.CS.CP.carFingerprint not in HONDA_BOSCH and self.CP.enableCamera:
|
||||
events.append(create_event('invalidGiraffeHonda', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT]))
|
||||
if self.CS.steer_error:
|
||||
if not self.CS.lkMode:
|
||||
events.append(create_event('manualSteeringRequired', [ET.WARNING]))
|
||||
elif self.CS.lkMode and (self.CS.left_blinker_on or self.CS.right_blinker_on) and self.dragon_enable_steering_on_signal:
|
||||
events.append(create_event('manualSteeringRequiredBlinkersOn', [ET.WARNING]))
|
||||
elif self.CS.steer_error:
|
||||
events.append(create_event('steerUnavailable', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT]))
|
||||
elif self.CS.steer_warning:
|
||||
events.append(create_event('steerTempUnavailable', [ET.WARNING]))
|
||||
@@ -499,13 +517,18 @@ class CarInterface(object):
|
||||
if self.CP.enableCruise and ret.vEgo < self.CP.minEnableSpeed:
|
||||
events.append(create_event('speedTooLow', [ET.NO_ENTRY]))
|
||||
|
||||
# disable on pedals rising edge or when brake is pressed and speed isn't zero
|
||||
if (ret.gasPressed and not self.gas_pressed_prev) or \
|
||||
(ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)):
|
||||
events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE]))
|
||||
# DragonAllowGas
|
||||
if not self.dragon_allow_gas:
|
||||
# disable on pedals rising edge or when brake is pressed and speed isn't zero
|
||||
if (ret.gasPressed and not self.gas_pressed_prev) or \
|
||||
(ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)):
|
||||
events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE]))
|
||||
|
||||
if ret.gasPressed:
|
||||
events.append(create_event('pedalPressed', [ET.PRE_ENABLE]))
|
||||
if ret.gasPressed:
|
||||
events.append(create_event('pedalPressed', [ET.PRE_ENABLE]))
|
||||
else:
|
||||
if ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001):
|
||||
events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE]))
|
||||
|
||||
# it can happen that car cruise disables while comma system is enabled: need to
|
||||
# keep braking if needed or if the speed is very low
|
||||
|
||||
@@ -84,7 +84,7 @@ FINGERPRINTS = {
|
||||
148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 399: 7, 401: 8, 420: 8, 427: 3, 432: 7, 441: 5, 446: 3, 450: 8, 464: 8, 477: 8, 479: 8, 495: 8, 545: 6, 662: 4, 773: 7, 777: 8, 780: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 927: 8, 929: 8, 1302: 8, 1600: 5, 1601: 8, 1652: 8
|
||||
}],
|
||||
CAR.ACCORDH: [{
|
||||
148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 387: 8, 388: 8, 399: 7, 419: 8, 420: 8, 427: 3, 432: 7, 441: 5, 450: 8, 464: 8, 477: 8, 479: 8, 495: 8, 525: 8, 545: 6, 662: 4, 773: 7, 777: 8, 780: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 927: 8, 929: 8, 1302: 8, 1600: 5, 1601: 8, 1652: 8
|
||||
148: 8, 228: 5, 304: 8, 330: 8, 344: 8, 380: 8, 387: 8, 388: 8, 399: 7, 419: 8, 420: 8, 427: 3, 432: 7, 441: 5, 450: 8, 464: 8, 477: 8, 479: 8, 495: 8, 525: 8, 545: 6, 662: 4, 773: 7, 777: 8, 780: 8, 804: 8, 806: 8, 808: 8, 829: 5, 862: 8, 884: 8, 891: 8, 927: 8, 929: 8, 1302: 8, 1416: 5, 1600: 5, 1601: 8, 1652: 8
|
||||
}],
|
||||
CAR.ACURA_ILX: [{
|
||||
57: 3, 145: 8, 228: 5, 304: 8, 316: 8, 342: 6, 344: 8, 380: 8, 398: 3, 399: 7, 419: 8, 420: 8, 422: 8, 428: 8, 432: 7, 464: 8, 476: 4, 490: 8, 506: 8, 512: 6, 513: 6, 542: 7, 545: 4, 597: 8, 660: 8, 773: 7, 777: 8, 780: 8, 800: 8, 804: 8, 808: 8, 819: 7, 821: 5, 829: 5, 882: 2, 884: 7, 887: 8, 888: 8, 892: 8, 923: 2, 929: 4, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1030: 5, 1034: 5, 1036: 8, 1039: 8, 1057: 5, 1064: 7, 1108: 8, 1365: 5,
|
||||
|
||||
@@ -8,6 +8,9 @@ from selfdrive.car.toyota.toyotacan import make_can_msg, create_video_target,\
|
||||
create_fcw_command
|
||||
from selfdrive.car.toyota.values import ECU, STATIC_MSGS, TSS2_CAR
|
||||
from selfdrive.can.packer import CANPacker
|
||||
from common.params import Params
|
||||
params = Params()
|
||||
|
||||
|
||||
VisualAlert = car.CarControl.HUDControl.VisualAlert
|
||||
AudibleAlert = car.CarControl.HUDControl.AudibleAlert
|
||||
@@ -123,9 +126,20 @@ class CarController(object):
|
||||
|
||||
self.packer = CANPacker(dbc_name)
|
||||
|
||||
# dragonpilot
|
||||
self.turning_signal_timer = 0
|
||||
self.dragon_enable_steering_on_signal = False
|
||||
self.dragon_allow_gas = False
|
||||
self.dragon_lat_ctrl = True
|
||||
|
||||
def update(self, enabled, CS, frame, actuators,
|
||||
pcm_cancel_cmd, hud_alert, audible_alert, forwarding_camera,
|
||||
left_line, right_line, lead, left_lane_depart, right_lane_depart):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
if frame % 100 == 0:
|
||||
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
|
||||
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
|
||||
self.dragon_lat_ctrl = False if params.get("DragonLatCtrl") == "0" else True
|
||||
|
||||
# *** compute control surfaces ***
|
||||
|
||||
@@ -197,6 +211,28 @@ class CarController(object):
|
||||
|
||||
can_sends = []
|
||||
|
||||
# dragonpilot
|
||||
if enabled and (CS.left_blinker_on or CS.right_blinker_on) and self.dragon_enable_steering_on_signal:
|
||||
self.turning_signal_timer = 100
|
||||
|
||||
if self.turning_signal_timer > 0:
|
||||
self.turning_signal_timer -= 1
|
||||
apply_steer_req = 0
|
||||
|
||||
if not self.dragon_lat_ctrl:
|
||||
apply_steer_req = 0
|
||||
|
||||
if CS.v_ego > 12.5 and not enabled:
|
||||
if right_lane_depart and not CS.right_blinker_on:
|
||||
apply_steer = self.last_steer + 3
|
||||
apply_steer = min(apply_steer , 800)
|
||||
apply_steer_req = 1
|
||||
|
||||
if left_lane_depart and not CS.left_blinker_on:
|
||||
apply_steer = self.last_steer - 3
|
||||
apply_steer = max(apply_steer , -800)
|
||||
apply_steer_req = 1
|
||||
|
||||
#*** control msgs ***
|
||||
#print("steer {0} {1} {2} {3}".format(apply_steer, min_lim, max_lim, CS.steer_torque_motor)
|
||||
|
||||
@@ -215,6 +251,19 @@ class CarController(object):
|
||||
elif ECU.APGS in self.fake_ecus:
|
||||
can_sends.append(create_ipas_steer_command(self.packer, 0, 0, True))
|
||||
|
||||
# DragonAllowGas
|
||||
# if we detect gas pedal pressed, we do not want OP to apply gas or brake
|
||||
# gasPressed code from interface.py
|
||||
if CS.CP.enableGasInterceptor:
|
||||
# use interceptor values to disengage on pedal press
|
||||
gasPressed = CS.pedal_gas > 15
|
||||
else:
|
||||
gasPressed = CS.pedal_gas > 0
|
||||
|
||||
if self.dragon_allow_gas and gasPressed:
|
||||
apply_accel = 0
|
||||
apply_gas = 0
|
||||
|
||||
# accel cmd comes from DSU, but we can spam can to cancel the system even if we are using lat only control
|
||||
if (frame % 3 == 0 and ECU.DSU in self.fake_ecus) or (pcm_cancel_cmd and ECU.CAM in self.fake_ecus):
|
||||
lead = lead or CS.v_ego < 12. # at low speed we always assume the lead is present do ACC can be engaged
|
||||
|
||||
@@ -5,6 +5,10 @@ from selfdrive.can.parser import CANParser
|
||||
from selfdrive.config import Conversions as CV
|
||||
from selfdrive.car.toyota.values import CAR, DBC, STEER_THRESHOLD, TSS2_CAR, NO_DSU_CAR
|
||||
|
||||
from common.realtime import sec_since_boot
|
||||
from common.params import Params
|
||||
params = Params()
|
||||
|
||||
def parse_gear_shifter(gear, vals):
|
||||
|
||||
val_to_capnp = {'P': 'park', 'R': 'reverse', 'N': 'neutral',
|
||||
@@ -109,7 +113,16 @@ class CarState(object):
|
||||
K=[[0.12287673], [0.29666309]])
|
||||
self.v_ego = 0.0
|
||||
|
||||
self.dragon_toyota_stock_dsu = False
|
||||
self.ts_last_check = 0.
|
||||
|
||||
def update(self, cp):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
ts = sec_since_boot()
|
||||
if ts - self.ts_last_check > 1.:
|
||||
self.dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
|
||||
self.ts_last_check = ts
|
||||
|
||||
# update prevs, update must run once per loop
|
||||
self.prev_left_blinker_on = self.left_blinker_on
|
||||
self.prev_right_blinker_on = self.right_blinker_on
|
||||
@@ -182,3 +195,13 @@ class CarState(object):
|
||||
self.generic_toggle = cp.vl["AUTOPARK_STATUS"]['STATE'] != 0
|
||||
else:
|
||||
self.generic_toggle = bool(cp.vl["LIGHT_STALK"]['AUTO_HIGH_BEAM'])
|
||||
|
||||
if self.dragon_toyota_stock_dsu and self.generic_toggle and self.main_on:
|
||||
enable_acc = True
|
||||
if not self.gear_shifter == 'drive' or not self.seatbelt or not self.door_all_closed:
|
||||
enable_acc = False
|
||||
self.pcm_acc_active = enable_acc
|
||||
if self.standstill:
|
||||
self.pcm_acc_status = 7
|
||||
else:
|
||||
self.pcm_acc_status = 1
|
||||
@@ -8,6 +8,8 @@ from selfdrive.car.toyota.carstate import CarState, get_can_parser, get_cam_can_
|
||||
from selfdrive.car.toyota.values import ECU, check_ecu_msgs, CAR, NO_STOP_TIMER_CAR
|
||||
from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness
|
||||
from selfdrive.swaglog import cloudlog
|
||||
from common.params import Params
|
||||
params = Params()
|
||||
|
||||
class CarInterface(object):
|
||||
def __init__(self, CP, CarController):
|
||||
@@ -31,6 +33,12 @@ class CarInterface(object):
|
||||
if CarController is not None:
|
||||
self.CC = CarController(self.cp.dbc_name, CP.carFingerprint, CP.enableCamera, CP.enableDsu, CP.enableApgs)
|
||||
|
||||
# dragonpilot
|
||||
self.dragon_toyota_stock_dsu = False
|
||||
self.dragon_enable_steering_on_signal = False
|
||||
self.dragon_allow_gas = False
|
||||
self.ts_last_check = 0.
|
||||
|
||||
@staticmethod
|
||||
def compute_gb(accel, speed):
|
||||
return float(accel) / 3.0
|
||||
@@ -247,6 +255,14 @@ class CarInterface(object):
|
||||
|
||||
# returns a car.CarState
|
||||
def update(self, c, can_strings):
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
ts = sec_since_boot()
|
||||
if ts - self.ts_last_check > 1.:
|
||||
self.dragon_enable_steering_on_signal = False if params.get("DragonEnableSteeringOnSignal") == "0" else True
|
||||
self.dragon_allow_gas = False if params.get("DragonAllowGas") == "0" else True
|
||||
self.dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
|
||||
self.ts_last_check = ts
|
||||
|
||||
# ******************* do can recv *******************
|
||||
self.cp.update_strings(int(sec_since_boot() * 1e9), can_strings)
|
||||
|
||||
@@ -348,7 +364,9 @@ class CarInterface(object):
|
||||
events.append(create_event('wrongCarMode', [ET.NO_ENTRY, ET.USER_DISABLE]))
|
||||
if ret.gearShifter == 'reverse' and self.CP.enableDsu:
|
||||
events.append(create_event('reverseGear', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE]))
|
||||
if self.CS.steer_error:
|
||||
if (self.CS.left_blinker_on or self.CS.right_blinker_on) and self.dragon_enable_steering_on_signal:
|
||||
events.append(create_event('manualSteeringRequiredBlinkersOn', [ET.WARNING]))
|
||||
elif self.CS.steer_error:
|
||||
events.append(create_event('steerTempUnavailable', [ET.NO_ENTRY, ET.WARNING]))
|
||||
if self.CS.low_speed_lockout and self.CP.enableDsu:
|
||||
events.append(create_event('lowSpeedLockout', [ET.NO_ENTRY, ET.PERMANENT]))
|
||||
@@ -367,13 +385,19 @@ class CarInterface(object):
|
||||
elif not ret.cruiseState.enabled:
|
||||
events.append(create_event('pcmDisable', [ET.USER_DISABLE]))
|
||||
|
||||
# disable on pedals rising edge or when brake is pressed and speed isn't zero
|
||||
if (ret.gasPressed and not self.gas_pressed_prev) or \
|
||||
(ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)):
|
||||
events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE]))
|
||||
if not self.dragon_toyota_stock_dsu:
|
||||
# DragonAllowGas
|
||||
if not self.dragon_allow_gas:
|
||||
# disable on pedals rising edge or when brake is pressed and speed isn't zero
|
||||
if (ret.gasPressed and not self.gas_pressed_prev) or \
|
||||
(ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001)):
|
||||
events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE]))
|
||||
|
||||
if ret.gasPressed:
|
||||
events.append(create_event('pedalPressed', [ET.PRE_ENABLE]))
|
||||
if ret.gasPressed:
|
||||
events.append(create_event('pedalPressed', [ET.PRE_ENABLE]))
|
||||
else:
|
||||
if ret.brakePressed and (not self.brake_pressed_prev or ret.vEgo > 0.001):
|
||||
events.append(create_event('pedalPressed', [ET.NO_ENTRY, ET.USER_DISABLE]))
|
||||
|
||||
ret.events = events
|
||||
|
||||
|
||||
@@ -491,7 +491,17 @@ def controlsd_thread(gctx=None):
|
||||
|
||||
prof = Profiler(False) # off by default
|
||||
|
||||
# dragonpilot
|
||||
ts_last_check = 0.
|
||||
dragon_toyota_stock_dsu = False
|
||||
|
||||
while True:
|
||||
# dragonpilot, don't check for param too often as it's a kernel call
|
||||
ts = sec_since_boot()
|
||||
if ts - ts_last_check > 1.:
|
||||
dragon_toyota_stock_dsu = False if params.get("DragonToyotaStockDSU") == "0" else True
|
||||
ts_last_check = ts
|
||||
|
||||
start_time = sec_since_boot()
|
||||
prof.checkpoint("Ratekeeper", ignore=True)
|
||||
|
||||
@@ -519,9 +529,10 @@ def controlsd_thread(gctx=None):
|
||||
if not CS.canValid:
|
||||
events.append(create_event('canError', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE]))
|
||||
|
||||
# Only allow engagement with brake pressed when stopped behind another stopped car
|
||||
if CS.brakePressed and sm['plan'].vTargetFuture >= STARTING_TARGET_SPEED and not CP.radarOffCan and CS.vEgo < 0.3:
|
||||
events.append(create_event('noTarget', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE]))
|
||||
if not dragon_toyota_stock_dsu:
|
||||
# Only allow engagement with brake pressed when stopped behind another stopped car
|
||||
if CS.brakePressed and sm['plan'].vTargetFuture >= STARTING_TARGET_SPEED and not CP.radarOffCan and CS.vEgo < 0.3:
|
||||
events.append(create_event('noTarget', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE]))
|
||||
|
||||
if not read_only:
|
||||
# update control state
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# This Python file uses the following encoding: utf-8
|
||||
# -*- coding: utf-8 -*-
|
||||
from cereal import car, log
|
||||
|
||||
# Priority
|
||||
@@ -680,4 +682,18 @@ ALERTS = [
|
||||
"",
|
||||
AlertStatus.normal, AlertSize.small,
|
||||
Priority.LOWEST, VisualAlert.steerRequired, AudibleAlert.none, .0, .0, .1),
|
||||
|
||||
Alert(
|
||||
"manualSteeringRequired",
|
||||
"STEERING REQUIRED: Lane Keeping OFF",
|
||||
"",
|
||||
AlertStatus.normal, AlertSize.small,
|
||||
Priority.LOW, VisualAlert.none, AudibleAlert.none, .0, .1, .1, alert_rate=0.25),
|
||||
|
||||
Alert(
|
||||
"manualSteeringRequiredBlinkersOn",
|
||||
"STEERING REQUIRED: Blinkers ON",
|
||||
"",
|
||||
AlertStatus.normal, AlertSize.small,
|
||||
Priority.LOW, VisualAlert.none, AudibleAlert.none, .0, .1, .1, alert_rate=0.25),
|
||||
]
|
||||
|
||||
@@ -2,6 +2,8 @@ import numpy as np
|
||||
from common.realtime import sec_since_boot, DT_CTRL, DT_DMON
|
||||
from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET
|
||||
from common.filter_simple import FirstOrderFilter
|
||||
from common.params import Params
|
||||
params = Params()
|
||||
|
||||
_AWARENESS_TIME = 180 # 3 minutes limit without user touching steering wheels make the car enter a terminal status
|
||||
_AWARENESS_PRE_TIME = 20. # a first alert is issued 20s before expiration
|
||||
@@ -72,6 +74,10 @@ class DriverStatus():
|
||||
self.terminal_alert_cnt = 0
|
||||
self._set_timers()
|
||||
|
||||
# dragonpilot
|
||||
self.dp_last_check = 0.
|
||||
self.dragon_enable_driver_safety_check = True
|
||||
|
||||
def _reset_filters(self):
|
||||
self.driver_distraction_filter.x = 0.
|
||||
self.variance_filter.x = 0.
|
||||
@@ -131,6 +137,11 @@ class DriverStatus():
|
||||
|
||||
|
||||
def update(self, events, driver_engaged, ctrl_active, standstill):
|
||||
# don't check for param too often as it's a kernel call
|
||||
ts = sec_since_boot()
|
||||
if ts - self.dp_last_check > 1.:
|
||||
self.dragon_enable_driver_safety_check = False if params.get("DragonEnableDriverSafetyCheck") == "0" else True
|
||||
self.dp_last_check = ts
|
||||
|
||||
driver_engaged |= (self.driver_distraction_filter.x < 0.37 and self.monitor_on)
|
||||
awareness_prev = self.awareness
|
||||
@@ -156,8 +167,7 @@ class DriverStatus():
|
||||
elif self.awareness <= self.threshold_pre:
|
||||
# pre green alert
|
||||
alert = 'preDriverDistracted' if self.monitor_on else 'preDriverUnresponsive'
|
||||
|
||||
if alert is not None:
|
||||
if alert is not None and self.dragon_enable_driver_safety_check:
|
||||
events.append(create_event(alert, [ET.WARNING]))
|
||||
|
||||
return events
|
||||
|
||||
@@ -14,9 +14,9 @@ class ModelParser(object):
|
||||
self.lead_dist, self.lead_prob, self.lead_var = 0, 0, 1
|
||||
self._path_pinv = compute_path_pinv()
|
||||
|
||||
self.lane_width_estimate = 3.7
|
||||
self.lane_width_estimate = 3.5
|
||||
self.lane_width_certainty = 1.0
|
||||
self.lane_width = 3.7
|
||||
self.lane_width = 3.5
|
||||
self.l_prob = 0.
|
||||
self.r_prob = 0.
|
||||
self.x_points = np.arange(50)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
"""Install exception handler for process crash."""
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
#from subprocess import check_output
|
||||
import threading
|
||||
import capnp
|
||||
from selfdrive.version import version, dirty
|
||||
|
||||
from selfdrive.swaglog import cloudlog
|
||||
@@ -19,13 +20,42 @@ if os.getenv("NOLOG") or os.getenv("NOCRASH"):
|
||||
else:
|
||||
from raven import Client
|
||||
from raven.transport.http import HTTPTransport
|
||||
client = Client('https://1994756b5e6f41cf939a4c65de45f4f2:cefebaf3a8aa40d182609785f7189bd7@app.getsentry.com/77924',
|
||||
install_sys_hook=False, transport=HTTPTransport, release=version, tags={'dirty': dirty})
|
||||
|
||||
error_tags = {'dirty': dirty, 'username': 'char_error'}
|
||||
|
||||
try:
|
||||
with open("/data/data/ai.comma.plus.offroad/files/persistStore/persist-auth", "r") as f:
|
||||
auth = json.loads(f.read())
|
||||
auth = json.loads(auth['commaUser'])
|
||||
tags = ['username', 'email']
|
||||
for tag in tags:
|
||||
try:
|
||||
error_tags[tag] = ''.join(char for char in auth[tag].decode('utf-8', 'ignore') if char.isalnum())
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
logging_data = {"branch": "/data/params/d/GitBranch", "commit": "/data/params/d/GitCommit", "remote": "/data/params/d/GitRemote"}
|
||||
|
||||
for key in logging_data:
|
||||
try:
|
||||
with open(logging_data[key], "r") as f:
|
||||
error_tags[key] = str(f.read())
|
||||
except:
|
||||
error_tags[key] = "unknown"
|
||||
|
||||
client = Client('https://980a0cba712a4c3593c33c78a12446e1:fecab286bcaf4dba8b04f7cff0188e2d@sentry.io/1488600',
|
||||
install_sys_hook=False, transport=HTTPTransport, release=version, tags=error_tags)
|
||||
|
||||
def capture_warning(warning_string):
|
||||
client.captureMessage(warning_string, level='warning')
|
||||
|
||||
def capture_info(info_string):
|
||||
client.captureMessage(info_string, level='info')
|
||||
|
||||
def capture_exception(*args, **kwargs):
|
||||
exc_info = sys.exc_info()
|
||||
if not exc_info[0] is capnp.lib.capnp.KjException:
|
||||
client.captureException(*args, **kwargs)
|
||||
client.captureException(*args, **kwargs)
|
||||
cloudlog.error("crash", exc_info=kwargs.get('exc_info', 1))
|
||||
|
||||
def bind_user(**kwargs):
|
||||
|
||||
0
selfdrive/dragonpilot/__init__.py
Normal file
0
selfdrive/dragonpilot/__init__.py
Normal file
0
selfdrive/dragonpilot/dashcamd/__init__.py
Normal file
0
selfdrive/dragonpilot/dashcamd/__init__.py
Normal file
70
selfdrive/dragonpilot/dashcamd/dashcamd.py
Normal file
70
selfdrive/dragonpilot/dashcamd/dashcamd.py
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#
|
||||
# courtesy of pjlao307 (https://github.com/pjlao307/)
|
||||
# this is just his original implementation but
|
||||
# in openpilot service form so it's always on
|
||||
#
|
||||
# with the highest bit rates, the video is approx. 0.5MB per second
|
||||
# the default value is set to 2.56Mbps = 0.32MB per second
|
||||
#
|
||||
import os
|
||||
import time
|
||||
import datetime
|
||||
import zmq
|
||||
import selfdrive.messaging as messaging
|
||||
from selfdrive.services import service_list
|
||||
from common.params import Params
|
||||
params = Params()
|
||||
|
||||
dashcam_videos = '/sdcard/dashcam/'
|
||||
duration = 60 # max is 180
|
||||
bit_rates = 2560000 # max is 4000000
|
||||
max_size_per_file = bit_rates/8*duration # 2.56Mbps / 8 * 60 = 19.2MB per 60 seconds
|
||||
max_storage = max_size_per_file/duration*60*60*6 # 6 hours worth of footage (around 7gb)
|
||||
freespace_limit = 0.15 # we start cleaning up footage when freespace is below 15%
|
||||
|
||||
def main(gctx=None):
|
||||
if not os.path.exists(dashcam_videos):
|
||||
os.makedirs(dashcam_videos)
|
||||
|
||||
poller = zmq.Poller()
|
||||
sock = messaging.sub_sock(service_list['thermal'].port, poller)
|
||||
poller.poll(timeout=1000)
|
||||
|
||||
while 1:
|
||||
if params.get("DragonEnableDashcam") == "1":
|
||||
now = datetime.datetime.now()
|
||||
file_name = now.strftime("%Y-%m-%d_%H-%M-%S")
|
||||
os.system("screenrecord --bit-rate %s --time-limit %s %s%s.mp4 &" % (bit_rates, duration, dashcam_videos, file_name))
|
||||
|
||||
used_spaces = get_used_spaces()
|
||||
last_used_spaces = used_spaces
|
||||
|
||||
# we should clean up files here if use too much spaces
|
||||
# when used spaces greater than max available storage
|
||||
# or when free space is less than 10%
|
||||
|
||||
# get health of board, log this in "thermal"
|
||||
msg = messaging.recv_sock(sock, wait=True)
|
||||
if used_spaces >= max_storage or (msg is not None and msg.thermal.freeSpace < freespace_limit):
|
||||
# get all the files in the dashcam_videos path
|
||||
files = [f for f in sorted(os.listdir(dashcam_videos)) if os.path.isfile(dashcam_videos + f)]
|
||||
for file in files:
|
||||
msg = messaging.recv_sock(sock, wait=True)
|
||||
# delete file one by one and once it has enough space for 1 video, we stop deleting
|
||||
if used_spaces - last_used_spaces < max_size_per_file or msg.thermal.freeSpace < freespace_limit:
|
||||
os.system("rm -fr %s" % (dashcam_videos + file))
|
||||
last_used_spaces = get_used_spaces()
|
||||
else:
|
||||
break
|
||||
# we start the process 1 second before screenrecord ended
|
||||
# to make sure there are no missing footage
|
||||
time.sleep(duration-1)
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
def get_used_spaces():
|
||||
return sum(os.path.getsize(dashcam_videos + f) for f in os.listdir(dashcam_videos) if os.path.isfile(dashcam_videos + f))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
69
selfdrive/dragonpilot/dragonconf/__init__.py
Normal file
69
selfdrive/dragonpilot/dragonconf/__init__.py
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python2.7
|
||||
from common.params import Params
|
||||
|
||||
default_conf = {
|
||||
'DragonEnableDashcam': '1',
|
||||
'DragonDisableDriverSafetyCheck': '0', # deprecated
|
||||
'DragonEnableDriverSafetyCheck': '1',
|
||||
'DragonAutoShutdownAt': '30', # in minute
|
||||
'DragonTempDisableSteerOnSignal': '0', # deprecated
|
||||
'DragonEnableSteeringOnSignal': '0',
|
||||
'DragonDisableLogger': '0', # deprecated
|
||||
'DragonEnableLogger': '1',
|
||||
'DragonDisableUploader': '0', # deprecated
|
||||
'DragonEnableUploader': '1',
|
||||
'DragonNoctuaMode': '0',
|
||||
'DragonCacheCar': '0',
|
||||
'DragonCachedModel': '', # for cache car
|
||||
'DragonCachedFP': '', # for cache car
|
||||
'DragonCachedVIN': '', # for cache car
|
||||
'DragonAllowGas': '0',
|
||||
'DragonBBUI': '0', # deprecated
|
||||
'DragonToyotaStockDSU': '0',
|
||||
'DragonLatCtrl': '1',
|
||||
'DragonUIEvent': '0',
|
||||
'DragonUIMaxSpeed': '0',
|
||||
'DragonUIFace': '0',
|
||||
'DragonUIDev': '0',
|
||||
'DragonUIDevMini': '1',
|
||||
}
|
||||
|
||||
deprecated_conf = {
|
||||
'DragonDisableDriverSafetyCheck': 'DragonEnableDriverSafetyCheck',
|
||||
'DragonTempDisableSteerOnSignal': 'DragonEnableSteeringOnSignal',
|
||||
'DragonDisableLogger': 'DragonEnableLogger',
|
||||
'DragonDisableUploader': 'DragonEnableUploader',
|
||||
'DragonBBUI': 'DragonUIDev',
|
||||
}
|
||||
|
||||
deprecated_conf_invert = {
|
||||
'DragonDisableDriverSafetyCheck': True,
|
||||
'DragonTempDisableSteerOnSignal': False,
|
||||
'DragonDisableLogger': True,
|
||||
'DragonDisableUploader': True,
|
||||
'DragonBBUI': False
|
||||
}
|
||||
|
||||
def dragonpilot_set_params(params):
|
||||
# remove deprecated params
|
||||
for old, new in deprecated_conf.items():
|
||||
if params.get(old) is not None:
|
||||
if new is not None:
|
||||
old_val = str(params.get(old))
|
||||
new_val = old_val
|
||||
# invert the value if true
|
||||
if old in deprecated_conf_invert and deprecated_conf_invert[old] is True:
|
||||
new_val = "1" if old_val == "0" else "0"
|
||||
params.put(new, new_val)
|
||||
params.delete(old)
|
||||
|
||||
# set params
|
||||
for key, val in default_conf.items():
|
||||
if params.get(key) is None and key not in deprecated_conf:
|
||||
params.put(key, str(val))
|
||||
|
||||
if __name__ == "__main__":
|
||||
params = Params()
|
||||
params.manager_start()
|
||||
|
||||
dragonpilot_set_params(params)
|
||||
BIN
selfdrive/dragonpilot/mediaplayer/libnative-lib.so
Normal file
BIN
selfdrive/dragonpilot/mediaplayer/libnative-lib.so
Normal file
Binary file not shown.
BIN
selfdrive/dragonpilot/mediaplayer/mediaplayer
Executable file
BIN
selfdrive/dragonpilot/mediaplayer/mediaplayer
Executable file
Binary file not shown.
0
selfdrive/dragonpilot/safeguardd/__init__.py
Normal file
0
selfdrive/dragonpilot/safeguardd/__init__.py
Normal file
BIN
selfdrive/dragonpilot/safeguardd/error.wav
Normal file
BIN
selfdrive/dragonpilot/safeguardd/error.wav
Normal file
Binary file not shown.
47
selfdrive/dragonpilot/safeguardd/safeguardd.py
Normal file
47
selfdrive/dragonpilot/safeguardd/safeguardd.py
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#
|
||||
# I had a few incidents where OP suddenly stopped while cruising.
|
||||
# This script is used to detect such event
|
||||
#
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
import zmq
|
||||
from selfdrive.services import service_list
|
||||
import selfdrive.messaging as messaging
|
||||
|
||||
mediaplayer = '/data/openpilot/selfdrive/dragonpilot/mediaplayer/'
|
||||
|
||||
def main(gctx=None):
|
||||
|
||||
poller = zmq.Poller()
|
||||
sock = messaging.sub_sock(service_list['controlsState'].port, poller)
|
||||
poller.poll(timeout=1000)
|
||||
|
||||
last_v_ego = 0.
|
||||
last_active = False
|
||||
|
||||
env = dict(os.environ)
|
||||
env['LD_LIBRARY_PATH'] = mediaplayer
|
||||
|
||||
while 1:
|
||||
|
||||
v_ego = 0
|
||||
active = False
|
||||
controls_state = messaging.recv_sock(sock, wait=True)
|
||||
|
||||
if controls_state is not None:
|
||||
v_ego = controls_state.controlsState.vEgo
|
||||
active = controls_state.controlsState.active
|
||||
|
||||
# we are driving and all of sudden we dont have any speed at all
|
||||
# we better warn the driver before it's too late
|
||||
if last_active and last_v_ego >= 5 and v_ego == 0:
|
||||
subprocess.Popen([mediaplayer + 'mediaplayer', '/data/openpilot/selfdrive/dragonpilot/safeguardd/error.wav'], shell = False, stdin=None, stdout=None, stderr=None, env = env, close_fds=True)
|
||||
|
||||
last_active = active
|
||||
last_v_ego = v_ego
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
0
selfdrive/dragonpilot/shutdownd/__init__.py
Normal file
0
selfdrive/dragonpilot/shutdownd/__init__.py
Normal file
39
selfdrive/dragonpilot/shutdownd/shutdownd.py
Normal file
39
selfdrive/dragonpilot/shutdownd/shutdownd.py
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python2.7
|
||||
|
||||
import os
|
||||
import time
|
||||
from common.params import Params
|
||||
params = Params()
|
||||
|
||||
def main(gctx=None):
|
||||
|
||||
shutdown_count = 0
|
||||
autoShutdownAt = get_shutdown_val()
|
||||
|
||||
while 1:
|
||||
with open("/sys/class/power_supply/usb/present") as f:
|
||||
usb_online = bool(int(f.read()))
|
||||
|
||||
if not usb_online:
|
||||
shutdown_count += 1
|
||||
else:
|
||||
shutdown_count = 0
|
||||
|
||||
if autoShutdownAt is None:
|
||||
autoShutdownAt = get_shutdown_val()
|
||||
else:
|
||||
if shutdown_count >= autoShutdownAt > 0:
|
||||
os.system('LD_LIBRARY_PATH="" svc power shutdown')
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
def get_shutdown_val():
|
||||
val = params.get("DragonAutoShutdownAt")
|
||||
if val is None:
|
||||
return None
|
||||
else:
|
||||
return int(val)*60 # convert to seconds
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -10,6 +10,8 @@ from common.basedir import BASEDIR
|
||||
sys.path.append(os.path.join(BASEDIR, "pyextra"))
|
||||
os.environ['BASEDIR'] = BASEDIR
|
||||
|
||||
from selfdrive.dragonpilot.dragonconf import dragonpilot_set_params
|
||||
|
||||
def unblock_stdout():
|
||||
# get a non-blocking stdout
|
||||
child_pid, child_pty = os.forkpty()
|
||||
@@ -117,6 +119,8 @@ managed_processes = {
|
||||
"sensord": ("selfdrive/sensord", ["./start_sensord.py"]),
|
||||
"gpsd": ("selfdrive/sensord", ["./start_gpsd.py"]),
|
||||
"updated": "selfdrive.updated",
|
||||
"dashcamd": "selfdrive.dragonpilot.dashcamd.dashcamd",
|
||||
"shutdownd": "selfdrive.dragonpilot.shutdownd.shutdownd",
|
||||
}
|
||||
daemon_processes = {
|
||||
"athenad": "selfdrive.athena.athenad",
|
||||
@@ -144,6 +148,7 @@ persistent_processes = [
|
||||
'uploader',
|
||||
'ui',
|
||||
'updated',
|
||||
'shutdownd',
|
||||
]
|
||||
|
||||
car_started_processes = [
|
||||
@@ -159,6 +164,7 @@ car_started_processes = [
|
||||
'ubloxd',
|
||||
'gpsd',
|
||||
'deleter',
|
||||
'dashcamd',
|
||||
]
|
||||
|
||||
def register_managed_process(name, desc, car_started=False):
|
||||
@@ -573,6 +579,8 @@ def main():
|
||||
if params.get("LimitSetSpeedNeural") is None:
|
||||
params.put("LimitSetSpeedNeural", "0")
|
||||
|
||||
dragonpilot_set_params(params)
|
||||
|
||||
# is this chffrplus?
|
||||
if os.getenv("PASSIVE") is not None:
|
||||
params.put("Passive", str(int(os.getenv("PASSIVE"))))
|
||||
@@ -584,10 +592,18 @@ def main():
|
||||
if os.getenv("PREPAREONLY") is not None:
|
||||
spinner_proc = None
|
||||
else:
|
||||
spinner_text = "chffrplus" if params.get("Passive")=="1" else "openpilot"
|
||||
spinner_text = "chffrplus" if params.get("Passive")=="1" else "dragonpilot"
|
||||
spinner_proc = subprocess.Popen(["./spinner", "loading %s"%spinner_text],
|
||||
cwd=os.path.join(BASEDIR, "selfdrive", "ui", "spinner"),
|
||||
close_fds=True)
|
||||
|
||||
if params.get("DragonEnableLogger") == "0":
|
||||
del managed_processes['loggerd']
|
||||
del managed_processes['tombstoned']
|
||||
|
||||
if params.get("DragonEnableUploader") == "0":
|
||||
del managed_processes['uploader']
|
||||
|
||||
try:
|
||||
manager_update()
|
||||
manager_init()
|
||||
|
||||
@@ -11,6 +11,7 @@ from common.params import Params
|
||||
from common.realtime import sec_since_boot, DT_TRML
|
||||
from common.numpy_fast import clip
|
||||
from common.filter_simple import FirstOrderFilter
|
||||
params = Params()
|
||||
|
||||
ThermalStatus = log.ThermalData.ThermalStatus
|
||||
CURRENT_TAU = 15. # 15s time constant
|
||||
@@ -82,6 +83,9 @@ _TEMP_THRS_L = [42.5, 57.5, 72.5, 10000]
|
||||
_FAN_SPEEDS = [0, 16384, 32768, 65535]
|
||||
# max fan speed only allowed if battery is hot
|
||||
_BAT_TEMP_THERSHOLD = 45.
|
||||
if params.get('DragonNoctuaMode') == "1":
|
||||
_FAN_SPEEDS = [65535, 65535, 65535, 65535]
|
||||
_BAT_TEMP_THERSHOLD = 20.
|
||||
|
||||
|
||||
def handle_fan(max_cpu_temp, bat_temp, fan_speed):
|
||||
@@ -146,8 +150,6 @@ def thermald_thread():
|
||||
charging_disabled = False
|
||||
os.system('echo "1" > /sys/class/power_supply/battery/charging_enabled')
|
||||
|
||||
params = Params()
|
||||
|
||||
while 1:
|
||||
health = messaging.recv_sock(health_sock, wait=True)
|
||||
location = messaging.recv_sock(location_sock)
|
||||
|
||||
@@ -104,7 +104,7 @@ def report_tombstone(fn, client):
|
||||
def main(gctx=None):
|
||||
initial_tombstones = set(get_tombstones())
|
||||
|
||||
client = Client('https://d3b175702f62402c91ade04d1c547e68:b20d68c813c74f63a7cdf9c4039d8f56@sentry.io/157615',
|
||||
client = Client('https://980a0cba712a4c3593c33c78a12446e1:fecab286bcaf4dba8b04f7cff0188e2d@sentry.io/1488600',
|
||||
install_sys_hook=False, transport=HTTPTransport, release=version, tags={'dirty': dirty}, string_max_length=10000)
|
||||
|
||||
client.user_context({'id': os.environ.get('DONGLE_ID')})
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "cereal/gen/c/log.capnp.h"
|
||||
#include "slplay.h"
|
||||
#include <time.h>
|
||||
|
||||
#define STATUS_STOPPED 0
|
||||
#define STATUS_DISENGAGED 1
|
||||
@@ -68,6 +69,7 @@ const int viz_w = vwp_w-(bdr_s*2);
|
||||
const int header_h = 420;
|
||||
const int footer_h = 280;
|
||||
const int footer_y = vwp_h-bdr_s-footer_h;
|
||||
const int bdr_is = 30;
|
||||
|
||||
const int UI_FREQ = 30; // Hz
|
||||
|
||||
@@ -163,6 +165,11 @@ typedef struct UIScene {
|
||||
bool gps_planner_active;
|
||||
|
||||
bool is_playing_alert;
|
||||
|
||||
// for minimal UI
|
||||
float angleSteersDes;
|
||||
float angleSteers;
|
||||
|
||||
} UIScene;
|
||||
|
||||
typedef struct {
|
||||
@@ -195,6 +202,8 @@ typedef struct UIState {
|
||||
int font_sans_regular;
|
||||
int font_sans_semibold;
|
||||
int font_sans_bold;
|
||||
int font_miui_regular;
|
||||
int font_miui_bold;
|
||||
int img_wheel;
|
||||
int img_turn;
|
||||
int img_face;
|
||||
@@ -284,6 +293,22 @@ typedef struct UIState {
|
||||
model_path_vertices_data model_path_vertices[MODEL_LANE_PATH_CNT * 2];
|
||||
|
||||
track_vertices_data track_vertices[2];
|
||||
|
||||
// dragonpilot
|
||||
int dragon_ui_event_timeout;
|
||||
int dragon_ui_maxspeed_timeout;
|
||||
int dragon_ui_face_timeout;
|
||||
int dragon_ui_dev_timeout;
|
||||
int dragon_ui_dev_mini_timeout;
|
||||
int dragon_enable_dashcam_timeout;
|
||||
|
||||
bool dragon_ui_event;
|
||||
bool dragon_ui_maxspeed;
|
||||
bool dragon_ui_face;
|
||||
bool dragon_ui_dev;
|
||||
bool dragon_ui_dev_mini;
|
||||
bool dragon_enable_dashcam;
|
||||
|
||||
} UIState;
|
||||
|
||||
static int last_brightness = -1;
|
||||
@@ -510,6 +535,10 @@ static void ui_init(UIState *s) {
|
||||
assert(s->font_sans_semibold >= 0);
|
||||
s->font_sans_bold = nvgCreateFont(s->vg, "sans-bold", "../assets/OpenSans-Bold.ttf");
|
||||
assert(s->font_sans_bold >= 0);
|
||||
s->font_miui_regular = nvgCreateFont(s->vg, "miui-regular", "/system/fonts/Miui-Regular.ttf");
|
||||
assert(s->font_miui_regular >= 0);
|
||||
s->font_miui_bold = nvgCreateFont(s->vg, "miui-bold", "/system/fonts/Miui-Bold.ttf");
|
||||
assert(s->font_miui_bold >= 0);
|
||||
|
||||
assert(s->img_wheel >= 0);
|
||||
s->img_wheel = nvgCreateImage(s->vg, "../assets/img_chffr_wheel.png", 1);
|
||||
@@ -649,11 +678,27 @@ static void ui_init_vision(UIState *s, const VisionStreamBufs back_bufs,
|
||||
read_param_bool(&s->is_metric, "IsMetric");
|
||||
read_param_bool(&s->longitudinal_control, "LongitudinalControl");
|
||||
read_param_bool(&s->limit_set_speed, "LimitSetSpeed");
|
||||
// dragonpilot
|
||||
read_param_bool(&s->dragon_ui_event, "DragonUIEvent");
|
||||
read_param_bool(&s->dragon_ui_maxspeed, "DragonUIMaxSpeed");
|
||||
read_param_bool(&s->dragon_ui_face, "DragonUIFace");
|
||||
read_param_bool(&s->dragon_ui_dev, "DragonUIDev");
|
||||
read_param_bool(&s->dragon_ui_dev_mini, "DragonUIDevMini");
|
||||
read_param_bool(&s->dragon_enable_dashcam, "DragonEnableDashcam");
|
||||
|
||||
|
||||
// Set offsets so params don't get read at the same time
|
||||
s->longitudinal_control_timeout = UI_FREQ / 3;
|
||||
s->is_metric_timeout = UI_FREQ / 2;
|
||||
s->limit_set_speed_timeout = UI_FREQ;
|
||||
|
||||
// dragonpilot, 1 sec
|
||||
s->dragon_ui_event_timeout = 100;
|
||||
s->dragon_ui_maxspeed_timeout = 100;
|
||||
s->dragon_ui_face_timeout = 100;
|
||||
s->dragon_ui_dev_timeout = 100;
|
||||
s->dragon_ui_dev_mini_timeout = 100;
|
||||
s->dragon_enable_dashcam_timeout = 100;
|
||||
}
|
||||
|
||||
static void ui_draw_transformed_box(UIState *s, uint32_t color) {
|
||||
@@ -1394,13 +1439,297 @@ static void ui_draw_vision_header(UIState *s) {
|
||||
nvgRect(s->vg, ui_viz_rx, box_y, ui_viz_rw, header_h);
|
||||
nvgFill(s->vg);
|
||||
|
||||
ui_draw_vision_maxspeed(s);
|
||||
if (s->dragon_ui_maxspeed) {
|
||||
ui_draw_vision_maxspeed(s);
|
||||
}
|
||||
|
||||
#ifdef SHOW_SPEEDLIMIT
|
||||
ui_draw_vision_speedlimit(s);
|
||||
#endif
|
||||
ui_draw_vision_speed(s);
|
||||
ui_draw_vision_event(s);
|
||||
if (s->dragon_ui_event) {
|
||||
ui_draw_vision_event(s);
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_draw_infobar(UIState *s) {
|
||||
// timestamp from pjlao307 dashcam (https://github.com/pjlao307)
|
||||
int rect_w = 1440; // 1920 * 0.75
|
||||
int rect_h = 50;
|
||||
int rect_x = (1920-rect_w)/2;
|
||||
int rect_y = (1080-rect_h-50);
|
||||
int sidebar_offset = 0;
|
||||
bool hasSidebar = !s->scene.uilayout_sidebarcollapsed;
|
||||
if (hasSidebar) {
|
||||
sidebar_offset = 100;
|
||||
}
|
||||
|
||||
|
||||
// Get local time to display
|
||||
char infobar[68];
|
||||
time_t t = time(NULL);
|
||||
struct tm tm = *localtime(&t);
|
||||
|
||||
if (s->dragon_ui_dev_mini) {
|
||||
char rel_steer[9];
|
||||
snprintf(rel_steer, sizeof(rel_steer), "%s%05.1f°", s->scene.angleSteers < 0? "-" : "+", fabs(s->scene.angleSteers));
|
||||
|
||||
char des_steer[9];
|
||||
if (s->scene.engaged) {
|
||||
snprintf(des_steer, sizeof(des_steer), "%s%05.1f°", s->scene.angleSteersDes < 0? "-" : "+", fabs(s->scene.angleSteersDes));
|
||||
} else {
|
||||
snprintf(des_steer, sizeof(des_steer), "%7s", "N/A");
|
||||
}
|
||||
|
||||
|
||||
char lead_dist[8];
|
||||
if (s->scene.lead_status) {
|
||||
snprintf(lead_dist, sizeof(lead_dist), "%06.2fm", s->scene.lead_d_rel);
|
||||
} else {
|
||||
snprintf(lead_dist, sizeof(lead_dist), "%7s", "N/A");
|
||||
}
|
||||
|
||||
|
||||
snprintf(
|
||||
infobar,
|
||||
sizeof(infobar),
|
||||
"%04d/%02d/%02d %02d:%02d:%02d | REL: %s | DES: %s | DIST: %s",
|
||||
tm.tm_year + 1900,
|
||||
tm.tm_mon + 1,
|
||||
tm.tm_mday,
|
||||
tm.tm_hour,
|
||||
tm.tm_min,
|
||||
tm.tm_sec,
|
||||
rel_steer,
|
||||
des_steer,
|
||||
lead_dist
|
||||
);
|
||||
} else {
|
||||
snprintf(
|
||||
infobar,
|
||||
sizeof(infobar),
|
||||
"%04d/%02d/%02d %02d:%02d:%02d",
|
||||
tm.tm_year + 1900,
|
||||
tm.tm_mon + 1,
|
||||
tm.tm_mday,
|
||||
tm.tm_hour,
|
||||
tm.tm_min,
|
||||
tm.tm_sec
|
||||
);
|
||||
}
|
||||
|
||||
nvgBeginPath(s->vg);
|
||||
nvgRoundedRect(s->vg, rect_x + sidebar_offset, rect_y, rect_w, rect_h, 15);
|
||||
nvgFillColor(s->vg, nvgRGBA(0, 0, 0, 100));
|
||||
nvgFill(s->vg);
|
||||
|
||||
nvgFontSize(s->vg, 40);
|
||||
nvgFontFace(s->vg, "courbd");
|
||||
nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 175));
|
||||
nvgText(s->vg, rect_x + 720 + sidebar_offset, rect_y + 35, infobar, NULL);
|
||||
}
|
||||
|
||||
//BB START: functions added for the display of various items
|
||||
static int bb_ui_draw_measure(UIState *s, const char* bb_value, const char* bb_uom, const char* bb_label,
|
||||
int bb_x, int bb_y, int bb_uom_dx,
|
||||
NVGcolor bb_valueColor, NVGcolor bb_labelColor, NVGcolor bb_uomColor,
|
||||
int bb_valueFontSize, int bb_labelFontSize, int bb_uomFontSize ) {
|
||||
const UIScene *scene = &s->scene;
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE);
|
||||
int dx = 0;
|
||||
if (strlen(bb_uom) > 0) {
|
||||
dx = (int)(bb_uomFontSize*2.5/2);
|
||||
}
|
||||
//print value
|
||||
nvgFontFace(s->vg, "sans-semibold");
|
||||
nvgFontSize(s->vg, bb_valueFontSize*2.5);
|
||||
nvgFillColor(s->vg, bb_valueColor);
|
||||
nvgText(s->vg, bb_x-dx/2, bb_y+ (int)(bb_valueFontSize*2.5)+5, bb_value, NULL);
|
||||
//print label
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontSize(s->vg, bb_labelFontSize*2.5);
|
||||
nvgFillColor(s->vg, bb_labelColor);
|
||||
nvgText(s->vg, bb_x, bb_y + (int)(bb_valueFontSize*2.5)+5 + (int)(bb_labelFontSize*2.5)+5, bb_label, NULL);
|
||||
//print uom
|
||||
if (strlen(bb_uom) > 0) {
|
||||
nvgSave(s->vg);
|
||||
int rx =bb_x + bb_uom_dx + bb_valueFontSize -3;
|
||||
int ry = bb_y + (int)(bb_valueFontSize*2.5/2)+25;
|
||||
nvgTranslate(s->vg,rx,ry);
|
||||
nvgRotate(s->vg, -1.5708); //-90deg in radians
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontSize(s->vg, (int)(bb_uomFontSize*2.5));
|
||||
nvgFillColor(s->vg, bb_uomColor);
|
||||
nvgText(s->vg, 0, 0, bb_uom, NULL);
|
||||
nvgRestore(s->vg);
|
||||
}
|
||||
return (int)((bb_valueFontSize + bb_labelFontSize)*2.5) + 5;
|
||||
}
|
||||
|
||||
static void bb_ui_draw_measures_left(UIState *s, int bb_x, int bb_y, int bb_w ) {
|
||||
const UIScene *scene = &s->scene;
|
||||
int bb_rx = bb_x + (int)(bb_w/2);
|
||||
int bb_ry = bb_y;
|
||||
int bb_h = 5;
|
||||
NVGcolor lab_color = nvgRGBA(255, 255, 255, 200);
|
||||
NVGcolor uom_color = nvgRGBA(255, 255, 255, 200);
|
||||
int value_fontSize=30;
|
||||
int label_fontSize=15;
|
||||
int uom_fontSize = 15;
|
||||
int bb_uom_dx = (int)(bb_w /2 - uom_fontSize*2.5) ;
|
||||
|
||||
//add visual radar relative distance
|
||||
if (true) {
|
||||
char val_str[16];
|
||||
char uom_str[6];
|
||||
NVGcolor val_color = nvgRGBA(255, 255, 255, 200);
|
||||
if (scene->lead_status) {
|
||||
//show RED if less than 5 meters
|
||||
//show orange if less than 15 meters
|
||||
if((int)(scene->lead_d_rel) < 15) {
|
||||
val_color = nvgRGBA(255, 188, 3, 200);
|
||||
}
|
||||
if((int)(scene->lead_d_rel) < 5) {
|
||||
val_color = nvgRGBA(255, 0, 0, 200);
|
||||
}
|
||||
// lead car relative distance is always in meters
|
||||
snprintf(val_str, sizeof(val_str), "%d", (int)scene->lead_d_rel);
|
||||
} else {
|
||||
snprintf(val_str, sizeof(val_str), "-");
|
||||
}
|
||||
snprintf(uom_str, sizeof(uom_str), "m ");
|
||||
bb_h +=bb_ui_draw_measure(s, val_str, uom_str, "REL DIST",
|
||||
bb_rx, bb_ry, bb_uom_dx,
|
||||
val_color, lab_color, uom_color,
|
||||
value_fontSize, label_fontSize, uom_fontSize );
|
||||
bb_ry = bb_y + bb_h;
|
||||
}
|
||||
|
||||
//add visual radar relative speed
|
||||
if (true) {
|
||||
char val_str[16];
|
||||
char uom_str[6];
|
||||
NVGcolor val_color = nvgRGBA(255, 255, 255, 200);
|
||||
if (scene->lead_status) {
|
||||
//show Orange if negative speed (approaching)
|
||||
//show Orange if negative speed faster than 5mph (approaching fast)
|
||||
if((int)(scene->lead_v_rel) < 0) {
|
||||
val_color = nvgRGBA(255, 188, 3, 200);
|
||||
}
|
||||
if((int)(scene->lead_v_rel) < -5) {
|
||||
val_color = nvgRGBA(255, 0, 0, 200);
|
||||
}
|
||||
// lead car relative speed is always in meters
|
||||
if (s->is_metric) {
|
||||
snprintf(val_str, sizeof(val_str), "%d", (int)(scene->lead_v_rel * 3.6 + 0.5));
|
||||
} else {
|
||||
snprintf(val_str, sizeof(val_str), "%d", (int)(scene->lead_v_rel * 2.2374144 + 0.5));
|
||||
}
|
||||
} else {
|
||||
snprintf(val_str, sizeof(val_str), "-");
|
||||
}
|
||||
if (s->is_metric) {
|
||||
snprintf(uom_str, sizeof(uom_str), "km/h");;
|
||||
} else {
|
||||
snprintf(uom_str, sizeof(uom_str), "mph");
|
||||
}
|
||||
bb_h +=bb_ui_draw_measure(s, val_str, uom_str, "REL SPEED",
|
||||
bb_rx, bb_ry, bb_uom_dx,
|
||||
val_color, lab_color, uom_color,
|
||||
value_fontSize, label_fontSize, uom_fontSize );
|
||||
bb_ry = bb_y + bb_h;
|
||||
}
|
||||
|
||||
//finally draw the frame
|
||||
bb_h += 20;
|
||||
nvgBeginPath(s->vg);
|
||||
nvgRoundedRect(s->vg, bb_x, bb_y, bb_w, bb_h, 20);
|
||||
nvgStrokeColor(s->vg, nvgRGBA(255,255,255,80));
|
||||
nvgStrokeWidth(s->vg, 6);
|
||||
nvgStroke(s->vg);
|
||||
}
|
||||
|
||||
static void bb_ui_draw_measures_right(UIState *s, int bb_x, int bb_y, int bb_w ) {
|
||||
const UIScene *scene = &s->scene;
|
||||
int bb_rx = bb_x + (int)(bb_w/2);
|
||||
int bb_ry = bb_y;
|
||||
int bb_h = 5;
|
||||
NVGcolor lab_color = nvgRGBA(255, 255, 255, 200);
|
||||
NVGcolor uom_color = nvgRGBA(255, 255, 255, 200);
|
||||
int value_fontSize=30;
|
||||
int label_fontSize=15;
|
||||
int uom_fontSize = 15;
|
||||
int bb_uom_dx = (int)(bb_w /2 - uom_fontSize*2.5) ;
|
||||
|
||||
//add steering angle
|
||||
if (true) {
|
||||
char val_str[16];
|
||||
char uom_str[6];
|
||||
NVGcolor val_color = nvgRGBA(255, 255, 255, 200);
|
||||
//show Orange if more than 6 degrees
|
||||
//show red if more than 12 degrees
|
||||
if(((int)(scene->angleSteers) < -6) || ((int)(scene->angleSteers) > 6)) {
|
||||
val_color = nvgRGBA(255, 188, 3, 200);
|
||||
}
|
||||
if(((int)(scene->angleSteers) < -12) || ((int)(scene->angleSteers) > 12)) {
|
||||
val_color = nvgRGBA(255, 0, 0, 200);
|
||||
}
|
||||
// steering is in degrees
|
||||
snprintf(val_str, sizeof(val_str), "%.0f°",(scene->angleSteers));
|
||||
|
||||
snprintf(uom_str, sizeof(uom_str), "");
|
||||
bb_h +=bb_ui_draw_measure(s, val_str, uom_str, "REAL STEER",
|
||||
bb_rx, bb_ry, bb_uom_dx,
|
||||
val_color, lab_color, uom_color,
|
||||
value_fontSize, label_fontSize, uom_fontSize );
|
||||
bb_ry = bb_y + bb_h;
|
||||
}
|
||||
|
||||
//add desired steering angle
|
||||
if (true) {
|
||||
char val_str[16];
|
||||
char uom_str[6];
|
||||
NVGcolor val_color = nvgRGBA(255, 255, 255, 200);
|
||||
//show Orange if more than 6 degrees
|
||||
//show red if more than 12 degrees
|
||||
if(((int)(scene->angleSteersDes) < -6) || ((int)(scene->angleSteersDes) > 6)) {
|
||||
val_color = nvgRGBA(255, 188, 3, 200);
|
||||
}
|
||||
if(((int)(scene->angleSteersDes) < -12) || ((int)(scene->angleSteersDes) > 12)) {
|
||||
val_color = nvgRGBA(255, 0, 0, 200);
|
||||
}
|
||||
// steering is in degrees
|
||||
snprintf(val_str, sizeof(val_str), "%.0f°",(scene->angleSteersDes));
|
||||
|
||||
snprintf(uom_str, sizeof(uom_str), "");
|
||||
bb_h +=bb_ui_draw_measure(s, val_str, uom_str, "DESIR STEER",
|
||||
bb_rx, bb_ry, bb_uom_dx,
|
||||
val_color, lab_color, uom_color,
|
||||
value_fontSize, label_fontSize, uom_fontSize );
|
||||
bb_ry = bb_y + bb_h;
|
||||
}
|
||||
|
||||
//finally draw the frame
|
||||
bb_h += 20;
|
||||
nvgBeginPath(s->vg);
|
||||
nvgRoundedRect(s->vg, bb_x, bb_y, bb_w, bb_h, 20);
|
||||
nvgStrokeColor(s->vg, nvgRGBA(255,255,255,80));
|
||||
nvgStrokeWidth(s->vg, 6);
|
||||
nvgStroke(s->vg);
|
||||
}
|
||||
|
||||
static void ui_draw_bbui(UIState *s) {
|
||||
const UIScene *scene = &s->scene;
|
||||
const int bb_dml_w = 180;
|
||||
const int bb_dml_x = (scene->ui_viz_rx + (bdr_is * 2));
|
||||
const int bb_dml_y = (box_y + (bdr_is * 1.5)) + 220;
|
||||
|
||||
const int bb_dmr_w = 180;
|
||||
const int bb_dmr_x = scene->ui_viz_rx + scene->ui_viz_rw - bb_dmr_w - (bdr_is * 2);
|
||||
const int bb_dmr_y = (box_y + (bdr_is * 1.5)) + 220;
|
||||
|
||||
bb_ui_draw_measures_right(s, bb_dml_x, bb_dml_y, bb_dml_w);
|
||||
bb_ui_draw_measures_left(s, bb_dmr_x, bb_dmr_y, bb_dmr_w);
|
||||
}
|
||||
|
||||
static void ui_draw_vision_footer(UIState *s) {
|
||||
@@ -1411,11 +1740,19 @@ static void ui_draw_vision_footer(UIState *s) {
|
||||
nvgBeginPath(s->vg);
|
||||
nvgRect(s->vg, ui_viz_rx, footer_y, ui_viz_rw, footer_h);
|
||||
|
||||
ui_draw_vision_face(s);
|
||||
if (s->dragon_ui_face) {
|
||||
ui_draw_vision_face(s);
|
||||
}
|
||||
|
||||
#ifdef SHOW_SPEEDLIMIT
|
||||
ui_draw_vision_map(s);
|
||||
#endif
|
||||
if (s->dragon_ui_dev) {
|
||||
ui_draw_bbui(s);
|
||||
}
|
||||
if (s->dragon_ui_dev_mini || s->dragon_enable_dashcam) {
|
||||
ui_draw_infobar(s);
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_draw_vision_alert(UIState *s, int va_size, int va_color,
|
||||
@@ -1450,23 +1787,23 @@ static void ui_draw_vision_alert(UIState *s, int va_size, int va_color,
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE);
|
||||
|
||||
if (va_size == ALERTSIZE_SMALL) {
|
||||
nvgFontFace(s->vg, "sans-semibold");
|
||||
nvgFontFace(s->vg, "miui-bold");
|
||||
nvgFontSize(s->vg, 40*2.5);
|
||||
nvgText(s->vg, alr_x+alr_w/2, alr_y+alr_h/2+15, va_text1, NULL);
|
||||
} else if (va_size== ALERTSIZE_MID) {
|
||||
nvgFontFace(s->vg, "sans-bold");
|
||||
nvgFontFace(s->vg, "miui-bold");
|
||||
nvgFontSize(s->vg, 48*2.5);
|
||||
nvgText(s->vg, alr_x+alr_w/2, alr_y+alr_h/2-45, va_text1, NULL);
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontFace(s->vg, "miui-regular");
|
||||
nvgFontSize(s->vg, 36*2.5);
|
||||
nvgText(s->vg, alr_x+alr_w/2, alr_y+alr_h/2+75, va_text2, NULL);
|
||||
} else if (va_size== ALERTSIZE_FULL) {
|
||||
nvgFontSize(s->vg, (longAlert1?72:96)*2.5);
|
||||
nvgFontFace(s->vg, "sans-bold");
|
||||
nvgFontFace(s->vg, "miui-bold");
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE);
|
||||
nvgTextBox(s->vg, alr_x, alr_y+(longAlert1?360:420), alr_w-60, va_text1, NULL);
|
||||
nvgFontSize(s->vg, 48*2.5);
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontFace(s->vg, "miui-regular");
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BOTTOM);
|
||||
nvgTextBox(s->vg, alr_x, alr_h-(longAlert1?300:360), alr_w-60, va_text2, NULL);
|
||||
}
|
||||
@@ -1633,6 +1970,9 @@ void handle_message(UIState *s, void *which) {
|
||||
|
||||
s->scene.decel_for_model = datad.decelForModel;
|
||||
|
||||
s->scene.angleSteers = datad.angleSteers;
|
||||
s->scene.angleSteersDes = datad.angleSteersDes;
|
||||
|
||||
if (datad.alertSound.str && datad.alertSound.str[0] != '\0' && strcmp(s->alert_type, datad.alertType.str) != 0) {
|
||||
char* error = NULL;
|
||||
if (s->alert_sound[0] != '\0') {
|
||||
@@ -2312,6 +2652,13 @@ int main(int argc, char* argv[]) {
|
||||
read_param_bool_timeout(&s->longitudinal_control, "LongitudinalControl", &s->longitudinal_control_timeout);
|
||||
read_param_bool_timeout(&s->limit_set_speed, "LimitSetSpeed", &s->limit_set_speed_timeout);
|
||||
read_param_float_timeout(&s->speed_lim_off, "SpeedLimitOffset", &s->limit_set_speed_timeout);
|
||||
// dragonpilot
|
||||
read_param_bool_timeout(&s->dragon_ui_event, "DragonUIEvent", &s->dragon_ui_event_timeout);
|
||||
read_param_bool_timeout(&s->dragon_ui_maxspeed, "DragonUIMaxSpeed", &s->dragon_ui_maxspeed_timeout);
|
||||
read_param_bool_timeout(&s->dragon_ui_face, "DragonUIFace", &s->dragon_ui_face_timeout);
|
||||
read_param_bool_timeout(&s->dragon_ui_dev, "DragonUIDev", &s->dragon_ui_dev_timeout);
|
||||
read_param_bool_timeout(&s->dragon_ui_dev_mini, "DragonUIDevMini", &s->dragon_ui_dev_mini_timeout);
|
||||
read_param_bool_timeout(&s->dragon_enable_dashcam, "DragonEnableDashcam", &s->dragon_enable_dashcam_timeout);
|
||||
|
||||
pthread_mutex_unlock(&s->lock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user