mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-08 21:54:20 +08:00
VisualRadarTracks toggle
This commit is contained in:
@@ -165,6 +165,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"VisualStyle", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
{"VisualStyleBlend", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"VisualStyleBlendThreshold", {PERSISTENT | BACKUP, INT, "20"}},
|
||||
{"VisualRadarTracks", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
|
||||
// MADS params
|
||||
{"Mads", {PERSISTENT | BACKUP, BOOL, "1"}},
|
||||
|
||||
@@ -43,14 +43,16 @@ void ModelRenderer::draw(QPainter &painter, const QRect &surface_rect) {
|
||||
}
|
||||
}
|
||||
|
||||
if (sm.alive("liveTracks") && sm.rcv_frame("liveTracks") >= s->scene.started_frame) {
|
||||
const auto &tracks = sm["liveTracks"].getLiveTracks().getPoints();
|
||||
for (const auto &track : tracks) {
|
||||
if (!std::isfinite(track.getDRel()) || !std::isfinite(track.getYRel())) continue;
|
||||
QPointF screen_pt;
|
||||
if (mapToScreen(track.getDRel(), -track.getYRel(), path_offset_z, &screen_pt)) {
|
||||
float radius = std::clamp(15.0f / (1.0f + track.getDRel() * 0.1f), 3.0f, 8.0f);
|
||||
drawRadarPoint(painter, screen_pt, track.getVRel(), radius * 3);
|
||||
if (QString::fromStdString(Params().get("VisualRadarTracks")).toInt()) {
|
||||
if (sm.alive("liveTracks") && sm.rcv_frame("liveTracks") >= s->scene.started_frame) {
|
||||
const auto &tracks = sm["liveTracks"].getLiveTracks().getPoints();
|
||||
for (const auto &track : tracks) {
|
||||
if (!std::isfinite(track.getDRel()) || !std::isfinite(track.getYRel())) continue;
|
||||
QPointF screen_pt;
|
||||
if (mapToScreen(track.getDRel(), -track.getYRel(), path_offset_z, &screen_pt)) {
|
||||
float radius = std::clamp(15.0f / (1.0f + track.getDRel() * 0.1f), 3.0f, 8.0f);
|
||||
drawRadarPoint(painter, screen_pt, track.getVRel(), radius * 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,13 @@ VisualsPanel::VisualsPanel(QWidget *parent) : QWidget(parent) {
|
||||
"",
|
||||
false,
|
||||
},
|
||||
{
|
||||
"VisualRadarTracks",
|
||||
tr("Show Radar Tracks"),
|
||||
tr("Shows what the cars radar sees."),
|
||||
"../assets/offroad/icon_monitoring.png",
|
||||
false,
|
||||
},
|
||||
{
|
||||
"VisualStyleBlend",
|
||||
tr("Blend to Overhead Visual Style"),
|
||||
|
||||
Reference in New Issue
Block a user