diff --git a/misc/gimbal-ai-api.h b/misc/gimbal-ai-api.h new file mode 100644 index 0000000..d2e7173 --- /dev/null +++ b/misc/gimbal-ai-api.h @@ -0,0 +1,65 @@ +// 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); +} +