Added USE_THNEED environment variable and removed build flag (#29645)

old-commit-hash: d998fd88a8
beeps
Mitchell Goff 2 years ago committed by GitHub
parent 279bd020dc
commit c4ae1fae5a
  1. 6
      selfdrive/modeld/modeld.py
  2. 6
      selfdrive/modeld/models/driving.h
  3. 1
      selfdrive/modeld/models/driving.pxd
  4. 3
      selfdrive/modeld/models/driving_pyx.pyx

@ -1,4 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os
import sys import sys
import time import time
import numpy as np import numpy as np
@ -7,7 +8,7 @@ from typing import Dict, Optional
from setproctitle import setproctitle from setproctitle import setproctitle
from cereal.messaging import PubMaster, SubMaster from cereal.messaging import PubMaster, SubMaster
from cereal.visionipc import VisionIpcClient, VisionStreamType, VisionBuf from cereal.visionipc import VisionIpcClient, VisionStreamType, VisionBuf
from openpilot.system.hardware import PC from openpilot.system.hardware import PC, TICI
from openpilot.system.swaglog import cloudlog from openpilot.system.swaglog import cloudlog
from openpilot.common.params import Params from openpilot.common.params import Params
from openpilot.common.filter_simple import FirstOrderFilter from openpilot.common.filter_simple import FirstOrderFilter
@ -16,8 +17,9 @@ from openpilot.selfdrive.modeld.models.commonmodel_pyx import ModelFrame, CLCont
from openpilot.selfdrive.modeld.models.driving_pyx import ( from openpilot.selfdrive.modeld.models.driving_pyx import (
PublishState, create_model_msg, create_pose_msg, update_calibration, PublishState, create_model_msg, create_pose_msg, update_calibration,
FEATURE_LEN, HISTORY_BUFFER_LEN, DESIRE_LEN, TRAFFIC_CONVENTION_LEN, NAV_FEATURE_LEN, NAV_INSTRUCTION_LEN, FEATURE_LEN, HISTORY_BUFFER_LEN, DESIRE_LEN, TRAFFIC_CONVENTION_LEN, NAV_FEATURE_LEN, NAV_INSTRUCTION_LEN,
OUTPUT_SIZE, NET_OUTPUT_SIZE, MODEL_FREQ, USE_THNEED) OUTPUT_SIZE, NET_OUTPUT_SIZE, MODEL_FREQ)
USE_THNEED = int(os.getenv('USE_THNEED', str(int(TICI))))
if USE_THNEED: if USE_THNEED:
from selfdrive.modeld.runners.thneedmodel_pyx import ThneedModel as ModelRunner from selfdrive.modeld.runners.thneedmodel_pyx import ThneedModel as ModelRunner
else: else:

@ -9,12 +9,6 @@
#include "common/util.h" #include "common/util.h"
#include "selfdrive/modeld/models/nav.h" #include "selfdrive/modeld/models/nav.h"
#ifdef USE_THNEED
constexpr bool CPP_USE_THNEED = true;
#else
constexpr bool CPP_USE_THNEED = false;
#endif
constexpr int FEATURE_LEN = 128; constexpr int FEATURE_LEN = 128;
constexpr int HISTORY_BUFFER_LEN = 99; constexpr int HISTORY_BUFFER_LEN = 99;
constexpr int DESIRE_LEN = 8; constexpr int DESIRE_LEN = 8;

@ -21,7 +21,6 @@ cdef extern from "selfdrive/modeld/models/driving.h":
cdef int OUTPUT_SIZE cdef int OUTPUT_SIZE
cdef int NET_OUTPUT_SIZE cdef int NET_OUTPUT_SIZE
cdef int MODEL_FREQ cdef int MODEL_FREQ
cdef bool CPP_USE_THNEED
cdef struct PublishState: pass cdef struct PublishState: pass
mat3 update_calibration(float *, bool, bool) mat3 update_calibration(float *, bool, bool)

@ -11,7 +11,7 @@ from .commonmodel cimport mat3
from .driving cimport FEATURE_LEN as CPP_FEATURE_LEN, HISTORY_BUFFER_LEN as CPP_HISTORY_BUFFER_LEN, DESIRE_LEN as CPP_DESIRE_LEN, \ from .driving cimport FEATURE_LEN as CPP_FEATURE_LEN, HISTORY_BUFFER_LEN as CPP_HISTORY_BUFFER_LEN, DESIRE_LEN as CPP_DESIRE_LEN, \
TRAFFIC_CONVENTION_LEN as CPP_TRAFFIC_CONVENTION_LEN, DRIVING_STYLE_LEN as CPP_DRIVING_STYLE_LEN, \ TRAFFIC_CONVENTION_LEN as CPP_TRAFFIC_CONVENTION_LEN, DRIVING_STYLE_LEN as CPP_DRIVING_STYLE_LEN, \
NAV_FEATURE_LEN as CPP_NAV_FEATURE_LEN, NAV_INSTRUCTION_LEN as CPP_NAV_INSTRUCTION_LEN, \ NAV_FEATURE_LEN as CPP_NAV_FEATURE_LEN, NAV_INSTRUCTION_LEN as CPP_NAV_INSTRUCTION_LEN, \
OUTPUT_SIZE as CPP_OUTPUT_SIZE, NET_OUTPUT_SIZE as CPP_NET_OUTPUT_SIZE, MODEL_FREQ as CPP_MODEL_FREQ, CPP_USE_THNEED OUTPUT_SIZE as CPP_OUTPUT_SIZE, NET_OUTPUT_SIZE as CPP_NET_OUTPUT_SIZE, MODEL_FREQ as CPP_MODEL_FREQ
from .driving cimport MessageBuilder, PublishState as cppPublishState from .driving cimport MessageBuilder, PublishState as cppPublishState
from .driving cimport fill_model_msg, fill_pose_msg, update_calibration as cpp_update_calibration from .driving cimport fill_model_msg, fill_pose_msg, update_calibration as cpp_update_calibration
@ -25,7 +25,6 @@ NAV_INSTRUCTION_LEN = CPP_NAV_INSTRUCTION_LEN
OUTPUT_SIZE = CPP_OUTPUT_SIZE OUTPUT_SIZE = CPP_OUTPUT_SIZE
NET_OUTPUT_SIZE = CPP_NET_OUTPUT_SIZE NET_OUTPUT_SIZE = CPP_NET_OUTPUT_SIZE
MODEL_FREQ = CPP_MODEL_FREQ MODEL_FREQ = CPP_MODEL_FREQ
USE_THNEED = CPP_USE_THNEED
cdef class PublishState: cdef class PublishState:
cdef cppPublishState state cdef cppPublishState state

Loading…
Cancel
Save