mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-20 13:43:57 +08:00
* navd: render simple map * render route * offscreen rendering * cleanup * more cleanup * render into visionIPC * rename class * split position update from route update * stop broadcast if not active * gate vipc server behind flag * add python library * faster * no vipc from python * put behind extras * only send when loaded * add glFlush just to be sure * cleanup settings into helper function * function ordering * broadcast thumbnails * put behind param * adjust zoom level * add route to python bindings * revert that freq change * add logging if map rendering is enabled * use rlogs if available * bump cereal
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include <QOpenGLContext>
|
|
#include <QMapboxGL>
|
|
#include <QTimer>
|
|
#include <QGeoCoordinate>
|
|
#include <QOpenGLBuffer>
|
|
#include <QOffscreenSurface>
|
|
#include <QOpenGLFunctions>
|
|
#include <QOpenGLFramebufferObject>
|
|
|
|
#include "cereal/visionipc/visionipc_server.h"
|
|
#include "cereal/messaging/messaging.h"
|
|
|
|
|
|
class MapRenderer : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MapRenderer(const QMapboxGLSettings &, bool enable_vipc=true);
|
|
uint8_t* getImage();
|
|
void update();
|
|
bool loaded();
|
|
~MapRenderer();
|
|
|
|
|
|
private:
|
|
std::unique_ptr<QOpenGLContext> ctx;
|
|
std::unique_ptr<QOffscreenSurface> surface;
|
|
std::unique_ptr<QOpenGLFunctions> gl_functions;
|
|
std::unique_ptr<QOpenGLFramebufferObject> fbo;
|
|
|
|
std::unique_ptr<VisionIpcServer> vipc_server;
|
|
std::unique_ptr<PubMaster> pm;
|
|
void sendVipc();
|
|
|
|
QMapboxGLSettings m_settings;
|
|
QScopedPointer<QMapboxGL> m_map;
|
|
|
|
void initLayers();
|
|
|
|
uint32_t frame_id = 0;
|
|
|
|
public slots:
|
|
void updatePosition(QMapbox::Coordinate position, float bearing);
|
|
void updateRoute(QList<QGeoCoordinate> coordinates);
|
|
};
|