mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 22:06:34 +00:00
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
struct GPSData
|
|
{
|
|
float latitude; // Decimal degrees
|
|
float longitude; // Decimal degrees
|
|
float altitude; // Meters
|
|
};
|
|
|
|
struct CameraData
|
|
{
|
|
uint16_t height; // Pixels
|
|
uint16_t width; // Pixels
|
|
float pitch; // Degrees
|
|
float yaw; // Degrees
|
|
float fow; // Degrees
|
|
};
|
|
|
|
struct DroneData
|
|
{
|
|
GPSData gps;
|
|
float yaw; // Degrees
|
|
float pitch; // Degrees
|
|
float roll; // Degrees
|
|
};
|
|
|
|
class UtilsTargetLocation
|
|
{
|
|
public:
|
|
static GPSData getLocation(float altitude, float latitude, float lognitude, float yaw, float pitch, float roll, float targetTrueSize, uint16_t targetPixelSize);
|
|
static void getAnglesToOnScreenTarget(uint16_t targetX, uint16_t targetY, float &resultYaw, float &resultPitch);
|
|
|
|
private:
|
|
static CameraData getCameraData();
|
|
static float calculateTargetDistance(float targetSize, uint16_t targetPixelSize, uint16_t imageWidth, float fov);
|
|
static float degreesToRadians(float degrees);
|
|
static GPSData calculateTargetLocation(DroneData drone, CameraData camera, float distance, float bearing);
|
|
};
|