mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-28 18:33:45 +08:00
dmonitoringmodeld: initialize model first (#29080)
* hacky fix * even better * ordering * clean up * fix model replay * add comment * catch sigint old-commit-hash: 12ed894362dd22513a21de6689a31511b791e37b
This commit is contained in:
@@ -107,6 +107,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"DisablePowerDown", PERSISTENT},
|
||||
{"DisableUpdates", PERSISTENT},
|
||||
{"DisengageOnAccelerator", PERSISTENT},
|
||||
{"DmModelInitialized", CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"DongleId", PERSISTENT},
|
||||
{"DoReboot", CLEAR_ON_MANAGER_START},
|
||||
{"DoShutdown", CLEAR_ON_MANAGER_START},
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <cstdlib>
|
||||
|
||||
#include "cereal/visionipc/visionipc_client.h"
|
||||
#include "common/params.h"
|
||||
#include "common/swaglog.h"
|
||||
#include "common/util.h"
|
||||
#include "selfdrive/modeld/models/dmonitoring.h"
|
||||
@@ -49,6 +50,8 @@ int main(int argc, char **argv) {
|
||||
DMonitoringModelState model;
|
||||
dmonitoring_init(&model);
|
||||
|
||||
Params().putBool("DmModelInitialized", true);
|
||||
|
||||
LOGW("connecting to driver stream");
|
||||
VisionIpcClient vipc_client = VisionIpcClient("camerad", VISION_STREAM_DRIVER, true);
|
||||
while (!do_exit && !vipc_client.connect(false)) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <cstdlib>
|
||||
|
||||
#include "cereal/visionipc/visionipc_client.h"
|
||||
#include "common/params.h"
|
||||
#include "common/swaglog.h"
|
||||
#include "common/util.h"
|
||||
#include "selfdrive/modeld/models/nav.h"
|
||||
@@ -41,6 +42,13 @@ void run_model(NavModelState &model, VisionIpcClient &vipc_client) {
|
||||
int main(int argc, char **argv) {
|
||||
setpriority(PRIO_PROCESS, 0, -15);
|
||||
|
||||
// there exists a race condition when two processes try to create a
|
||||
// SNPE model runner at the same time, wait for dmonitoringmodeld to finish
|
||||
LOGW("waiting for dmonitoringmodeld to initialize");
|
||||
if (!Params().getBool("DmModelInitialized", true)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// init the models
|
||||
NavModelState model;
|
||||
navmodel_init(&model);
|
||||
|
||||
@@ -6,6 +6,7 @@ from collections import defaultdict
|
||||
from typing import Any
|
||||
|
||||
import cereal.messaging as messaging
|
||||
from common.params import Params
|
||||
from common.spinner import Spinner
|
||||
from system.hardware import PC
|
||||
from selfdrive.manager.process_config import managed_processes
|
||||
@@ -62,6 +63,7 @@ def nav_model_replay(lr):
|
||||
try:
|
||||
assert "MAPBOX_TOKEN" in os.environ
|
||||
os.environ['MAP_RENDER_TEST_MODE'] = '1'
|
||||
Params().put_bool('DmModelInitialized', True)
|
||||
managed_processes['mapsd'].start()
|
||||
managed_processes['navmodeld'].start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user