mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-22 20:03:53 +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
63 lines
1.3 KiB
C++
63 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <optional>
|
|
|
|
#include <QThread>
|
|
#include <QGeoCoordinate>
|
|
#include <QGeoManeuver>
|
|
#include <QGeoRouteRequest>
|
|
#include <QGeoRouteSegment>
|
|
#include <QGeoRoutingManager>
|
|
#include <QGeoServiceProvider>
|
|
#include <QTimer>
|
|
#include <QMapboxGL>
|
|
|
|
#include "cereal/messaging/messaging.h"
|
|
|
|
class RouteEngine : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
RouteEngine();
|
|
|
|
SubMaster *sm;
|
|
PubMaster *pm;
|
|
|
|
QTimer* msg_timer;
|
|
QTimer* route_timer;
|
|
|
|
std::optional<int> ui_pid;
|
|
|
|
// Route
|
|
bool gps_ok = false;
|
|
QGeoServiceProvider *geoservice_provider;
|
|
QGeoRoutingManager *routing_manager;
|
|
QGeoRoute route;
|
|
QGeoRouteSegment segment;
|
|
QMapbox::Coordinate nav_destination;
|
|
|
|
// Position
|
|
std::optional<QMapbox::Coordinate> last_position;
|
|
std::optional<float> last_bearing;
|
|
bool localizer_valid = false;
|
|
|
|
// Route recompute
|
|
bool active = false;
|
|
int recompute_backoff = 0;
|
|
int recompute_countdown = 0;
|
|
void calculateRoute(QMapbox::Coordinate destination);
|
|
void clearRoute();
|
|
bool shouldRecompute();
|
|
|
|
private slots:
|
|
void routeUpdate();
|
|
void msgUpdate();
|
|
void routeCalculated(QGeoRouteReply *reply);
|
|
void recomputeRoute();
|
|
void sendRoute();
|
|
|
|
signals:
|
|
void positionUpdated(QMapbox::Coordinate position, float bearing);
|
|
void routeUpdated(QList<QGeoCoordinate> coordinates);
|
|
};
|