Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump pandaStates to 10Hz #29889

Merged
merged 26 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b3cf76c
bump pandaStates to 10Hz
sshane Sep 12, 2023
8769682
run thermald at 2 Hz
sshane Sep 12, 2023
8201720
use service list for freq
sshane Sep 12, 2023
4a9d8ef
even better
sshane Sep 12, 2023
e06d70a
fix import
sshane Sep 12, 2023
43c9df4
Merge remote-tracking branch 'upstream/master' into 10hz-pandaStates
sshane Sep 15, 2023
47e8af3
Merge remote-tracking branch 'upstream/master' into 10hz-pandaStates
sshane Sep 15, 2023
7a11d9a
use DT_TRML
sshane Sep 15, 2023
8b940fb
Merge remote-tracking branch 'upstream/master' into 10hz-pandaStates
sshane Sep 15, 2023
6c12ed1
revert service list
sshane Sep 16, 2023
7ffbd51
bump cereal
sshane Sep 16, 2023
ddeaef2
no inter
sshane Sep 16, 2023
233d9eb
not sure why 5hz before
sshane Sep 16, 2023
89ed0d6
revert
sshane Sep 16, 2023
2c99c19
revert peripheral
sshane Sep 16, 2023
5eecb83
poll on peripheralState
sshane Sep 16, 2023
6effedf
Revert "poll on peripheralState"
sshane Sep 16, 2023
19832f3
revert this
sshane Sep 16, 2023
16a548b
Merge remote-tracking branch 'upstream/master' into 10hz-pandaStates
sshane Sep 16, 2023
a0e7e4d
Merge remote-tracking branch 'upstream/master' into 10hz-pandaStates
sshane Sep 19, 2023
c628209
Merge remote-tracking branch 'upstream/master' into 10hz-pandaStates
sshane Sep 21, 2023
5a39f25
bump
sshane Sep 21, 2023
af4dc59
cmt
sshane Sep 22, 2023
b12c5c1
Merge remote-tracking branch 'upstream/master' into 10hz-pandaStates
sshane Sep 22, 2023
b4f8985
fix
sshane Sep 22, 2023
7d9297d
bump to master
sshane Sep 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cereal
11 changes: 7 additions & 4 deletions selfdrive/boardd/boardd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 6 additions & 1 deletion selfdrive/thermald/thermald.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

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
Expand All @@ -33,7 +34,7 @@
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',
Expand Down Expand Up @@ -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
Expand Down