mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 22:46:33 +00:00
45c19baa45
- autopilot -> drone_controller - rtsp_ai_player -> ai_controller - added top level qmake project file - updated documentation - moved small demo applications from tmp/ to misc/
69 lines
2.0 KiB
C++
69 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <QDebug>
|
|
#include "aienginedefinitions.h"
|
|
#include "aienginegimbalserverudpcommand.h"
|
|
#include "aienginegimbalserverudpresponse.h"
|
|
#include "aienginegimbalserverudp.h"
|
|
|
|
|
|
const double EARTH_RADIUS = 6371000.0; // Earth's radius in meters
|
|
|
|
|
|
struct GPSData
|
|
{
|
|
float altitude; // Meters
|
|
float latitude; // Decimal degrees
|
|
float longitude; // Decimal degrees
|
|
};
|
|
|
|
|
|
struct CameraData
|
|
{
|
|
uint16_t height; // Pixels
|
|
uint16_t width; // Pixels
|
|
float pitch; // Degrees
|
|
float yaw; // Degrees
|
|
};
|
|
|
|
|
|
struct DroneData
|
|
{
|
|
GPSData gps;
|
|
float yaw; // Degrees
|
|
float pitch; // Degrees
|
|
float roll; // Degrees
|
|
};
|
|
|
|
|
|
class AiEngineGimbalServerActions : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit AiEngineGimbalServerActions(QObject *parent = nullptr);
|
|
|
|
public slots:
|
|
void setup(AiEngineGimbalServerUDP *udpSocket, AiEngineGimbalServerUDPCommand *udpCommand, AiEngineGimbalServerUDPResponse *udpResponse, AiEngineGimbalStatus *gimbalStatus);
|
|
AiEngineRectangleProperties calculateRectangleProperties(int top, int left, int bottom, int right);
|
|
void turnToTarget(AiEngineRectangleProperties rectangle);
|
|
void zoomToTarget(AiEngineRectangleProperties rectangle);
|
|
void getLocation(AiEngineDronePosition dronePosition, int targetIndex);
|
|
void restoreOrientationAndZoom(AiEngineGimbalStatus gimbalStatus);
|
|
|
|
signals:
|
|
void aiTargetZoomed(AiEngineTargetPosition);
|
|
|
|
private:
|
|
AiEngineGimbalServerUDP *mUdpSocket;
|
|
AiEngineGimbalServerUDPCommand *mUdpCommand;
|
|
AiEngineGimbalServerUDPResponse *mUdpResponse;
|
|
AiEngineGimbalStatus *mGimbalStatus;
|
|
|
|
private slots:
|
|
CameraData getCameraData(void);
|
|
void getAnglesToOnScreenTarget(int targetX, int targetY, float &resultYaw, float &resultPitch);
|
|
AiEngineGeoPosition calculateTargetLocation(DroneData drone, CameraData camera);
|
|
void calculateDistancesToTarget(float altitude, float cameraPitch, float &slantDistance, float &horizontalDistance);
|
|
float degreesToRadians(float degrees);
|
|
};
|