bench mode: live camera via thermald, blinking telemetry indicator
- Unblocked thermald and camerad — thermald manages CPU cores and reads fake pandaStates for ignition, bench no longer publishes deviceState - camerad starts with live camera feed on bench - Force nvg->update() every frame for HUD repaint without camera dependency - Blue blinking telemetry circle uses getBool pattern - camerad debug logging for startup diagnostics Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,8 +36,9 @@ def main():
|
|||||||
params_mem.put("BenchGear", "P")
|
params_mem.put("BenchGear", "P")
|
||||||
params_mem.put("BenchEngaged", "0")
|
params_mem.put("BenchEngaged", "0")
|
||||||
|
|
||||||
|
# thermald handles deviceState (reads our fake pandaStates for ignition)
|
||||||
pm = messaging.PubMaster([
|
pm = messaging.PubMaster([
|
||||||
"deviceState", "pandaStates", "carState", "controlsState",
|
"pandaStates", "carState", "controlsState",
|
||||||
"driverMonitoringState", "liveCalibration",
|
"driverMonitoringState", "liveCalibration",
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -65,19 +66,7 @@ def main():
|
|||||||
speed_ms = speed_mph * MS_PER_MPH
|
speed_ms = speed_mph * MS_PER_MPH
|
||||||
gear = gear_map.get(gear_str, car.CarState.GearShifter.park)
|
gear = gear_map.get(gear_str, car.CarState.GearShifter.park)
|
||||||
|
|
||||||
# deviceState — 2 Hz
|
# pandaStates — 10 Hz (thermald reads ignition from this)
|
||||||
if frame % 5 == 0:
|
|
||||||
dat = messaging.new_message("deviceState")
|
|
||||||
dat.deviceState.started = True
|
|
||||||
dat.deviceState.freeSpacePercent = 80
|
|
||||||
dat.deviceState.memoryUsagePercent = 30
|
|
||||||
dat.deviceState.cpuTempC = [40.0] * 3
|
|
||||||
dat.deviceState.gpuTempC = [40.0] * 3
|
|
||||||
dat.deviceState.cpuUsagePercent = [20] * 8
|
|
||||||
dat.deviceState.networkType = log.DeviceState.NetworkType.cell4G
|
|
||||||
pm.send("deviceState", dat)
|
|
||||||
|
|
||||||
# pandaStates — 10 Hz
|
|
||||||
if frame % 1 == 0:
|
if frame % 1 == 0:
|
||||||
dat = messaging.new_message("pandaStates", 1)
|
dat = messaging.new_message("pandaStates", 1)
|
||||||
dat.pandaStates[0].ignitionLine = True
|
dat.pandaStates[0].ignitionLine = True
|
||||||
|
|||||||
@@ -402,10 +402,10 @@ def manager_thread(frogpilot_functions) -> None:
|
|||||||
ignore.append("pandad")
|
ignore.append("pandad")
|
||||||
# CLEARPILOT: bench mode — disable real car processes, enable bench simulator
|
# CLEARPILOT: bench mode — disable real car processes, enable bench simulator
|
||||||
if os.getenv("BENCH_MODE") is not None:
|
if os.getenv("BENCH_MODE") is not None:
|
||||||
ignore += ["pandad", "thermald", "controlsd", "radard", "plannerd",
|
ignore += ["pandad", "controlsd", "radard", "plannerd",
|
||||||
"calibrationd", "torqued", "paramsd", "locationd", "sensord",
|
"calibrationd", "torqued", "paramsd", "locationd", "sensord",
|
||||||
"ubloxd", "pigeond", "dmonitoringmodeld", "dmonitoringd",
|
"ubloxd", "pigeond", "dmonitoringmodeld", "dmonitoringd",
|
||||||
"modeld", "soundd", "camerad", "loggerd", "micd",
|
"modeld", "soundd", "loggerd", "micd",
|
||||||
"dashcamd"]
|
"dashcamd"]
|
||||||
session_log.info("bench mode enabled")
|
session_log.info("bench mode enabled")
|
||||||
ignore += [x for x in os.getenv("BLOCK", "").split(",") if len(x) > 0]
|
ignore += [x for x in os.getenv("BLOCK", "").split(",") if len(x) > 0]
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ void OnroadWindow::updateState(const UIState &s) {
|
|||||||
alerts->updateAlert(alert);
|
alerts->updateAlert(alert);
|
||||||
|
|
||||||
nvg->updateState(s);
|
nvg->updateState(s);
|
||||||
|
nvg->update(); // CLEARPILOT: force repaint every frame for HUD elements
|
||||||
|
|
||||||
QColor bgColor = bg_colors[s.status];
|
QColor bgColor = bg_colors[s.status];
|
||||||
if (paramsMemory.getBool("no_lat_lane_change") == 1) {
|
if (paramsMemory.getBool("no_lat_lane_change") == 1) {
|
||||||
@@ -403,13 +404,13 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
|
|||||||
Hardware::set_display_power(true);
|
Hardware::set_display_power(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CLEARPILOT: blinking red circle when telemetry is recording
|
// CLEARPILOT: blinking blue circle when telemetry is recording
|
||||||
if (Params().get("TelemetryEnabled") == "1") {
|
if (Params().getBool("TelemetryEnabled")) {
|
||||||
// Blink: visible for 500ms, hidden for 500ms
|
// Blink: visible for 500ms, hidden for 500ms
|
||||||
int phase = (QDateTime::currentMSecsSinceEpoch() / 500) % 2;
|
int phase = (QDateTime::currentMSecsSinceEpoch() / 500) % 2;
|
||||||
if (phase == 0) {
|
if (phase == 0) {
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.setBrush(QColor(220, 30, 30));
|
p.setBrush(QColor(30, 100, 220));
|
||||||
p.drawEllipse(width() - 150, 50, 100, 100);
|
p.drawEllipse(width() - 150, 50, 100, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,17 +7,27 @@
|
|||||||
#include "system/hardware/hw.h"
|
#include "system/hardware/hw.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
fprintf(stderr, "camerad: starting\n");
|
||||||
|
|
||||||
if (Hardware::PC()) {
|
if (Hardware::PC()) {
|
||||||
printf("exiting, camerad is not meant to run on PC\n");
|
fprintf(stderr, "camerad: exiting, not meant to run on PC\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
fprintf(stderr, "camerad: setting realtime priority 53\n");
|
||||||
ret = util::set_realtime_priority(53);
|
ret = util::set_realtime_priority(53);
|
||||||
|
fprintf(stderr, "camerad: set_realtime_priority ret=%d\n", ret);
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
ret = util::set_core_affinity({6});
|
|
||||||
assert(ret == 0 || Params().getBool("IsOffroad")); // failure ok while offroad due to offlining cores
|
|
||||||
|
|
||||||
|
fprintf(stderr, "camerad: setting core affinity to cpu6\n");
|
||||||
|
ret = util::set_core_affinity({6});
|
||||||
|
bool isOffroad = Params().getBool("IsOffroad");
|
||||||
|
fprintf(stderr, "camerad: set_core_affinity ret=%d, IsOffroad=%d\n", ret, isOffroad);
|
||||||
|
assert(ret == 0 || isOffroad); // failure ok while offroad due to offlining cores
|
||||||
|
|
||||||
|
fprintf(stderr, "camerad: starting camerad_thread\n");
|
||||||
camerad_thread();
|
camerad_thread();
|
||||||
|
fprintf(stderr, "camerad: camerad_thread returned\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user