openpilot v0.3.2 release

v0.3.2
Vehicle Researcher 2017-05-22 22:26:12 -07:00
parent 50c0d1c9da
commit 7fe46f1e1d
19 changed files with 119 additions and 27 deletions

1
.gitignore vendored
View File

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

View File

@ -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
* Refactor visiond IPC to support multiple clients

Binary file not shown.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -52,7 +52,8 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
CI = CarInterface(CP, logcan, sendcan)
# write CarParams
Params().put("CarParams", CP.to_bytes())
params = Params()
params.put("CarParams", CP.to_bytes())
AM = AlertManager()
@ -74,6 +75,7 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
# rear view camera state
rear_view_toggle = False
rear_view_allowed = bool(params.get("IsRearViewMirror"))
v_cruise_kph = 255
@ -127,7 +129,7 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
# button presses for rear view
if b.type == "leftBlinker" or b.type == "rightBlinker":
if b.pressed:
if b.pressed and rear_view_allowed:
rear_view_toggle = True
else:
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.speedVisible = enabled
CC.hudControl.lanesVisible = enabled
#CC.hudControl.leadVisible = bool(AC.has_lead)
# TODO: fix this
CC.hudControl.leadVisible = False
CC.hudControl.leadVisible = plan.hasLead
CC.hudControl.visualAlert = visual_alert
CC.hudControl.audibleAlert = audible_alert
@ -344,7 +344,7 @@ def controlsd_thread(gctx, rate=100): #rate in Hz
dat.init('live100')
# 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.alertText2 = alert_text_2
dat.live100.awarenessStatus = max(awareness_status, 0.0) if enabled else 0.0

View File

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

View File

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

Binary file not shown.

View File

@ -208,7 +208,7 @@ class Uploader(object):
cloudlog.info("uploading %r", fn)
# stat = self.killable_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)
os.unlink(fn) # delete the file
success = True
@ -254,7 +254,7 @@ def uploader_fn(exit_event):
else:
cloudlog.info("backoff %r", backoff)
time.sleep(backoff + random.uniform(0, backoff))
backoff *= 2
backoff = min(backoff*2, 120)
cloudlog.info("upload done, success=%r", success)
time.sleep(5)

View File

@ -3,7 +3,9 @@ import os
# check if NEOS update is required
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")
else:
break
@ -183,15 +185,34 @@ def manager_init():
cloudlog.info("dongle id is " + 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)
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
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():
global baseui_running
@ -219,14 +240,13 @@ def manager_thread():
if os.getenv("NOPROG") is None:
# checkout the matching panda repo
rootdir = os.path.dirname(os.path.abspath(__file__))
ret = os.system("cd %s && git submodule init && git submodule update" % rootdir)
cloudlog.info("git submodule update panda returned %d" % ret)
system("cd %s && git submodule init" % rootdir)
system("cd %s && git submodule update" % rootdir)
# flash the board
boarddir = os.path.dirname(os.path.abspath(__file__))+"/../panda/board/"
mkfile = "Makefile" if panda else "Makefile.legacy"
print "using", mkfile
ret = os.system("cd %s && make -f %s" % (boarddir, mkfile))
cloudlog.info("flash board returned %d" % ret)
system("cd %s && make -f %s" % (boarddir, mkfile))
start_managed_process("boardd")
@ -421,6 +441,13 @@ def main():
params = Params()
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_prepare()

View File

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

View File

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

View File

@ -122,6 +122,8 @@ typedef struct UIState {
bool awake;
int awake_timeout;
bool is_metric;
} UIState;
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, 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) {
@ -621,9 +630,15 @@ static void ui_draw_world(UIState *s) {
if (scene->lead_status) {
char radar_str[16];
int lead_v_rel = (int)(2.236 * scene->lead_v_rel);
snprintf(radar_str, sizeof(radar_str), "%3d m %+d mph",
(int)(scene->lead_d_rel), lead_v_rel);
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);
snprintf(radar_str, sizeof(radar_str), "%3d m %+d mph",
(int)(scene->lead_d_rel), lead_v_rel);
}
nvgFontSize(s->vg, 96.0f);
nvgFillColor(s->vg, nvgRGBA(128, 128, 0, 192));
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) {
// Convert KPH to MPH.
snprintf(speed_str, sizeof(speed_str), "%3d MPH",
(int)(scene->v_cruise * 0.621371 + 0.5));
if (s->is_metric) {
snprintf(speed_str, sizeof(speed_str), "%3d KPH",
(int)(scene->v_cruise + 0.5));
} else {
// Convert KPH to MPH.
snprintf(speed_str, sizeof(speed_str), "%3d MPH",
(int)(scene->v_cruise * 0.621371 + 0.5));
}
nvgTextAlign(s->vg, NVG_ALIGN_RIGHT | NVG_ALIGN_BASELINE);
nvgText(s->vg, 500, 150, speed_str, NULL);
}
nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 192));
snprintf(speed_str, sizeof(speed_str), "%3d MPH",
(int)(scene->v_ego * 2.237 + 0.5));
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",
(int)(scene->v_ego * 2.237 + 0.5));
}
nvgTextAlign(s->vg, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE);
nvgText(s->vg, 1920 - 500, 150, speed_str, NULL);

Binary file not shown.