Skip to main content

Camera Basic Function Management

Overview

To help developers quickly develop camera control features for Autel Robotics aircraft based on PSDK, Autel Robotics PSDK provides camera management functionality. Developers can use the camera management interface to simultaneously set and retrieve values for parameters such as ISO, aperture, shutter speed, and exposure on multiple cameras mounted on the aircraft. They can also control the camera to take photos, record videos, and perform zoom operations

Camera Management Functionality

When using the camera management functionality, developers need to first initialize the camera management module in PSDK. Then, based on actual use needs, they should set the camera mode. Finally, according to the user's logic, they can implement the required functionality, such as setting camera parameters or checking the status of different features. Below is an example for the Linux platform.

Functionality 4T 4T XE 4N 4TH PSDK
Basic Information Get Camera Type
Get Firmware Version
Get Camera Connection Status
Shooting Function Set/Get Working Mode
Set/Get Photo Mode
Start/Stop Photography
Set/Get Continuous Shooting Parameters - - - - -
Set/Get Timed Photography Parameters
Start/Stop Video Recording
Camera Photography Status -
Multi-Lens Photography Storage Settings -
Get Camera Photo Format Range
Set/Get Camera Photo Format
Get Timed Photography Countdown -
Recording Status -
Current Recording Video Duration -
Multi-Lens Video Storage Settings -
Get Camera Video Format Range
Set/Get Supported Video Formats
Get Camera Video Source Range
Get Camera Lens Video Resolution and Frame Rate
Zoom/Focus Functions Set/Get Focus Mode
Set/Get Focus Target
Start/Stop Continuous Optical Zoom -
Set/Get Optical Zoom Parameters -
Set Camera Manual Focus Value
Camera Basic Parameters Set/Get Exposure Mode
Set/Get ISO
Set/Get Aperture
Set/Get Shutter Speed
Set/Get Exposure Compensation Parameters
Camera Lens Auto Exposure Lock
Reset Camera Parameters
Media File Management Get Camera SD Card Storage Info -
Format Storage
Infrared Camera Functions Set Infrared Zoom Parameters -
Set/Get Gain Mode -
Set FFC Calibration Mode -
Manually Trigger FFC Calibration Mode -
Enable or Disable Zoom Linkage Function -
Metering Function Set Camera Lens Metering Mode
Camera Lens Spot Metering

Using Camera Management Functionality

1. Camera Management Module Initialization

To control camera functions on a payload device developed using PSDK, you must first call the UAV_CameraManager_Init() interface to initialize the camera management module.

USER_LOG_INFO("--> Step 1: Init camera manager module");
UAV_Test_WidgetLogAppend("--> Step 1: Init camera manager module");
returnCode = UAV_CameraManager_Init();
if (returnCode != UAV_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Init camera manager failed, error code: 0x%08X\r\n", returnCode);
goto exitCameraModule;
}

2. Get Camera Type and Version

Developers can retrieve the camera type and version on the aircraft by calling the UAV_CameraManager_GetCameraType and UAV_CameraManager_GetFirmwareVersion interfaces, respectively.

    USER_LOG_INFO("--> Step 2: Get camera type and version");
UAV_Test_WidgetLogAppend("--> Step 2: Get camera type and version");
returnCode = UAV_CameraManager_GetCameraType(&cameraType);
if (returnCode != UAV_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Get mounted camera's type failed, error code: 0x%08X\r\n",
returnCode);
goto exitCameraModule;
}
USER_LOG_INFO("Mounted camera's type is %s",
s_cameraTypeStrList[UAV_Test_CameraManagerGetCameraTypeIndex(cameraType)].cameraTypeStr);

returnCode = UAV_CameraManager_GetFirmwareVersion(&firmwareVersion);
if (returnCode != UAV_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Get mounted camera's firmware version failed, error code: 0x%08X\r\n",
returnCode);
goto exitCameraModule;
}
USER_LOG_INFO("Mounted camera's firmware is V%d.%d.%d.%d\r\n",
firmwareVersion.firmware_version[0], firmwareVersion.firmware_version[1],
firmwareVersion.firmware_version[2], firmwareVersion.firmware_version[3]);

3. Set or Get Camera Parameters

The camera management module provides a series of Set or Get interfaces to adjust camera parameters. For example, you can retrieve and set the camera's ISO parameter by calling the UAV_CameraManager_GetISO and UAV_CameraManager_SetISO interfaces, respectively.

T_UAVReturnCode returnCode;
E_UAVCameraManagerISO isoDataTemp;

returnCode = UAV_CameraManager_GetISO(&isoDataTemp);
if (returnCode != UAV_ERROR_SYSTEM_MODULE_CODE_SUCCESS &&
returnCode != UAV_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
USER_LOG_ERROR("Get mounted camera's iso failed, error code: 0x%08X.",
returnCode);
return returnCode;
}

if (isoDataTemp == isoData) {
USER_LOG_INFO("The mounted camera's iso is already what you expected.");
return UAV_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}

returnCode = UAV_CameraManager_SetISO(isoData);
if (returnCode != UAV_ERROR_SYSTEM_MODULE_CODE_SUCCESS &&
returnCode != UAV_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
USER_LOG_ERROR("Set mounted camera's iso %d failed, "
"error code: 0x%08X.", isoData, returnCode);
}

return returnCode;

4. Control Camera to Perform Specific Actions

Developers can execute specific camera actions by calling the corresponding interfaces. For example, by calling the UAV_CameraManager_StartShootPhoto interface, you can command the camera at a designated position to take a photo.

/*!< start to shoot single photo */
USER_LOG_INFO("Mounted position %d camera start to shoot photo", position);
returnCode = UAV_CameraManager_StartShootPhotoEx(position);
if (returnCode != UAV_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
USER_LOG_ERROR("Mounted position %d camera shoot photo failed, "
"error code :0x%08X", position, returnCode);
}