openpilot v0.3.2 release

old-commit-hash: 7fe46f1e1d
commatwo_master v0.3.2
Vehicle Researcher 8 years ago
parent 32657dcca4
commit beae7b6009
  1. 1
      .gitignore
  2. 13
      RELEASES.md
  3. 4
      apk/com.baseui.apk
  4. 12
      cereal/log.capnp
  5. 4
      common/params.py
  6. 4
      selfdrive/car/honda/carcontroller.py
  7. 2
      selfdrive/car/honda/hondacan.py
  8. 5
      selfdrive/common/params.c
  9. 2
      selfdrive/common/version.h
  10. 12
      selfdrive/controls/controlsd.py
  11. 1
      selfdrive/controls/plannerd.py
  12. 2
      selfdrive/loggerd/config.py
  13. 4
      selfdrive/loggerd/loggerd
  14. 4
      selfdrive/loggerd/uploader.py
  15. 41
      selfdrive/manager.py
  16. 1
      selfdrive/service_list.yaml
  17. 1
      selfdrive/tombstoned.py
  18. 25
      selfdrive/ui/ui.c
  19. 4
      selfdrive/visiond/visiond

1
.gitignore vendored

@ -13,6 +13,7 @@ model2.png
*.a *.a
*.clb *.clb
*.class *.class
*.pyxbldc
config.json config.json
clcache clcache

@ -1,4 +1,15 @@
Version 0.3.0 (2017-03-xx) Version 0.3.2 (2017-05-22)
===========================
* Minor stability bugfixes
* Added metrics and rear view mirror disable to settings
* Update model with more crowdsourced data
Version 0.3.1 (2017-05-17)
===========================
* visiond stability bugfix
* Add logging for angle and flashing
Version 0.3.0 (2017-05-12)
=========================== ===========================
* Add CarParams struct to improve the abstraction layer * Add CarParams struct to improve the abstraction layer
* Refactor visiond IPC to support multiple clients * Refactor visiond IPC to support multiple clients

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:84da6150714d2069367c3cc9591b795cd33b218635000e79e1c031e9c0232039 oid sha256:a18e2a4e7077cd7fa082a0617a433283dde9acd2ec1ee5c6f00bf57679c8bf05
size 8987577 size 8994047

@ -31,6 +31,10 @@ struct InitData {
androidSensors @6 :List(AndroidSensor); androidSensors @6 :List(AndroidSensor);
chffrAndroidExtra @7 :ChffrAndroidExtra; chffrAndroidExtra @7 :ChffrAndroidExtra;
pandaInfo @8 :PandaInfo;
dirty @9 :Bool;
enum DeviceType { enum DeviceType {
unknown @0; unknown @0;
neo @1; neo @1;
@ -84,6 +88,13 @@ struct InitData {
struct ChffrAndroidExtra { struct ChffrAndroidExtra {
allCameraCharacteristics @0 :Map(Text, Text); allCameraCharacteristics @0 :Map(Text, Text);
} }
struct PandaInfo {
hasPanda @0: Bool;
dongleId @1: Text;
stVersion @2: Text;
espVersion @3: Text;
}
} }
struct FrameData { struct FrameData {
@ -411,6 +422,7 @@ struct Plan {
aTargetMin @4 :Float32; aTargetMin @4 :Float32;
aTargetMax @5 :Float32; aTargetMax @5 :Float32;
jerkFactor @6 :Float32; jerkFactor @6 :Float32;
hasLead @7 :Bool;
} }
struct LiveLocationData { struct LiveLocationData {

@ -52,6 +52,10 @@ keys = {
"Version": TxType.PERSISTANT, "Version": TxType.PERSISTANT,
"GitCommit": TxType.PERSISTANT, "GitCommit": TxType.PERSISTANT,
"GitBranch": TxType.PERSISTANT, "GitBranch": TxType.PERSISTANT,
# written: baseui
# read: ui, controls
"IsMetric": TxType.PERSISTANT,
"IsRearViewMirror": TxType.PERSISTANT,
# written: visiond # written: visiond
# read: visiond # read: visiond
"CalibrationParams": TxType.PERSISTANT, "CalibrationParams": TxType.PERSISTANT,

@ -87,6 +87,10 @@ class CarController(object):
snd_beep, snd_chime): snd_beep, snd_chime):
""" Controls thread """ """ Controls thread """
# TODO: Make the accord work.
if CS.accord:
return
# *** apply brake hysteresis *** # *** apply brake hysteresis ***
final_brake, self.braking, self.brake_steady = actuator_hystereses(final_brake, self.braking, self.brake_steady, CS.v_ego, CS.civic) final_brake, self.braking, self.brake_steady = actuator_hystereses(final_brake, self.braking, self.brake_steady, CS.v_ego, CS.civic)

@ -50,7 +50,7 @@ def create_accord_steering_control(apply_steer, idx):
dat = [0, 0, 0x40, 0] dat = [0, 0, 0x40, 0]
else: else:
dat = [0,0,0,0] dat = [0,0,0,0]
rp = clip(apply_steer/0xF, -0xFF, 0xFF) rp = np.clip(apply_steer/0xF, -0xFF, 0xFF)
if rp < 0: if rp < 0:
rp += 512 rp += 512
dat[0] |= (rp >> 5) & 0xf dat[0] |= (rp >> 5) & 0xf

@ -49,7 +49,12 @@ int write_db_value(const char* params_path, const char* key, const char* value,
// Move temp into place. // Move temp into place.
result = rename(tmp_path, path); result = rename(tmp_path, path);
if (result < 0) {
goto cleanup;
}
// fsync to force persist the changes.
result = fsync(tmp_fd);
cleanup: cleanup:
// Release lock. // Release lock.
if (lock_fd >= 0) { if (lock_fd >= 0) {

@ -1 +1 @@
const char *openpilot_version = "0.3.1"; const char *openpilot_version = "0.3.2";

@ -52,7 +52,8 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
CI = CarInterface(CP, logcan, sendcan) CI = CarInterface(CP, logcan, sendcan)
# write CarParams # write CarParams
Params().put("CarParams", CP.to_bytes()) params = Params()
params.put("CarParams", CP.to_bytes())
AM = AlertManager() AM = AlertManager()
@ -74,6 +75,7 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
# rear view camera state # rear view camera state
rear_view_toggle = False rear_view_toggle = False
rear_view_allowed = bool(params.get("IsRearViewMirror"))
v_cruise_kph = 255 v_cruise_kph = 255
@ -127,7 +129,7 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
# button presses for rear view # button presses for rear view
if b.type == "leftBlinker" or b.type == "rightBlinker": if b.type == "leftBlinker" or b.type == "rightBlinker":
if b.pressed: if b.pressed and rear_view_allowed:
rear_view_toggle = True rear_view_toggle = True
else: else:
rear_view_toggle = False rear_view_toggle = False
@ -318,9 +320,7 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
CC.hudControl.setSpeed = float(v_cruise_kph * CV.KPH_TO_MS) CC.hudControl.setSpeed = float(v_cruise_kph * CV.KPH_TO_MS)
CC.hudControl.speedVisible = enabled CC.hudControl.speedVisible = enabled
CC.hudControl.lanesVisible = enabled CC.hudControl.lanesVisible = enabled
#CC.hudControl.leadVisible = bool(AC.has_lead) CC.hudControl.leadVisible = plan.hasLead
# TODO: fix this
CC.hudControl.leadVisible = False
CC.hudControl.visualAlert = visual_alert CC.hudControl.visualAlert = visual_alert
CC.hudControl.audibleAlert = audible_alert CC.hudControl.audibleAlert = audible_alert
@ -344,7 +344,7 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
dat.init('live100') dat.init('live100')
# show rear view camera on phone if in reverse gear or when button is pressed # show rear view camera on phone if in reverse gear or when button is pressed
dat.live100.rearViewCam = ('reverseGear' in CS.errors) or rear_view_toggle dat.live100.rearViewCam = ('reverseGear' in CS.errors and rear_view_allowed) or rear_view_toggle
dat.live100.alertText1 = alert_text_1 dat.live100.alertText1 = alert_text_1
dat.live100.alertText2 = alert_text_2 dat.live100.alertText2 = alert_text_2
dat.live100.awarenessStatus = max(awareness_status, 0.0) if enabled else 0.0 dat.live100.awarenessStatus = max(awareness_status, 0.0) if enabled else 0.0

@ -68,6 +68,7 @@ def plannerd_thread(gctx):
plan_send.plan.aTargetMin = float(AC.a_target[0]) plan_send.plan.aTargetMin = float(AC.a_target[0])
plan_send.plan.aTargetMax = float(AC.a_target[1]) plan_send.plan.aTargetMax = float(AC.a_target[1])
plan_send.plan.jerkFactor = float(AC.jerk_factor) plan_send.plan.jerkFactor = float(AC.jerk_factor)
plan_send.plan.hasLead = AC.has_lead
plan.send(plan_send.to_bytes()) plan.send(plan_send.to_bytes())

@ -1,4 +1,4 @@
import os import os
ROOT = '/sdcard/realdata/' ROOT = '/data/media/0/realdata/'
SEGMENT_LENGTH = 60 SEGMENT_LENGTH = 60

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:11b28827b7523063614eb82cc2ecd10f015b832eceadf6eaad968bedae9c443e oid sha256:c74d6aaf1167f0820dc6b7949870bae14ae1b5ebb9fd70e24dfdcea369475ee5
size 1357136 size 1357296

@ -208,7 +208,7 @@ class Uploader(object):
cloudlog.info("uploading %r", fn) cloudlog.info("uploading %r", fn)
# stat = self.killable_upload(key, fn) # stat = self.killable_upload(key, fn)
stat = self.normal_upload(key, fn) stat = self.normal_upload(key, fn)
if stat is not None and stat.status_code == 200: if stat is not None and stat.status_code in (200, 201):
cloudlog.event("upload_success", key=key, fn=fn, sz=sz) cloudlog.event("upload_success", key=key, fn=fn, sz=sz)
os.unlink(fn) # delete the file os.unlink(fn) # delete the file
success = True success = True
@ -254,7 +254,7 @@ def uploader_fn(exit_event):
else: else:
cloudlog.info("backoff %r", backoff) cloudlog.info("backoff %r", backoff)
time.sleep(backoff + random.uniform(0, backoff)) time.sleep(backoff + random.uniform(0, backoff))
backoff *= 2 backoff = min(backoff*2, 120)
cloudlog.info("upload done, success=%r", success) cloudlog.info("upload done, success=%r", success)
time.sleep(5) time.sleep(5)

@ -3,7 +3,9 @@ import os
# check if NEOS update is required # check if NEOS update is required
while 1: while 1:
if (not os.path.isfile("/VERSION") or int(open("/VERSION").read()) < 3) and not os.path.isfile("/sdcard/noupdate"): if ((not os.path.isfile("/VERSION")
or int(open("/VERSION").read()) < 3)
and not os.path.isfile("/data/media/0/noupdate")):
os.system("curl -o /tmp/updater https://openpilot.comma.ai/updater && chmod +x /tmp/updater && /tmp/updater") os.system("curl -o /tmp/updater https://openpilot.comma.ai/updater && chmod +x /tmp/updater && /tmp/updater")
else: else:
break break
@ -183,15 +185,34 @@ def manager_init():
cloudlog.info("dongle id is " + dongle_id) cloudlog.info("dongle id is " + dongle_id)
os.environ['DONGLE_ID'] = dongle_id os.environ['DONGLE_ID'] = dongle_id
dirty = subprocess.call(["git", "diff-index", "--quiet", "origin/release", "--"]) != 0
cloudlog.info("dirty is %d" % dirty)
if not dirty:
os.environ['CLEAN'] = '1'
cloudlog.bind_global(dongle_id=dongle_id, version=version) cloudlog.bind_global(dongle_id=dongle_id, version=version)
crash.bind_user(id=dongle_id) crash.bind_user(id=dongle_id)
crash.bind_extra(version=version) crash.bind_extra(version=version, dirty=dirty)
os.system("mkdir -p "+ROOT) os.umask(0)
try:
os.mkdir(ROOT, 0777)
except OSError:
pass
# set gctx # set gctx
gctx = {} gctx = {}
def system(cmd):
try:
cloudlog.info("running %s" % cmd)
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
except subprocess.CalledProcessError, e:
cloudlog.event("running failed",
cmd=e.cmd,
output=e.output,
returncode=e.returncode)
def manager_thread(): def manager_thread():
global baseui_running global baseui_running
@ -219,14 +240,13 @@ def manager_thread():
if os.getenv("NOPROG") is None: if os.getenv("NOPROG") is None:
# checkout the matching panda repo # checkout the matching panda repo
rootdir = os.path.dirname(os.path.abspath(__file__)) rootdir = os.path.dirname(os.path.abspath(__file__))
ret = os.system("cd %s && git submodule init && git submodule update" % rootdir) system("cd %s && git submodule init" % rootdir)
cloudlog.info("git submodule update panda returned %d" % ret) system("cd %s && git submodule update" % rootdir)
# flash the board # flash the board
boarddir = os.path.dirname(os.path.abspath(__file__))+"/../panda/board/" boarddir = os.path.dirname(os.path.abspath(__file__))+"/../panda/board/"
mkfile = "Makefile" if panda else "Makefile.legacy" mkfile = "Makefile" if panda else "Makefile.legacy"
print "using", mkfile print "using", mkfile
ret = os.system("cd %s && make -f %s" % (boarddir, mkfile)) system("cd %s && make -f %s" % (boarddir, mkfile))
cloudlog.info("flash board returned %d" % ret)
start_managed_process("boardd") start_managed_process("boardd")
@ -421,6 +441,13 @@ def main():
params = Params() params = Params()
params.manager_start() params.manager_start()
# set unset params
if params.get("IsMetric") is None:
params.put("IsMetric", "0")
if params.get("IsRearViewMirror") is None:
params.put("IsRearViewMirror", "1")
manager_init() manager_init()
manager_prepare() manager_prepare()

@ -41,6 +41,7 @@ navUpdate: [8028, true]
qcomGnss: [8029, true] qcomGnss: [8029, true]
lidarPts: [8030, true] lidarPts: [8030, true]
procLog: [8031, true] procLog: [8031, true]
testModel: [8040, false]
# manager -- base process to manage starting and stopping of all others # manager -- base process to manage starting and stopping of all others
# subscribes: health # subscribes: health

@ -56,6 +56,7 @@ def report_tombstone(fn, client):
'backtrace': parsedict.get('backtrace'), 'backtrace': parsedict.get('backtrace'),
'logtail': logtail, 'logtail': logtail,
'version': version, 'version': version,
'dirty': not bool(os.environ.get('CLEAN')),
}, },
user={'id': os.environ.get('DONGLE_ID')}, user={'id': os.environ.get('DONGLE_ID')},
message=message, message=message,

@ -122,6 +122,8 @@ typedef struct UIState {
bool awake; bool awake;
int awake_timeout; int awake_timeout;
bool is_metric;
} UIState; } UIState;
static void set_awake(UIState *s, bool awake) { static void set_awake(UIState *s, bool awake) {
@ -342,6 +344,13 @@ static void ui_init_vision(UIState *s, const VisionStreamBufs back_bufs,
0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0,
}}; }};
char *value;
const int result = read_db_value("/data/params", "IsMetric", &value, NULL);
if (result == 0) {
s->is_metric = value[0] == '1';
free(value);
}
} }
static void ui_update_frame(UIState *s) { static void ui_update_frame(UIState *s) {
@ -621,9 +630,15 @@ static void ui_draw_world(UIState *s) {
if (scene->lead_status) { if (scene->lead_status) {
char radar_str[16]; char radar_str[16];
if (s->is_metric) {
int lead_v_rel = (int)(3.6 * scene->lead_v_rel);
snprintf(radar_str, sizeof(radar_str), "%3d m %+d kph",
(int)(scene->lead_d_rel), lead_v_rel);
} else {
int lead_v_rel = (int)(2.236 * scene->lead_v_rel); int lead_v_rel = (int)(2.236 * scene->lead_v_rel);
snprintf(radar_str, sizeof(radar_str), "%3d m %+d mph", snprintf(radar_str, sizeof(radar_str), "%3d m %+d mph",
(int)(scene->lead_d_rel), lead_v_rel); (int)(scene->lead_d_rel), lead_v_rel);
}
nvgFontSize(s->vg, 96.0f); nvgFontSize(s->vg, 96.0f);
nvgFillColor(s->vg, nvgRGBA(128, 128, 0, 192)); nvgFillColor(s->vg, nvgRGBA(128, 128, 0, 192));
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_TOP); nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_TOP);
@ -670,16 +685,26 @@ static void ui_draw_vision(UIState *s) {
} }
if (scene->v_cruise != 255 && scene->v_cruise != 0) { if (scene->v_cruise != 255 && scene->v_cruise != 0) {
if (s->is_metric) {
snprintf(speed_str, sizeof(speed_str), "%3d KPH",
(int)(scene->v_cruise + 0.5));
} else {
// Convert KPH to MPH. // Convert KPH to MPH.
snprintf(speed_str, sizeof(speed_str), "%3d MPH", snprintf(speed_str, sizeof(speed_str), "%3d MPH",
(int)(scene->v_cruise * 0.621371 + 0.5)); (int)(scene->v_cruise * 0.621371 + 0.5));
}
nvgTextAlign(s->vg, NVG_ALIGN_RIGHT | NVG_ALIGN_BASELINE); nvgTextAlign(s->vg, NVG_ALIGN_RIGHT | NVG_ALIGN_BASELINE);
nvgText(s->vg, 500, 150, speed_str, NULL); nvgText(s->vg, 500, 150, speed_str, NULL);
} }
nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 192)); nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 192));
if (s->is_metric) {
snprintf(speed_str, sizeof(speed_str), "%3d KPH",
(int)(scene->v_ego * 3.6 + 0.5));
} else {
snprintf(speed_str, sizeof(speed_str), "%3d MPH", snprintf(speed_str, sizeof(speed_str), "%3d MPH",
(int)(scene->v_ego * 2.237 + 0.5)); (int)(scene->v_ego * 2.237 + 0.5));
}
nvgTextAlign(s->vg, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE); nvgTextAlign(s->vg, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE);
nvgText(s->vg, 1920 - 500, 150, speed_str, NULL); nvgText(s->vg, 1920 - 500, 150, speed_str, NULL);

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:9fd4388fc4387cc933d415d8e5c1e09de966b41b6666234f88ee6f10eb51c840 oid sha256:479641365cc5b1a4acb72f57aa82bcd029b596ec98027a920fda0092009d6178
size 16373480 size 16374520

Loading…
Cancel
Save