poll on peripheralState

after pandaStates
pull/29889/head
Shane Smiskol 2 years ago
parent 2c99c19eb1
commit 5eecb83e07
  1. 4
      selfdrive/boardd/boardd.cc
  2. 10
      selfdrive/thermald/thermald.py

@ -476,13 +476,13 @@ void panda_state_thread(std::vector<Panda *> pandas, bool spoofing_started) {
RateKeeper rk("panda_state_thread", 10); RateKeeper rk("panda_state_thread", 10);
while (!do_exit && check_all_connected(pandas)) { while (!do_exit && check_all_connected(pandas)) {
auto ignition_opt = send_panda_states(&pm, pandas, spoofing_started);
if (sm.frame % 5 == 0) { if (sm.frame % 5 == 0) {
// send out peripheralState at 2Hz // send out peripheralState at 2Hz
send_peripheral_state(&pm, peripheral_panda); send_peripheral_state(&pm, peripheral_panda);
} }
auto ignition_opt = send_panda_states(&pm, pandas, spoofing_started);
if (!ignition_opt) { if (!ignition_opt) {
LOGE("Failed to get ignition_opt"); LOGE("Failed to get ignition_opt");
rk.keepTime(); rk.keepTime();

@ -34,7 +34,7 @@ NetworkStrength = log.DeviceState.NetworkStrength
CURRENT_TAU = 15. # 15s time constant CURRENT_TAU = 15. # 15s time constant
TEMP_TAU = 5. # 5s time constant TEMP_TAU = 5. # 5s time constant
DISCONNECT_TIMEOUT = 5. # wait 5 seconds before going offroad after disconnect so you get an alert DISCONNECT_TIMEOUT = 5. # wait 5 seconds before going offroad after disconnect so you get an alert
PANDA_STATES_TIMEOUT = round(1000 / service_list['pandaStates'].frequency * 1.5) # 1.5x the expected pandaState frequency PERIPHERAL_STATE_TIMEOUT = round(1000 / service_list['peripheralState'].frequency * 1.5) # 1.5x the expected peripheralState frequency
ThermalBand = namedtuple("ThermalBand", ['min_temp', 'max_temp']) ThermalBand = namedtuple("ThermalBand", ['min_temp', 'max_temp'])
HardwareState = namedtuple("HardwareState", ['network_type', 'network_info', 'network_strength', 'network_stats', HardwareState = namedtuple("HardwareState", ['network_type', 'network_info', 'network_strength', 'network_stats',
@ -168,7 +168,7 @@ def hw_state_thread(end_event, hw_queue):
def thermald_thread(end_event, hw_queue) -> None: def thermald_thread(end_event, hw_queue) -> None:
pm = messaging.PubMaster(['deviceState']) pm = messaging.PubMaster(['deviceState'])
sm = messaging.SubMaster(["peripheralState", "gpsLocationExternal", "controlsState", "pandaStates"], poll=["pandaStates"]) sm = messaging.SubMaster(["peripheralState", "gpsLocationExternal", "controlsState", "pandaStates"], poll=["peripheralState"])
count = 0 count = 0
@ -209,11 +209,7 @@ def thermald_thread(end_event, hw_queue) -> None:
fan_controller = None fan_controller = None
while not end_event.is_set(): while not end_event.is_set():
sm.update(PANDA_STATES_TIMEOUT) sm.update(PERIPHERAL_STATE_TIMEOUT)
# Run at 2Hz
if sm.frame % round(service_list['pandaStates'].frequency * DT_TRML) != 0:
continue
pandaStates = sm['pandaStates'] pandaStates = sm['pandaStates']
peripheralState = sm['peripheralState'] peripheralState = sm['peripheralState']

Loading…
Cancel
Save