Files
autopilot/misc/gimbal-ai-api.h
T
2024-07-15 21:58:38 +02:00

66 lines
1.8 KiB
C++

// AiEngineGimbalControl class in the rtsp_ai_player program takes RemoteControl class as a member variable and probably puts it in the thread.
// Communication between AiEngineGimbalControl and RemoteControl object is normal Qt's signal-slots.
// API suggestion
// Common geoposition
typedef struct {
float lat;
float lon;
float alt;
} Position;
// AiEngineGimbalControl -> RemoteControl is sent when location or position of the drone changes.
typedef struct {
Position position;
float pitch;
float yaw;
} DronePosition;
// AiEngineGimbalControl -> RemoteControl when AI finds the target. Index is a new variable to keep track of the targets.
typedef struct {
int index;
int top;
int left;
int bottom;
int right;
} AiCameraTarget;
// RemoteControl -> AiEngineGimbalControl when RemoteControl has zoomed to the target defined in AiCameraTarget.
// position variable contains calculated geoposition of the target.
typedef struct {
int targetIndex;
Position position;
} TargetPosition;
// AiEngineGimbalControl -> RemoteControl when AI asks to change camera direction. For example nothing interesting was not found.
// RemoteControl -> AiEngineGimbalControl every few second so that AI knows the position of the camera.
typedef struct {
float yaw;
float pitch;
float zoom;
} CameraPosition;
class AiEngineGimbalControl {
signals:
void newDronePosition(DronePosition);
void zoomToAiTarget(AiCameraTarget);
void setCameraPosition(CameraPosition);
slots:
void aiTargetZoomedSlot(TargetPosition);
void cameraPositionSlot(CameraPosition);
}
class RemoteControl {
slots:
void dronePositionSlot(DronePosition);
void zoomToAiTargetSlot(AiCameraTarget);
void cameraPositionSlot(CameraPosition);
signals:
void aiTargetZoomed(TargetPosition);
void newCameraPosition(CameraPosition);
}