wip
This commit is contained in:
132
selfdrive/ui/qt/onroad.h
Executable file → Normal file
132
selfdrive/ui/qt/onroad.h
Executable file → Normal file
@@ -2,7 +2,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QMovie>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QStackedLayout>
|
||||
#include <QWidget>
|
||||
@@ -16,7 +17,6 @@
|
||||
const int btn_size = 192;
|
||||
const int img_size = (btn_size / 4) * 3;
|
||||
|
||||
// FrogPilot global variables
|
||||
static double fps;
|
||||
|
||||
// ***** onroad widgets *****
|
||||
@@ -42,13 +42,14 @@ class Compass : public QWidget {
|
||||
public:
|
||||
explicit Compass(QWidget *parent = nullptr);
|
||||
|
||||
void initializeStaticElements();
|
||||
void updateState(int bearing_deg);
|
||||
void updateState();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
UIScene &scene;
|
||||
|
||||
int bearingDeg;
|
||||
int circleOffset;
|
||||
int compassSize;
|
||||
@@ -56,10 +57,37 @@ private:
|
||||
int innerCompass;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
QPixmap compassInnerImg;
|
||||
QPixmap staticElements;
|
||||
};
|
||||
|
||||
class DistanceButton : public QPushButton {
|
||||
public:
|
||||
explicit DistanceButton(QWidget *parent = nullptr);
|
||||
|
||||
void buttonPressed();
|
||||
void buttonReleased();
|
||||
void updateState();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
|
||||
UIScene &scene;
|
||||
|
||||
bool trafficModeActive;
|
||||
|
||||
int personality;
|
||||
|
||||
QElapsedTimer transitionTimer;
|
||||
|
||||
QVector<std::pair<QPixmap, QString>> profile_data;
|
||||
QVector<std::pair<QPixmap, QString>> profile_data_kaofui;
|
||||
};
|
||||
|
||||
class ExperimentalButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -78,14 +106,24 @@ private:
|
||||
bool engageable;
|
||||
|
||||
// FrogPilot variables
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
UIScene &scene;
|
||||
|
||||
std::map<int, QPixmap> wheelImages;
|
||||
QMap<int, QPixmap> wheelImages;
|
||||
QMap<int, QMovie*> wheelImagesGif;
|
||||
|
||||
QMovie engage_gif;
|
||||
QLabel *gifLabel;
|
||||
|
||||
bool docRandomEventTriggered;
|
||||
bool firefoxRandomEventTriggered;
|
||||
bool rotatingWheel;
|
||||
bool treeFiddyRandomEventTriggered;
|
||||
bool weebRandomEventTriggered;
|
||||
|
||||
int steeringAngleDeg;
|
||||
int wheelIcon;
|
||||
int wheelIconGif;
|
||||
int y_offset;
|
||||
};
|
||||
|
||||
@@ -102,28 +140,25 @@ private:
|
||||
QPixmap settings_img;
|
||||
};
|
||||
|
||||
// FrogPilot buttons
|
||||
class PersonalityButton : public QPushButton {
|
||||
public:
|
||||
explicit PersonalityButton(QWidget *parent = 0);
|
||||
class PedalIcons : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
void checkUpdate();
|
||||
void handleClick();
|
||||
public:
|
||||
explicit PedalIcons(QWidget *parent = 0);
|
||||
void updateState();
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
Params params;
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
QPixmap brake_pedal_img;
|
||||
QPixmap gas_pedal_img;
|
||||
|
||||
UIScene &scene;
|
||||
|
||||
int personalityProfile = 0;
|
||||
bool accelerating;
|
||||
bool decelerating;
|
||||
|
||||
QElapsedTimer transitionTimer;
|
||||
|
||||
QVector<std::pair<QPixmap, QString>> profile_data;
|
||||
float acceleration;
|
||||
};
|
||||
|
||||
// container window for the NVG UI
|
||||
@@ -163,79 +198,86 @@ private:
|
||||
bool wide_cam_requested = false;
|
||||
|
||||
// FrogPilot widgets
|
||||
void initializeFrogPilotWidgets();
|
||||
void paintFrogPilotWidgets(QPainter &p);
|
||||
void updateFrogPilotWidgets();
|
||||
|
||||
void drawLeadInfo(QPainter &p);
|
||||
void drawSLCConfirmation(QPainter &p);
|
||||
void drawStatusBar(QPainter &p);
|
||||
void drawTurnSignals(QPainter &p);
|
||||
void initializeFrogPilotWidgets();
|
||||
void updateFrogPilotWidgets(QPainter &p);
|
||||
|
||||
// FrogPilot variables
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
|
||||
UIScene &scene;
|
||||
|
||||
Compass *compass_img;
|
||||
PersonalityButton *personality_btn;
|
||||
DistanceButton *distance_btn;
|
||||
PedalIcons *pedal_icons;
|
||||
ScreenRecorder *recorder_btn;
|
||||
|
||||
QHBoxLayout *bottom_layout;
|
||||
|
||||
bool accelerationPath;
|
||||
bool adjacentPath;
|
||||
bool alwaysOnLateral;
|
||||
bool alwaysOnLateralActive;
|
||||
bool bigMapOpen;
|
||||
bool blindSpotLeft;
|
||||
bool blindSpotRight;
|
||||
bool compass;
|
||||
bool conditionalExperimental;
|
||||
bool experimentalMode;
|
||||
bool hideSpeed;
|
||||
bool leadInfo;
|
||||
bool mapOpen;
|
||||
bool muteDM;
|
||||
bool onroadAdjustableProfiles;
|
||||
bool reverseCruise;
|
||||
bool onroadDistanceButton;
|
||||
bool roadNameUI;
|
||||
bool showDriverCamera;
|
||||
bool showAlwaysOnLateralStatusBar;
|
||||
bool showConditionalExperimentalStatusBar;
|
||||
bool showSLCOffset;
|
||||
bool slcOverridden;
|
||||
bool speedLimitController;
|
||||
bool trafficModeActive;
|
||||
bool turnSignalLeft;
|
||||
bool turnSignalRight;
|
||||
bool useSI;
|
||||
bool useViennaSLCSign;
|
||||
double maxAcceleration;
|
||||
bool vtscControllingCurve;
|
||||
|
||||
float cruiseAdjustment;
|
||||
float distanceConversion;
|
||||
float laneDetectionWidth;
|
||||
float laneWidthLeft;
|
||||
float laneWidthRight;
|
||||
float slcOverriddenSpeed;
|
||||
float slcSpeedLimit;
|
||||
float slcSpeedLimitOffset;
|
||||
int bearingDeg;
|
||||
float speedConversion;
|
||||
|
||||
int alertSize;
|
||||
int cameraView;
|
||||
int conditionalSpeed;
|
||||
int conditionalSpeedLead;
|
||||
int conditionalStatus;
|
||||
int currentHolidayTheme;
|
||||
int customColors;
|
||||
int customSignals;
|
||||
int desiredFollow;
|
||||
int obstacleDistance;
|
||||
int obstacleDistanceStock;
|
||||
int stoppedEquivalence;
|
||||
int totalFrames = 8;
|
||||
QTimer *animationTimer;
|
||||
|
||||
QString leadDistanceUnit;
|
||||
QString leadSpeedUnit;
|
||||
|
||||
size_t animationFrameIndex;
|
||||
|
||||
inline QColor greenColor(int alpha = 242) { return QColor(23, 134, 68, alpha); }
|
||||
|
||||
std::unordered_map<int, std::pair<QString, std::pair<QColor, std::map<double, QBrush>>>> themeConfiguration;
|
||||
std::unordered_map<int, std::tuple<QString, QColor, std::map<double, QBrush>>> themeConfiguration;
|
||||
std::unordered_map<int, std::tuple<QString, QColor, std::map<double, QBrush>>> holidayThemeConfiguration;
|
||||
std::vector<QPixmap> signalImgVector;
|
||||
|
||||
QTimer *animationTimer;
|
||||
|
||||
inline QColor blueColor(int alpha = 255) { return QColor(0, 150, 255, alpha); }
|
||||
inline QColor greenColor(int alpha = 242) { return QColor(23, 134, 68, alpha); }
|
||||
|
||||
protected:
|
||||
void paintGL() override;
|
||||
void initializeGL() override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
void updateFrameMat() override;
|
||||
void drawLaneLines(QPainter &painter, const UIState *s);
|
||||
void drawLead(QPainter &painter, const cereal::RadarState::LeadData::Reader &lead_data, const QPointF &vd);
|
||||
void drawLead(QPainter &painter, const cereal::ModelDataV2::LeadDataV3::Reader &lead_data, const QPointF &vd, const float v_ego);
|
||||
void drawHud(QPainter &p);
|
||||
void drawDriverState(QPainter &painter, const UIState *s);
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
@@ -270,6 +312,8 @@ private:
|
||||
|
||||
// FrogPilot variables
|
||||
UIScene &scene;
|
||||
Params params;
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
|
||||
QPoint timeoutPoint = QPoint(420, 69);
|
||||
QTimer clickTimer;
|
||||
|
||||
Reference in New Issue
Block a user