作者 ookk303

调整结构

要显示太多修改。

为保证性能只显示 17 of 17+ 个文件。

... ... @@ -31,6 +31,7 @@ project_build/Psdk312/*
project_build/特殊固件
project_build/DJI_Test
project_build/Psdk2257
project_build/zy_101
# project_build/Attention_提示程序
... ...
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
.a
.lib
# Executables
*.exe
*.out
*.app
cmake_minimum_required(VERSION 2.8)
if (NOT USE_SYSTEM_ARCH)
# select use platform 'LINUX' or 'RTOS' here, reset cache and reload cmake project
set(USE_SYSTEM_ARCH LINUX)
endif ()
if (USE_SYSTEM_ARCH MATCHES RTOS)
cmake_minimum_required(VERSION 3.15)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER arm-none-eabi-gcc)
set(CMAKE_AR arm-none-eabi-ar)
set(CMAKE_OBJCOPY arm-none-eabi-objcopy)
set(CMAKE_OBJDUMP arm-none-eabi-objdump)
set(SIZE arm-none-eabi-size)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
endif ()
project(entry)
# Disable in-source builds to prevent source tree corruption.
if (" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "FATAL: In-source builds are not allowed.
You should create a separate directory for build files.")
endif ()
if (USE_SYSTEM_ARCH MATCHES LINUX)
add_definitions(-DSYSTEM_ARCH_LINUX)
add_subdirectory(samples/sample_c/platform/linux/nvidia_jetson)
execute_process(COMMAND uname -m OUTPUT_VARIABLE DEVICE_SYSTEM_ID)
if (DEVICE_SYSTEM_ID MATCHES x86_64)
set(LIBRARY_PATH psdk_lib/lib/x86_64-linux-gnu)
elseif (DEVICE_SYSTEM_ID MATCHES aarch64)
set(LIBRARY_PATH psdk_lib/lib/aarch64-linux-gnu)
elseif (DEVICE_SYSTEM_ID MATCHES armv7l)
set(LIBRARY_PATH psdk_lib/lib/arm-linux-gnueabihf)
else ()
message(FATAL_ERROR "FATAL: Please confirm your platform.")
endif ()
install(FILES ${LIBRARY_PATH}/libpayloadsdk.a
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
)
install(DIRECTORY psdk_lib/include
DESTINATION "${CMAKE_INSTALL_PREFIX}"
)
elseif (USE_SYSTEM_ARCH MATCHES RTOS)
add_definitions(-DSYSTEM_ARCH_RTOS)
add_subdirectory(samples/sample_c/platform/rtos_freertos/stm32f4_discovery/project/armgcc)
endif ()
add_custom_target(${PROJECT_NAME} ALL)
# Ziyan Payload SDK (PSDK)
## What is the Ziyan Payload SDK?
The ziyan Payload SDK(PSDK), is a development kit provided by ziyan to support developers to develop payload that can be mounted on ziyan aircraft. developers can obtain the information or other resource from the aircraft. According to the software logic and algorithm framework designed by the developer, users could develop payload that can be mounted on ziyan aircraft, to perform actions they need, such as Automated Flight Controller, Payload Controller, Video Image Analysis Platform, Mapping Camera, Megaphone And Searchlight, etc.
## Latest Release
The latest release version of PSDK is 1.0.0.0 This version of Payload SDK mainly first release. Please refer to the release notes for detailed changes list.
## License
Payload SDK codebase is MIT-licensed. Please refer to the LICENSE file for detailed information.
# Ziyan Payload SDK Release Log
## V1.1.1.0-20250721-Release
**[Note]**:
* Refactored the camera range finder handler and separated it into an independent interface.
* Introduced a new camera API to support the camera tracker.
* Resolved several known issues.
**[Added]**:
* Added support for the camera tracker feature. Introduced new APIs for controlling the camera tracker integrated with the payload camera, and exposed additional tracking status feedback data.
* Separated the camera range finder into a dedicated interface to improve modularity.
**[Optimized]**:
* Optimized the video streaming transmission mechanism for improved efficiency and stability.
* Enhanced core task monitoring by periodically reporting tasks with abnormal execution time, ensuring stable and reliable system behavior.
**[Fixed]**:
* Fixed an issue where the widget module ignored items with an index greater than 256.
----
## V1.1.0.0-20250620-Release
**[Note]**:
* Introduced a new self-checking mechanism.
* Fixed several known issues.
**[Added]**:
* Added support for the self-checking mechanism. Users will now be prompted to update their PSPK version in the event of communication or version mismatches.
* Added support for the I2C communication protocol.
**[Optimized]**:
* Optimized the widget configuration file loading method. UAVs can now load configuration files dynamically.
* Optimized the speaker module to improve real-time speaker and TTS (text-to-speech) transmission logic.
* Refined the core initialization logic.
**[Fixed]**:
* Fixed an issue where the widget module occasionally failed to load the configuration file, causing the Ziyan app to not display payload widget information.
* Fixed an issue where log timestamps were displayed abnormally.
---
## V1.0.0.4-20250603-Release
**[Note]**:
* Added new module.
* Fixed some known issues.
**[Added]**:
* Add support for the speaker module.
**[Optimized]**:
* Optimize the core initialization process and provide more log information to support developers in quickly identifying the cause of exceptions during the adaptation process.
**[Fixed]**:
* Fix issues that may cause abnormal program termination in specific communication scenarios.
* Fix the issue of strong coupling between the sample program and the system environment
---
## V1.0.0.3-20250429-Release
**[Note]**:
To support more camera expansion features, Add new camera API. Fixed some known issues.
**[Added]**:
* Adjust the feedback frequency of the camera status, support the remote control to refresh data at a higher frequency, and ensure real-time display.
* Add diverse debugging options
**[Fixed]**:
* Fix the dependency of the sample program and run the samples based on the computer system environment where they were compiled.
---
## V1.0.0.2-20250401-Release
**[Note]**:
To support more camera expansion features, Add new camera API. Fixed some known issues.
**[Added]**:
* Add API which used to get obtain camera calculation position.
* Add API which used to control the camera tracker integrated into the payload camera.
**[Fixed]**:
* Fix the issue that the camera status is not updated when the camera has connected.
* Fix occasional screen distortion in camera videos
---
## V1.0.0.1-20250310-Release
**[Note]**:
To support more camera expansion features, Add new camera API. Fixed some known issues.
**[Added]**:
* Add API which used to control the range finder integrated into the payload camera.
---
## V1.0.0.0-20250306-Release
**[Note]**:
This version of Payload SDK mainly first release. Please refer to the release notes for detailed changes list.
**[Added]**:
* Added support for gimbal functionality
* Added support for basic camera functionality
* Added support for widget functionality
* Added support for subscription functionality
---
/**
********************************************************************
* @file ziyan_aircraft_info.h
* @brief This is the header file for "ziyan_aircraft_info.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_AIRCRAFT_INFO_H
#define ZIYAN_AIRCRAFT_INFO_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Information related to mobile APP.
*/
typedef struct {
E_ZiyanMobileAppLanguage appLanguage; /*!< Mobile APP system language */
E_ZiyanMobileAppScreenType appScreenType; /*!< Mobile APP screen size type. */
} T_ZiyanMobileAppInfo;
/**
* @brief Basic information about the aircraft system, mainly including some constant parameters information.
*/
typedef struct {
E_ZiyanAircraftSeries aircraftSeries; /*!< Aircraft series. */
E_ZiyanMountPositionType mountPositionType; /*!< Mount position type. */
E_ZiyanAircraftType aircraftType; /*!< Aircraft type. */
E_ZiyanSdkAdapterType ziyanAdapterType; /*!< ZIYAN adapter type. */
E_ZiyanMountPosition mountPosition; /*!< Payload mount position. */
} T_ZiyanAircraftInfoBaseInfo;
/**
* @brief Aircraft version information.
*/
typedef struct {
uint8_t debugVersion;
uint8_t modifyVersion;
uint8_t minorVersion;
uint8_t majorVersion;
} T_ZiyanAircraftVersion;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Basic information about the aircraft system, including aircraft type and ZIYAN adapter type.
* @param baseInfo: Pointer to a memory space where the aircraft's basic information will be stored.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanAircraftInfo_GetBaseInfo(T_ZiyanAircraftInfoBaseInfo *baseInfo);
/**
* @brief Get information related to mobile app.
* @note Returns unknown for app language and screen type if the RC or app is not connected to the aircraft system.
* @param mobileAppInfo: Pointer to a memory space where the mobile app information will be stored.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanAircraftInfo_GetMobileAppInfo(T_ZiyanMobileAppInfo *mobileAppInfo);
/**
* @brief Get connection status between the payload and the aircraft.
* @note Update period: 1Hz
* @param isConnected: Pointer to connection status.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanAircraftInfo_GetConnectionStatus(bool *isConnected);
/**
* @brief Get version of the aircraft.
* @param aircraftVersion: Pointer to aircraft version.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanAircraftInfo_GetAircraftVersion(T_ZiyanAircraftVersion *aircraftVersion);
#ifdef __cplusplus
}
#endif
#endif //ZIYAN_AIRCRAFT_INFO_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/
/**
********************************************************************
* @file ziyan_camera_manager.h
* @brief This is the header file for "ziyan_camera_manager.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_CAMERA_MANAGER_H
#define ZIYAN_CAMERA_MANAGER_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/*! @brief CameraModule work modes.
*/
typedef enum {
/*!
- Capture mode. In this mode, the user can capture pictures.
*/
ZIYAN_CAMERA_MANAGER_WORK_MODE_SHOOT_PHOTO = 0,
/*!
- Record mode. In this mode, the user can record videos.
*/
ZIYAN_CAMERA_MANAGER_WORK_MODE_RECORD_VIDEO = 1,
/*!
- Playback mode. In this mode, the user can preview photos and videos, and
can delete files. It is supported by Phantom 3 Professional camera, X3, X5
and X5R cameras on aircraft and Phantom 4 camera. Playback mode is not
supported by Z30, X5S, X4S, Phantom 4 Pro, Mavic Pro, Phantom 3 Standard,
Phantom 3 Advanced, Phantom 3 4K and Osmo series.
*/
ZIYAN_CAMERA_MANAGER_WORK_MODE_PLAYBACK = 2,
/*!
- In this mode, the user can download media to the Mobile Device. Not
supported by X5 camera nor X5R camera while mounted on aircraft.
*/
ZIYAN_CAMERA_MANAGER_WORK_MODE_MEDIA_DOWNLOAD = 3,
/*!
- In this mode, live stream resolution and frame rate will be 1080i50 (PAL)
or 720p60 (NTSC). In this mode videos can be recorded. Still photos can
also be taken only when video is recording. The only way to exit broadcast
mode is to change modes to RECORD_VIDEO. Only supported by Inspire 2.
*/
ZIYAN_CAMERA_MANAGER_WORK_MODE_BROADCAST = 4,
/*!
* The camera work mode is unknown.
*/
ZIYAN_CAMERA_MANAGER_WORK_MODE_WORK_MODE_UNKNOWN = 0xFF,
} E_ZiyanCameraManagerWorkMode;
/*! @brief The ShootPhoto mode itself can have several modes. The default
* value is SINGLE.
*/
typedef enum {
/*!
- Sets the camera to take a single photo.
*/
ZIYAN_CAMERA_MANAGER_SHOOT_PHOTO_MODE_SINGLE = 0x01,
/*!
- Sets the camera to take an HDR photo. X5 camera, X5R camera, XT camera,
Z30 camera, Phantom 4 Pro camera, X4S camera and X5S camera do not support
HDR mode.
*/
ZIYAN_CAMERA_MANAGER_SHOOT_PHOTO_MODE_HDR = 0x02,
/*!
- Set the camera to take multiple photos at once. XT camera does not
support Burst mode.
*/
ZIYAN_CAMERA_MANAGER_SHOOT_PHOTO_MODE_BURST = 0x04,
/*!
- Automatic Exposure Bracketing (AEB) capture. In this mode you can quickly
take multiple shots (the default is 3) at different exposures without
having to manually change any settings between frames. XT camera and Z30
camera does not support AEB mode.
*/
ZIYAN_CAMERA_MANAGER_SHOOT_PHOTO_MODE_AEB = 0x05,
/*!
- Sets the camera to take a picture (or multiple pictures) continuously at
a set time interval. The minimum interval for JPEG format of any quality is
2s. For all cameras except X4S, X5S and Phantom 4 Pro camera: The minimum
interval for RAW or RAW+JPEG format is 10s. For the X4S, X5S and Phantom 4
Pro cameras the minimum interval for RAW or RAW+JPEG dformat is 5s.
*/
ZIYAN_CAMERA_MANAGER_SHOOT_PHOTO_MODE_INTERVAL = 0x06,
/*!
- Sets the camera to take a burst of RAW photos. Use getRAWPhotoBurstCount
to check how many photos have been shot. Only supported by X5S.
*/
ZIYAN_CAMERA_MANAGER_SHOOT_PHOTO_MODE_RAW_BURST = 0x09,
/*!
- Sets the camera to take an regional photos. It is supported by H20/H20T.
*/
ZIYAN_CAMERA_MANAGER_SHOOT_PHOTO_MODE_REGIONAL_SR = 0x16,
/*!
- The shoot photo mode is unknown.
*/
ZIYAN_CAMERA_MANAGER_SHOOT_PHOTO_MODE_UNKNOWN = 0xFF,
} E_ZiyanCameraManagerShootPhotoMode;
/*! @brief the photo action of INTERVAL shooting photo mode
*/
typedef enum {
ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_PROGRAM_AUTO = 1, /*!< Program mode */
ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_SHUTTER_PRIORITY = 2, /*!< Shutter priority mode */
ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_APERTURE_PRIORITY = 3, /*!< Aperture priority mode */
ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_EXPOSURE_MANUAL = 4, /*!< Manual mode */
ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_EXPOSURE_UNKNOWN = 0xFF /*!< The camera exposure mode is unknown. */
} E_ZiyanCameraManagerExposureMode;
/*! @brief CameraModule focus mode. If the physical AF switch on the camera is
* set to auto.
*/
typedef enum {
/*!
- The camera's focus mode is set to manual. In this mode, user sets the
focus ring value to adjust the focal distance.
*/
ZIYAN_CAMERA_MANAGER_FOCUS_MODE_MANUAL = 0,
/*!
- The camera's focus mode is set to auto. For the Z30 camera, the focus is
calculated completely automatically. For all other cameras, a focus target
can be set by the user, which is used to calculate focus automatically.
*/
ZIYAN_CAMERA_MANAGER_FOCUS_MODE_AUTO = 1,
/*!
- The camera's focus mode is set to Continuous AF. It is only supported by
Mavic Pro with firmware version V01.03.0000 or above, X4S camera, Mavic 2
Zoom camera and Mavic 2 Pro camera.
*/
ZIYAN_CAMERA_MANAGER_FOCUS_MODE_AFC = 2,
/*!
- The camera's focus mode is unknown.
*/
ZIYAN_CAMERA_MANAGER_FOCUS_MODE_UNKNOWN = 0xFF,
} E_ZiyanCameraManagerFocusMode;
/*! @brief CameraModule shutter mode.
*/
typedef enum {
/*! The shutter mode of camera is automatical */
ZIYAN_CAMERA_MANAGER_SHUTTER_AUTO_MODE = 0x00,
/*! The shutter mode of camera is manual, the shutter speed setting is
valid. */
ZIYAN_CAMERA_MANAGER_SHUTTER_MANUAL_MODE = 0x01,
} E_ZiyanCameraManagerShutterMode;
/*! @brief CameraModule shutter speed values.
*/
typedef enum {
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_8000 = 0, /*!< 1/8000 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_6400 = 1, /*!< 1/6400 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_6000 = 2, /*!< 1/6000 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_5000 = 3, /*!< 1/5000 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_4000 = 4, /*!< 1/4000 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_3200 = 5, /*!< 1/3200 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_3000 = 6, /*!< 1/3000 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_2500 = 7, /*!< 1/2500 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_2000 = 8, /*!< 1/2000 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_1600 = 9, /*!< 1/1600 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_1500 = 10, /*!< 1/1500 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_1250 = 11, /*!< 1/1250 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_1000 = 12, /*!< 1/1000 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_800 = 13, /*!< 1/800 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_725 = 14, /*!< 1/725 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_640 = 15, /*!< 1/640 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_500 = 16, /*!< 1/500 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_400 = 17, /*!< 1/400 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_350 = 18, /*!< 1/350 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_320 = 19, /*!< 1/320 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_250 = 20, /*!< 1/250 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_240 = 21, /*!< 1/240 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_200 = 22, /*!< 1/200 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_180 = 23, /*!< 1/180 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_160 = 24, /*!< 1/160 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_125 = 25, /*!< 1/125 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_120 = 26, /*!< 1/120 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_100 = 27, /*!< 1/100 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_90 = 28, /*!< 1/90 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_80 = 29, /*!< 1/80 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_60 = 30, /*!< 1/60 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_50 = 31, /*!< 1/50 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_40 = 32, /*!< 1/40 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_30 = 33, /*!< 1/30 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_25 = 34, /*!< 1/25 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_20 = 35, /*!< 1/20 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_15 = 36, /*!< 1/15 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_12DOT5 = 37, /*!< 1/12.5 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_10 = 38, /*!< 1/10 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_8 = 39, /*!< 1/8 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_6DOT25 = 40, /*!< 1/6.25 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_5 = 41, /*!< 1/5 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_4 = 42, /*!< 1/4 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_3 = 43, /*!< 1/3 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_2DOT5 = 44, /*!< 1/2.5 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_2 = 45, /*!< 1/2 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_1DOT67 = 46, /*!< 1/1.67 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1_1DOT25 = 47, /*!< 1/1.25 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1 = 48, /*!< 1.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1DOT3 = 49, /*!< 1.3 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_1DOT6 = 50, /*!< 1.6 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_2 = 51, /*!< 2.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_2DOT5 = 52, /*!< 2.5 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_3 = 53, /*!< 3.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_3DOT2 = 54, /*!< 3.2 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_4 = 55, /*!< 4.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_5 = 56, /*!< 5.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_6 = 57, /*!< 6.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_7 = 58, /*!< 7.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_8 = 59, /*!< 8.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_9 = 60, /*!< 9.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_10 = 61, /*!< 10.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_13 = 62, /*!< 13.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_15 = 63, /*!< 15.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_20 = 64, /*!< 20.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_25 = 65, /*!< 25.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_30 = 66, /*!< 30.0 s */
ZIYAN_CAMERA_MANAGER_SHUTTER_SPEED_UNKNOWN = 0xFF, /*!< Unknown */
} E_ZiyanCameraManagerShutterSpeed;
/*! @brief CameraModule ISO values.
*/
typedef enum {
/*! The ISO value is automatically set. This cannot be used for all cameras
when in Manual mode. */
ZIYAN_CAMERA_MANAGER_ISO_AUTO = 0x00,
/*! The ISO value is set to 100. */
ZIYAN_CAMERA_MANAGER_ISO_100 = 0x03,
/*! The ISO value is set to 200. */
ZIYAN_CAMERA_MANAGER_ISO_200 = 0x04,
/*! The ISO value is set to 400.*/
ZIYAN_CAMERA_MANAGER_ISO_400 = 0x05,
/*! The ISO value is set to 800.*/
ZIYAN_CAMERA_MANAGER_ISO_800 = 0x06,
/*! The ISO value is set to 1600.*/
ZIYAN_CAMERA_MANAGER_ISO_1600 = 0x07,
/*! The ISO value is set to 3200.*/
ZIYAN_CAMERA_MANAGER_ISO_3200 = 0x08,
/*! The ISO value is set to 6400.*/
ZIYAN_CAMERA_MANAGER_ISO_6400 = 0x09,
/*! The ISO value is set to 12800.*/
ZIYAN_CAMERA_MANAGER_ISO_12800 = 0x0A,
/*! The ISO value is set to 25600.*/
ZIYAN_CAMERA_MANAGER_ISO_25600 = 0x0B,
/*! ISO value is fixed by the camera firmware. When the camera color is set
to D_LOG, camera will fix the ISO to a specific value in order to optimize
the performance.
*/
ZIYAN_CAMERA_MANAGER_ISO_FIXED = 0xFF,
} E_ZiyanCameraManagerISO;
/*! @brief CameraModule exposure compensation.
*/
typedef enum {
/*! The camera's exposure compensation is -5.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_5_0 = 1,
/*! The camera's exposure compensation is -4.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_4_7 = 2,
/*! The camera's exposure compensation is -4.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_4_3 = 3,
/*! The camera's exposure compensation is -4.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_4_0 = 4,
/*! The camera's exposure compensation is -3.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_3_7 = 5,
/*! The camera's exposure compensation is -3.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_3_3 = 6,
/*! The camera's exposure compensation is -3.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_3_0 = 7,
/*! The camera's exposure compensation is -2.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_2_7 = 8,
/*! The camera's exposure compensation is -2.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_2_3 = 9,
/*! The camera's exposure compensation is -2.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_2_0 = 10,
/*! The camera's exposure compensation is -1.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_1_7 = 11,
/*! The camera's exposure compensation is -1.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_1_3 = 12,
/*! The camera's exposure compensation is -1.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_1_0 = 13,
/*! The camera's exposure compensation is -0.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_0_7 = 14,
/*! The camera's exposure compensation is -0.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_0_3 = 15,
/*! The camera's exposure compensation is 0.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_N_0_0 = 16,
/*! The camera's exposure compensation is +0.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_0_3 = 17,
/*! The camera's exposure compensation is +0.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_0_7 = 18,
/*! The camera's exposure compensation is +1.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_1_0 = 19,
/*! The camera's exposure compensation is +1.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_1_3 = 20,
/*! The camera's exposure compensation is +1.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_1_7 = 21,
/*! The camera's exposure compensation is +2.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_2_0 = 22,
/*! The camera's exposure compensation is +2.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_2_3 = 23,
/*! The camera's exposure compensation is +2.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_2_7 = 24,
/*! The camera's exposure compensation is +3.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_3_0 = 25,
/*! The camera's exposure compensation is +3.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_3_3 = 26,
/*! The camera's exposure compensation is +3.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_3_7 = 27,
/*! The camera's exposure compensation is +4.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_4_0 = 28,
/*! The camera's exposure compensation is +4.3ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_4_3 = 29,
/*! The camera's exposure compensation is +4.7ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_4_7 = 30,
/*! The camera's exposure compensation is +5.0ev.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_P_5_0 = 31,
/*! The camera's exposure compensation is fixed by the camera.*/
ZIYAN_CAMERA_MANAGER_EXPOSURE_COMPENSATION_FIXED = 0xFF,
} E_ZiyanCameraManagerExposureCompensation;
/*! @brief CameraModule aperture values.
* @note X5, X5R, Z30, Phantom 4 Pro camera, X4S and X5S support this
* setting.
*/
typedef enum {
/*! The Aperture value is f/1.6. It is only supported by Z30
camera.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_1_DOT_6 = 160,
/*! The Aperture value is f/1.7.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_1_DOT_7 = 170,
/*! The Aperture value is f/1.8.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_1_DOT_8 = 180,
/*! The Aperture value is f/2.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_2 = 200,
/*! The Aperture value is f/2.2.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_2_DOT_2 = 220,
/*! The Aperture value is f/2.4. It is only supported by Z30 camera.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_2_DOT_4 = 240,
/*! The Aperture value is f/2.5.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_2_DOT_5 = 250,
/*! The Aperture value is f/2.6.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_2_DOT_6 = 260,
/*! The Aperture value is f/2.8.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_2_DOT_8 = 280,
/*! The Aperture value is f/3.2.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_3_DOT_2 = 320,
/*! The Aperture value is f/3.4.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_3_DOT_4 = 340,
/*! The Aperture value is f/3.5.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_3_DOT_5 = 350,
/*! The Aperture value is f/4.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_4 = 400,
/*! The Aperture value is f/4.5.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_4_DOT_5 = 450,
/*! The Aperture value is f/4.8.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_4_DOT_8 = 480,
/*! The Aperture value is f/5.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_5 = 500,
/*! The Aperture value is f/5.6.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_5_DOT_6 = 560,
/*! The Aperture value is f/6.3.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_6_DOT_3 = 630,
/*! The Aperture value is f/6.8.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_6_DOT_8 = 680,
/*! The Aperture value is f/7.1.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_7_DOT_1 = 710,
/*! The Aperture value is f/8.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_8 = 800,
/*! The Aperture value is f/9.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_9 = 900,
/*! The Aperture value is f/9.6.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_9_DOT_6 = 960,
/*! The Aperture value is f/10.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_10 = 1000,
/*! The Aperture value is f/11.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_11 = 1100,
/*! The Aperture value is f/13.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_13 = 1300,
/*! The Aperture value is f/14.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_14 = 1400,
/*! The Aperture value is f/16.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_16 = 1600,
/*! The Aperture value is f/18.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_18 = 1800,
/*! The Aperture value is f/19.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_19 = 1900,
/*! The Aperture value is f/20.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_20 = 2000,
/*! The Aperture value is f/22.*/
ZIYAN_CAMERA_MANAGER_APERTURE_F_22 = 2200,
/*! The Aperture value is Unknown. */
ZIYAN_CAMERA_MANAGER_APERTURE_F_UNKNOWN = 0xFFFF,
} E_ZiyanCameraManagerAperture;
typedef enum {
ZIYAN_CAMERA_MANAGER_RECORDING_CONTROL_STOP = 0,
ZIYAN_CAMERA_MANAGER_RECORDING_CONTROL_BEGIN = 1,
ZIYAN_CAMERA_MANAGER_RECORDING_CONTROL_PAUSE = 2,
ZIYAN_CAMERA_MANAGER_RECORDING_CONTROL_RESUME = 3,
} E_ZiyanCameraManagerRecordingControl;
typedef enum {
ZIYAN_CAMERA_MANAGER_FILE_LIST_COUNT_60_PER_SLICE = 60,
ZIYAN_CAMERA_MANAGER_FILE_LIST_COUNT_120_PER_SLICE = 120,
ZIYAN_CAMERA_MANAGER_FILE_LIST_COUNT_ALL_PER_SLICE = 0xFFFF,
} E_ZiyanCameraManagerFileListCountPerSlice;
typedef enum {
ZIYAN_CAMERA_MANAGER_SOURCE_DEFAULT_CAM = 0x0,
ZIYAN_CAMERA_MANAGER_SOURCE_WIDE_CAM = 0x1,
ZIYAN_CAMERA_MANAGER_SOURCE_ZOOM_CAM = 0x2,
ZIYAN_CAMERA_MANAGER_SOURCE_IR_CAM = 0x3,
ZIYAN_CAMERA_MANAGER_SOURCE_VISIBLE_CAM = 0x7,
} E_ZiyanCameraManagerStreamSource, E_ZiyanCameraManagerStreamStorage;
typedef enum {
ZIYAN_CAMERA_MANAGER_NIGHT_SCENE_MODE_DISABLE = 0,
ZIYAN_CAMERA_MANAGER_NIGHT_SCENE_MODE_ENABLE = 1,
ZIYAN_CAMERA_MANAGER_NIGHT_SCENE_MODE_AUTO = 2,
} E_ZiyanCameraManagerNightSceneMode;
typedef enum {
ZIYAN_CAMERA_MANAGER_CAPTURE_OR_RECORDING_CAPTURE = 0,
ZIYAN_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING = 1,
} E_ZiyanCameraManagerCaptureOrRecording;
typedef enum {
ZIYAN_CAMERA_MANAGER_EXPAND_NAME_TYPE_FILE = 1,
ZIYAN_CAMERA_MANAGER_EXPAND_NAME_TYPE_DIR = 2,
} E_ZiyanCameraManagerExpandNameType;
typedef enum {
ZIYAN_CAMERA_MANAGER_PHOTO_RATIO_4X3 = 0,
ZIYAN_CAMERA_MANAGER_PHOTO_RATIO_16X9 = 1,
ZIYAN_CAMERA_MANAGER_PHOTO_RATIO_3X2 = 2,
ZIYAN_CAMERA_MANAGER_PHOTO_RATIO_1X1 = 3,
ZIYAN_CAMERA_MANAGER_PHOTO_RATIO_18X3 = 4,
ZIYAN_CAMERA_MANAGER_PHOTO_RATIO_5X4 = 5,
} E_ZiyanCameraManagerPhotoRatio;
typedef struct {
uint8_t firmware_version[4];
} T_ZiyanCameraManagerFirmwareVersion;
/*! @brief Tap zoom target point data struct, used by user.
*/
typedef T_ZiyanCameraPointInScreen T_ZiyanCameraManagerTapZoomPosData;
/*! @brief Tap focus target point data struct, used by user.
*/
typedef T_ZiyanCameraPointInScreen T_ZiyanCameraManagerFocusPosData;
typedef struct {
ziyan_f32_t currentOpticalZoomFactor;
ziyan_f32_t maxOpticalZoomFactor;
} T_ZiyanCameraManagerOpticalZoomParam;
typedef struct {
uint8_t second;
uint8_t minute;
uint8_t hour;
uint8_t day;
uint8_t month;
uint16_t year;
} T_ZiyanCameraManagerFileCreateTime;
typedef struct {
union {
struct {
uint32_t attributePhotoReserved: 22;
uint32_t attributePhotoRatio: 8;
uint32_t attributePhotoRotation: 2;
uint8_t reserved[12];
} photoAttribute;
struct {
uint32_t attributeVideoDuration: 16;
uint32_t attributeVideoFramerate: 6;
uint32_t attributeVideoRotation: 2;
uint32_t attributeVideoResolution: 8;
uint8_t reserved[12];
} videoAttribute;
};
} T_ZiyanCameraManagerFileAttributeData;
typedef struct {
char fileName[ZIYAN_FILE_NAME_SIZE_MAX];
uint32_t fileSize;
uint32_t fileIndex;
T_ZiyanCameraManagerFileCreateTime createTime;
E_ZiyanCameraMediaFileSubType type;
T_ZiyanCameraManagerFileAttributeData attributeData;
} T_ZiyanCameraManagerSubFileListInfo;
typedef struct {
char fileName[ZIYAN_FILE_NAME_SIZE_MAX];
uint32_t fileSize;
uint32_t fileIndex;
T_ZiyanCameraManagerFileCreateTime createTime;
E_ZiyanCameraMediaFileType type;
T_ZiyanCameraManagerFileAttributeData attributeData;
uint8_t subFileListTotalNum;
T_ZiyanCameraManagerSubFileListInfo* subFileListInfo;
} T_ZiyanCameraManagerFileListInfo;
typedef struct {
uint16_t totalCount;
T_ZiyanCameraManagerFileListInfo *fileListInfo;
} T_ZiyanCameraManagerFileList;
typedef struct {
uint16_t sliceStartIndex;
E_ZiyanCameraManagerFileListCountPerSlice countPerSlice;
} T_ZiyanCameraManagerSliceConfig;
typedef enum {
ZIYAN_DOWNLOAD_FILE_EVENT_START,
ZIYAN_DOWNLOAD_FILE_EVENT_TRANSFER,
ZIYAN_DOWNLOAD_FILE_EVENT_END,
ZIYAN_DOWNLOAD_FILE_EVENT_START_TRANSFER_END,
} E_ZiyanDownloadFileEvent;
typedef enum {
ZIYAN_CAMERA_MANAGER_VIDEO_RESOLUTION_640X480P = 0, // 640X480P
ZIYAN_CAMERA_MANAGER_VIDEO_RESOLUTION_1280X640P = 2, // 1280X640P
ZIYAN_CAMERA_MANAGER_VIDEO_RESOLUTION_1280X720P = 4, // 1280X720P
ZIYAN_CAMERA_MANAGER_VIDEO_RESOLUTION_1920X1080P = 10, // 1920X1080P
ZIYAN_CAMERA_MANAGER_VIDEO_RESOLUTION_3840X2160P = 16, // 3840X2160P
} E_ZiyanCameraManagerVideoResolution;
typedef enum {
ZIYAN_CAMERA_MANAGER_VIDEO_FRAME_RATE_15FPS = 0, // 14.985
ZIYAN_CAMERA_MANAGER_VIDEO_FRAME_RATE_25FPS = 2, // 25.000
ZIYAN_CAMERA_MANAGER_VIDEO_FRAME_RATE_30FPS = 3, // 29.970
ZIYAN_CAMERA_MANAGER_VIDEO_FRAME_RATE_60FPS = 6, // 59.940
} E_ZiyanCameraManagerVideoFrameRate;
typedef enum {
ZIYAN_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_RAW = 0,
ZIYAN_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_JPEG = 1,
ZIYAN_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_RAW_JPEG = 2,
ZIYAN_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_YUV = 3, // Save as YUV format image
ZIYAN_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_RJPEG = 7, // Radiometric JPEG
} E_ZiyanCameraManagerPhotoStorageFormat;
typedef enum {
ZIYAN_CAMERA_MANAGER_VIDEO_STORAGE_FORMAT_MOV = 0,
ZIYAN_CAMERA_MANAGER_VIDEO_STORAGE_FORMAT_MP4 = 1,
} E_ZiyanCameraManagerVideoStorageFormat;
typedef enum {
ZIYAN_CAMERA_MANAGER_METERING_MODE_CENTRAL = 0,
ZIYAN_CAMERA_MANAGER_METERING_MODE_AVERAGE = 1,
ZIYAN_CAMERA_MANAGER_METERING_MODE_SPOT = 2,
} E_ZiyanCameraManagerMeteringMode;
typedef enum {
ZIYAN_CAMERA_MANAGER_FFC_MODE_MANUAL = 0,
ZIYAN_CAMERA_MANAGER_FFC_MODE_AUTO = 1,
} E_ZiyanCameraManagerFfcMode;
typedef enum {
ZIYAN_CAMERA_MANAGER_IR_GAIN_MODE_AUTO = 0,
ZIYAN_CAMERA_MANAGER_IR_GAIN_MODE_LOW = 1,
ZIYAN_CAMERA_MANAGER_IR_GAIN_MODE_HIGH = 2,
} E_ZiyanCameraManagerIrGainMode;
typedef enum {
/* Camera is not capturing photos*/
ZIYAN_CAMERA_MANAGER_CAPTURING_STATE_IDLE = 0,
/* Camera is capturing a single photo */
ZIYAN_CAMERA_MANAGER_CAPTURING_STATE_SINGLE = 1,
/* Camera is capturing multiple photos */
ZIYAN_CAMERA_MANAGER_CAPTURING_STATE_MULTI = 2,
} E_ZiyanCameraManagerCapturingState;
typedef enum {
ZIYAN_CAMERA_MANAGER_RECORDING_STATE_IDLE = 0,
ZIYAN_CAMERA_MANAGER_RECORDING_STATE_STARTING = 1,
ZIYAN_CAMERA_MANAGER_RECORDING_STATE_RECORDING = 2,
ZIYAN_CAMERA_MANAGER_RECORDING_STATE_STOPPING = 3,
} E_ZiyanCameraManagerRecordingState;
/*! @brief: when the remote control is in split-screen mode, the coordinate range of the x-axis is 0-0.5.
*/
typedef struct {
ziyan_f32_t pointX; /*! x-coordinate of point thermometry, range: 0-1 */
ziyan_f32_t pointY; /*! y-coordinate of point thermometry, range: 0-1 */
} T_ZiyanCameraManagerPointThermometryCoordinate;
typedef struct {
ziyan_f32_t areaTempLtX; /*! x-coordinate of the upper left corner of the area thermometry, range: 0-1 */
ziyan_f32_t areaTempLtY; /*! y-coordinate of the upper left corner of the area thermometry, range: 0-1 */
ziyan_f32_t areaTempRbX; /*! x-coordinate of the lower right corner of the area thermometry, range: 0-1 */
ziyan_f32_t areaTempRbY; /*! y-coordinate of the lower right corner of the area thermometry, range: 0-1 */
} T_ZiyanCameraManagerAreaThermometryCoordinate;
//result of point thermometry
typedef struct {
ziyan_f32_t pointX; /*! x-coordinate of point thermometry, range: 0-1 */
ziyan_f32_t pointY; /*! y-coordinate of point thermometry, range: 0-1 */
ziyan_f32_t pointTemperature; /*! The temperature of the current point */
} T_ZiyanCameraManagerPointThermometryData;
//result of area thermometry
typedef struct {
ziyan_f32_t areaTempLtX; /*! x_coordinate of the upper left corner of the current thermometry area */
ziyan_f32_t areaTempLtY; /*! y_coordinate of the upper left corner of the current thermometry area */
ziyan_f32_t areaTempRbX; /*! x_coordinate of the lower right corner of the current thermometry area */
ziyan_f32_t areaTempRbY; /*! y_coordinate of the lower right corner of the current thermometry area */
ziyan_f32_t areaAveTemp; /*! The average temperature of the current thermometry area */
ziyan_f32_t areaMinTemp; /*! The minimum temperature of the current thermometry area */
ziyan_f32_t areaMaxTemp; /*! The maximum temperature of the current thermometry area */
ziyan_f32_t areaMinTempPointX; /*! x_coordinate of the minimum temperature in the thermometry area */
ziyan_f32_t areaMinTempPointY; /*! y_coordinate of the minimum temperature in the thermometry area */
ziyan_f32_t areaMaxTempPointX; /*! x_coordinate of the maximum temperature in the thermometry area */
ziyan_f32_t areaMaxTempPointY; /*! y_coordinate of the maximum temperature in the thermometry area */
} T_ZiyanCameraManagerAreaThermometryData;
typedef struct {
E_ZiyanDownloadFileEvent downloadFileEvent;
uint8_t fileType;
uint32_t fileIndex;
uint32_t fileSize;
ziyan_f32_t progressInPercent;
} T_ZiyanDownloadFilePacketInfo;
typedef struct {
ziyan_f64_t longitude; /*! Range: [-180,180] */
ziyan_f64_t latitude; /*! Range: [-90,90] */
int32_t altitude; /*! Unit: 0.1m */
int32_t distance; /*! Unit: 0.1m */
int16_t screenX; /*! Unit: 0.1% */
int16_t screenY; /*! Unit: 0.1% */
bool enable_lidar;
uint8_t exception;
} T_ZiyanCameraManagerLaserRangingInfo;
typedef struct {
uint32_t size;
E_ZiyanCameraManagerStreamSource streamSource[4];
E_ZiyanCameraManagerStreamStorage streamStorage[4];
} T_ZiyanCameraManagerStreamList;
typedef struct {
E_ZiyanCameraManagerVideoResolution videoResolution;
E_ZiyanCameraManagerVideoFrameRate videoFrameRate;
} T_ZiyanCameraManagerVideoFormat;
typedef struct {
uint8_t size;
union {
E_ZiyanCameraManagerPhotoStorageFormat photoStorageFormat[16];
E_ZiyanCameraManagerVideoStorageFormat videoStorageFormat[16];
E_ZiyanCameraManagerPhotoRatio photoRatioFormat[16];
E_ZiyanCameraManagerStreamSource streamSource[16];
E_ZiyanCameraManagerStreamStorage streamStorage[16];
E_ZiyanCameraManagerNightSceneMode nightSceneMode[16];
};
uint32_t minValue;
uint32_t maxValue;
} T_ZiyanCameraManagerRangeList;
typedef struct {
double lowGainTempMin;
double lowGainTempMax;
double highGainTempMin;
double highGainTempMax;
} T_ZiyanCameraManagerIrTempMeterRange;
typedef struct {
uint32_t totalCapacity; /* MByte */
uint32_t remainCapacity; /* MByte */
} T_ZiyanCameraManagerStorageInfo;
typedef struct {
uint32_t flag; /* 0xFFFFFFFF */
uint32_t seqNum;
uint64_t timestamp;
uint32_t dataByte; /* actual num of bytes used for points */
} __attribute__((packed)) T_ZiyanCameraManagerPointCloudHeader;
typedef struct {
ziyan_f32_t x; /* the x-axis of NED coordinate system */
ziyan_f32_t y; /* the y-axis of NED coordinate system */
ziyan_f32_t z; /* the z-axis of NED coordinate system */
uint8_t intensity;
uint8_t r;
uint8_t g;
uint8_t b;
}__attribute__((packed)) T_ZiyanCameraManagerPointXYZRGBInfo;
typedef struct {
T_ZiyanCameraManagerPointCloudHeader pointCloudHeader;
uint32_t crc_header;
uint32_t crc_rest;
T_ZiyanCameraManagerPointXYZRGBInfo points[1];
}__attribute__((packed)) T_ZiyanCameraManagerColorPointCloud;
typedef T_ZiyanReturnCode (*ZiyanCameraManagerDownloadFileDataCallback)(T_ZiyanDownloadFilePacketInfo packetInfo,
const uint8_t *data,
uint16_t dataLen);
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise camera manager module, and user should call this function
* before using camera manager features.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_Init(void);
/**
* @brief Deinitialise camera manager module.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_DeInit(void);
/**
* @brief Get camera type of the selected camera mounted position.
* @param position: camera mounted position
* @param cameraType: refer to E_ZiyanCameraType.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetCameraType(E_ZiyanMountPosition position, E_ZiyanCameraType *cameraType);
/**
* @brief Get camera firmware version of the selected camera mounted position.
* @param position: camera mounted position
* @param firmwareVersion: refer to T_ZiyanCameraManagerFirmwareVersion.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetFirmwareVersion(E_ZiyanMountPosition position,
T_ZiyanCameraManagerFirmwareVersion *firmwareVersion);
/**
* @brief Get camera connection status.
* @param position: camera mounted position
* @param connectStatus: returned value of connection status
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetCameraConnectStatus(E_ZiyanMountPosition position,
bool *connectStatus);
/**
* @brief Set camera working mode of the selected camera mounted position.
* @note Set the camera's work mode to options such as taking pictures, recording video,
* playback, or downloading. Please note that you cannot change the mode when a certain
* task is executing. This action takes about 1-2 s.
* @param position: camera mounted position
* @param workMode: refer to E_ZiyanCameraManagerWorkMode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerWorkMode workMode);
/**
* @brief Get camera working mode of the selected camera mounted position.
* @param position: camera mounted position
* @param workMode: refer to E_ZiyanCameraManagerWorkMode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerWorkMode *workMode);
/**
* @brief Set camera shoot mode of the selected camera mounted position.
* @param position: camera mounted position
* @param mode: refer to E_ZiyanCameraManagerShootPhotoMode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetShootPhotoMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerShootPhotoMode mode);
/**
* @brief Get camera shoot mode of the selected camera mounted position.
* @param position: camera mounted position
* @param mode: refer to E_ZiyanCameraManagerShootPhotoMode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetShootPhotoMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerShootPhotoMode *takePhotoMode);
/**
* @brief Start shooting photo.
* @note Camera must be in ShootPhoto mode. For thermal imaging cameras,
* it is allowed to take a single photo while recording video. Check the SD
* card's capacity before using this method to ensure there is enough space.
* @param position: camera mounted position
* @param mode: refer to E_ZiyanCameraManagerShootPhotoMode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_StartShootPhoto(E_ZiyanMountPosition position,
E_ZiyanCameraManagerShootPhotoMode mode);
/**
* @brief Stop shooting photo.
* @note Camera must be in ShootPhoto mode and the shoot mode is either
* Interval or Time-lapse. If set to single shot mode, the camera will
* automatically stop after taking the photo.
* @param position: camera mounted position
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_StopShootPhoto(E_ZiyanMountPosition position);
/**
* @brief Get camera capturing state.
* @note This API is not supported by L1/P1/M3D/M3TD models.
* @param position: camera mounted position
* @param capturingState: result of getting, see E_ZiyanCameraManagerCapturingState.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetCapturingState(E_ZiyanMountPosition position,
E_ZiyanCameraManagerCapturingState *capturingState);
/**
* @brief Set the burst count for burst shooting mode.
* @param position: camera mounted position
* @param count: refer to E_ZiyanCameraBurstCount.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetPhotoBurstCount(E_ZiyanMountPosition position,
E_ZiyanCameraBurstCount count);
/**
* @brief Set the parameters for INTERVAL shooting mode.
* @note In this mode, the camera captures a photo, waits a specified interval
* of time, then captures another photo, continuing until the set number of
* photos is reached. Supported by thermal imaging cameras, too.
* @param position: camera mounted position
* @param intervalSetting: refer to T_ZiyanCameraPhotoTimeIntervalSettings.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetPhotoTimeIntervalSettings(E_ZiyanMountPosition position,
T_ZiyanCameraPhotoTimeIntervalSettings intervalSetting);
/**
* @brief Get the parameters for INTERVAL shooting mode.
* @param position: camera mounted position
* @param intervalSetting: refer to T_ZiyanCameraPhotoTimeIntervalSettings.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetPhotoTimeIntervalSettings(E_ZiyanMountPosition position,
T_ZiyanCameraPhotoTimeIntervalSettings *intervalSetting);
/**
* @brief Get the remaining time of interval shooting.
* @note Not supported by L1/P1/M3D/M3TD models.
* @param position: camera mounted position
* @param remainTime: time in seconds.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetIntervalShootingRemainTime(E_ZiyanMountPosition position,
uint8_t *remainTime);
/**
* @brief Set camera focus mode of the selected camera mounted position.
* @note Set the lens focus mode. In auto focus mode, the target
* point is the focal point. In manual focus mode, if focus assist is
* enabled, it adjusts focus in the zoomed-out area.
* @param position: camera mounted position
* @param focusMode: refer to E_ZiyanCameraManagerFocusMode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetFocusMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerFocusMode focusMode);
/**
* @brief Get camera focus mode of the selected camera mounted position.
* @param position: camera mounted position
* @param focusMode: refer to E_ZiyanCameraManagerFocusMode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetFocusMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerFocusMode *focusMode);
/**
* @brief Set camera focus point of the selected camera mounted position.
* @note Sets the target point for focusing. In auto mode, this is the focal
* point. In manual mode with focus assist enabled, it's the zoomed-out area.
* @param position: camera mounted position
* @param focusPosData: refer to T_ZiyanCameraManagerFocusPosData.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetFocusTarget(E_ZiyanMountPosition position,
T_ZiyanCameraManagerFocusPosData focusPosData);
/**
* @brief Get camera focus point of the selected camera mounted position.
* @param position: camera mounted position
* @param focusPosData: refer to T_ZiyanCameraManagerFocusPosData.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetFocusTarget(E_ZiyanMountPosition position,
T_ZiyanCameraManagerFocusPosData *tapFocusPos);
/**
* @brief Start camera optical zooming of the selected camera mounted position.
* @note Changes the lens's focal length in the specified direction at a specified
* speed. Zooming stops at the lens's max or min focal length or when
* StopContinuousOpticalZoom is called.
* @param position: camera mounted position
* @param zoomDirection: optical zoom direction, refer to E_ZiyanCameraZoomDirection.
* @param zoomSpeed: optical zoom direction, refer to E_ZiyanCameraZoomSpeed.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_StartContinuousOpticalZoom(E_ZiyanMountPosition position,
E_ZiyanCameraZoomDirection zoomDirection,
E_ZiyanCameraZoomSpeed zoomSpeed);
/**
* @brief Stop the ongoing optical zoom operation of the selected camera mounted position.
* @note Should be called to halt the focal length change initiated by
* ZiyanCameraManager_StartContinuousOpticalZoom.
* @param position: camera mounted position
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_StopContinuousOpticalZoom(E_ZiyanMountPosition position);
/**
* @brief Set target zoom factor for optical zooming of the selected camera mounted position.
* @note This interface sets the zoom to the specified target value.
* @param position: camera mounted position
* @param zoomDirection: optical zoom direction, refer to E_ZiyanCameraZoomDirection.
* @param factor: target zoom factor.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetOpticalZoomParam(E_ZiyanMountPosition position,
E_ZiyanCameraZoomDirection zoomDirection,
ziyan_f32_t factor);
/**
* @brief Get parameters for camera optical zooming of the selected camera mounted position.
* @param position: camera mounted position
* @param opticalZoomParam: refer to T_ZiyanCameraManagerOpticalZoomParam.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetOpticalZoomParam(E_ZiyanMountPosition position,
T_ZiyanCameraManagerOpticalZoomParam *opticalZoomParam);
/**
* @brief Set target zoom factor for infrared zooming of the selected camera mounted position.
* @param position: camera mounted position
* @param factor: target zoom factor.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetInfraredZoomParam(E_ZiyanMountPosition position,
ziyan_f32_t factor);
/**
* @brief Enable/Disable the tap-zoom function for the selected camera mounted position.
* @note TapZoomAtTarget can only be called when tap-zoom is enabled.
* @param position: camera mounted position
* @param param: enable/disable
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetTapZoomEnabled(E_ZiyanMountPosition position,
bool param);
/**
* @brief Get status of camera's tap-zoom function of the selected camera mounted position.
* @param position: camera mounted position
* @param param: enable/disable
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetTapZoomEnabled(E_ZiyanMountPosition position, bool *param);
/**
* @brief Set camera's tap-zoom multiplier of the selected camera mounted position.
* @note The final zoom scale during a tap-zoom action will be:
* Current Zoom Scale x Multiplier.
* @param position: camera mounted position
* @param tapZoomMultiplier: The multiplier range is [1,5]. A multiplier of 1 will not change the zoom.
* hen the multiplier is 1, the zoom scale will not change during TapZoom.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetTapZoomMultiplier(E_ZiyanMountPosition position, uint8_t tapZoomMultiplier);
/**
* @brief Get camera's tap-zoom multiplier of the selected camera mounted position.
* @param position: camera mounted position
* @param tapZoomMultiplier: The multiplier range is [1,5]. A multiplier of 1 will not change the zoom.
* When the multiplier is 1, the zoom scale will not change during TapZoom.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetTapZoomMultiplier(E_ZiyanMountPosition position, uint8_t *tapZoomMultiplier);
/**
* @brief Set camera's tap-zoom point of the selected camera mounted position.
* @note Only available when tap-zoom is enabled. Sets a new target,
* reorienting the gimbal to locate the target on the screen center and
* applying the tap-zoom multiplier.
* @param position: camera mounted position
* @param tapZoomPos: refer to T_ZiyanCameraManagerTapZoomPosData.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_TapZoomAtTarget(E_ZiyanMountPosition position,
T_ZiyanCameraManagerTapZoomPosData tapZoomPos);
/**
* @brief Get camera focus ring value range.
* @param position: camera mounted position
* @param rangeList: returned value of range.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetFocusRingRange(E_ZiyanMountPosition position,
T_ZiyanCameraManagerRangeList *rangeList);
/**
* @brief Set camera focus ring value.
* @param position: camera mounted position
* @param value: focus ring value.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetFocusRingValue(E_ZiyanMountPosition position,
uint16_t value);
/**
* @brief Get camera focus ring value.
* @param position: camera mounted position
* @param value: focus ring value to be returned.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetFocusRingValue(E_ZiyanMountPosition position,
uint16_t *value);
/**
* @brief Set camera's exposure mode of the selected camera mounted position.
* @note Different exposure modes define whether settings like aperture, shutter
* speed, and ISO are set automatically or manually. Exposure compensation is
* adjustable in all modes except the manual mode.
* @param position: camera mounted position
* @param mode: refer to E_ZiyanCameraManagerExposureMode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetExposureMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerExposureMode mode);
/**
* @brief Get camera's exposure mode of the selected camera mounted position.
* @note Different exposure modes define whether settings like aperture, shutter
* speed, and ISO are set automatically or manually. Exposure compensation is
* adjustable in all modes except the manual mode.
* @param position: camera mounted position
* @param mode: refer to E_ZiyanCameraManagerExposureMode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetExposureMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerExposureMode *mode);
/**
* @brief Set camera's iso value of the selected camera mounted position.
* @note ISO value can only be set when the camera exposure mode is in
* manual mode.
* @param position: camera mounted position
* @param iso: refer to E_ZiyanCameraManagerISO.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetISO(E_ZiyanMountPosition position,
E_ZiyanCameraManagerISO iso);
/**
* @brief Get camera's iso value of the selected camera mounted position.
* @param position: camera mounted position
* @param iso: refer to E_ZiyanCameraManagerISO.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetISO(E_ZiyanMountPosition position,
E_ZiyanCameraManagerISO *iso);
/**
* @brief Set camera's aperture size value of the selected camera mounted position.
* @note The exposure mode must be on ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_EXPOSURE_MANUAL or
* ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_APERTURE_PRIORITY.
* @param position: camera mounted position
* @param aperture: refer to E_ZiyanCameraManagerAperture.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetAperture(E_ZiyanMountPosition position,
E_ZiyanCameraManagerAperture aperture);
/**
* @brief Get camera's aperture size value of the selected camera mounted position.
* @param position: camera mounted position
* @param aperture: refer to E_ZiyanCameraManagerAperture.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetAperture(E_ZiyanMountPosition position,
E_ZiyanCameraManagerAperture *aperture);
/**
* @brief Set camera's shutter speed value of the selected camera mounted position.
* @note Set the camera shutter speed. Ensure the shutter speed is not set
* slower than the video frame rate when the camera's mode is RECORD_VIDEO.
* For example, if the video frame rate is 30fps, the shutterSpeed must be <=
* 1/30. Precondition: The shutter speed can be set only when the camera
* exposure mode is ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_EXPOSURE_MANUAL mode or
* ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_SHUTTER_PRIORITY
* @param position: camera mounted position
* @param shutterSpeed: refer to E_ZiyanCameraManagerShutterSpeed.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetShutterSpeed(E_ZiyanMountPosition position,
E_ZiyanCameraManagerShutterSpeed shutterSpeed);
/**
* @brief Get camera's shutter value of the selected camera mounted position.
* @param position: camera mounted position
* @param shutterSpeed: refer to E_ZiyanCameraManagerShutterSpeed.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetShutterSpeed(E_ZiyanMountPosition position,
E_ZiyanCameraManagerShutterSpeed *shutterSpeed);
/**
* @brief Set camera's EV value of the selected camera mounted position.
* @note This function is available in program, shutter, or aperture
* exposure modes. Enums are ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_EXPOSURE_MANUAL,
* ZIYAN_CAMERA_MANAGER_EXPOSURE_MODE_SHUTTER_PRIORITY, and
* ZIYAN_CAMERA_MANAGER_EXPOSURE_APERTURE_PRIORITY
* @param position: camera mounted position
* @param ev: refer to E_ZiyanCameraManagerExposureCompensation.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetExposureCompensation(E_ZiyanMountPosition position,
E_ZiyanCameraManagerExposureCompensation ev);
/**
* @brief Get camera's EV value of the selected camera mounted position.
* @param position: camera mounted position
* @param ev: refer to E_ZiyanCameraManagerExposureCompensation.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetExposureCompensation(E_ZiyanMountPosition position,
E_ZiyanCameraManagerExposureCompensation *ev);
/**
* @brief Set AE lock mode.
* @param position: camera mounted position
* @param enable: true to enable, false to disable AE lock.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetAELockEnabled(E_ZiyanMountPosition position,
bool enable);
/**
* @brief Get AE lock mode.
* @note This API is not supported by L1/P1/M3D/M3TD models.
* @param position: camera mounted position
* @param enable: result of AE lock mode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetAELockEnabled(E_ZiyanMountPosition position,
bool *enable);
/**
* @brief Reset camera settings.
* @param position: camera mounted position
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_ResetCameraSettings(E_ZiyanMountPosition position);
/**
* @brief Start to take video of the selected camera mounted position.
* @note Camera must be in RECORD_VIDEO mode. For thermal imaging camera,
* user can take a single photo when recording video.
* @param position: camera mounted position
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_StartRecordVideo(E_ZiyanMountPosition position);
/**
* @brief Stop to take video of the selected camera mounted position.
* @note Precondition: The camera is recording currently.
* @param position: camera mounted position
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_StopRecordVideo(E_ZiyanMountPosition position);
/**
* @brief Get camera recording state.
* @param position: camera mounted position
* @param recordingState: result of getting, see E_ZiyanCameraManagerRecordingState.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetRecordingState(E_ZiyanMountPosition position,
E_ZiyanCameraManagerRecordingState *recordingState);
/**
* @brief Get camera recording time.
* @note This API is not supported by L1/P1/M3D/M3TD models.
* @param position: camera mounted position
* @param recordingTime: result of getting, unit is seconds.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetRecordingTime(E_ZiyanMountPosition position,
uint16_t *recordingTime);
/**
* @brief Get camera stream source range.
* @param position: camera mounted position
* @param rangeList: pointer to the result.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetStreamSourceRange(E_ZiyanMountPosition position,
T_ZiyanCameraManagerRangeList *rangeList);
/**
* @brief Choose camera stream source.
* @param position: camera mounted position
* @param streamSource: stream source to be chose.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetStreamSource(E_ZiyanMountPosition position,
E_ZiyanCameraManagerStreamSource streamSource);
/**
* @brief Get photo storage format range.
* @param position: camera mounted position
* @param rangeList: range list returned value
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetPhotoStorageFormatRange(E_ZiyanMountPosition position,
T_ZiyanCameraManagerRangeList *rangeList);
/**
* @brief Set photo storage format.
* @param position: camera mounted position
* @param format: storage format.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetPhotoFormat(E_ZiyanMountPosition position,
E_ZiyanCameraManagerPhotoStorageFormat format);
/**
* @brief Get photo storage format.
* @param position: camera mounted position
* @param format: returned value of storage format.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetPhotoFormat(E_ZiyanMountPosition position,
E_ZiyanCameraManagerPhotoStorageFormat *format);
/**
* @brief Get video storage format range.
* @param position: camera mounted position
* @param rangeList: range list returned value
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetVideoFormatRange(E_ZiyanMountPosition position,
T_ZiyanCameraManagerRangeList *rangeList);
/**
* @brief Set video storage format.
* @param position: camera mounted position
* @param format: storage format.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetVideoStorageFormat(E_ZiyanMountPosition position,
E_ZiyanCameraManagerVideoStorageFormat format);
/**
* @brief Get video storage format.
* @param position: camera mounted position
* @param format: returned value of storage format.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetVideoFormat(E_ZiyanMountPosition position,
E_ZiyanCameraManagerVideoStorageFormat *format);
/**
* @brief Get photo ratio range
* @param position: camera mounted position
* @param rangeList: range list returned value
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetPhotoRatioRange(E_ZiyanMountPosition position,
T_ZiyanCameraManagerRangeList *rangeList);
/**
* @brief Set camera photo ratio
* @param position: camera mounted position
* @param photoRatio: ratio to be set
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetPhotoRatio(E_ZiyanMountPosition position,
E_ZiyanCameraManagerPhotoRatio photoRatio);
/**
* @brief Get camera photo ratio
* @param position: camera mounted position
* @param photoRatio: returned value of photo ratio
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetPhotoRatio(E_ZiyanMountPosition position,
E_ZiyanCameraManagerPhotoRatio *photoRatio);
/**
* @brief Get camera video resolution and frame rate
* @param position: camera mounted position
* @param photoRatio: returned value of video resolution and frame rate
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetVideoResolutionFrameRate(E_ZiyanMountPosition position,
T_ZiyanCameraManagerVideoFormat *videoParam);
/**
* @brief Get night scene mode range.
* @param position: camera mounted position.
* @param tempRange: returned valued of night scene mode range.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetNightSceneModeRange(E_ZiyanMountPosition position,
T_ZiyanCameraManagerRangeList *rangeList);
/**
* @brief Set night scene mode.
* @note Make sure that stream source is zoom or wide camera.
* @param position: camera mounted position
* @param nightSceneMode: night scene mode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetNightSceneMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerNightSceneMode nightSceneMode);
/**
* @brief Get night scene mode.
* @param position: camera mounted position
* @param nightSceneMode: pointer to night scene mode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetNightSceneMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerNightSceneMode *nightSceneMode);
/**
* @brief Get range of stream source(s) can be stored when capturing or recording.
* @param position: camera mounted position.
* @param rangeList: returned value of range, in member streamStorage.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetStreamStorageRange(E_ZiyanMountPosition position,
T_ZiyanCameraManagerRangeList *rangeList);
/**
* @brief Select capture or recording stream(s) to store.
* @note Precondition: set camera's work corresponding to streamType
* @param position: camera mounted position.
* @param streamType: capture mode or recording mode.
* @param streamStorageList: Pointer to the struct that contains stream list.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetCaptureRecordingStreams(E_ZiyanMountPosition position,
E_ZiyanCameraManagerCaptureOrRecording streamType,
T_ZiyanCameraManagerStreamList *streamStorageList);
/**
* @brief Get the stream(s) of capture or recording mode to be stored.
* @param position: camera mounted position.
* @param streamType: capture mode or recording mode.
* @param streamSourceList: the real return value.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetCaptureRecordingStreams(E_ZiyanMountPosition position,
E_ZiyanCameraManagerCaptureOrRecording streamType,
T_ZiyanCameraManagerStreamList *streamStorageList);
/**
* @brief Turn on/off synchronized split screen zoom function.
* @param position: camera mounted position.
* @param enable: set true to turn on, false to turn off.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetSynchronizedSplitScreenZoomEnabled(E_ZiyanMountPosition position, bool enable);
/**
* @brief Set suffix name of directory or file.
* @note This setting applies only once for file names.
* @param position: camera mounted position.
* @param nameType: see E_ZiyanCameraManagerExpandNameType, select to set name of directory or file.
* @param nameSize: Length of the name string, between 1 and 239 characters.
* @param nameStr: Content of custom suffix name.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetCustomExpandName(E_ZiyanMountPosition position,
E_ZiyanCameraManagerExpandNameType nameType,
const uint8_t *nameStr,
uint32_t nameSize);
/**
* @brief Get the custom suffix of the most recent directory or file name.
* @param position: camera mounted position
* @param nameType: to choose directory or file to get custom name
* @param nameStr: name string buffer
* @param nameSize: On input, indicates the maximum size of nameStr; on output,
* the actual size of the name string.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetCustomExpandName(E_ZiyanMountPosition position,
E_ZiyanCameraManagerExpandNameType nameType,
uint8_t *nameStr,
uint32_t *nameSize);
/**
* @brief Downloads a list of media files from the selected camera.
* @note This synchronous interface may lead to higher CPU usage.
* Times out after 3 seconds if the download fails.
* @param position: the mount position of the camera
* @param fileList: the pointer to the downloaded camera file list
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_DownloadFileList(E_ZiyanMountPosition position, T_ZiyanCameraManagerFileList *fileList);
/**
* @brief Download selected camera media file list by slices.
* @note This synchronous interface may lead to higher CPU usage.
* Times out after 3 seconds if the download fails.
* @param position: the mount position of the camera
* @param sliceConfig: the slices config for downloading file list
* @param fileList: the pointer to the downloaded camera file list
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_DownloadFileListBySlices(E_ZiyanMountPosition position,
T_ZiyanCameraManagerSliceConfig sliceConfig,
T_ZiyanCameraManagerFileList *fileList);
/**
* @brief Registers a callback for downloading file data.
* @param position: the mount position of the camera
* @param callback: the download file data callback
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_RegDownloadFileDataCallback(E_ZiyanMountPosition position,
ZiyanCameraManagerDownloadFileDataCallback callback);
/**
* @brief Downloads a media file specified by its index.
* @note Supports downloading one file at a time. Wait for a download to finish before starting another.
* This synchronous interface may lead to higher CPU usage.
* Times out after 3 seconds if the download fails.
* @param position: the mount position of the camera
* @param fileIndex: the index of the camera media file
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_DownloadFileByIndex(E_ZiyanMountPosition position, uint32_t fileIndex);
/**
* @brief Download selected camera media file by file index and file type.
* @note This API only supports L2 camera.
* Supports downloading one file at a time. Wait for a download to finish before starting another.
* This synchronous interface may lead to higher CPU usage.
* Times out after 3 seconds if the download fails.
* @param position: the mount position of the camera
* @param fileIndex: the index of the camera media file
* @param fileType: the sub type of the camera media file
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_DownloadSubFileByIndexAndSubType(E_ZiyanMountPosition position, uint32_t index, E_ZiyanCameraMediaFileSubType fileType);
/**
* @brief Obtains the rights to download media files before downloading media files
* @param position: the mount position of the camera
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_ObtainDownloaderRights(E_ZiyanMountPosition position);
/**
* @brief Releases the rights to download media files after downloading media files
* @note Failure to release downloader rights may restrict access to the camera album
* by the pilot app.
* @param position: the mount position of the camera
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_ReleaseDownloaderRights(E_ZiyanMountPosition position);
/**
* @brief Format SD card.
* @param position: the mount position of the camera
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_FormatStorage(E_ZiyanMountPosition position);
/**
* @brief Get storage info of SD card.
* @note This API doesn't support L1/P1/M3D/M3TD models.
* @param position: the mount position of the camera
* @param storageInfo: Result of SD Card storage information
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetStorageInfo(E_ZiyanMountPosition position,
T_ZiyanCameraManagerStorageInfo *storageInfo);
/**
* @brief Delete selected camera media file by file index.
* @param position: the mount position of the camera
* @param fileIndex: the index of the camera media file
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_DeleteFileByIndex(E_ZiyanMountPosition position, uint32_t fileIndex);
/**
* @brief Get the camera laser ranging info of the selected camera mounted position.
* @note Maximum data update frequency: 5Hz.
* @param position: the mount position of the camera
* @param laserRangingInfo: the pointer to the camera laser ranging info
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetLaserRangingInfo(E_ZiyanMountPosition position,
T_ZiyanCameraManagerLaserRangingInfo *laserRangingInfo);
/**
* @brief Set point thermometry coordinates of the selected camera mounted position.
* @param position: camera mounted position
* @param pointCoordinate: point thermometry coordinates
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetPointThermometryCoordinate(E_ZiyanMountPosition position,
T_ZiyanCameraManagerPointThermometryCoordinate pointCoordinate);
/**
* @brief Get point thermometry result.
* @note Before get point thermometry data from camera, ZiyanCameraManager_SetPointThermometryCoordinate()
* function has to be called.
* @param position: camera mounted position
* @param pointThermometryData: point thermometry result
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetPointThermometryData(E_ZiyanMountPosition position,
T_ZiyanCameraManagerPointThermometryData *pointThermometryData);
/**
* @brief Set area thermometry coordinates of the selected camera mounted position.
* @param position: camera mounted position
* @param areaCoordinate: area thermometry coordinates
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetAreaThermometryCoordinate(E_ZiyanMountPosition position,
T_ZiyanCameraManagerAreaThermometryCoordinate areaCoordinate);
/**
* @brief Get area thermometry result.
* @note Before get area thermometry data from camera, ZiyanCameraManager_SetAreaThermometryCoordinate()
* function has to be called.
* @param position: camera mounted position
* @param areaThermometryData: area thermometry result
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetAreaThermometryData(E_ZiyanMountPosition position,
T_ZiyanCameraManagerAreaThermometryData *areaThermometryData);
/**
* @brief Set FFC mode.
* @param position: camera mounted position.
* @param ffcMode: mode to be set.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetFfcMode(E_ZiyanMountPosition position, E_ZiyanCameraManagerFfcMode ffcMode);
/**
* @brief Trigger FFC one time.
* @param position: camera mounted position.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_TriggerFfc(E_ZiyanMountPosition position);
/**
* @brief Set infrared camera gain mode.
* @param position: camera mounted position.
* @param gainMode: gain mode to set.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetInfraredCameraGainMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerIrGainMode gainMode);
/**
* @brief Get temperature range of infrared camera.
* @param position: camera mounted position.
* @param tempRange: returned valued of temperature range.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetInfraredCameraGainModeTemperatureRange(E_ZiyanMountPosition position,
T_ZiyanCameraManagerIrTempMeterRange *tempRange);
/**
* @brief Set camera metering mode.
* @param position: camera mounted position
* @param meteringMode: metering mode
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetMeteringMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerMeteringMode meteringMode);
/**
* @brief Get camera metering mode.
* @param position: camera mounted position
* @param meteringMode: pointer to returned value of metering mode
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetMeteringMode(E_ZiyanMountPosition position,
E_ZiyanCameraManagerMeteringMode *meteringMode);
/**
* @brief Get range of metering point.
* @param position: camera mounted position
* @param hrzNum: returned value, horizontal range.
* @param vtcNum: returned value, vertical range.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetMeteringPointRegionRange(E_ZiyanMountPosition position,
uint8_t *hrzNum, uint8_t *vtcNum);
/**
* @brief Set metering point.
* @param position: camera mounted position
* @param x: Horizontal coordinate value, should be no greater than hrzNum - 1.
* @param y: Horizontal coordinate value, should be no greater than vtcNum - 1.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_SetMeteringPoint(E_ZiyanMountPosition position,
uint8_t x, uint8_t y);
/**
* @brief Get camera metering mode.
* @param position: camera mounted position
* @param x: returned valued, current metering point in horizontal coordinate.
* @param y: returned valued, current metering point in vertical coordinate.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_GetMeteringPoint(E_ZiyanMountPosition position,
uint8_t *x, uint8_t *y);
/**
* @brief Start to record point cloud of the selected camera mounted position.
* @param position: camera mounted position
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_StartRecordPointCloud(E_ZiyanMountPosition position);
/**
* @brief Stop to record point cloud of the selected camera mounted position.
* @note Precondition: The camera is recording currently.
* @param position: camera mounted position
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCameraManager_StopRecordPointCloud(E_ZiyanMountPosition position);
#ifdef __cplusplus
}
#endif
#endif // ZIYAN_CAMERA_MANAGER_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/
/**
********************************************************************
* @file dij_core.h
* @brief This is the header file for "dij_core.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_CORE_H
#define ZIYAN_CORE_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_platform.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef struct {
char appName[32]; /*!< Specifies ZIYAN SDK app name. This info can be obtained by logging in to the
developer website https://developer.ziyan.com/user/apps/#all. End with '\0'. */
char appId[16]; /*!< Specifies ZIYAN SDK app ID. This info can be obtained by logging in to the
developer website https://developer.ziyan.com/user/apps/#all. */
char appKey[32]; /*!< Specifies ZIYAN SDK app key. This info can be obtained by logging in to the
developer website https://developer.ziyan.com/user/apps/#all. */
char appLicense[512]; /*!< Specifies ZIYAN SDK app license. This info can be obtained by logging in to the
developer website https://developer.ziyan.com/user/apps/#all. */
char developerAccount[64]; /*!< Specifies ZIYAN SDK developer account email. This info can be obtained by
logging in to the developer website https://developer.ziyan.com/user/apps/#all.
Developer's account and other related information need to be able to correspond.
End with '\0'. */
char baudRate[16]; /*!< Specifies ZIYAN SDK communication serial port baud rate. */
} T_ZiyanUserInfo;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialize the Payload SDK core in blocking mode.
* @note The order of calling this call is crucial. It must be done after registering console/OSAL/HAL handler functions
* It must be done after registering console/OSAL/HAL handler functions and before using other functional module
* interfaces. Correctly fill in the developer information to ensure successful initialization. See the
* See the "PSDK Initialization" tutorial for more.
* This function does not return until the correct aircraft type and PSDK adapter type is obtained. The logic ensures
* that aircraft and PSDK adapter have been started up normally before PSDK functional module and user's program run.
* General execution time of this function is 2-4 seconds.
* @param userInfo: pointer to the PSDK application information.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCore_Init(const T_ZiyanUserInfo *userInfo);
/**
* @brief Sets an alias for a ZIYAN application or product that meets the condition for ZIYAN application or product.
* If an alias exists, it will be displayed in ZIYAN Pilot.
* @note Still need to pass in correct ZIYAN APP name that is obtained from ZIYAN SDK developer website to ZiyanCore_Init()
* interface. The ZIYAN APP name will be used to bind and verification.
* The alias will take effect after a short delay, up to a maximum of 1 second.
* @param productAlias: A pointer to the product alias string, which must end with '\0'. The maximum length of the string is 31 characters.
* If the alias string exceeds 31 characters, it will be truncated before being passed in.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCore_SetAlias(const char *productAlias);
/**
* @brief Set custom firmware version for ZIYAN application or product.
* @details Payload firmware version will always display in ZIYAN Pilot payload settings interface.
* @param version: the custom firmware version to be set.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCore_SetFirmwareVersion(T_ZiyanFirmwareVersion version);
/**
* @brief Set custom serial number for ZIYAN application or product.
* @details Payload custom serial number will always display in ZIYAN Pilot payload settings interface.
* @param productSerialNumber: the custom serial number to be set, needs to be no larger than 32 bytes.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCore_SetSerialNumber(const char *productSerialNumber);
/**
* @brief Notify that the Payload SDK core application starts.
* @note The order of calling this interface requires special attention, The call needs to be completed after all the
* module initialize and register interfaces.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCore_ApplicationStart(void);
/**
* @brief DeInitialize the Payload SDK core in blocking mode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanCore_DeInit(void);
#ifdef __cplusplus
}
#endif
#endif // DIJ_CORE_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/
/**
********************************************************************
* @file ziyan_fc_subscription.h
* @brief This is the header file for "ziyan_fc_subscription.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_FC_SUBSCRIPTION_H
#define ZIYAN_FC_SUBSCRIPTION_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Name of topics that can be subscribed. Topic is minimum data item subscribed.
*/
typedef enum {
/*!
* @brief Quaternion of aircraft topic name. Quaternion topic provides aircraft body frame (FRD) to ground frame
* (NED) rotation. Please refer to ::T_ZiyanFcSubscriptionQuaternion for information about data structure.
* @details The ZIYAN quaternion follows Hamilton convention (q0 = w, q1 = x, q2 = y, q3 = z).
* | Angle | Unit | Accuracy | Notes |
|--------------|------|------------|-------------------------------------------------|
| pitch, roll | deg | <1 | in NON-AHRS mode |
| yaw | deg | <3 | in well-calibrated compass with fine aligned |
| yaw with rtk | deg | around 1.2 | in RTK heading fixed mode with 1 meter baseline |
* @datastruct \ref T_ZiyanFcSubscriptionQuaternion
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_QUATERNION = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 0),
/*!
* @brief Provides aircraft's acceleration w.r.t a ground-fixed \b NEU frame @ up to 200Hz
* @warning Please note that this data is not in a conventional right-handed frame of reference.
* @details This is a fusion output from the flight control system. The output is in a right-handed NED frame, but the
* sign of the Z-axis acceleration is flipped before publishing to this topic. So if you are looking to get acceleration
* in an NED frame, simply flip the sign of the z-axis value. Beyond that, you can convert using rotations to
* any right-handed frame of reference.
* @units m/s<SUP>2</SUP>
* @datastruct \ref T_ZiyanFcSubscriptionAccelerationGround
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_ACCELERATION_GROUND = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 1),
/*!
* @brief Provides aircraft's acceleration w.r.t a body-fixed \b FRU frame @ up to 200Hz
* @warning Please note that this data is not in a conventional right-handed frame of reference.
* @details This is a fusion output from the flight control system.
* @units m/s<SUP>2</SUP>
* @datastruct \ref T_ZiyanFcSubscriptionAccelerationBody
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_ACCELERATION_BODY = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 2),
/*!
* @brief Provides aircraft's acceleration in an IMU-centered, body-fixed \b FRD frame @ up to 400Hz
* @details This is a filtered output from the IMU on board the flight control system.
* @sensors IMU
* @units m/s<SUP>2</SUP>
* @datastruct \ref T_ZiyanFcSubscriptionAccelerationRaw
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_ACCELERATION_RAW = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 3),
/*!
* @brief Velocity of aircraft topic name. Velocity topic provides aircraft's velocity in a ground-fixed NEU frame.
* Please refer to ::T_ZiyanFcSubscriptionVelocity for information about data structure.
* @warning Please note that this data is not in a conventional right-handed frame of reference.
* @details This velocity data is a fusion output from the aircraft. Original output is in a right-handed NED frame, but the
* sign of the Z-axis velocity is flipped before publishing to this topic. So if you are looking to get velocity
* in an NED frame, simply flip the sign of the z-axis value. Beyond that, you can convert using rotations to
* any right-handed frame of reference.
* | Axis | Unit | Accuracy |
|----------|------|---------------------------------------------------------------------------------------------|
| vgx, vgy | m/s | Around 5cm/s for GNSS navigation. Around 3cm/s with VO at 1 meter height |
| vgz | m/s | 10cm/s only with barometer in steady air. 3cm/s with VO at 1 meter height with 8cm baseline |
* @datastruct \ref T_ZiyanFcSubscriptionVelocity
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_VELOCITY = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 4),
/*!
* @brief Provides aircraft's angular velocity in a ground-fixed \b NED frame @ up to 200Hz
* @details This is a fusion output from the flight control system.
* @units rad/s
* @datastruct \ref T_ZiyanFcSubscriptionAngularRateFusioned
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_ANGULAR_RATE_FUSIONED = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 5),
/*!
* @brief Provides aircraft's angular velocity in an IMU-centered, body-fixed \b FRD frame @ up to 400Hz
* @details This is a filtered output from the IMU on board the flight control system.
* @sensors IMU
* @units rad/s
* @datastruct \ref T_ZiyanFcSubscriptionAngularRateRaw
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_ANGULAR_RATE_RAW = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 6),
/*!
* @brief Fused altitude of aircraft topic name. Fused altitude topic provides aircraft's fused altitude from sea
* level. Please refer to ::T_ZiyanFcSubscriptionAltitudeFused for information about data structure.
* @units m
* @datastruct \ref T_ZiyanFcSubscriptionAltitudeFused
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_ALTITUDE_FUSED = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 7),
/*!
* @brief Provides aircraft's pressure altitude from sea level using the ICAO model @ up to 200Hz
* @details
* This is a filetered output from the barometer without any further fusion.
*
* The ICAO model gives an MSL altitude of 1013.25mBar at 15&deg; C and a temperature lapse rate of -6.5&deg; C
* per 1000m. In your case, it may be possible that the take off altitude of the aircraft is recording a higher pressure
* than 1013.25mBar. Let's take an example - a weather station shows that SFO (San Francisco International Airport) had
* recently recorded a pressure of 1027.1mBar. SFO is 4m above MSL, yet, if you calculate the Pressure Altitude using
* the ICAO model, it relates to -114m. You can use an online calculator to similarly calculate the Pressure Altitude
* in your area.
*
* Another factor that may affect your altitude reading is manufacturing differences in the barometer - it is not
* uncommon to have a variation of &plusmn;30m readings at the same physical location with two different aircraft. For a given
* aircraft, these readings will be consistent, so you will need to calibrate the offset of your system if your code
* relies on the accuracy of the absolute value of altitude.
* @sensors GPS, Barometer, IMU
* @units m
* @datastruct \ref T_ZiyanFcSubscriptionAltitudeBarometer
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_ALTITUDE_BAROMETER = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 8),
/*!
* @brief Provides the altitude from sea level when the aircraft last took off.
* @details
* This is a fusion output from the flight control system, and also uses the ICAO model.
*
* The ICAO model gives an MSL altitude of 1013.25mBar at 15&deg; C and a temperature lapse rate of -6.5&deg; C
* per 1000m. In your case, it may be possible that the take off altitude of the aircraft is recording a higher pressure
* than 1013.25mBar. Let's take an example - a weather station shows that SFO (San Francisco International Airport) had
* recently recorded a pressure of 1027.1mBar. SFO is 4m above MSL, yet, if you calculate the Pressure Altitude using
* the ICAO model, it relates to -114m. You can use an online calculator to similarly calculate the Pressure Altitude
* in your area.
*
* Another factor that may affect your altitude reading is manufacturing differences in the barometer - it is not
* uncommon to have a variation of &plusmn;30m readings at the same physical location with two different aircraft. For a given
* aircraft, these readings will be consistent, so you will need to calibrate the offset of your system if your code
* relies on the accuracy of the absolute value of altitude.
*
* @note This value is updated each time the drone takes off.
*
* @units m
* @datastruct \ref T_ZiyanFcSubscriptionAltitudeOfHomePoint
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_ALTITUDE_OF_HOMEPOINT = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 9),
/*!
* @brief Provides the relative height above ground at up to 100Hz.
* @details
* This is a fusion output from the flight control system. The height is a direct estimate of the closest large object below the aircraft's ultrasonic sensors.
* A large object is something that covers the ultrasonic sensor for an extended duration of time.
*
* @warning This topic does not come with a 'valid' flag - so if the aircraft is too far from an object for the
* ultrasonic sensors/VO to provide any meaningful data, the values will latch and there is no way for user code to
* determine if the data is valid or not. Use with caution.
* @sensors Visual Odometry, Ultrasonic
* @units m
* @datastruct \ref T_ZiyanFcSubscriptionHeightFusion
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_HEIGHT_FUSION = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 10),
/*!
* @brief Relative height above ground of aircraft topic name. Please refer to
* ::T_ZiyanFcSubscriptionHeightRelative for information about data structure.
* @details This data is a fusion output from aircraft. The height is a direct estimate of the closest large object
* below the aircraft's ultrasonic sensors.
* @warning This topic does not come with a 'valid' flag - so if the aircraft is too far from an object for the
* ultrasonic sensors/VO to provide any meaningful data, the values will latch and there is no way for user to
* determine if the data is valid or not. Please use with caution.
* @datastruct \ref T_ZiyanFcSubscriptionHeightRelative
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_HEIGHT_RELATIVE = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 11),
/*!
* Fused position of aircraft topic name. Please refer to ::T_ZiyanFcSubscriptionPositionFused for information
* about data structure.
* @warning Please note that if GPS signal is weak (low visibleSatelliteNumber, see below), the
* latitude/longitude values won't be updated but the altitude might still be. There is currently no way to know if
* the lat/lon update is healthy.
* @details The most important component of this topic is the T_ZiyanFcSubscriptionPositionFused::visibleSatelliteNumber.
* Use this to track your GPS satellite coverage and build some heuristics for when you might expect to lose GPS updates.
* | Axis | Unit | Position Sensor | Accuracy |
|------|------|-----------------|--------------------------------------------------|
| x, y | m | GPS | <3m with open sky without multipath |
| z | m | GPS | <5m with open sky without multipath |
* @datastruct \ref T_ZiyanFcSubscriptionPositionFused
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_POSITION_FUSED = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 12),
/*!
* @brief GPS date topic name. Please refer to ::T_ZiyanFcSubscriptionGpsDate for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionGpsDate
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GPS_DATE = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 13),
/*!
* @brief GPS time topic name. Please refer to ::T_ZiyanFcSubscriptionGpsTime for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionGpsTime
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GPS_TIME = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 14),
/*!
* @brief GPS position topic name. Please refer to ::T_ZiyanFcSubscriptionGpsPosition for information about data structure.
* @details
* | Axis | Accuracy |
|------|--------------------------------------------------|
| x, y | <3m with open sky without multipath |
| z | <5m with open sky without multipath |
* @datastruct \ref T_ZiyanFcSubscriptionGpsPosition
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GPS_POSITION = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 15),
/*!
* @brief GPS velocity topic name. Please refer to ::T_ZiyanFcSubscriptionGpsVelocity for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionGpsVelocity
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GPS_VELOCITY = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 16),
/*!
* @brief GPS details topic name. GPS details topic provides GPS state and other detail information. Please refer
* to ::T_ZiyanFcSubscriptionGpsDetail for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionGpsDetails
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GPS_DETAILS = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 17),
/*!
* @brief GPS signal level topic name. This topic provides a measure of the quality of GPS signal. Please refer to
* ::T_ZiyanFcSubscriptionGpsSignalLevel for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionGpsSignalLevel
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GPS_SIGNAL_LEVEL = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 18),
/*!
* @brief RTK position topic name. Please refer to ::T_ZiyanFcSubscriptionRtkPosition for information about data structure.
* @details
* | Axis | Accuracy |
|------|--------------------------------------------------|
| x, y | ~2cm with fine alignment and fix condition |
| z | ~3cm with fine alignment and fix condition |
* @datastruct \ref T_ZiyanFcSubscriptionRtkPosition
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_RTK_POSITION = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 19),
/*!
* @brief RTK velocity topic name. Please refer to ::T_ZiyanFcSubscriptionRtkVelocity for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionRtkVelocity
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_RTK_VELOCITY = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 20),
/*!
* @brief RTK yaw topic name. Please refer to ::T_ZiyanFcSubscriptionRtkYaw for information about data structure.
* @details The RTK yaw will provide the vector from ANT1 to ANT2 as configured in ZIYAN Assistant 2. This
* means that the value of RTK yaw will be 90deg offset from the yaw of the aircraft.
* @datastruct \ref T_ZiyanFcSubscriptionRtkYaw
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_RTK_YAW = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 21),
/*!
* @brief RTK position information topic name. RTK position information topic provides a state of RTK position
* solution. Please refer to ::T_ZiyanFcSubscriptionRtkPositionInfo for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionRtkPositionInfo
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_RTK_POSITION_INFO = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 22),
/*!
* @brief RTK yaw topic name. RTK yaw information topic provides a state of RTK yaw solution. Please refer to
* ::T_ZiyanFcSubscriptionRtkYawInfo for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionRtkYawInfo
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_RTK_YAW_INFO = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 23),
/*!
* @brief Provides aircraft's magnetometer reading, fused with IMU and GPS @ up to 100Hz
* @details This reading is the magnetic field recorded by the magnetometer in x,y,z axis, calibrated such that
* 1000 < |m| < 2000, and fused with IMU and GPS for robustness
* @sensors Magnetometer, IMU, GPS
* @units N/A
* @datastruct \ref T_ZiyanFcSubscriptionCompass
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_COMPASS = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 24),
/*!
* @brief Provides remote controller stick inputs @ up to 100Hz
* @details This topic will give you:
* - Stick inputs (R,P,Y,Thr)
* - Mode switch (P/A/F)
* - Landing gear switch (Up/Down)
*
* @datastruct \ref T_ZiyanFcSubscriptionRC
* @also \ref TOPIC_RC_WITH_FLAG_DATA
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_RC = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 25),
/*!
* @brief Provides gimbal pitch, roll, yaw @ up to 50Hz
* @details
* The reference frame for gimbal angles is a NED frame attached to the gimbal.
* This topic uses a data structure, Vector3f, that is too generic for the topic. The order of angles is :
* |Data Structure Element| Meaning|
* |----------------------|--------|
* |Vector3f.x |pitch |
* |Vector3f.y |roll |
* |Vector3f.z |yaw |
*
* @perf
* 0.1 deg accuracy in all axes
*
* @sensors Gimbal Encoder, IMU, Magnetometer
* @units deg
* @datastruct \ref T_ZiyanFcSubscriptionGimbalAngles
* @also \ref TOPIC_GIMBAL_STATUS, \ref TOPIC_GIMBAL_CONTROL_MODE
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 26),
/*!
* @brief Provides gimbal status and error codes @ up to 50Hz
* @details Please see the \ref GimbalStatus struct for the details on what data you can receive.
*
* @datastruct \ref T_ZiyanFcSubscriptionGimbalStatus
* @also \ref TOPIC_GIMBAL_ANGLES, \ref TOPIC_GIMBAL_CONTROL_MODE
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GIMBAL_STATUS = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 27),
/*!
* @brief Flight status topic name. Please refer to ::T_ZiyanFcSubscriptionFlightStatus for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionFlightStatus
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 28),
/*!
* @brief Provides a granular state representation for various tasks/flight modes @ up to 50Hz
* @details Typically, use this topic together with \ref TOPIC_STATUS_FLIGHT to get a
* better understanding of the overall status of the aircraft.
*
* @datastruct \ref T_ZiyanFcSubscriptionDisplaymode
* @also \ref TOPIC_STATUS_FLIGHT
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_STATUS_DISPLAYMODE = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 29),
/*!
* @brief Provides status for the landing gear state @ up to 50Hz
*
* @datastruct \ref T_ZiyanFcSubscriptionLandinggear
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_STATUS_LANDINGGEAR = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 30),
/*!
* @brief If motors failed to start, this topic provides reasons why. Available @ up to 50Hz
* @datastruct \ref T_ZiyanFcSubscriptionMotorStartError
* \note These enumerations show up in the ErrorCode class because they can also be returned as acknowledgements
* for APIs that start the motors, such as \ref Control::takeoff "Takeoff" or \ref Control::armMotors "Arm"
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_STATUS_MOTOR_START_ERROR = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC,
31),
/*!
* @brief Battery information topic name. Please refer to ::T_ZiyanFcSubscriptionWholeBatteryInfo for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionWholeBatteryInfo
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_BATTERY_INFO = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 32),
/*!
* @brief Provides states of the aircraft related to SDK/RC control
* @details The following information is available in this topic:
* |Data Structure Element| Meaning|
* |----------------------|--------|
* |controlMode |The modes in which the aircraft is being controlled (control loops being applied on horizontal, vertical and yaw axes of the aircraft)|
* |deviceStatus |Which device is controlling the motion of the aircraft: RC (Manual control), MSDK (Missions kicked off through mobile), OSDK (Missions kicked off through onboard/ low-level flight control) |
* |flightStatus |Has the OSDK been granted control authority? Since MSDK and RC have precedence, it is possible that deviceStatus shows RC or MSDK actually controlling the aircraft but this value is 1. |
* |vrcStatus |Deprecated|
* @datastruct \ref T_ZiyanFcSubscriptionControlDevice
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_CONTROL_DEVICE = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 33),
/*!
* @brief Provides IMU and quaternion data time-synced with a hardware clock signal @ up to 400Hz.
* @details This is the only data which can be synchronized with external software or hardware systems. If you want to
* fuse an external sensor's data with the aircraft's IMU, this data along with a hardware trigger from the A3/N3's
* expansion ports is how you would do it. You can see detailed documentation on how this process works in the [Hardware
* Sync Guide](https://developer.ziyan.com/onboard-sdk/documentation/guides/component-guide-hardware-sync.html).
* @sensors IMU, sensor fusion output
* @units
* |Data Structure Element| Units|
* |----------------------|--------|
* |Timestamp |2.5ms, 1ns (See \ref SyncTimestamp)|
* |Quaternion |rad (after converting to rotation matrix)|
* |Acceleration |g|
* |Gyroscope |rad/sec|
* @datastruct \ref T_ZiyanFcSubscriptionHardSync
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_HARD_SYNC = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 34),
/*!
* @brief Provides a measure of the quality of GPS signal, with a mechanism for guarding against unset homepoint @ up to 50Hz
* @details The level varies from 0 to 5, with 0 being the worst and 5 the best GPS signal. The key difference between
* this and TOPIC_GPS_SIGNAL_LEVEL is that this topic always returns 0 if the homepoint is not set. Once the home point is
* set, the behavior is exactly the same as TOPIC_GPS_SIGNAL_LEVEL.
* @sensors GPS
* @datastruct \ref T_ZiyanFcSubscriptionGpsControlLevel
* @also \ref TOPIC_GPS_SIGNAL_LEVEL
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GPS_CONTROL_LEVEL = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 35),
/*!
* @brief Provides normalized remote controller stick input data, along with connection status @ up to 50Hz
* @note This topic was added in August 2018. Your aircraft may require a FW update to enable this feature.
* @details This topic will give you:
* - Stick inputs (R,P,Y,Thr)
* - Mode switch (P/A/F)
* - Landing gear switch (Up/Down)
* - Connection status for air system, ground system and MSDK apps. The connection status also includes a
* logicConnected element, which will change to false if either the air system or the ground system radios
* are disconnected for >3s.
* - Deadzones near the center of the stick positions are also handled in this topic.
*
* @datastruct \ref T_ZiyanFcSubscriptionRCWithFlagData
* @also \ref TOPIC_RC
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_RC_WITH_FLAG_DATA = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 36),
/*!
* @brief Provides raw data from the ESCs @ up to 50Hz
* @note This topic was added in August 2018. Your aircraft may require a FW update to enable this feature.
* @details This topic supports reporting data for up to 8 ESCs; note that only ZIYAN Intelligent ESCs are supported
* for this reporting feature. Use this topic to get data on elements close to the hardware - e.g. motor speeds,
* ESC current and voltage, error flags at the ESC level etc.
* @datastruct \ref T_ZiyanFcSubscriptionEscData
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_ESC_DATA = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 37),
/*!
* @brief Provides RTK connection status @ up to 50Hz
* @note This topic was added in August 2018. Your aircraft may require a FW update to enable this feature.
* @details This topic will update in real time whether the RTK GPS system is connected or not; typical uses
* include app-level logic to switch between GPS and RTK sources of positioning based on this flag.
* @datastruct \ref T_ZiyanFcSubscriptionRTKConnectStatus
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_RTK_CONNECT_STATUS = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 38),
/*!
* @brief Provides the mode in which the gimbal will interpret control commands @ up to 50Hz
* @note This topic was added in August 2018. Your aircraft may require a FW update to enable this feature.
* @details This topic will report the current control mode which can be set in the
* ZIYAN Go app, MSDK apps, or through Onboard SDK gimbal control APIs (see \ref Gimbal::AngleData "AngleData" struct
* for more information)
* @datastruct \ref T_ZiyanFcSubscriptionGimbalControlMode
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_GIMBAL_CONTROL_MODE = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 39),
/*!
* @brief Provides a number of flags which report different errors the aircraft may encounter in flight @ up to 50Hz
* @note This topic was added in August 2018. Your aircraft may require a FW update to enable this feature.
* @warning Most of the errors reported by this topic are cases where immediate action is required; you can use these
* as a baseline for implementing safety-related error-handling routines.
* @datastruct \ref T_ZiyanFcSubscriptionFlightAnomaly
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_FLIGHT_ANOMALY = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 40),
/*!
* @brief Provides aircraft's position in a Cartesian frame @ up to 50Hz, without the need for GPS
* @warning This topic does not follow a standard co-ordinate convention. Please read the details below for usage.
* @details This is the only topic which can provide positioning information without having a GPS fix; though this
* can be a big enabler please note the caveats of using this topic:
* - The topic will use an origin that does not have a global reference, and is not published to the SDK.
* - The topic uses a combination of VO and compass heading to identify the X-Y axes of its reference frame. This means
* that if your compass performance is not good in an environment, there is no guarantee the X-Y axes will point to
* North and East.
* - The actual directions of the X-Y axes are currently not published to the SDK.
* - If during a flight the compass performance were to change dramatically, the orientation of the X-Y axes may change
* to re-align with North-East. The aircraft's position in X and Y may exhibit discontinuities in these cases.
* - The reference frame is referred to as the Navigation Frame - Cartesian X,Y axes aligned with N,E directions on a best-effort
* basis, and Z aligned to D (down) direction.
* - A health flag for each axis provides some granularity on whether this data is valid or not.
*
* The key takeaway from these details is that this topic provides a best-effort attempt at providing position
* information in the absence of absolute references (GPS, compass etc.), without guarantees of consistency if
* environmental conditions change. So if your application is confined to a stable environment, or if you will
* have GPS and compass available at all times, this topic can still provide useful data that cannot be otherwise
* had. If using for control, make sure to have guards checking for the continuity of data.
*
* @note Since this topic relies on visual features and/or GPS, if your environment does not provide any of these
* sources of data, the quality of this topic will reduce significantly. VO data quality will reduce if you are too high
* above the ground. Make sure that the Vision Positioning System is enabled in ZIYAN Go 4 before using this topic
* (by default it is enabled).
* @sensors IMU, VO, GPS(if available), RTK (if available), ultrasonic, magnetometer, barometer
* @units m
* @datastruct \ref T_ZiyanFcSubscriptionPositionVO
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_POSITION_VO = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 41),
/*!
* @brief Provides obstacle info around the vehicle @ up to 100Hz
* @datastruct \ref T_ZiyanFcSubscriptionAvoidData
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_AVOID_DATA = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 42),
/*!
* @brief Provides status of whether the home point was set or not
* @datastruct \ref T_ZiyanFcSubscriptionHomePointSetStatus
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_HOME_POINT_SET_STATUS = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 43),
/*!
* @brief Provides homepoint information, the valid of the home point infomation can ref to the
* topic ZIYAN_FC_SUBSCRIPTION_TOPIC_HOME_POINT_SET_STATUS
* @datastruct \ref T_ZiyanFcSubscriptionHomePointInfo
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_HOME_POINT_INFO = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 44),
/*!
* @brief Provides three gimbal information, used for M300
* @datastruct \ref T_ZiyanFcSubscriptionThreeGimbalData
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 45),
/*!
* @brief Battery information topic name. Please refer to ::T_ZiyanFcSubscriptionSingleBatteryInfo for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionSingleBatteryInfo
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX1 = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC,
46),
/*!
* @brief Battery information topic name. Please refer to ::T_ZiyanFcSubscriptionSingleBatteryInfo for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionSingleBatteryInfo
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX2 = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC,
47),
/*!
* @brief Please refer to ::T_ZiyanFcSubscriptionImuAttiNaviDataWithTimestamp for information about data structure.
* @datastruct \ref T_ZiyanFcSubscriptionImuAttiNaviDataWithTimestamp
*/
ZIYAN_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP = ZIYAN_DATA_SUBSCRIPTION_TOPIC(ZIYAN_DATA_SUBSCRIPTION_MODULE_FC, 48),
/*! Total number of topics that can be subscribed. */
ZIYAN_FC_SUBSCRIPTION_TOPIC_TOTAL_NUMBER,
} E_ZiyanFcSubscriptionTopic;
/**
* @brief Health state of data subscribed.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_DATA_NOT_HEALTH = 0, /*!< Data subscribed is healthy and can be used. */
ZIYAN_FC_SUBSCRIPTION_DATA_HEALTH = 1, /*!< Data subscribed is not healthy and recommend not to use it. */
} E_ZiyanFcSubscriptionDataHealthFlag;
/**
* @brief Position solution property.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_NOT_AVAILABLE = 0, /*!< Position solution is not available. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FIX_POSITION = 1, /*!< Position has been fixed by the FIX POSITION command. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FIX_HEIGHT_AUTO = 2, /*!< Position has been fixed by the FIX HEIGHT/AUTO command. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_INSTANTANEOUS_DOPPLER_COMPUTE_VELOCITY = 8, /*!< Velocity computed using instantaneous Doppler. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_SINGLE_PNT_SOLUTION = 16, /*!< Single point position solution. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_PSEUDORANGE_DIFFERENTIAL_SOLUTION = 17, /*!< Pseudorange differential solution. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_SBAS_CORRECTION_CALCULATED = 18, /*!< Solution calculated using corrections from an SBAS. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_KALMAN_FILTER_WITHOUT_OBSERVATION_PROPAGATED = 19, /*!< Propagated by a Kalman filter without new observations. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_OMNISTAR_VBS_POSITION = 20, /*!< OmniSTAR VBS position (L1 sub-metre). */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_L1_AMBIGUITY = 32, /*!< Floating L1 ambiguity solution. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_IONOSPHERIC_FREE_AMBIGUITY = 33, /*!< Floating ionospheric-free ambiguity solution. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_FLOAT_SOLUTION = 34, /*!< Float position solution. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_L1_AMBIGUITY_INT = 48, /*!< Integer L1 ambiguity solution. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_WIDE_LANE_AMBIGUITY_INT = 49, /*!< Integer wide-lane ambiguity solution. */
ZIYAN_FC_SUBSCRIPTION_POSITION_SOLUTION_PROPERTY_NARROW_INT = 50, /*!< Narrow fixed point position solution. */
} E_ZiyanFcSubscriptionPositionSolutionProperty;
/**
* @brief GPS fix state.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_GPS_FIX_STATE_NO_FIX = 0, /*!< GPS position has not been fixed. */
ZIYAN_FC_SUBSCRIPTION_GPS_FIX_STATE_DEAD_RECKONING_ONLY = 1, /*!< GPS position is dead reckoned only. */
ZIYAN_FC_SUBSCRIPTION_GPS_FIX_STATE_2D_FIX = 2, /*!< The horizontal position with latitude/longitude (or northing/easting or X/Y) is fixed. */
ZIYAN_FC_SUBSCRIPTION_GPS_FIX_STATE_3D_FIX = 3, /*!< The horizontal and vertical position with latitude/longitude/altitude (northing/easting/altitude or X/Y/Z) is fixed. */
ZIYAN_FC_SUBSCRIPTION_GPS_FIX_STATE_GPS_PLUS_DEAD_RECKONING = 4, /*!< Position is calculated by GPS and combined with dead reckoning. */
ZIYAN_FC_SUBSCRIPTION_GPS_FIX_STATE_TIME_ONLY_FIX = 5, /*!< Only time is fixed. */
} E_ZiyanFcSubscriptionGpsFixState;
/**
* @brief Flight status of aircraft.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_FLIGHT_STATUS_STOPED = 0, /*!< Aircraft is on ground and motors are still. */
ZIYAN_FC_SUBSCRIPTION_FLIGHT_STATUS_ON_GROUND = 1, /*!< Aircraft is on ground but motors are rotating. */
ZIYAN_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR = 2, /*!< Aircraft is in air. */
} E_ZiyanFcSubscriptionFlightStatus;
/*!
* @brief "Mode" of the vehicle's state machine, as displayed on ZIYAN Go
* @details Available through Telemetry::TOPIC_STATUS_DISPLAYMODE
*/
typedef enum {
/*! This mode requires the user to manually
* control the aircraft to remain stable in air. */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_MANUAL_CTRL = 0,
/*! In this mode, the aircraft can keep
* attitude stabilization and only use the
* barometer for positioning to control the altitude. <br>
* The aircraft can not autonomously locate and hover stably.*/
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_ATTITUDE = 1,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_2 = 2,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_3 = 3,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_4 = 4,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_5 = 5,
/*! The aircraft is in normal GPS mode. <br>
* In normal GPS mode, the aircraft can
* autonomously locate and hover stably. <br>
* The sensitivity of the aircraft to the
* command response is moderate.
*/
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_P_GPS = 6,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_7 = 7,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_8 = 8,
/*! In hotpoint mode */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_HOTPOINT_MODE = 9,
/*! In this mode, user can push the throttle
* stick to complete stable take-off. */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_ASSISTED_TAKEOFF = 10,
/*! In this mode, the aircraft will autonomously
* start motor, ascend and finally hover. */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_AUTO_TAKEOFF = 11,
/*! In this mode, the aircraft can land autonomously. */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_AUTO_LANDING = 12,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_13 = 13,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_14 = 14,
/*! In this mode, the aircraft can antonomously return the
* last recorded Home Point. <br>
* There are three types of this mode: Smart RTH(Return-to-Home),
* Low Batterry RTH, and Failsafe RTTH. */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_NAVI_GO_HOME = 15,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_16 = 16,
/*! In this mode, the aircraft is controled by SDK API. <br>
* User can directly define the control mode of horizon
* and vertical directions and send control datas to aircraft. */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_NAVI_SDK_CTRL = 17,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_18 = 18,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_19 = 19,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_20 = 20,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_21 = 21,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_22 = 22,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_23 = 23,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_24 = 24,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_25 = 25,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_26 = 26,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_27 = 27,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_28 = 28,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_29 = 29,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_30 = 30,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_31 = 31,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_32 = 32,
/*! drone is forced to land, might due to low battery */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING = 33,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_34 = 34,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_35 = 35,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_36 = 36,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_37 = 37,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_38 = 38,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_39 = 39,
/*! drone will search for the last position where the rc is not lost */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_SEARCH_MODE = 40,
/*! Mode for motor starting. <br>
* Every time user unlock the motor, this will be the first mode. */
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_ENGINE_START = 41,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_42 = 42,
ZIYAN_FC_SUBSCRIPTION_DISPLAY_MODE_RESERVED_43 = 42,
} E_ZiyanFcSubscriptionDisplayMode;
/**
* @brief Setting status of homepoint.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_HOME_POINT_SET_STATUS_FAILED = 0, /*!< The home point was not set yet. */
ZIYAN_FC_SUBSCRIPTION_HOME_POINT_SET_STATUS_SUCCESS = 1, /*!< The home point was set successfully. */
} E_ZiyanFcSubscriptionHomePointSetStatus;
/**
* @brief Smart battery self-check result.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_BATTERY_SELF_CHECK_NORMAL = 0, /*!< Battery self-check is normal. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SELF_CHECK_NTC_ABNORMAL = 1, /*!< Battery self-check NTC is abnormal. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SELF_CHECK_MOS_ABNORMAL = 2, /*!< Battery self-check MOS is abnormal. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SELF_CHECK_R_ABNORMAL = 3, /*!< Battery self-check sampling resistance is abnormal. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SELF_CHECK_CELL_DAMAGE = 4, /*!< Battery cell self-check is damaged. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SELF_CHECK_CAL_EXP = 5, /*!< Battery self-check is not calibrated. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SELF_CHECK_GAUGE_PARM_EXP = 6, /*!< Battery self-check fuel gauge parameters is abnormal. */
} E_ZIYANFcSubscriptionBatterySelfCheck;
/**
* @brief Smart battery closed reason.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_NORMAL = 0, /*!< Battery closed reason is normal shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_FORCED = 1, /*!< Battery closed reason is forced by flight controller shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_SCD = 2, /*!< Battery closed reason is discharge short circuit shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_OLD = 3, /*!< Battery closed reason is discharge overload shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_OCD = 4, /*!< Battery closed reason is discharge over current shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_UVD = 5, /*!< Battery closed reason is discharge under voltage shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_OTD = 6, /*!< Battery closed reason is discharge over temperature shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_SCC = 16, /*!< Battery closed reason is charging short circuit shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_OCC = 17, /*!< Battery closed reason is charging over current shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_OVC = 18, /*!< Battery closed reason is charging over voltage shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_CHARGER_OVC = 19, /*!< Battery closed reason is charger over voltage shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_LTC = 20, /*!< Battery closed reason is charging low temperature shutdown. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_CLOSED_HTC = 21, /*!< Battery closed reason is charging high temperature shutdown. */
} E_ZIYANFcSubscriptionBatteryClosedReason;
/**
* @brief Smart battery SOH state.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_BATTERY_SOH_NORMAL = 0, /*!< Battery SOH state is normal. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SOH_ALERT = 1, /*!< Battery SOH state is alert. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SOH_SAFE = 2, /*!< Battery SOH state is safe. */
} E_ZIYANFcSubscriptionBatterySohState;
/**
* @brief Smart battery heart state.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_BATTERY_NO_HEAT = 0, /*!< Battery is in no heat state. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_IN_HEAT = 1, /*!< Battery is in heat state. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_KEEP_WARM = 2, /*!< Battery is in keep warm state. */
} E_ZIYANFcSubscriptionBatteryHeatState;
/**
* @brief Smart battery SOC state.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_BATTERY_SOC_NORMAL = 0, /*!< Battery SOC state is normal. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SOC_ABNORMAL_HIGH = 1, /*!< Battery SOC state is abnormal high. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SOC_JUMP_DOWN = 2, /*!< Battery SOC state is jump down. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SOC_JUMP_UP = 3, /*!< Battery SOC state is jump up. */
ZIYAN_FC_SUBSCRIPTION_BATTERY_SOC_INVALID = 4, /*!< Battery SOC state is invalid. */
} E_ZIYANFcSubscriptionBatterySocState;
/**
* @brief Flight control mode.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_UNKNOWN = 0,
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_ANG_VER_VEL_YAW_ANG = 1, /*!< Horizontal mode is angle, vertical mode is velocity, yaw mode is angle. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_ANG_VER_VEL_YAW_RAT = 2, /*!< Horizontal mode is angle, vertical mode is velocity, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_VEL_VER_VEL_YAW_ANG = 3, /*!< Horizontal mode is velocity, vertical mode is velocity, yaw mode is angle. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_VEL_VER_VEL_YAW_RAT = 4, /*!< Horizontal mode is velocity, vertical mode is velocity, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_POS_VER_VEL_YAW_ANG = 5, /*!< Horizontal mode is position, vertical mode is velocity, yaw mode is angle. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_POS_VER_VEL_YAW_RAT = 6, /*!< Horizontal mode is position, vertical mode is velocity, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_ANG_VER_POS_YAW_ANG = 7, /*!< Horizontal mode is angle, vertical mode is position, yaw mode is angle. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_ANG_VER_POS_YAW_RAT = 8, /*!< Horizontal mode is angle, vertical mode is position, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_VEL_VER_POS_YAW_ANG = 9, /*!< Horizontal mode is velocity, vertical mode is position, yaw mode is angle. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_VEL_VER_POS_YAW_RAT = 10, /*!< Horizontal mode is velocity, vertical mode is position, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_POS_VER_POS_YAW_ANG = 11, /*!< Horizontal mode is position, vertical mode is position, yaw mode is angle. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_POS_VER_POS_YAW_RAT = 12, /*!< Horizontal mode is position, vertical mode is position, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_ANG_VER_THR_YAW_ANG = 13, /*!< Horizontal mode is angle, vertical mode is thrust, yaw mode is angle. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_ANG_VER_THR_YAW_RAT = 14, /*!< Horizontal mode is angle, vertical mode is thrust, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_VEL_VER_THR_YAW_ANG = 15, /*!< Horizontal mode is velocity, vertical mode is thrust, yaw mode is angle. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_VEL_VER_THR_YAW_RAT = 16, /*!< Horizontal mode is velocity, vertical mode is thrust, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_POS_VER_THR_YAW_ANG = 17, /*!< Horizontal mode is position, vertical mode is thrust, yaw mode is angle. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_POS_VER_THR_YAW_RAT = 18, /*!< Horizontal mode is position, vertical mode is thrust, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_AEL_VER_VEL_YAW_RAT = 19, /*!< Horizontal mode is angle-rate, vertical mode is velocity, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_AEL_VER_POS_YAW_RAT = 20, /*!< Horizontal mode is angle-rate, vertical mode is thrust, yaw mode is rate. */
ZIYAN_FC_SUBSCRIPTION_CONTROL_MODE_HOR_AEL_VER_THR_YAW_RAT = 21, /*!< Horizontal mode is angle-rate, vertical mode is velocity, yaw mode is rate. */
} E_ZIYANFcSubscriptionControlMode;
/**
* @brief Flight control authority.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_CONTROL_AUTHORITY_RC = 0, /*!< Authority is in remote control */
ZIYAN_FC_SUBSCRIPTION_CONTROL_AUTHORITY_MSDK = 1, /*!< Authority is in MSDK */
ZIYAN_FC_SUBSCRIPTION_CONTROL_AUTHORITY_PSDK = 4, /*!< Authority is in PSDK */
ZIYAN_FC_SUBSCRIPTION_CONTROL_AUTHORITY_DOCK = 5, /*!< Authority is in dock */
} E_ZIYANFcSubscriptionControlAuthority;
/**
* @brief Flight control authority change reason.
*/
typedef enum {
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_UNKNOWN = 0, /*!< Reason unknown */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_MSDK_REQUEST = 1, /*!< Contro authority changed by MSDK request. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_USER_REQUEST = 2, /*!< Contro authority changed by user request. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_PSDK_REQUEST = 3, /*!< Contro authority changed by PSDK request. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_RC_LOST = 4, /*!< Contro authority changed for remote control lost. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_RC_NOT_P_MODE = 5, /*!< Contro authority changed for remote control not in P mode. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_RC_SWITCH = 6, /*!< Contro authority changed for remote control switching mode. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_RC_PAUSE_STOP = 7, /*!< Contro authority changed for remote control stop key paused. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_RC_ONE_KEY_GO_HOME = 8, /*!< Contro authority changed for remote control go-home key paused. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_BATTERY_LOW_GO_HOME = 9, /*!< Contro authority changed for remote control go-home key paused. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_BATTERY_SUPER_LOW_LANDING = 10, /*!< Contro authority changed for going home caused by low batter power. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_PSDK_LOST = 11, /*!< Contro authority changed for PSDK lost. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_NEAR_BOUNDARY = 13, /*!< Contro authority changed for nearing boundary. */
ZIYAN_FC_SUBSCRIPTION_AUTHORITY_CHANGE_REASON_AIRPORT_REQUEST = 14, /*!< Contro authority changed by airport request. */
} E_ZIYANFcSubscriptionAuthorityChangeReason;
#pragma pack(1)
/**
* @brief Quaternion topic data structure.
*/
typedef struct Quaternion {
ziyan_f32_t q0; /*!< w, rad (when converted to a rotation matrix or Euler angles). */
ziyan_f32_t q1; /*!< x, rad (when converted to a rotation matrix or Euler angles). */
ziyan_f32_t q2; /*!< y, rad (when converted to a rotation matrix or Euler angles). */
ziyan_f32_t q3; /*!< z, rad (when converted to a rotation matrix or Euler angles). */
} T_ZiyanFcSubscriptionQuaternion;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_ACCELERATION_GROUND topic data structure.
*/
typedef T_ZiyanVector3f T_ZiyanFcSubscriptionAccelerationGround;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_ACCELERATION_BODY topic data structure.
*/
typedef T_ZiyanVector3f T_ZiyanFcSubscriptionAccelerationBody;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_ACCELERATION_RAW topic data structure.
*/
typedef T_ZiyanVector3f T_ZiyanFcSubscriptionAccelerationRaw;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_VELOCITY topic data structure.
*/
typedef struct Velocity {
/*! Velocity of aircraft. */
T_ZiyanVector3f data;
/*! Health state of aircraft velocity data. It can be any value of ::E_ZiyanFcSubscriptionDataHealthFlag. */
uint8_t health: 1;
/*! Reserved. */
uint8_t reserve: 7;
} T_ZiyanFcSubscriptionVelocity;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_ANGULAR_RATE_FUSIONED topic data structure.
*/
typedef T_ZiyanVector3f T_ZiyanFcSubscriptionAngularRateFusioned;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_ANGULAR_RATE_RAW topic data structure.
*/
typedef T_ZiyanVector3f T_ZiyanFcSubscriptionAngularRateRaw;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_ANGULAR_RATE_RAW topic data structure.
*/
typedef ziyan_f32_t T_ZiyanFcSubscriptionAltitudeFused;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_ALTITUDE_BAROMETER topic data structure.
*/
typedef ziyan_f32_t T_ZiyanFcSubscriptionAltitudeBarometer;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_ALTITUDE_OF_HOMEPOINT topic data structure.
*/
typedef ziyan_f32_t T_ZiyanFcSubscriptionAltitudeOfHomePoint;
/**
* @brief ZIYAN_FC_SUBSCRIPTION_TOPIC_HEIGHT_FUSION topic data structure.
*/
typedef ziyan_f32_t T_ZiyanFcSubscriptionHeightFusion;
/**
* @brief Relative height above ground topic data structure, unit: m.
*/
typedef ziyan_f32_t T_ZiyanFcSubscriptionHeightRelative;
/**
* @brief Fused position topic data structure.
*/
typedef struct PositionFused {
ziyan_f64_t longitude; /*!< Longitude, unit: rad. */
ziyan_f64_t latitude; /*!< Latitude, unit: rad. */
ziyan_f32_t altitude; /*!< Altitude, WGS 84 reference ellipsoid, unit: m. */
uint16_t visibleSatelliteNumber; /*!< Number of visible satellites. */
} T_ZiyanFcSubscriptionPositionFused;
/**
* @brief GPS date topic data structure, format: yyyymmdd.
*/
typedef uint32_t T_ZiyanFcSubscriptionGpsDate;
/**
* @brief GPS time topic data structure, format: hhmmss.
*/
typedef uint32_t T_ZiyanFcSubscriptionGpsTime;
/**
* @brief GPS position topic data structure. x = Longitude, y = Latitude, z = Altitude, unit: deg*10<SUP>-7</SUP>
* (Lat,Lon), mm (Alt)
*/
typedef T_ZiyanVector3d T_ZiyanFcSubscriptionGpsPosition;
/**
* @brief GPS velocity topic data structure, unit: cm/s.
*/
typedef T_ZiyanVector3f T_ZiyanFcSubscriptionGpsVelocity;
/**
* @brief GPS details topic data structure.
*/
typedef struct GpsDetail {
ziyan_f32_t hdop; /*!< Horizontal dilution of precision, unit: 0.01, eg: 100 = 1.00, <1: ideal, 1-2: excellent, 2-5: good, 5-10: moderate, 10-20: fair, >20: poor. */
ziyan_f32_t pdop; /*!< Position dilution of precision, unit: 0.01, eg: 100 = 1.00, <1: ideal, 1-2: excellent, 2-5: good, 5-10: moderate, 10-20: fair, >20: poor. */
ziyan_f32_t fixState; /*!< GPS fix state, and can be any value of ::E_ZiyanFcSubscriptionGpsFixState. Value other than ::E_ZiyanFcSubscriptionGpsFixState is invalid. */
ziyan_f32_t vacc; /*!< Vertical position accuracy (mm), the smaller, the better. */
ziyan_f32_t hacc; /*!< Horizontal position accuracy (mm), the smaller, the better. */
ziyan_f32_t sacc; /*!< Speed accuracy (cm/s), the smaller, the better. */
uint32_t gpsSatelliteNumberUsed; /*!< Number of GPS satellites used for fixing position. */
uint32_t glonassSatelliteNumberUsed; /*!< Number of GLONASS satellites used for fixing position. */
uint16_t totalSatelliteNumberUsed; /*!< Total number of satellites used for fixing position. */
uint16_t gpsCounter; /*!< Accumulated times of sending GPS data. */
} T_ZiyanFcSubscriptionGpsDetails;
/**
* @brief GPS signal level topic data structure. Signal level of GPS. The level varies from 0 to 5, with 0 being the
* worst and 5 the best GPS signal.
*/
typedef uint8_t T_ZiyanFcSubscriptionGpsSignalLevel;
/**
* @brief RTK position topic data structure.
*/
typedef struct PositionData {
ziyan_f64_t longitude; /*!< Longitude, unit: deg. */
ziyan_f64_t latitude; /*!< Latitude, unit: deg. */
ziyan_f32_t hfsl; /*!< Height above mean sea level, unit: m. */
} T_ZiyanFcSubscriptionRtkPosition;
/**
* @brief RTK velocity topic data structure, unit: cm/s.
*/
typedef T_ZiyanVector3f T_ZiyanFcSubscriptionRtkVelocity;
/**
* @brief RTK yaw topic data structure, unit: deg.
*/
typedef int16_t T_ZiyanFcSubscriptionRtkYaw;
/**
* @brief RTK position information topic data structure. Specifies RTK position solution state, it can be any value of
* ::E_ZiyanFcSubscriptionPositionSolutionProperty.
*/
typedef uint8_t T_ZiyanFcSubscriptionRtkPositionInfo;
/**
* @brief RTK yaw information topic data structure. Specifies RTK yaw solution state, it can be any value of
* ::E_ZiyanFcSubscriptionPositionSolutionProperty.
*/
typedef uint8_t T_ZiyanFcSubscriptionRtkYawInfo;
/*!
* @brief struct for data broadcast, return magnetometer reading
*
* @note returned value is calibrated mag data,
* 1000 < |mag| < 2000 for normal operation
*/
typedef struct Mag {
int16_t x;
int16_t y;
int16_t z;
} T_ZiyanFcSubscriptionCompass;
/*!
* @brief struct for data broadcast and data subscription, return RC reading
*/
typedef struct RC {
int16_t roll; /*!< [-10000,10000] */
int16_t pitch; /*!< [-10000,10000] */
int16_t yaw; /*!< [-10000,10000] */
int16_t throttle; /*!< [-10000,10000] */
int16_t mode; /*!< [-10000,10000] */
/*!< M100 [P: -8000, A: 0, F: 8000] */
int16_t gear; /*!< [-10000,10000] */
/*!< M100 [Up: -10000, Down: -4545] */
} T_ZiyanFcSubscriptionRC;
typedef T_ZiyanVector3f T_ZiyanFcSubscriptionGimbalAngles;
/*!
* @brief struct for TOPIC_GIMBAL_STATUS
*/
typedef struct GimbalStatus {
uint32_t mountStatus: 1; /*!< 1 - gimbal mounted, 0 - gimbal not mounted*/
uint32_t isBusy: 1;
uint32_t pitchLimited: 1; /*!< 1 - axis reached limit, 0 - no */
uint32_t rollLimited: 1; /*!< 1 - axis reached limit, 0 - no */
uint32_t yawLimited: 1; /*!< 1 - axis reached limit, 0 - no */
uint32_t calibrating: 1; /*!< 1 - calibrating, 0 - no */
uint32_t prevCalibrationgResult: 1; /*!< 1 - success, 0 - fail */
uint32_t installedDirection: 1; /*!< 1 - reversed for OSMO, 0 - normal */
uint32_t disabled_mvo: 1;
uint32_t gear_show_unable: 1;
uint32_t gyroFalut: 1; /*!< 1 - fault, 0 - normal */
uint32_t escPitchStatus: 1; /*!< 1 - Pitch data is normal, 0 - fault */
uint32_t escRollStatus: 1; /*!< 1 - Roll data is normal, 0 - fault */
uint32_t escYawStatus: 1; /*!< 1 - Yaw data is normal , 0 - fault */
uint32_t droneDataRecv: 1; /*!< 1 - normal , 0 - at fault */
uint32_t initUnfinished: 1; /*!< 1 - init complete, 0 - not complete */
uint32_t FWUpdating: 1; /*!< 1 - updating, 0 - not updating */
uint32_t reserved2: 15;
} T_ZiyanFcSubscriptionGimbalStatus;
/**
* @brief Flight status information topic data structure. It can be any value of ::E_ZiyanFcSubscriptionFlightStatus.
*/
typedef uint8_t T_ZiyanFcSubscriptionFlightStatus;
typedef uint8_t T_ZiyanFcSubscriptionDisplaymode;
typedef uint8_t T_ZiyanFcSubscriptionLandinggear;
typedef uint16_t T_ZiyanFcSubscriptionMotorStartError;
typedef struct {
uint32_t reserved: 12;
uint32_t cellBreak: 5; /*!< 0: normal; other: under voltage core index(0x01-0x1F). */
uint32_t selfCheckError: 3; /*!< enum-type: E_ZIYANFcSubscriptionBatterySelfCheck. */
uint32_t reserved1: 7;
uint32_t batteryClosedReason: 5; /*!< enum-type: E_ZIYANFcSubscriptionBatteryClosedReason. */
uint8_t reserved2: 6; /*!< 0: CHG state; 1: DSG state; 2: ORING state. */
uint8_t batSOHState: 2; /*!< enum-type: E_ZIYANFcSubscriptionBatterySohState. */
uint8_t maxCycleLimit: 6; /*!< APP: cycle_limit*10. */
uint8_t reserved3: 2;
uint16_t lessBattery: 1;
uint16_t batteryCommunicationAbnormal: 1;
uint16_t reserved4: 3;
uint16_t hasCellBreak: 1;
uint16_t reserved5: 4;
uint16_t isBatteryEmbed: 1; /*!< 0:embed; 1:not embed. */
uint16_t heatState: 2; /*!< enum-type: E_ZIYANFcSubscriptionBatteryHeatState. */
uint16_t socState: 3; /*!< enum-type: E_ZIYANFcSubscriptionBatterySocState. */
} T_ZiyanFcSubscriptionSingleBatteryState;
/**
* @brief Battery information topic data structure.
*/
typedef struct BatteryWholeInfo {
uint32_t capacity; /*!< Battery capacity, unit: mAh. */
int32_t voltage; /*!< Battery voltage, unit: mV. */
int32_t current; /*!< Battery current, unit: mA. */
uint8_t percentage; /*!< Battery capacity percentage, unit: 1%. */
} T_ZiyanFcSubscriptionWholeBatteryInfo;
typedef struct BatterySingleInfo {
uint8_t reserve;
uint8_t batteryIndex;
int32_t currentVoltage; /*!< uint: mV. */
int32_t currentElectric; /*!< uint: mA. */
uint32_t fullCapacity; /*!< uint: mAh. */
uint32_t remainedCapacity; /*!< uint: mAh. */
int16_t batteryTemperature; /*!< uint: 0.1℃. */
uint8_t cellCount;
uint8_t batteryCapacityPercent; /*!< uint: %. */
T_ZiyanFcSubscriptionSingleBatteryState batteryState;
uint8_t reserve1;
uint8_t reserve2;
uint8_t SOP; /*!< Relative power percentage. */
} T_ZiyanFcSubscriptionSingleBatteryInfo;
/*!
* @brief struct for TOPIC_CONTROL_DEVICE and data broadcast, return SDK info
*/
typedef struct SDKCtrlInfo {
union {
/* Used by M300 & M350 */
struct {
uint8_t controlMode; /*!< enum-type: E_ZIYANFcSubscriptionControlMode. */
uint8_t deviceStatus: 3; /*!< 0->rc 1->app 4->psdk */
uint8_t flightStatus: 1; /*!< 1->open 0->closed */
uint8_t vrcStatus: 1;
uint8_t reserved: 3;
};
/* Used by other aircrafts */
struct {
uint8_t controlAuthority; /*!< enum-type: E_ZIYANFcSubscriptionControlAuthority. */
uint8_t controlAuthorityChangeReason; /*!< enum-type: E_ZIYANFcSubscriptionAuthorityChangeReason. */
};
};
} T_ZiyanFcSubscriptionControlDevice; // pack(1)
/*!
* @brief sub struct for TOPIC_HARD_SYNC
*/
typedef struct SyncTimestamp {
uint32_t time2p5ms; /*!< clock time in multiples of 2.5ms. Sync timer runs at
400Hz, this field increments in integer steps */
uint32_t time1ns; /*!< nanosecond time offset from the 2.5ms pulse */
uint32_t resetTime2p5ms; /*!< clock time in multiple of 2.5ms elapsed since the
hardware sync started */
uint16_t index; /*!< This is the tag field you filled out when using the
setSyncFreq API above; use it to identify the packets that
have sync data. This is useful when you call the
setSyncFreq API with freqInHz = 0, so you get a single
pulse that can be uniquely identified with a tag - allowing
you to create your own pulse train with uniquely
identifiable pulses. */
uint8_t flag; /*!< This is true when the packet corresponds to a hardware
pulse and false otherwise. This is useful because you can
request the software packet to be sent at a higher frequency
that the hardware line.*/
} SyncTimestamp; // pack(1)
/*!
* @brief struct for TOPIC_HARD_SYNC
*/
typedef struct HardSyncData {
SyncTimestamp ts; /*!< time stamp for the incoming data */
struct Quaternion q; /*!< quaternion */
T_ZiyanVector3f a; /*!< accelerometer reading unit: g */
T_ZiyanVector3f w; /*!< gyro reading unit: rad/sec */
} T_ZiyanFcSubscriptionHardSync;
typedef uint8_t T_ZiyanFcSubscriptionGpsControlLevel;
/*!
* @brief struct for TOPIC_RC_WITH_FLAG_DATA
*/
typedef struct RCWithFlagData {
ziyan_f32_t pitch; /*!< down = -0.999, middle = 0.000, up =0.999 */
ziyan_f32_t roll; /*!< left = -0.999, middle = 0.000, right=0.999 */
ziyan_f32_t yaw; /*!< left = -0.999, middle = 0.000, right=0.999 */
ziyan_f32_t throttle; /*!< down = -0.999, middle = 0.000, up =0.999 */
struct {
uint8_t logicConnected: 1; /*!< 0 if sky or ground side is disconnected for 3 seconds */
uint8_t skyConnected: 1; /*!< Sky side is connected, i.e., receiver is connected to FC */
uint8_t groundConnected: 1; /*!< Ground side is connected, i.e., RC is on and connected to FC */
uint8_t appConnected: 1; /*!< Mobile App is connected to RC */
uint8_t reserved: 4;
} flag;
} T_ZiyanFcSubscriptionRCWithFlagData;
/*!
* @brief struct for status of each individual esc
*/
typedef struct ESCStatusIndividual {
int16_t current; /*!< ESC current, unit: mA */
int16_t speed; /*!< ESC speed, unit: rpm */
uint16_t voltage; /*!< Input power from battery to ESC, unit: mV */
int16_t temperature; /*!< ESC temperature, unit: degree C */
uint16_t stall: 1; /*!< Motor is stall */
uint16_t empty: 1; /*!< Motor has no load */
uint16_t unbalanced: 1; /*!< Motor speed is unbalanced */
uint16_t escDisconnected: 1; /*!< ESC is disconnected */
uint16_t temperatureHigh: 1; /*!< Temperature is high */
uint16_t reserved: 11;
} ESCStatusIndividual;
/*!
* @brief struct for TOPIC_ESC_DATA
*/
typedef struct EscData {
ESCStatusIndividual esc[8];
} T_ZiyanFcSubscriptionEscData;
/*!
* @brief struct indicating RTK GPS Connection
*/
typedef struct RTKConnectStatus {
uint16_t rtkConnected: 1;
uint16_t reserve: 15;
} T_ZiyanFcSubscriptionRTKConnectStatus;
typedef uint8_t T_ZiyanFcSubscriptionGimbalControlMode;
/*!
* @brief struct for TOPIC_FLIGHT_ANOMALY
*/
typedef struct FlightAnomaly {
uint32_t impactInAir: 1; /*!< 0: No impact, 1: Impact happens in Air */
uint32_t randomFly: 1; /*!< 0: Normal, 1: Randomly fly in GPS mode without stick input*/
uint32_t heightCtrlFail: 1; /*!< 0: Height control normal, 1: Height control failed */
uint32_t rollPitchCtrlFail: 1; /*!< 0: Tilt control normal, 1: Tilt control failed */
uint32_t yawCtrlFail: 1; /*!< 0: Yaw control normal, 1: Yaw control failed */
uint32_t aircraftIsFalling: 1; /*!< 0: Aircraft is not falling, 1: Aircraft is falling */
uint32_t strongWindLevel1: 1; /*!< 0: Wind is under big wind level 1, 1: wind is stronger than big wind level 1*/
uint32_t strongWindLevel2: 1; /*!< 0: Wind is under big wind level 2, 1: wind is stronger than big wind level 2*/
uint32_t compassInstallationError: 1; /*!< 0: Compass install right, 1: Compass install error */
uint32_t imuInstallationError: 1; /*!< 0: IMU install right, 1: IMU install error */
uint32_t escTemperatureHigh: 1; /*!< 0: ESC temperature is normal, 1: ESC temperature is high */
uint32_t atLeastOneEscDisconnected: 1; /*!< 0: No ESC disconnected, 1: At least one ESC is disconnected */
uint32_t gpsYawError: 1; /*!< 0: No GPS yaw error, 1: GPS yaw error */
uint32_t reserved: 19;
} T_ZiyanFcSubscriptionFlightAnomaly;
/*!
* @brief struct for TOPIC_POSITION_VO
*/
typedef struct PositionVO {
ziyan_f32_t x; /*!< North (best effort), unit: m */
ziyan_f32_t y; /*!< East (best effort), unit: m */
ziyan_f32_t z; /*!< Down, unit: m */
uint8_t xHealth: 1;
uint8_t yHealth: 1;
uint8_t zHealth: 1;
uint8_t reserved: 5;
} T_ZiyanFcSubscriptionPositionVO;
/*!
* @brief struct for data broadcast and subscription, return obstacle info around the vehicle
*
*/
typedef struct RelativePosition {
ziyan_f32_t down; /*!< distance from obstacle (m) */
ziyan_f32_t front; /*!< distance from obstacle (m) */
ziyan_f32_t right; /*!< distance from obstacle (m) */
ziyan_f32_t back; /*!< distance from obstacle (m) */
ziyan_f32_t left; /*!< distance from obstacle (m) */
ziyan_f32_t up; /*!< distance from obstacle (m) */
uint8_t downHealth: 1; /*!< Down sensor flag: 0 - not working, 1 - working */
uint8_t frontHealth: 1; /*!< Front sensor flag: 0 - not working, 1 - working */
uint8_t rightHealth: 1; /*!< Right sensor flag: 0 - not working, 1 - working */
uint8_t backHealth: 1; /*!< Back sensor flag: 0 - not working, 1 - working */
uint8_t leftHealth: 1; /*!< Left sensor flag: 0 - not working, 1 - working */
uint8_t upHealth: 1; /*!< Up sensor health flag: 0 - not working, 1 - working */
uint8_t reserved: 2; /*!< Reserved sensor health flag*/
} T_ZiyanFcSubscriptionAvoidData;
/**
* @brief Struct for the topic ZIYAN_FC_SUBSCRIPTION_TOPIC_HOME_POINT_SET_STATUS. Specifies homepoint was set or not,
* it can be any value of ::E_ZiyanFcSubscriptionHomePointSetStatus.
*/
typedef uint8_t T_ZiyanFcSubscriptionHomePointSetStatus;
/**
* @brief Struct for the topic ZIYAN_FC_SUBSCRIPTION_TOPIC_HOME_POINT_INFO. Specifies homepoint.
*/
typedef struct HomeLocationData {
ziyan_f64_t latitude; /*!< unit: rad */
ziyan_f64_t longitude; /*!< unit: rad */
} T_ZiyanFcSubscriptionHomePointInfo; // pack(1)
typedef struct GimbalSingleData {
ziyan_f32_t roll;
ziyan_f32_t pitch;
ziyan_f32_t yaw;
} GimbalAnglesData;
/**
* @brief Struct for the topic ZIYAN_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA. Used in M300
*/
typedef struct GimbalThreeData {
GimbalAnglesData anglesData[3];
} T_ZiyanFcSubscriptionThreeGimbalData;
/**
* @brief Struct for the topic ZIYAN_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP. Used in M300
*/
typedef struct ImuAttiNaviDataWithTimestamp {
uint16_t version;
uint16_t flag;
ziyan_f32_t pn_x;
ziyan_f32_t pn_y;
ziyan_f32_t pn_z;
ziyan_f32_t vn_x;
ziyan_f32_t vn_y;
ziyan_f32_t vn_z;
ziyan_f32_t an_x;
ziyan_f32_t an_y;
ziyan_f32_t an_z;
ziyan_f32_t q[4];
uint16_t resv;
uint16_t cnt;
uint32_t timestamp;
} T_ZiyanFcSubscriptionImuAttiNaviDataWithTimestamp;
#pragma pack()
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise data subscription module in blocking mode. This function has to be called before subscribing any
* data, to initialize run environment of data subscription module, if need to subscribe data from aircraft.
* @note Max execution time of this function is slightly larger than 500ms.
* @note This function has to be called in user task, rather than main() function, and after scheduler being started.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFcSubscription_Init(void);
/**
* @brief Deinitialize data subscription module. When data subscription will no longer be used, can call this function
* to deinitialize the data subscription module. Deinitialization function will help to release all system resource data
* subscription has occupied.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFcSubscription_DeInit(void);
/**
* @brief Subscribe a topic in blocking mode. Before subscribing any data from aircraft, ZiyanFcSubscription_Init()
* function has to be called.
* @details User can subscribe a topic by specifying topic name, push frequency and callback function used to receive
* data of topic (if needed). After subscribing successfully, the user can call
* ZiyanFcSubscription_GetLatestValueOfTopic() function to get the latest data of the topic have been
* subscribed and the corresponding timestamp when aircraft sends the data out, and the callback function will be called to
* push data of the topic and corresponding timestamp if the callback function is specified.
* @note Max execution time of this function is slightly larger than 1200ms.
* @note Topic to be subscribed can not have been subscribed, that is, one topic can not be subscribed repeatedly.
* @note User must ensure that types of subscription frequency of all topics have been subscribed is less than or
* equal to 4. Otherwise, the subscribing topic will fail.
* @note User must ensure that the data length sum of all topics of the same subscription frequency is less than or equal to 242.
* @param topic: topic name to be subscribed.
* @param frequency: subscription frequency of topic to be subscribed. Subscription frequency can not beyond max
* frequency limitation of the topic and must be the value of enum E_ZiyanFcSubscriptionTopicFreq. And, subscription
* frequency has to be larger than 0. Users can find max frequency of topics in data subscription part of documentation
* on developer website (developer.ziyan.com).
* @param callback: callback function used to receive data of topic to be subscribed. If the callback function is not needed,
* this item can be set as NULL.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFcSubscription_SubscribeTopic(E_ZiyanFcSubscriptionTopic topic,
E_ZiyanDataSubscriptionTopicFreq frequency,
ZiyanReceiveDataOfTopicCallback callback);
/**
* @brief Unsubscribe a topic in blocking mode. Before unsubscribing any data from aircraft, ZiyanFcSubscription_Init()
* and ZiyanFcSubscription_SubscribeTopic() function has to be called,
* @details User can unsubscribe a topic by specifying topic name, but the topic must be unsubscribed in the order of subscription.
* @note Topic to be unsubscribed must have been subscribed.
* @note Topic to be unsubscribed must be in the order of subscription, similar to a queue, subscription is similar to enqueue,
* unsubscription is similar to dequeue.
* @param topic: topic name to be unsubscribed.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFcSubscription_UnSubscribeTopic(E_ZiyanFcSubscriptionTopic topic);
/**
* @brief Get the latest data value and timestamp in aircraft time system when sending the data from aircraft of specified
* topic. If the specified topic has not been subscribed successfully, this function will return the error code.
* @note After calling this function, user need transfer type of data pointer that pointer to data of topic to
* corresponding data structure pointer for getting every item of the topic conveniently.
* @param topicName: topic name to be gotten value.
* @param data: pointer to memory space used to store data of the topic. The memory space used to store data of topic
* have to have been allocated correctly and should ensure its size is equal to data structure size corresponding to
* the topic, otherwise, this function will not be able to return data and timestamp (return error code).
* @param dataSizeOfTopic: the size of memory space used to store data of topic. Normally, this size is equal to data
* structure size corresponding to the topic. If this size is not equal to the size of the memory space, may cause memory
* overflow event
* @param timestamp: pointer to memory space used to store timestamps. The memory space used to store timestamps
* have to have been allocated correctly, and should ensure its size is equal to data structure size of timestamp,
* otherwise, this function will not be able to return data and timestamp (return error code) or even cause memory
* overflow event. If the user does not need timestamp information, can fill in NULL. Use flight controller power-on
* timestamp on M300 RTK. Use payload local timestamp on M30/M30T.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFcSubscription_GetLatestValueOfTopic(E_ZiyanFcSubscriptionTopic topic,
uint8_t *data, uint16_t dataSizeOfTopic,
T_ZiyanDataTimestamp *timestamp);
#ifdef __cplusplus
}
#endif
#endif // ZIYAN_FC_SUBSCRIPTION_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/
/**
********************************************************************
* @file ziyan_flight_controller.h
* @brief This is the header file for "ziyan_flight_controller.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_FLIGHT_CONTROLLER_H
#define ZIYAN_FLIGHT_CONTROLLER_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
#define EMERGENCY_STOP_MOTOR_MSG_MAX_LENGTH 10 /*!< Max length of emergency stop motor message. */
/* Exported types ------------------------------------------------------------*/
typedef uint16_t E_ZiyanFlightControllerGoHomeAltitude; /*!< Unit:meter, range 20~500 */
/**
* @brief The aircraft's actions when RC is lost.
*/
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_RC_LOST_ACTION_HOVER = 0, /*!< Aircraft will execute hover action when RC is lost. */
ZIYAN_FLIGHT_CONTROLLER_RC_LOST_ACTION_LANDING = 1, /*!< Aircraft will execute land action when RC is lost. */
ZIYAN_FLIGHT_CONTROLLER_RC_LOST_ACTION_GOHOME = 2, /*!< Aircraft will execute go-home action when RC is lost. */
} E_ZiyanFlightControllerRCLostAction;
/**
* @brief Enable/Disable RTK position enum
*/
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_DISABLE_RTK_POSITION = 0, /*!< 0: The aircraft will use GPS data instead of RTK data to execute
* actions which requires location information(waypoint, go home...)
*/
ZIYAN_FLIGHT_CONTROLLER_ENABLE_RTK_POSITION = 1, /*!< 1:The aircraft will use RTK data instead of GPS data to execute
* actions which requires location information(waypoint, go home...)*/
} E_ZiyanFlightControllerRtkPositionEnableStatus;
/**
* @brief Enable/Disable obstacle sensing enum
*/
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_DISABLE_OBSTACLE_AVOIDANCE = 0, /*!< 0: The aircraft will not perform obstacle sensing in
* the specified direction */
ZIYAN_FLIGHT_CONTROLLER_ENABLE_OBSTACLE_AVOIDANCE = 1, /*!< 0: The aircraft will perform obstacle sensing in the
* specified direction */
} E_ZiyanFlightControllerObstacleAvoidanceEnableStatus;
/**
* @brief Enable/Disable emergency stop motor function enum
* @note Enable emergency-stop-motor function is very dangerous in the air. It will make the aircraft crash!!!
*/
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_ENABLE_EMERGENCY_STOP_MOTOR = 0x01, /*!< Execute emergency-stop-motor action */
} E_ZiyanFlightControllerEmergencyStopMotor;
/**
* @brief Obtain/Release joystick control permission command enum
* @note You have obtained joystick control permission successfully before using joystick.
*/
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_RELEASE_JOYSTICK_CTRL_AUTHORITY = 0, /*!< Obtain joystick permission */
ZIYAN_FLIGHT_CONTROLLER_OBTAIN_JOYSTICK_CTRL_AUTHORITY = 1, /*!< Release joystick permission */
} E_ZiyanFlightControllerJoystickCtrlAuthorityAction;
/**
* @brief The aircraft's joystick control permission owner enum
*/
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_JOYSTICK_CTRL_AUTHORITY_RC = 0, /*!< RC could control aircraft with joystick. */
ZIYAN_FLIGHT_CONTROLLER_JOYSTICK_CTRL_AUTHORITY_MSDK = 1, /*!< MSDK could control aircraft with joystick. */
ZIYAN_FLIGHT_CONTROLLER_JOYSTICK_CTRL_AUTHORITY_INTERNAL = 2, /*!< Special Internal modules could control aircraft
* with joystick. */
ZIYAN_FLIGHT_CONTROLLER_JOYSTICK_CTRL_AUTHORITY_OSDK = 4, /*!< PSDK could control aircraft with joystick. */
} E_ZiyanFlightControllerJoystickCtrlAuthority;
/**
* @brief The aircraft's joystick control permission switch reason enum
*/
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_MSDK_GET_JOYSTICK_CTRL_AUTH_EVENT = 1, /*!< MSDK gets the joystick control permission. */
ZIYAN_FLIGHT_CONTROLLER_INTERNAL_GET_JOYSTICK_CTRL_AUTH_EVENT = 2, /*!< A specific internal modules gets the joystick control permission. */
ZIYAN_FLIGHT_CONTROLLER_OSDK_GET_JOYSTICK_CTRL_AUTH_EVENT = 3, /*!< PSDK gets the joystick control permission. */
ZIYAN_FLIGHT_CONTROLLER_RC_LOST_GET_JOYSTICK_CTRL_AUTH_EVENT = 4, /*!< Reset the joystick control permission to RC when executing RC lost action */
ZIYAN_FLIGHT_CONTROLLER_RC_NOT_P_MODE_RESET_JOYSTICK_CTRL_AUTH_EVENT = 5, /*!< Reset the joystick control permission to RC when RC is not in P mode */
ZIYAN_FLIGHT_CONTROLLER_RC_SWITCH_MODE_GET_JOYSTICK_CTRL_AUTH_EVENT = 6, /*!< Set the joystick control permission to RC when RC switches control mode(T/APS) */
ZIYAN_FLIGHT_CONTROLLER_RC_PAUSE_GET_JOYSTICK_CTRL_AUTH_EVENT = 7, /*!< Reset the joystick control permission to RC when RC pauses */
ZIYAN_FLIGHT_CONTROLLER_RC_REQUEST_GO_HOME_GET_JOYSTICK_CTRL_AUTH_EVENT = 8, /*!< Reset the joystick control permission to RC when RC requests to go home*/
ZIYAN_FLIGHT_CONTROLLER_LOW_BATTERY_GO_HOME_RESET_JOYSTICK_CTRL_AUTH_EVENT = 9, /*!< Reset the joystick control permission to RC when aircraft is executing low-battery-go-home*/
ZIYAN_FLIGHT_CONTROLLER_LOW_BATTERY_LANDING_RESET_JOYSTICK_CTRL_AUTH_EVENT = 10, /*!< Reset the joystick control permission to RC when aircraft is executing low-battery-landing*/
ZIYAN_FLIGHT_CONTROLLER_OSDK_LOST_GET_JOYSTICK_CTRL_AUTH_EVENT = 11, /*!< Reset the joystick control permission to RC when PSDK is lost*/
ZIYAN_FLIGHT_CONTROLLER_NERA_FLIGHT_BOUNDARY_RESET_JOYSTICK_CTRL_AUTH_EVENT = 12, /*!< Reset the joystick control permission to RC when aircraft is near boundary.*/
} E_ZiyanFlightControllerJoystickCtrlAuthoritySwitchEvent;
/**
* @brief The aircraft's joystick control permission switch event info enum
*/
typedef struct {
E_ZiyanFlightControllerJoystickCtrlAuthority curJoystickCtrlAuthority; /*!< The aircraft's joystick control permission owner */
E_ZiyanFlightControllerJoystickCtrlAuthoritySwitchEvent joystickCtrlAuthoritySwitchEvent; /*!< The aircraft's joystick control permission switch reason */
} T_ZiyanFlightControllerJoystickCtrlAuthorityEventInfo;
/**
* @brief Prototype of callback function used to get joystick control permission switch event info.
* @return Execution result.
*/
typedef T_ZiyanReturnCode (*JoystickCtrlAuthorityEventCbFunc)(
T_ZiyanFlightControllerJoystickCtrlAuthorityEventInfo eventData);
/**
* @brief Prototype of callback function used to get the trigger FTS event.
* @return Execution result.
*/
typedef T_ZiyanReturnCode (*TriggerFtsEventCallback)(void);
/**
* @brief Horizon control mode in joystick mode enum
* @note Only when the GPS signal is good (health_flag >=3),horizontal position control (ZIYAN_FLIGHT_CONTROLLER_HORIZONTAL_POSITION_CONTROL_MODE)
* related control modes can be used. Only when GPS signal is good (health_flag >=3),or advanced sensing system is working properly with Autopilot,
* horizontal velocity control(ZIYAN_FLIGHT_CONTROLLER_HORIZONTAL_VELOCITY_CONTROL_MODE) related control modes can be used.
*/
typedef enum {
/**
* @brief Control pitch & roll & angle of the aircraft.
* @note Need to be referenced to either the ground or body frame by E_ZiyanFlightControllerHorizontalCoordinate setting.
* Limit: -35 degree to 35 degree
*/
ZIYAN_FLIGHT_CONTROLLER_HORIZONTAL_ANGLE_CONTROL_MODE = 0,
/**
* @brief Set the control mode to control horizontal vehicle velocities.
* @note Need to be referenced to either the ground or body frame by E_ZiyanFlightControllerHorizontalCoordinate setting
* Limit: -30m/s to 30 m/s
*/
ZIYAN_FLIGHT_CONTROLLER_HORIZONTAL_VELOCITY_CONTROL_MODE = 1,
/**
* @brief Set the control mode to control position offsets of pitch & roll directions.
* @note Need to be referenced to either the ground or body frame by E_ZiyanFlightControllerHorizontalCoordinate setting
* Limit: N/A
*/
ZIYAN_FLIGHT_CONTROLLER_HORIZONTAL_POSITION_CONTROL_MODE = 2,
/**
* @brief Set the control mode to control rate of change of the vehicle's attitude.
* @note Need to be referenced to either the ground or body frame by E_ZiyanFlightControllerHorizontalCoordinate setting
* Limit: -150deg/s to 150.0 deg/s
*/
ZIYAN_FLIGHT_CONTROLLER_HORIZONTAL_ANGULAR_RATE_CONTROL_MODE = 3
} E_ZiyanFlightControllerHorizontalControlMode;
/**
* @brief Vertical control mode enum in joystick mode
* @note We don not recommend using VERTICAL_POSITION control mode indoors when the aircraft's flying height exceeds 3 meters.
* This is because barometer can be inaccurate indoors, and the vertical controller may fail to keep the height of the aircraft.
*/
typedef enum {
/**
* @brief Set the control mode to control the vertical speed of aircraft, setting the upward as positive/
* @note Limit: -5 m/s to 5 m/s
*/
ZIYAN_FLIGHT_CONTROLLER_VERTICAL_VELOCITY_CONTROL_MODE = 0,
/**
* @brief Set the control mode to control the height of aircraft
* @note Limit: 0 m to 120 m
*/
ZIYAN_FLIGHT_CONTROLLER_VERTICAL_POSITION_CONTROL_MODE = 1,
/**
* @brief Set the control mode to directly control the thrust
* @note Range: 0 % to 100 %
*/
ZIYAN_FLIGHT_CONTROLLER_VERTICAL_THRUST_CONTROL_MODE = 2,
} E_ZiyanFlightControllerVerticalControlMode;
/**
* @brief Yaw control mode enum in joystick mode
*/
typedef enum {
/**
* @brief Set the control mode to control yaw angle.
* @note Yaw angle is referenced to the ground frame. In this control mode, Ground frame is enforced in Autopilot.
*/
ZIYAN_FLIGHT_CONTROLLER_YAW_ANGLE_CONTROL_MODE = 0x00,
/**
* @brief Set the control-mode to control yaw angular velocity
* @note Same reference frame as YAW_ANGLE.
* Limit: -150 deg/s to 150 deg/s
*/
ZIYAN_FLIGHT_CONTROLLER_YAW_ANGLE_RATE_CONTROL_MODE = 1
} E_ZiyanFlightControllerYawControlMode;
/**
* @brief Horizontal coordinate enum in joystick mode
*/
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_HORIZONTAL_GROUND_COORDINATE = 0, /*!< Set the x-y of ground frame as the horizontal frame (NEU) */
ZIYAN_FLIGHT_CONTROLLER_HORIZONTAL_BODY_COORDINATE = 1 /*!< Set the x-y of body frame as the horizontal frame (FRU) */
} E_ZiyanFlightControllerHorizontalCoordinate;
/*!
* @brief Stable mode enum in joystick mode
* @note Only works in horizontal velocity control mode. In velocity stable mode, aircraft will brake and hover at one position once
* the input command is zero. In velocity non-stable mode, aircraft will follow the velocity command and not hover when the command is zero.
* That means aircraft will drift with the wind.
*/
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_STABLE_CONTROL_MODE_DISABLE = 0, /*!< Disable the stable mode */
ZIYAN_FLIGHT_CONTROLLER_STABLE_CONTROL_MODE_ENABLE = 1 /*!< Enable the stable mode */
} E_ZiyanFlightControllerStableControlMode;
typedef enum {
ZIYAN_FLIGHT_CONTROLLER_ENABLE_RC_LOST_ACTION = 0,
ZIYAN_FLIGHT_CONTROLLER_DISABLE_RC_LOST_ACTION = 1,
} E_ZiyanFlightControllerRCLostActionEnableStatus;
/**
* @brief Joystick mode.
* @note You need to set joystick mode first before start to send joystick command to aircraft.
*/
typedef struct {
E_ZiyanFlightControllerHorizontalControlMode horizontalControlMode; /*!< See reference of E_ZiyanFlightControllerHorizontalControlMode*/
E_ZiyanFlightControllerVerticalControlMode verticalControlMode; /*!< See reference of E_ZiyanFlightControllerVerticalControlMode*/
E_ZiyanFlightControllerYawControlMode yawControlMode; /*!< See reference of E_ZiyanFlightControllerYawControlMode*/
E_ZiyanFlightControllerHorizontalCoordinate horizontalCoordinate; /*!< See reference of E_ZiyanFlightControllerHorizontalCoordinate*/
E_ZiyanFlightControllerStableControlMode stableControlMode; /*!< See reference of E_ZiyanFlightControllerStableControlMode*/
} T_ZiyanFlightControllerJoystickMode;
#pragma pack(1)
typedef struct {
ziyan_f32_t x; /*!< Controls the x axis.*/
ziyan_f32_t y; /*!< Controls the y axis.*/
ziyan_f32_t z; /*!< Controls the z axis, setting upward as positive. */
ziyan_f32_t yaw; /*!< Yaw position/velocity control w.r.t. the ground frame.*/
} T_ZiyanFlightControllerJoystickCommand;// pack(1)
typedef struct {
ziyan_f64_t latitude; /*!< unit: rad */
ziyan_f64_t longitude; /*!< unit: rad */
} T_ZiyanFlightControllerHomeLocation; // pack(1)
typedef struct {
char serialNum[32];
} T_ZiyanFlightControllerGeneralInfo;
typedef struct {
ziyan_f64_t latitude; /*!< unit: rad */
ziyan_f64_t longitude; /*!< unit: rad */
uint16_t altitude;
} T_ZiyanFlightControllerRidInfo;
#pragma pack()
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise flight controller module
* @param ridInfo: Must report the correct RID information before using PSDK to control the aircraft.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_Init(T_ZiyanFlightControllerRidInfo ridInfo);
/**
* @brief DeInitialise flight controller module.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_DeInit(void);
/**
* @brief Enable/Disable RTK position function.
* @details Enabling RTK means that RTK data will be used instead of GPS during flight.
* @param rtkEnableStatus: refer to "E_ZiyanFlightControllerRtkPositionEnableStatus", inheriting from Pilot.
* @return Execution result.
*/
T_ZiyanReturnCode
ZiyanFlightController_SetRtkPositionEnableStatus(E_ZiyanFlightControllerRtkPositionEnableStatus rtkEnableStatus);
/**
* @brief Get RTK enable status.
* @note Enabling RTK means that RTK data will be used during intelligent flight.
* @param rtkEnableStatus: refer to "E_ZiyanFlightControllerRtkPositionEnableStatus", inheriting from Pilot.
* @return Execution result.
*/
T_ZiyanReturnCode
ZiyanFlightController_GetRtkPositionEnableStatus(E_ZiyanFlightControllerRtkPositionEnableStatus *rtkEnableStatus);
/**
* @brief Set RC lost action.
* @note Valid when RC and PSDK are both lost. It only supports M30.
* @param rcLostAction: actions when RC is lost.(hover/landing/go home).It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_SetRCLostAction(E_ZiyanFlightControllerRCLostAction rcLostAction);
/**
* @brief Get RC lost action(hover/landing/gohome).
* @note Valid when RC and PSDK are both lost. It only supports M30.
* @param rcLostAction: see reference of E_ZiyanFlightControllerRCLostAction.It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_GetRCLostAction(E_ZiyanFlightControllerRCLostAction *rcLostAction);
/**
* @brief Enable/Disable horizontal visual(forwards,backwards,left,right) obstacle sensing.
* @note For detailed parameters of obstacle sensing, it is recommended to read the official user manual in
* https://www.ziyan.com.
* @param horizontalObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_SetHorizontalVisualObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus horizontalObstacleAvoidanceEnableStatus);
/**
* @brief Get the switch status of horizontal visual(forwards,backwards,left,right) obstacle sensing.
* @note For detailed parameters of obstacle sensing, it is recommended to read the official user manual in
* https://www.ziyan.com.
* @param horizontalObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_GetHorizontalVisualObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus *horizontalObstacleAvoidanceEnableStatus);
/**
* @brief Enable/Disable horizontal radar obstacle sensing.
* @note It will be valid only if you install CSM radar successfully.For detailed parameters of obstacle sensing,
* it is recommended to read the official user manual in https://www.ziyan.com.
* @param horizontalObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_SetHorizontalRadarObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus horizontalObstacleAvoidanceEnableStatus);
/**
* @brief Get the switch status of horizontal radar obstacle sensing.
* @note It will be valid only if you install CSM radar successfully.For detailed parameters of obstacle sensing,
* it is recommended to read the official user manual in https://www.ziyan.com/uk/matrice-300/downloads.
* @param horizontalObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_GetHorizontalRadarObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus *horizontalObstacleAvoidanceEnableStatus);
/**
* @brief Enable/Disable upwards visual obstacle sensing.
* @note For detailed parameters of obstacle sensing, it is recommended to read the official user manual in
* https://www.ziyan.com.
* @param upwardsObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_SetUpwardsVisualObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus upwardsObstacleAvoidanceEnableStatus);
/**
* @brief Get the switch status of upwards visual obstacle sensing.
* @note For detailed parameters of obstacle sensing, it is recommended to read the official user manual in
* https://www.ziyan.com.
* @param upwardsObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_GetUpwardsVisualObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus *upwardsObstacleAvoidanceEnableStatus);
/**
* @brief Enable/Disable upwards radar obstacle sensing.
* @note It will be valid only if you install CSM radar successfully.For detailed parameters of obstacle sensing,
* it is recommended to read the official user manual in https://www.ziyan.com.
* @param upwardsObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_SetUpwardsRadarObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus upwardsObstacleAvoidanceEnableStatus);
/**
* @brief Get the switch status of upwards radar obstacle sensing.
* @note For detailed parameters of obstacle sensing, it is recommended to read the official user manual in
* https://www.ziyan.com.
* @param upwardsObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_GetUpwardsRadarObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus *upwardsObstacleAvoidanceEnableStatus);
/**
* @brief Enable/Disable downwards visual obstacle sensing.
* @note For detailed parameters of obstacle sensing, it is recommended to read the official user manual in
* https://www.ziyan.com.
* @param downwardsObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_SetDownwardsVisualObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus downwardsObstacleAvoidanceEnableStatus);
/**
* @brief Get the switch status of downwards visual obstacle sensing.
* @note For detailed parameters of obstacle sensing, it is recommended to read the official user manual in
* https://www.ziyan.com.
* @param downwardsObstacleAvoidanceEnableStatus: see reference of E_ZiyanFlightControllerObstacleAvoidanceEnableStatus.
* It inherits from Pilot's param.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_GetDownwardsVisualObstacleAvoidanceEnableStatus(
E_ZiyanFlightControllerObstacleAvoidanceEnableStatus *downwardsObstacleAvoidanceEnableStatus);
/**
* @brief Arrest flying means emergency braking
* @note When the aircraft is on the ground, it will stop motors and display "hms description" on App. when the aircraft is
* in the air, it will continue flying and display "hms description" on App only.
* If you use this interface, you need to use "ZiyanFlightController_CancelArrestFlying" to quit arrest-flying status, then
* then the aircraft can fly again.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_ArrestFlying(void);
/**
* @brief Quit status of arrest-flying.
* @note The aircraft need to quit status of arrest-flying to continue flying after arresting flying.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_CancelArrestFlying(void);
/**
* @brief Turn on motors when the aircraft is on the ground.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_TurnOnMotors(void);
/**
* @brief Turn off motors when the aircraft is on the ground.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_TurnOffMotors(void);
/**
* @brief Emergency stop motor in any case.
* @note If you want to turn on motor after emergency stopping motor, you need to use the interface to send disable
* command to quit lock-motor status.
* @param cmd: see reference of E_ZiyanFlightControllerEmergencyStopMotor
* @param debugMsg:inject debug message to flight control FW for logging, size limit: 10 bytes
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_EmergencyStopMotor(E_ZiyanFlightControllerEmergencyStopMotor cmd,
char debugMsg[EMERGENCY_STOP_MOTOR_MSG_MAX_LENGTH]);
/**
* @brief Request taking off action when the aircraft is on the ground.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_StartTakeoff(void);
/**
* @brief Request landing action when the aircraft is in the air.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_StartLanding(void);
/**
* @brief Request cancelling landing action when the aircraft is landing
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_CancelLanding(void);
/**
* @brief Confirm the landing when the aircraft is 0.7 m above the ground.
* @note When the clearance between the aircraft and the ground is less than 0.7m, the aircraft will pause landing and
* wait for user's confirmation. This API is for confirm landing. If the ground is not suitable for landing, user
* must use RC to control it landing manually or force landing.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_StartConfirmLanding(void);
/**
* @brief Force landing in any case.
* @note This API will ignore the smart landing function. When using this API, it will landing directly (would not stop
* at 0.7m and wait user's command). Attention: it may make the aircraft crash!!!
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_StartForceLanding(void);
/**
* @brief Set customized GPS(not RTK) home location.
* @note Set customized home location failed reason may as follows:
* 1. The distance between new home location and last home location is larger than MAX_FLY_RADIUS(20 km).
* 2. Record initial home location failed after start aircraft.
* @param homeLocation: homeLocation include latitude and longitude
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_SetHomeLocationUsingGPSCoordinates(T_ZiyanFlightControllerHomeLocation homeLocation);
/**
* @brief Set home location using current aircraft GPS (not RTK) location.
* @note Set home location failed reasons may as follows:
* 1. Aircraft's gps level can't reach the condition of recording home location.
* 2. Record initial home location failed after start aircraft.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_SetHomeLocationUsingCurrentAircraftLocation(void);
/**
* @brief Set go home altitude.
* @note If aircraft's current altitude is higher than the setting value of go home altitude, aircraft will go home
* using current altitude. Otherwise, it will climb to setting of go home altitude ,and then execute go home action.
* Go home altitude setting is 20-1500 m.
* @param altitude: go home altitude, unit: meter
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_SetGoHomeAltitude(E_ZiyanFlightControllerGoHomeAltitude altitude);
/**
* @brief Get go home altitude.
* @param altitude: go home altitude, unit: meter
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_GetGoHomeAltitude(E_ZiyanFlightControllerGoHomeAltitude *altitude);
/**
* @brief Get country code.
* @param countryCode: Pointer of buffer to return country code. The country code indicates the current country or
* region where the aircraft is located. Please refer to the ISO 3166-1 code table for the specific meaning of the
* country code.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_GetCountryCode(uint16_t *countryCode);
/**
* @brief Request go home action when the aircraft is in the air
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_StartGoHome(void);
/**
* @brief Request cancel go home action when the aircraft is going home
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_CancelGoHome(void);
/**
* @brief Obtain aircraft's joystick control permission.
* @note 1.You have to obtain joystick control permission successfully before you using joystick to control aircraft.
* 2. RC must be in p-mode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_ObtainJoystickCtrlAuthority(void);
/**
* @brief Release aircraft's joystick control permission.
* @note RC must be in p-mode.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_ReleaseJoystickCtrlAuthority(void);
/**
* @brief Subscribe to joystick control permission switch event with a callback function.
* @note it will be triggered once the joystick control permission switch event occurs.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_RegJoystickCtrlAuthorityEventCallback(JoystickCtrlAuthorityEventCbFunc callback);
/**
* @brief Set expected joystick mode before requesting joystick.
* @param joystickMode: include horizontal/vertical/yaw control mode, stable control mode.
*/
void ZiyanFlightController_SetJoystickMode(T_ZiyanFlightControllerJoystickMode joystickMode);
/**
* @brief Request execute joystick action.
* @param joystickCommand: include x/y/z/yaw.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_ExecuteJoystickAction(T_ZiyanFlightControllerJoystickCommand joystickCommand);
/**
* @brief Request emergency brake action.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_ExecuteEmergencyBrakeAction(void);
/**
* @brief Request cancel emergency brake action.
* @note It is only support on M30.If you use ZiyanFlightController_ExecuteEmergencyBrakeAction(), you need to use
* "ZiyanFlightController_CancelEmergencyBrakeAction()" to allow aircraft to execute aircraft action again.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_CancelEmergencyBrakeAction(void);
/**
* @brief Get general info of the aircraft.
* @param generalInfo: the struct stored the serial num which contains a array of chars var in case the user gives an
* illegal length character pointer
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_GetGeneralInfo(T_ZiyanFlightControllerGeneralInfo *generalInfo);
/*! @brief The command decides whether execute RC lost action or not when PSDK is running
* @note This setting only affects the behavior of the aircraft when the RC lost and the PSDK is connected.
* if the command is enable, the aircraft will not execute RC lost action when RC is lost but PSDK is running;
* if the command is disable, the aircraft will execute RC lost action when RC is lost but PSDK is running
* the aircraft will execute RC lost action when RC is lost and PSDK is lost whatever the command is.
* default command is disable.
* @param executeRCLostActionOrNotWhenOnboardOn enable:1;disable:0
* @return T_ZiyanReturnCode error code
*/
T_ZiyanReturnCode
ZiyanFlightController_SetRCLostActionEnableStatus(E_ZiyanFlightControllerRCLostActionEnableStatus command);
/*! @brief get RC lost action enable status(enable or disable)
* @param command executeRCLostActionOrNotWhenOnboardOn, enable:1;disable:0
* @return T_ZiyanReturnCode error code
*/
T_ZiyanReturnCode
ZiyanFlightController_GetEnableRCLostActionStatus(E_ZiyanFlightControllerRCLostActionEnableStatus *command);
/**
* @brief Register callback function for the trigger FTS event.
* @note The timing of the trigger of the callback function of the FTS is determined by the aircraft, and the trigger
* execution action of the FTS needs to be implemented in the callback function and the correct return value
* must be returned, otherwise the aircraft will always be triggered.
* @param callback: the callback for the trigger FTS event.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanFlightController_RegTriggerFtsEventCallback(TriggerFtsEventCallback callback);
#ifdef __cplusplus
}
#endif
#endif // ZIYAN_FLIGHT_CONTROLLER_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/
/**
********************************************************************
* @file ziyan_gimbal.h
* @brief ZIYAN gimbal module is used to achieve the third gimbal for developer. The module can be used only when the ZIYAN
* adapter is Skyport, rather than XPort.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_GIMBAL_H
#define ZIYAN_GIMBAL_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Gimbal calibration stage and result.
*/
typedef enum {
ZIYAN_GIMBAL_CALIBRATION_STAGE_COMPLETE = 0, /*!< Calibration have been completed and the result is successful. */
ZIYAN_GIMBAL_CALIBRATION_STAGE_PROCRESSING = 1, /*!< Gimbal is calibrating. */
ZIYAN_GIMBAL_CALIBRATION_STAGE_FAILED = 3, /*!< Calibration have been completed and the result is failure. */
} E_ZiyanGimbalCalibrationStage;
/**
* @brief Axis of gimbal.
*/
typedef enum {
ZIYAN_GIMBAL_AXIS_PITCH = 0, /*!< Pitch axis. */
ZIYAN_GIMBAL_AXIS_ROLL = 1, /*!< Roll axis. */
ZIYAN_GIMBAL_AXIS_YAW = 2, /*!< Yaw axis. */
} E_ZiyanGimbalAxis;
/**
* @brief Reset mode of gimbal.
*/
typedef enum {
/*! Only reset yaw axis of gimbal. Reset angle of yaw axis to the sum of yaw axis angle of aircraft and fine tune angle
* of yaw axis of gimbal. */
ZIYAN_GIMBAL_RESET_MODE_YAW = 1,
/*! Reset yaw axis and pitch axis of gimbal. Reset angle of yaw axis to sum of yaw axis angle of aircraft and fine tune
* angle of yaw axis of gimbal, and reset pitch axis angle to the fine tune angle. */
ZIYAN_GIMBAL_RESET_MODE_PITCH_AND_YAW = 3,
/*! Reset only pitch axis of gimbal. */
ZIYAN_GIMBAL_RESET_MODE_PITCH_ONLY = 4,
/*! Reset only roll axis of gimbal. */
ZIYAN_GIMBAL_RESET_MODE_ROLL_ONLY = 5,
/*! Reset only yaw axis of gimbal. */
ZIYAN_GIMBAL_RESET_MODE_YAW_ONLY = 6,
/*! Reset yaw axis and pitch axis of gimbal. Reset angle of yaw axis to sum of yaw axis angle of aircraft and fine tune
* angle of yaw axis of gimbal, and reset pitch axis angle to sum of -90 degree and fine tune angle if gimbal
* downward, sum of 90 degree and fine tune angle if upward. */
ZIYAN_GIMBAL_RESET_MODE_PITCH_DOWNWARD_UPWARD_AND_YAW = 11,
/*! Reset pitch axis of gimbal. Reset pitch axis angle to sum of -90 degree and fine tune angle if gimbal downward,
* sum of 90 degree and fine tune angle if upward. */
ZIYAN_GIMBAL_RESET_MODE_PITCH_DOWNWARD_UPWARD = 12,
} E_ZiyanGimbalResetMode;
/**
* @brief Smooth factor of gimbal controller.
*/
typedef struct {
uint8_t pitch; /*!< Smooth factor of pitch axis, range from 0 to 30. */
uint8_t yaw; /*!< Smooth factor of yaw axis, range from 0 to 30. */
} T_ZiyanGimbalControllerSmoothFactor;
/**
* @brief Max speed percentage of every axis of gimbal.
*/
typedef struct {
uint8_t pitch; /*!< Max speed percentage of pitch axis, range from 1 to 100. */
uint8_t yaw; /*!< Max speed percentage of yaw axis, range from 1 to 100. */
} T_ZiyanGimbalControllerMaxSpeedPercentage;
/**
* @brief Data structure describes gimbal system state.
*/
typedef struct {
bool resettingFlag; /*!< Specifies whether gimbal is resetting now or not. */
bool mountedUpward; /*!< Specifies whether gimbal is upward or not. */
bool blockingFlag; /*!< Specifies whether gimbal is stuck or not. */
bool pitchRangeExtensionEnabledFlag; /*!< Specifies whether extended angle range of gimbal pitch axis is enabled or not. */
E_ZiyanGimbalMode gimbalMode; /*!< Gimbal mode. */
T_ZiyanAttitude3d fineTuneAngle; /*!< Fine tune angles, unit: 0.1 degree. */
T_ZiyanGimbalControllerSmoothFactor smoothFactor; /*!< Smooth factor of gimbal controller. */
T_ZiyanGimbalControllerMaxSpeedPercentage maxSpeedPercentage; /*!< Max speed percentage of gimbal controller. */
} T_ZiyanGimbalSystemState;
/**
* @brief Reach limit flag.
*/
typedef struct {
bool pitch; /*!< Specifies whether gimbal has reached angle limit of pitch axis, if true, reached the limit. */
bool roll; /*!< Specifies whether gimbal has reached angle limit of roll axis, if true, reached the limit. */
bool yaw; /*!< Specifies whether gimbal has reached angle limit of yaw axis, if true, reached the limit. */
} T_ZiyanGimbalReachLimitFlag;
/**
* @brief Gimbal attitude related information.
*/
typedef struct {
T_ZiyanAttitude3d attitude; /*!< Gimbal attitude in the ground coordinate, unit: 0.1 degree. */
T_ZiyanGimbalReachLimitFlag reachLimitFlag; /*!< Reach limit flag, being set when the joint angles of gimbal reach limits. */
} T_ZiyanGimbalAttitudeInformation;
/**
* @brief Gimbal calibration state.
*/
typedef struct {
bool calibratingFlag; /*!< Specifies whether gimbal is calibrating now or not. */
bool lastCalibrationResult; /*!< Result of the last calibration, and true specifies success. */
uint8_t currentCalibrationProgress; /*!< Progress percentage of current calibration. If gimbal is calibrating now and fill in real progress percentage, if not, fill in zero. The item ranges from 0 to 100. */
E_ZiyanGimbalCalibrationStage currentCalibrationStage; /*!< Current calibration stage and result. If gimbal is calibrating now and fill in ::ZIYAN_GIMBAL_CALIBRATION_STAGE_PROCRESSING, if not, fill in result of the last calibration. */
} T_ZiyanGimbalCalibrationState;
/**
* @brief Gimbal rotation command property.
*/
typedef struct {
struct {
bool pitch; /*!< Specifies whether ignore rotation command of pitch axis, and true specifies ignoring. */
bool roll; /*!< Specifies whether ignore rotation command of roll axis, and true specifies ignoring. */
bool yaw; /*!< Specifies whether ignore rotation command of yaw axis, and true specifies ignoring. */
} rotationValueInvalidFlag; /*!< Specifies whether ignore rotation command of some axis, including pitch, roll and yaw. */
union {
struct {
uint16_t actionTime; /*!< Action time during which gimbal move to target angles, unit: 0.01s. */
} relativeAngleRotation; /*!< Property of relative angle rotation command. */
struct {
uint16_t actionTime; /*!< Action time during which gimbal move to target angles, unit: 0.01s. */
/*! Joint angle valid flag, specifying whether
* T_ZiyanGimbalRotationProperty::absoluteAngleRotation::jointAngle is valid when absolute angle control. */
bool jointAngleValid;
/*! Joint angles of gimbal, unit: 0.1 degree. If
* T_ZiyanGimbalRotationProperty::absoluteAngleRotation::jointAngleValid is false, specifying here joint
* angles are invalid, and please ignore the joint angles. If joint angles are valid, users should ensure
* that target joint angles of gimbal is approximately the same as the specified value. */
T_ZiyanAttitude3d jointAngle;
} absoluteAngleRotation; /*!< Property of absolute angle rotation command. */
};
} T_ZiyanGimbalRotationProperty;
/**
* @brief Common handler function prototypes of gimbal, that is, some common callback function prototypes of gimbal.
* @warning User can not execute blocking style operations or functions in callback function, because that will block ZIYAN
* root thread, causing problems such as slow system response, payload disconnection or infinite loop.
*/
typedef struct {
/*!
* @brief Prototype of callback function used to report system state of gimbal.
* @param systemState: pointer to memory space used to store gimbal system state.
* @return Execution result.
*/
T_ZiyanReturnCode (*GetSystemState)(T_ZiyanGimbalSystemState *systemState);
/*!
* @brief Prototype of callback function used to report attitude information of gimbal.
* @param attitudeInformation: pointer to memory space used to store gimbal attitude information.
* @return Execution result.
*/
T_ZiyanReturnCode (*GetAttitudeInformation)(T_ZiyanGimbalAttitudeInformation *attitudeInformation);
/*!
* @brief Prototype of callback function used to report calibration state of gimbal.
* @param calibrationState: pointer to memory space used to store gimbal calibration state.
* @return Execution result.
*/
T_ZiyanReturnCode (*GetCalibrationState)(T_ZiyanGimbalCalibrationState *calibrationState);
/*!
* @brief Prototype of callback function used to rotate gimbal. Rotation callback function will be called when
* other modules control gimbal.
* @warning User should control execution time of the callback function to be short, because this callback function
* may be called at very high frequency in some scenarios, just like 200Hz.
* @param rotationMode: mode of rotation command.
* @param rotationProperty: property of rotation command.
* @param rotationValue: value of rotation command, unit: 0.1 degree (if rotation mode is
* ::ZIYAN_GIMBAL_ROTATION_MODE_RELATIVE_ANGLE or ::ZIYAN_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE), 0.1 degree/s
* (if rotation mode is ::ZIYAN_GIMBAL_ROTATION_MODE_SPEED).
* @return Execution result.
*/
T_ZiyanReturnCode (*Rotate)(E_ZiyanGimbalRotationMode rotationMode, T_ZiyanGimbalRotationProperty rotationProperty,
T_ZiyanAttitude3d rotationValue);
/*!
* @brief Prototype of callback function used to start calibrating gimbal.
* @note Maximum allowable time of gimbal calibration is 120s. If gimbal has not completed calibration during
* 120s, ZIYAN Pilot believe calibration failed.
* @return Execution result.
*/
T_ZiyanReturnCode (*StartCalibrate)(void);
/**
* @brief Set smooth factor for gimbal controller, using to smooth control.
* @param smoothingFactor: smooth factor. The larger the value, the smaller the acceleration of gimbal. Recommended
* calculation formula is "acc = 10000 * (0.8 ^ (1 + x)) deg/s^2", x is smooth factor. Range from 0 to 30.
* @param axis: axis to be set.
* @return Execution result.
*/
T_ZiyanReturnCode (*SetControllerSmoothFactor)(uint8_t smoothingFactor, E_ZiyanGimbalAxis axis);
/*!
* @brief Prototype of callback function used to enable or disable extended pitch axis angle range.
* @details Switching the gimbal limit euler angle of pitch axis to the extended limit angle or the default limit
* angle.
* @param enabledFlag: flag specified whether enable or disable extended pitch axis angle range.
* @return Execution result.
*/
T_ZiyanReturnCode (*SetPitchRangeExtensionEnabled)(bool enabledFlag);
/**
* @brief Set max speed percentage for gimbal controller.
* @param maxSpeedPercentage: max speed value. Recommended calculation formula is "spd = default_max_spd * x / 100",
* x is default max speed value. Range from 1 to 100.
* @param axis: axis to be set.
* @return Execution result.
*/
T_ZiyanReturnCode (*SetControllerMaxSpeedPercentage)(uint8_t maxSpeedPercentage, E_ZiyanGimbalAxis axis);
/**
* @brief Restore factory settings of gimbal, including fine tune angle, pitch angle extension enable flag and max
* speed etc.
* @return Execution result.
*/
T_ZiyanReturnCode (*RestoreFactorySettings)(void);
/*!
* @brief Prototype of callback function used to set gimbal work mode.
* @param mode: gimbal work mode.
* @return Execution result.
*/
T_ZiyanReturnCode (*SetMode)(E_ZiyanGimbalMode mode);
/*!
* @brief Prototype of callback function used to reset gimbal.
* @note Reset command will interrupt rotation process.
* @param mode: Reset mode.
* @return Execution result.
*/
T_ZiyanReturnCode (*Reset)(E_ZiyanGimbalResetMode mode);
/*!
* @brief Prototype of callback function used to fine tune angle of gimbal.
* @param fineTuneAngle: fine tune angle, unit: 0.1 degree. Angle value of greater than 0 specifies rotation
* towards the positive direction of body coordinate.
* @return Execution result.
*/
T_ZiyanReturnCode (*FineTuneAngle)(T_ZiyanAttitude3d fineTuneAngle);
/**
* @brief Prototype of callback function used to report rotation speed of gimbal.
* @note The callback function will be called at 50 Hz. Developers should ensure that, the average rotation speed
* of gimbal within 20 ms after the callback function is called is approximately equal to the reported rotation
* speed.
* @param rotationSpeed: pointer to memory space used to store rotation speed, in body coordinate, unit:
* 0.1 degree/s.
* @return Execution result.
*/
T_ZiyanReturnCode (*GetRotationSpeed)(T_ZiyanAttitude3d *rotationSpeed);
/**
* @brief Prototype of callback function used to report joint angle of gimbal.
* @param jointAngle: pointer to memory space used to store joint angles, unit: 0.1 degree.
* @return Execution result.
*/
T_ZiyanReturnCode (*GetJointAngle)(T_ZiyanAttitude3d *jointAngle);
} T_ZiyanGimbalCommonHandler;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise gimbal module, and user should call this function before using gimbal features.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbal_Init(void);
/**
* @brief Deinitialise gimbal module.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbal_DeInit(void);
/**
* @brief Register common handler functions/callback functions of gimbal. After registering, callback functions will be
* called automatically.
* @param commonHandler: pointer to common handler functions of gimbal.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbal_RegCommonHandler(const T_ZiyanGimbalCommonHandler *commonHandler);
#ifdef __cplusplus
}
#endif
#endif // ZIYAN_GIMBAL_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/
/**
********************************************************************
* @file ziyan_gimbal_manager.h
* @brief This is the header file for "ziyan_gimbal_manager.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_GIMBAL_MANAGER_H
#define ZIYAN_GIMBAL_MANAGER_H
/* Includes ------------------------------------------------------------------*/
#include <ziyan_gimbal.h>
#include "ziyan_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Gimbal manager rotation command property.
*/
typedef struct {
E_ZiyanGimbalRotationMode rotationMode; /*!< Rotation gimbal mode. */
ziyan_f32_t pitch; /*!< Pitch angle in degree, unit: deg */
ziyan_f32_t roll; /*!< Roll angle in degree, unit: deg */
ziyan_f32_t yaw; /*!< Yaw angle in degree, unit: deg */
ziyan_f64_t time; /*!< Expected execution time for gimbal rotation, in seconds. */
} T_ZiyanGimbalManagerRotation;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialize the gimbal manager module.
* @note This interface must be initialized after ZiyanCore_Init.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbalManager_Init(void);
/**
* @brief DeInitialize the gimbal manager module.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbalManager_Deinit(void);
/**
* @brief Set the work mode of the gimbal.
* @param mountPosition: gimbal mount position, input limit see enum E_ZiyanMountPosition
* @param mode: gimbal work mode, input limit see enum E_ZiyanGimbalMode
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbalManager_SetMode(E_ZiyanMountPosition mountPosition, E_ZiyanGimbalMode mode);
/**
* @brief Reset the pitch and yaw of the gimbal.
* @param mountPosition: gimbal mount position, input limit see enum E_ZiyanMountPosition
* @param mode: reset mode, input limit see enum E_ZiyanGimbalResetMode
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbalManager_Reset(E_ZiyanMountPosition mountPosition, E_ZiyanGimbalResetMode resetMode);
/**
* @brief Rotate the angle of the gimbal.
* @param mountPosition: gimbal mount position, input limit see enum E_ZiyanMountPosition
* @param rotation: the rotation parameters to be executed on the target gimbal, including the rotation mode, target
* angle value and executed time, refer to T_ZiyanGimbalManagerRotation
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbalManager_Rotate(E_ZiyanMountPosition mountPosition, T_ZiyanGimbalManagerRotation rotation);
/*!
* @brief Prototype of callback function used to enable or disable extended pitch axis angle range.
* @note Switching the gimbal limit euler angle of pitch axis to the extended limit angle or the default limit
* angle.
* @param mountPosition: gimbal mount position, input limit see enum E_ZiyanMountPosition
* @param enabledFlag: flag specifying whether to enable or disable the extended pitch axis angle range..
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbalManager_SetPitchRangeExtensionEnabled(E_ZiyanMountPosition mountPosition, bool enabledFlag);
/**
* @brief Set max speed percentage for gimbal controller.
* @param mountPosition: gimbal mount position, input limit see enum E_ZiyanMountPosition
* @param axis: axis to be set.
* @param maxSpeedPercentage: max speed value. Recommended calculation formula is "spd = default_max_spd * x / 100",
* where 'x' is the default maximum speed value. Range from 1 to 100.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbalManager_SetControllerMaxSpeedPercentage(E_ZiyanMountPosition mountPosition, E_ZiyanGimbalAxis axis,
uint8_t maxSpeedPercentage);
/**
* @brief Set smooth factor for gimbal controller, using for smooth control.
* @param mountPosition: gimbal mount position, input limit see enum E_ZiyanMountPosition
* @param axis: axis to be set.
* @param smoothingFactor: smooth factor. A larger value results in slower gimbal acceleration. Recommended
* calculation formula is "acc = 10000 * (0.8 ^ (1 + x)) deg/s^2", x is smooth factor. Range from 0 to 30.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbalManager_SetControllerSmoothFactor(E_ZiyanMountPosition mountPosition, E_ZiyanGimbalAxis axis,
uint8_t smoothingFactor);
/**
* @brief Restore factory settings of gimbal, including fine tune angle, pitch angle extension enable flag and max
* speed etc.
* @param mountPosition: gimbal mount position, input limit see enum E_ZiyanMountPosition
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanGimbalManager_RestoreFactorySettings(E_ZiyanMountPosition mountPosition);
#ifdef __cplusplus
}
#endif
#endif // ZIYAN_GIMBAL_MANAGER_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/
/**
********************************************************************
* @file ziyan_high_speed_data_channel.h
* @brief This is the header file for "ziyan_high_speed_data_channel.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_HIGH_SPEED_DATA_CHANNEL_H
#define ZIYAN_HIGH_SPEED_DATA_CHANNEL_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef struct {
uint8_t dataStream; /*!< Bandwidth proportion of data stream, range from 0 to 100. */
uint8_t videoStream; /*!< Bandwidth proportion of video stream, range from 0 to 100. */
uint8_t downloadStream; /*!< Bandwidth proportion of download stream, range from 0 to 100. */
} T_ZiyanDataChannelBandwidthProportionOfHighspeedChannel;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Set bandwidth proportion for the data stream, video stream and download stream of high-speed channel.
* @details Self-defined bandwidth distribution mechanism allows that user can control bandwidth limitation
* freely. System multiplies total bandwidth limitation of the high-speed channel by a proportion of the corresponding stream to
* get realtime bandwidth limitation of the specified stream. Realtime bandwidth limitation of data and video stream can be
* gotten by PsdkDataTransmission_GetDataStreamState() and PsdkPayloadCamera_GetVideoStreamState() interfaces. Total
* bandwidth of the high-speed channel is determined by the environment in which the system located and loading of system. If
* user does not set bandwidth proportion for each stream, the default proportion is 33% (data stream), 33% (video
* stream) and 34% (download stream).
* @note The bandwidth proportion will be effective after a while, the max value is 1s. If you want use this interface, should calling
* PsdkPlatform_RegHalNetworkHandler interface firstly, otherwise this interface will not work.
* @param bandwidthProportion: bandwidth proportion of each stream of high-speed channel. The Sum of bandwidth proportion
* must equal 100.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHighSpeedDataChannel_SetBandwidthProportion(
T_ZiyanDataChannelBandwidthProportionOfHighspeedChannel bandwidthProportion);
/**
* @brief Get the network remote address for sending data stream.
* @note The interface is used to get the network remote address for sending data stream. You can get this info for another
* heterogeneous system to do somethings. This interface should be used after calling PsdkCore_Init function.
* @param ipAddr: the remote ip address for sending data stream.
* @param port: the remote port for sending data stream.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHighSpeedDataChannel_GetDataStreamRemoteAddress(char *ipAddr, uint16_t *port);
/**
* @brief Send data to mobile end via data stream of the data channel.
* @note This function can be used only in Linux operating system.
* @note Must ensure actual bandwidth is less than bandwidth limitation of corresponding channel or stream, please
* refer to developer documentation and state of channel/stream for details related to bandwidth limitation. User can
* get state of "dataStream" channel via PsdkDataTransmission_GetDataStreamState() function. If actual bandwidth
* exceeds the limitation or busy state is set, the user should stop transmitting data or decrease amount of data to be
* sent. Otherwise, data may be discarded.
* @param data: pointer to data to be sent.
* @param len: length of data to be sent via data stream, and it must be less than or equal to 65000, unit: byte.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHighSpeedDataChannel_SendDataStreamData(const uint8_t *data, uint16_t len);
/**
* @brief Get data transmission state of "dataStream" channel. User can use the state as base for controlling data
* transmission of data stream. This function exists and can be used only in Linux operation system.
* @param state: pointer to "dataStream" channel state.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHighSpeedDataChannel_GetDataStreamState(T_ZiyanDataChannelState *state);
#ifdef __cplusplus
}
#endif
#endif // ZIYAN_HIGH_SPEED_DATA_CHANNEL_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/
/**
********************************************************************
* @file ziyan_hms.h
* @brief This is the header file for "ziyan_hms.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_HMS_H
#define ZIYAN_HMS_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_typedef.h"
#include "ziyan_hms_customization.h"
#include "ziyan_hms_manager.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif // ZIYAN_HMS_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/
/**
********************************************************************
* @file ziyan_hms_customization.h
* @brief This is the header file for "ziyan_hms_customization.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2018 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_HMS_CUSTOMIZATION_H
#define ZIYAN_HMS_CUSTOMIZATION_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
typedef enum {
ZIYAN_HMS_ERROR_LEVEL_NONE = 0,
ZIYAN_HMS_ERROR_LEVEL_HINT,
ZIYAN_HMS_ERROR_LEVEL_WARN,
ZIYAN_HMS_ERROR_LEVEL_CRITICAL,
ZIYAN_HMS_ERROR_LEVEL_FATAL,
} E_ZiyanHmsErrorLevel;
typedef struct {
char *fileName; /*!< The file name of the hms text config file */
uint32_t fileSize; /*!< The file size of the hms text config file, uint : byte */
const uint8_t *fileBinaryArray; /*!< The binary C array of the hms text config file */
} T_ZiyanHmsFileBinaryArray;
typedef struct {
uint16_t binaryArrayCount; /*!< Binary array count. */
T_ZiyanHmsFileBinaryArray *fileBinaryArrayList; /*!< Pointer to binary array list */
} T_ZiyanHmsBinaryArrayConfig;
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialise hms customization module, and user should call this function
* before using hms customization features.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHmsCustomization_Init(void);
/**
* @brief DeInitialize hms manager module.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHmsCustomization_DeInit(void);
/**
* @brief Inject custom hms error code to APP.
* @note: For the same hms error code, a single call is enough, no need to call repeatedly.
* @param errorCode: hms error code, value range: [0x1E020000 ~ 0x1E02FFFF].
* @param errorLevel: hms error level, see reference of E_ZiyanHmsErrorLevel.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHmsCustomization_InjectHmsErrorCode(uint32_t errorCode, E_ZiyanHmsErrorLevel errorLevel);
/**
* @brief Eliminate custom hms error code to APP.
* @note: For the same hms error code, a single call is enough, no need to call repeatedly.
* @param errorCode: hms error code, value range: [0x1E020000 ~ 0x1E02FFFF].
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHmsCustomization_EliminateHmsErrorCode(uint32_t errorCode);
/**
* @brief Register default hms text configuration file by directory path.
* @param configDirPath: the hms text configuration by directory path.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHmsCustomization_RegDefaultHmsTextConfigByDirPath(const char *configDirPath);
/**
* @brief Register hms text configuration file by directory path.
* @note Different hms text configurations for several language require the same hms config.
* @param appLanguage: mobile app language type.
* @param configDirPath: the hms text configuration by directory path.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHmsCustomization_RegHmsTextConfigByDirPath(E_ZiyanMobileAppLanguage appLanguage,
const char *configDirPath);
/**
* @brief Register default hms text configuration config by binary array.
* @note In RTOS, most likely there is no file system. The hms text config file content can use C array express. Use this
* function and ZiyanHms_RegDefaultHmsTextConfigByBinaryArray set hms text configuration. When the language is not cover in
* your setting by ZiyanHms_RegHmsTextConfigByBinaryArray, the hms text configuration uses setting by this function.
* @param binaryArrayConfig: the binary array config for hms text configuration.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHmsCustomization_RegDefaultHmsTextConfigByBinaryArray(const T_ZiyanHmsBinaryArrayConfig
*binaryArrayConfig);
/**
* @brief Register hms text config by binary array configuration.
* @note Different hms text configurations for several language require the same hms config.
* @param appLanguage: mobile app language type.
* @param binaryArrayConfig: the binary array config for hms text configuration.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanHmsCustomization_RegHmsTextConfigByBinaryArray(E_ZiyanMobileAppLanguage appLanguage,
const T_ZiyanHmsBinaryArrayConfig *binaryArrayConfig);
#ifdef __cplusplus
}
#endif
#endif // ZIYAN_HMS_CUSTOMIZATION_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/