openpilot v0.4.3 release

old-commit-hash: 51fad4a6c6
commatwo_master
Vehicle Researcher 7 years ago
parent 4ff9de7002
commit 85171c28fc
  1. 4
      apk/ai.comma.plus.offroad.apk
  2. 13
      selfdrive/controls/controlsd.py
  3. 2
      selfdrive/controls/lib/alertmanager.py
  4. 0
      selfdrive/loggerd/uploader.py
  5. 94
      selfdrive/ui/ui.c

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:3ee3fcae5727530b008d40adf962bb5fac2f7c2b42745408b65f316c112905a6 oid sha256:d994ff54de0a618538a9ada328dc6196604f22a3a25051fe8e477390be29d28a
size 15385883 size 15407210

@ -211,7 +211,8 @@ def state_transition(CS, CP, state, events, soft_disable_timer, v_cruise_kph, AM
def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, AM, rk, def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last, AM, rk,
awareness_status, PL, LaC, LoC, VM, angle_offset, rear_view_allowed, rear_view_toggle): awareness_status, PL, LaC, LoC, VM, angle_offset, rear_view_allowed,
rear_view_toggle, passive):
# Given the state, this function returns the actuators # Given the state, this function returns the actuators
# reset actuators to zero # reset actuators to zero
@ -228,7 +229,7 @@ def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last,
else: else:
rear_view_toggle = False rear_view_toggle = False
if b.type == "altButton1" and b.pressed: if (b.type == "altButton1" and b.pressed) and not passive:
rear_view_toggle = not rear_view_toggle rear_view_toggle = not rear_view_toggle
@ -454,14 +455,14 @@ def controlsd_thread(gctx, rate=100):
CI, CP = get_car(logcan, sendcan, 1.0 if passive else None) CI, CP = get_car(logcan, sendcan, 1.0 if passive else None)
if CI is None:
raise Exception("unsupported car")
# if stock camera is connected, then force passive behavior # if stock camera is connected, then force passive behavior
if not CP.enableCamera: if not CP.enableCamera:
passive = True passive = True
sendcan = None sendcan = None
if CI is None:
raise Exception("unsupported car")
if passive: if passive:
CP.safetyModel = car.CarParams.SafetyModels.noOutput CP.safetyModel = car.CarParams.SafetyModels.noOutput
@ -528,7 +529,7 @@ def controlsd_thread(gctx, rate=100):
# compute actuators # compute actuators
actuators, v_cruise_kph, awareness_status, angle_offset, rear_view_toggle = state_control(plan, CS, CP, state, events, v_cruise_kph, actuators, v_cruise_kph, awareness_status, angle_offset, rear_view_toggle = state_control(plan, CS, CP, state, events, v_cruise_kph,
v_cruise_kph_last, AM, rk, awareness_status, PL, LaC, LoC, VM, v_cruise_kph_last, AM, rk, awareness_status, PL, LaC, LoC, VM,
angle_offset, rear_view_allowed, rear_view_toggle) angle_offset, rear_view_allowed, rear_view_toggle, passive)
prof.checkpoint("State Control") prof.checkpoint("State Control")
# publish data # publish data

@ -121,7 +121,7 @@ class AlertManager(object):
"manualRestart": Alert( "manualRestart": Alert(
"TAKE CONTROL", "TAKE CONTROL",
"Resume driving manually", "Resume driving manually",
AlertStatus.userPrompt, AlertSize.full, AlertStatus.userPrompt, AlertSize.mid,
Priority.LOW, None, None, 0., 0., .2), Priority.LOW, None, None, 0., 0., .2),
# Non-entry only alerts # Non-entry only alerts

@ -309,7 +309,7 @@ static const mat4 device_transform = {{
// frame from 4/3 to box size with a 2x zoon // frame from 4/3 to box size with a 2x zoon
static const mat4 frame_transform = {{ static const mat4 frame_transform = {{
2*(4./3.)/((float)(box_w+sbr_w-(bdr_s*2))/viz_h), 0.0, 0.0, 0.0, 2*(4./3.)/((float)box_w/viz_h), 0.0, 0.0, 0.0,
0.0, 2.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0,
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,
@ -1310,10 +1310,10 @@ static void ui_draw_vision(UIState *s) {
glClearColor(0.0, 0.0, 0.0, 0.0); glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
// scissor for EON UI
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
const int viewport_rw = (box_w+sbr_w-(bdr_s*2));
glViewport(ui_viz_rx + scene->ui_frame_offset, s->fb_h-(viz_y+viz_h), viewport_rw - scene->ui_frame_offset, viz_h);
glScissor(ui_viz_rx, s->fb_h-(viz_y+viz_h), ui_viz_rw, viz_h); glScissor(ui_viz_rx, s->fb_h-(viz_y+viz_h), ui_viz_rw, viz_h);
glViewport(ui_viz_rx, s->fb_h-(viz_y+viz_h), ui_viz_rw, viz_h);
draw_frame(s); draw_frame(s);
glViewport(0, 0, s->fb_w, s->fb_h); glViewport(0, 0, s->fb_w, s->fb_h);
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
@ -1326,10 +1326,10 @@ static void ui_draw_vision(UIState *s) {
nvgSave(s->vg); nvgSave(s->vg);
// hack for eon // hack for eon
const int inner_height = viewport_rw*9/16; const int inner_height = ui_viz_rw*9/16;
nvgScissor(s->vg, ui_viz_rx, viz_y, ui_viz_rw, viz_h); nvgScissor(s->vg, ui_viz_rx, viz_y, ui_viz_rw, viz_h);
nvgTranslate(s->vg, ui_viz_rx + scene->ui_world_offset, viz_y + (viz_h-inner_height)/2.0); nvgTranslate(s->vg, ui_viz_rx, viz_y + (viz_h-inner_height)/2.0);
nvgScale(s->vg, (float)viewport_rw / s->fb_w, (float)inner_height / s->fb_h); nvgScale(s->vg, (float)ui_viz_rw / s->fb_w, (float)inner_height / s->fb_h);
if (!scene->frontview) { if (!scene->frontview) {
ui_draw_world(s); ui_draw_world(s);
@ -1342,14 +1342,11 @@ static void ui_draw_vision(UIState *s) {
nvgRestore(s->vg); nvgRestore(s->vg);
// draw vision elements
ui_draw_vision_header(s); ui_draw_vision_header(s);
ui_draw_vision_alert(s);
// Draw calibration progress (if needed)
if (scene->cal_status == CALIBRATION_UNCALIBRATED) { if (scene->cal_status == CALIBRATION_UNCALIBRATED) {
ui_draw_calibration_status(s); ui_draw_calibration_status(s);
} }
ui_draw_vision_alert(s);
nvgEndFrame(s->vg); nvgEndFrame(s->vg);
glDisable(GL_BLEND); glDisable(GL_BLEND);
@ -1828,6 +1825,43 @@ static void ui_update(UIState *s) {
} }
static int vision_subscribe(int fd, VisionPacket *rp, int type) {
int err;
LOGW("vision_subscribe type:%d", type);
VisionPacket p1 = {
.type = VIPC_STREAM_SUBSCRIBE,
.d = { .stream_sub = { .type = type, .tbuffer = true, }, },
};
err = vipc_send(fd, &p1);
if (err < 0) {
close(fd);
return 0;
}
do {
err = vipc_recv(fd, rp);
if (err <= 0) {
close(fd);
return 0;
}
// release what we aren't ready for yet
if (rp->type == VIPC_STREAM_ACQUIRE) {
VisionPacket rep = {
.type = VIPC_STREAM_RELEASE,
.d = { .stream_rel = {
.type = rp->d.stream_acq.type,
.idx = rp->d.stream_acq.idx,
}},
};
vipc_send(fd, &rep);
}
} while (rp->type != VIPC_STREAM_BUFS || rp->d.stream_bufs.type != type);
return 1;
}
static void* vision_connect_thread(void *args) { static void* vision_connect_thread(void *args) {
int err; int err;
@ -1842,43 +1876,9 @@ static void* vision_connect_thread(void *args) {
int fd = vipc_connect(); int fd = vipc_connect();
if (fd < 0) continue; if (fd < 0) continue;
VisionPacket back_rp, front_rp;
if (!vision_subscribe(fd, &back_rp, VISION_STREAM_UI_BACK)) continue;
VisionPacket p1 = { if (!vision_subscribe(fd, &front_rp, VISION_STREAM_UI_FRONT)) continue;
.type = VIPC_STREAM_SUBSCRIBE,
.d = { .stream_sub = { .type = VISION_STREAM_UI_BACK, .tbuffer = true, }, },
};
err = vipc_send(fd, &p1);
if (err < 0) {
close(fd);
continue;
}
VisionPacket p2 = {
.type = VIPC_STREAM_SUBSCRIBE,
.d = { .stream_sub = { .type = VISION_STREAM_UI_FRONT, .tbuffer = true, }, },
};
err = vipc_send(fd, &p2);
if (err < 0) {
close(fd);
continue;
}
// printf("init recv\n");
VisionPacket back_rp;
err = vipc_recv(fd, &back_rp);
if (err <= 0) {
close(fd);
continue;
}
assert(back_rp.type == VIPC_STREAM_BUFS);
VisionPacket front_rp;
err = vipc_recv(fd, &front_rp);
if (err <= 0) {
close(fd);
continue;
}
assert(front_rp.type == VIPC_STREAM_BUFS);
pthread_mutex_lock(&s->lock); pthread_mutex_lock(&s->lock);
assert(!s->vision_connected); assert(!s->vision_connected);

Loading…
Cancel
Save