Make the DSP work everywhere (#2621)

* Use DSP again

* 20 Hz

Co-authored-by: Willem Melching <willem.melching@gmail.com>
pull/2653/head
George Hotz 4 years ago committed by GitHub
parent 460e4dc3b0
commit bdb1b766d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      common/realtime.py
  2. 9
      selfdrive/modeld/dmonitoringmodeld.cc
  3. 5
      selfdrive/modeld/models/dmonitoring.cc

@ -4,16 +4,21 @@ import os
import time import time
import multiprocessing import multiprocessing
from common.hardware import PC from common.hardware import PC, TICI
from common.clock import sec_since_boot # pylint: disable=no-name-in-module, import-error from common.clock import sec_since_boot # pylint: disable=no-name-in-module, import-error
# time step for each process # time step for each process
DT_CTRL = 0.01 # controlsd DT_CTRL = 0.01 # controlsd
DT_MDL = 0.05 # model DT_MDL = 0.05 # model
DT_DMON = 0.1 # driver monitoring
DT_TRML = 0.5 # thermald and manager DT_TRML = 0.5 # thermald and manager
# driver monitoring
if TICI:
DT_DMON = 0.05
else:
DT_DMON = 0.1
class Priority: class Priority:
MIN_REALTIME = 52 # highest android process priority is 51 MIN_REALTIME = 52 # highest android process priority is 51

@ -26,10 +26,6 @@ int main(int argc, char **argv) {
int err; int err;
setpriority(PRIO_PROCESS, 0, -15); setpriority(PRIO_PROCESS, 0, -15);
#ifdef QCOM2
set_core_affinity(5);
#endif
signal(SIGINT, (sighandler_t)set_do_exit); signal(SIGINT, (sighandler_t)set_do_exit);
signal(SIGTERM, (sighandler_t)set_do_exit); signal(SIGTERM, (sighandler_t)set_do_exit);
@ -70,11 +66,6 @@ int main(int argc, char **argv) {
LOGD("dmonitoring process: %.2fms, from last %.2fms", t2-t1, t1-last); LOGD("dmonitoring process: %.2fms, from last %.2fms", t2-t1, t1-last);
last = t1; last = t1;
#ifdef QCOM2
// this makes it run at about 2.7Hz on tici CPU to deal with modeld lags
// TODO: DSP needs to be freed (again)
usleep(250000);
#endif
} }
visionstream_destroy(&stream); visionstream_destroy(&stream);
} }

@ -22,11 +22,8 @@ void dmonitoring_init(DMonitoringModelState* s) {
#else #else
const char* model_path = "../../models/dmonitoring_model.dlc"; const char* model_path = "../../models/dmonitoring_model.dlc";
#endif #endif
#ifdef QCOM2
int runtime = USE_CPU_RUNTIME;
#else
int runtime = USE_DSP_RUNTIME; int runtime = USE_DSP_RUNTIME;
#endif
s->m = new DefaultRunModel(model_path, (float*)&s->output, OUTPUT_SIZE, runtime); s->m = new DefaultRunModel(model_path, (float*)&s->output, OUTPUT_SIZE, runtime);
s->is_rhd = Params().read_db_bool("IsRHD"); s->is_rhd = Params().read_db_bool("IsRHD");
} }

Loading…
Cancel
Save