mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-19 10:03:57 +08:00
bump pandaStates to 10Hz (#29889)
* bump pandaStates to 10Hz * run thermald at 2 Hz * use service list for freq * even better * fix import * use DT_TRML * revert service list * bump cereal * no inter * not sure why 5hz before * revert * revert peripheral * poll on peripheralState after pandaStates * Revert "poll on peripheralState" This reverts commit 5eecb83e070dd51b550a47f3e0e7a1600b8da4e4. * revert this * bump * cmt * fix * bump to master
This commit is contained in:
2
cereal
2
cereal
Submodule cereal updated: aed84aeedf...6bd65e7c7f
@@ -472,12 +472,15 @@ void panda_state_thread(std::vector<Panda *> pandas, bool spoofing_started) {
|
||||
|
||||
LOGD("start panda state thread");
|
||||
|
||||
// run at 2hz
|
||||
RateKeeper rk("panda_state_thread", 2);
|
||||
// run at 10hz
|
||||
RateKeeper rk("panda_state_thread", 10);
|
||||
|
||||
while (!do_exit && check_all_connected(pandas)) {
|
||||
// send out peripheralState
|
||||
send_peripheral_state(&pm, peripheral_panda);
|
||||
// send out peripheralState at 2Hz
|
||||
if (sm.frame % 5 == 0) {
|
||||
send_peripheral_state(&pm, peripheral_panda);
|
||||
}
|
||||
|
||||
auto ignition_opt = send_panda_states(&pm, pandas, spoofing_started);
|
||||
|
||||
if (!ignition_opt) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import psutil
|
||||
|
||||
import cereal.messaging as messaging
|
||||
from cereal import log
|
||||
from cereal.services import SERVICE_LIST
|
||||
from openpilot.common.dict_helpers import strip_deprecated_keys
|
||||
from openpilot.common.time import MIN_DATE
|
||||
from openpilot.common.filter_simple import FirstOrderFilter
|
||||
@@ -33,7 +34,7 @@ NetworkStrength = log.DeviceState.NetworkStrength
|
||||
CURRENT_TAU = 15. # 15s time constant
|
||||
TEMP_TAU = 5. # 5s time constant
|
||||
DISCONNECT_TIMEOUT = 5. # wait 5 seconds before going offroad after disconnect so you get an alert
|
||||
PANDA_STATES_TIMEOUT = int(1000 * 1.5 * DT_TRML) # 1.5x the expected pandaState frequency
|
||||
PANDA_STATES_TIMEOUT = round(1000 / SERVICE_LIST['pandaStates'].frequency * 1.5) # 1.5x the expected pandaState frequency
|
||||
|
||||
ThermalBand = namedtuple("ThermalBand", ['min_temp', 'max_temp'])
|
||||
HardwareState = namedtuple("HardwareState", ['network_type', 'network_info', 'network_strength', 'network_stats',
|
||||
@@ -210,6 +211,10 @@ def thermald_thread(end_event, hw_queue) -> None:
|
||||
while not end_event.is_set():
|
||||
sm.update(PANDA_STATES_TIMEOUT)
|
||||
|
||||
# Run at 2Hz
|
||||
if sm.frame % round(SERVICE_LIST['pandaStates'].frequency * DT_TRML) != 0:
|
||||
continue
|
||||
|
||||
pandaStates = sm['pandaStates']
|
||||
peripheralState = sm['peripheralState']
|
||||
peripheral_panda_present = peripheralState.pandaType != log.PandaState.PandaType.unknown
|
||||
|
||||
Reference in New Issue
Block a user