NEW: release DJI Payload-SDK version 3.6
Signed-off-by: DJI-Martin <DJI-Martin@dji.com>
This commit is contained in:
55
README.md
55
README.md
@ -1,6 +1,6 @@
|
|||||||
# DJI Payload SDK (PSDK)
|
# DJI Payload SDK (PSDK)
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
@ -23,38 +23,41 @@ to get the latest version information.
|
|||||||
|
|
||||||
## Latest Release
|
## Latest Release
|
||||||
|
|
||||||
PSDK 3.5.0 was released on 18 May 2023. This version of Payload SDK mainly add support for M350 RTK, also add some new features support and fixed some bugs.
|
PSDK 3.6.0 was released on 18 Sep 2023. This version of Payload SDK mainly add some new features support and fixed some
|
||||||
|
bugs.
|
||||||
Please refer to the release notes for detailed changes list.
|
Please refer to the release notes for detailed changes list.
|
||||||
|
|
||||||
* Added support for new drone model Matrice 350 RTK
|
* Added support for multi-language display in HMS management.
|
||||||
* Matrice 300 RTK added support for DJI RC Plus
|
* Added support for PSDK Non-RC flight.
|
||||||
* Added support for downloading media files in pieces on all drone models
|
* Added support for aircraft version number retrieval.
|
||||||
* Added support for Osal get random number callback interface on all drone model
|
* Added support for RTCM data subscription.
|
||||||
* Fixed issue with the black screen problem when uses third-party camera to playback video on M300 RTK and DJI smart controller screen combination
|
* Added support for cloud-based custom small data communication on Matrice 30/30T PSDK.
|
||||||
* Fixed issue with failure of subscribing L1 camera code stream on M300 RTK
|
* Added Support for Matrice 30/30T PSDK speaker cloud integration.
|
||||||
* Fixed issue with failure of subscribing main camera code stream in dual control mode on M300 RTK
|
* Added support for custom widgets wayline actions on Matrice 30/30T and Mavic 3E/3T aircraft.
|
||||||
* Fixed issue with local upgrade function of RTOS platform on Mavic 3E/3T
|
* Added support for grayscale image retrieval on M350 RTK.
|
||||||
* Fixed issue with the initialization failure of using PSDK Payload device and millimeter wave radar on M300 RTK
|
* Added support for time synchronization on M300 RTK and Matrice 30/30T.
|
||||||
* Fixed issue with custom HMS function on M300 RTK and X-Port combination
|
* Added support for third-party firmware upgrades through M350 RTK E-Port.
|
||||||
* Fixed issue with invalid TTS option of speaker widget on M300 RTK
|
* Added support for SDK interconnection on Mavic 3E/3T.
|
||||||
* Fixed issue with downloading file list with high probability of failure when the camera photos are over 400 on M300 RTK
|
* Added support for hotspot orbit function on Mavic 3E/3T.
|
||||||
* Fixed some of the memory leaks
|
* Added support for expanded camera and gimbal management interfaces.
|
||||||
|
* Fixed issue with the 500m altitude limit for flight control across all models.
|
||||||
|
* Fixed issue with incomplete small data transmission on specific models.
|
||||||
|
* Fixed issue with H20 I-frame retrieval on M300 RTK.
|
||||||
|
* Fixed issue with occasional custom widget display failure in DJI Pilot.
|
||||||
|
* Fixed issues with multiple live stream retrieval on Matrice 30/30T.
|
||||||
|
* Fixed issues with camera mode retrieval on Matrice 30/30T.
|
||||||
|
* Fixed issues with camera focal length value retrieval on Matrice 30/30T.
|
||||||
|
* Fixed issue with X-Port failed to self-check when both X-Port and SkyPort V2 were equipped on M300 RTK.
|
||||||
|
* Fixed issue with gimbal angle subscription data mismatching App display on M300 RTK.
|
||||||
|
* Fixed issue with flight control feature initialization failure on specific models after multiple calls.
|
||||||
|
* Fixed compatibility issues with initialization failures on some HiSilicon platforms.
|
||||||
|
* Optimized PSDK startup delays in single UART mode.
|
||||||
|
* Optimized slow media file download speeds for Mavic 3E/3T on ethernet links.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Payload SDK codebase is MIT-licensed. Please refer to the LICENSE file for detailed information.
|
Payload SDK codebase is MIT-licensed. Please refer to the LICENSE file for detailed information.
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Please read the following guidelines before starting work on a pull request.
|
|
||||||
|
|
||||||
#### Summary of the guidelines:
|
|
||||||
|
|
||||||
* One pull request per issue;
|
|
||||||
* Choose the right base branch;
|
|
||||||
* Clean up "oops" commits before submitting;
|
|
||||||
* Follow the coding style by "doc/dji_sdk_code_style"
|
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
You can get official support from DJI and the community with the following methods:
|
You can get official support from DJI and the community with the following methods:
|
||||||
|
|||||||
@ -49,11 +49,22 @@ typedef struct {
|
|||||||
* @brief Some base information of aircraft system, mainly including some constant parameters information of system.
|
* @brief Some base information of aircraft system, mainly including some constant parameters information of system.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
E_DjiAircraftSeries aircraftSeries; /*!< Aircraft series. */
|
||||||
|
E_DjiMountPositionType mountPositionType; /*!< Mount position type. */
|
||||||
E_DjiAircraftType aircraftType; /*!< Aircraft type. */
|
E_DjiAircraftType aircraftType; /*!< Aircraft type. */
|
||||||
E_DjiSdkAdapterType djiAdapterType; /*!< DJI adapter type. */
|
E_DjiSdkAdapterType djiAdapterType; /*!< DJI adapter type. */
|
||||||
E_DjiMountPosition mountPosition; /*!< Payload mount position. */
|
E_DjiMountPosition mountPosition; /*!< Payload mount position. */
|
||||||
} T_DjiAircraftInfoBaseInfo;
|
} T_DjiAircraftInfoBaseInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Aircraft version information.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
uint8_t debugVersion;
|
||||||
|
uint8_t modifyVersion;
|
||||||
|
uint8_t minorVersion;
|
||||||
|
uint8_t majorVersion;
|
||||||
|
} T_DjiAircraftVersion;
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@ -79,6 +90,13 @@ T_DjiReturnCode DjiAircraftInfo_GetMobileAppInfo(T_DjiMobileAppInfo *mobileAppIn
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiAircraftInfo_GetConnectionStatus(bool *isConnected);
|
T_DjiReturnCode DjiAircraftInfo_GetConnectionStatus(bool *isConnected);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get version of aircraft.
|
||||||
|
* @param aircraftVersion: pointer to aircraft version.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiAircraftInfo_GetAircraftVersion(T_DjiAircraftVersion *aircraftVersion);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -448,6 +448,39 @@ typedef enum {
|
|||||||
DJI_CAMERA_MANAGER_FILE_LIST_COUNT_ALL_PER_SLICE = 0xFFFF,
|
DJI_CAMERA_MANAGER_FILE_LIST_COUNT_ALL_PER_SLICE = 0xFFFF,
|
||||||
} E_DjiCameraManagerFileListCountPerSlice;
|
} E_DjiCameraManagerFileListCountPerSlice;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_SOURCE_DEFAULT_CAM = 0x0,
|
||||||
|
DJI_CAMERA_MANAGER_SOURCE_WIDE_CAM = 0x1,
|
||||||
|
DJI_CAMERA_MANAGER_SOURCE_ZOOM_CAM = 0x2,
|
||||||
|
DJI_CAMERA_MANAGER_SOURCE_IR_CAM = 0x3,
|
||||||
|
DJI_CAMERA_MANAGER_SOURCE_VISIBLE_CAM = 0x7,
|
||||||
|
} E_DjiCameraManagerStreamSource;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_NIGHT_SCENE_MODE_DISABLE = 0,
|
||||||
|
DJI_CAMERA_MANAGER_NIGHT_SCENE_MODE_ENABLE = 1,
|
||||||
|
DJI_CAMERA_MANAGER_NIGHT_SCENE_MODE_AUTO = 2,
|
||||||
|
} E_DjiCameraManagerNightSceneMode;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_CAPTURE = 0,
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING = 1,
|
||||||
|
} E_DjiCameraManagerCaptureOrRecording;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_FILE = 1,
|
||||||
|
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_DIR = 2,
|
||||||
|
} E_DjiCameraManagerExpandNameType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_RATIO_4X3 = 0,
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_RATIO_16X9 = 1,
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_RATIO_3X2 = 2,
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_RATIO_1X1 = 3,
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_RATIO_18X3 = 4,
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_RATIO_5X4 = 5,
|
||||||
|
} E_DjiCameraManagerPhotoRatio;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t firmware_version[4];
|
uint8_t firmware_version[4];
|
||||||
} T_DjiCameraManagerFirmwareVersion;
|
} T_DjiCameraManagerFirmwareVersion;
|
||||||
@ -517,6 +550,69 @@ typedef enum {
|
|||||||
DJI_DOWNLOAD_FILE_EVENT_END,
|
DJI_DOWNLOAD_FILE_EVENT_END,
|
||||||
} E_DjiDownloadFileEvent;
|
} E_DjiDownloadFileEvent;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_RESOLUTION_640X480P = 0, // 640X480P
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_RESOLUTION_1280X640P = 2, // 1280X640P
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_RESOLUTION_1280X720P = 4, // 1280X720P
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_RESOLUTION_1920X1080P = 10, // 1920X1080P
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_RESOLUTION_3840X2160P = 16, // 3840X2160P
|
||||||
|
} E_DjiCameraManagerVideoResolution;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_FRAME_RATE_15FPS = 0, // 14.985
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_FRAME_RATE_25FPS = 2, // 25.000
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_FRAME_RATE_30FPS = 3, // 29.970
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_FRAME_RATE_60FPS = 6, // 59.940
|
||||||
|
} E_DjiCameraManagerVideoFrameRate;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_RAW = 0,
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_JPEG = 1,
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_RAW_JPEG = 2,
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_YUV = 3, // 保存为YUV格式的图片
|
||||||
|
DJI_CAMERA_MANAGER_PHOTO_STORAGE_FORMAT_RJPEG = 7, // Radiometric JPEG
|
||||||
|
} E_DjiCameraManagerPhotoStorageFormat;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_STORAGE_FORMAT_MOV = 0,
|
||||||
|
DJI_CAMERA_MANAGER_VIDEO_STORAGE_FORMAT_MP4 = 1,
|
||||||
|
} E_DjiCameraManagerVideoStorageFormat;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_METERING_MODE_CENTRAL = 0,
|
||||||
|
DJI_CAMERA_MANAGER_METERING_MODE_AVERAGE = 1,
|
||||||
|
DJI_CAMERA_MANAGER_METERING_MODE_SPOT = 2,
|
||||||
|
} E_DjiCameraManagerMeteringMode;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_FFC_MODE_MANUAL = 0,
|
||||||
|
DJI_CAMERA_MANAGER_FFC_MODE_AUTO = 1,
|
||||||
|
} E_DjiCameraManagerFfcMode;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_IR_GAIN_MODE_AUTO = 0,
|
||||||
|
DJI_CAMERA_MANAGER_IR_GAIN_MODE_LOW = 1,
|
||||||
|
DJI_CAMERA_MANAGER_IR_GAIN_MODE_HIGH = 2,
|
||||||
|
} E_DjiCameraManagerIrGainMode;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/* not capturing*/
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURING_STATE_IDLE = 0,
|
||||||
|
|
||||||
|
/* doing single capture */
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURING_STATE_SINGLE = 1,
|
||||||
|
|
||||||
|
/* doing multi capture */
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURING_STATE_MULTI = 2,
|
||||||
|
} E_DjiCameraManagerCapturingState;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_CAMERA_MANAGER_RECORDING_STATE_IDLE = 0,
|
||||||
|
DJI_CAMERA_MANAGER_RECORDING_STATE_STARTING = 0,
|
||||||
|
DJI_CAMERA_MANAGER_RECORDING_STATE_RECORDING = 0,
|
||||||
|
DJI_CAMERA_MANAGER_RECORDING_STATE_STOPPING = 0,
|
||||||
|
} E_DjiCameraManagerRecordingState;
|
||||||
|
|
||||||
/*!< Attention: when the remote control is in split-screen mode, the coordinate range of the x-axis is 0 ~ 0.5
|
/*!< Attention: when the remote control is in split-screen mode, the coordinate range of the x-axis is 0 ~ 0.5
|
||||||
* */
|
* */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -571,6 +667,43 @@ typedef struct {
|
|||||||
uint8_t exception;
|
uint8_t exception;
|
||||||
} T_DjiCameraManagerLaserRangingInfo;
|
} T_DjiCameraManagerLaserRangingInfo;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t size;
|
||||||
|
E_DjiCameraManagerStreamSource streamSource[4];
|
||||||
|
E_DjiCameraManagerStreamSource streamStorage[4];
|
||||||
|
} T_DjiCameraManagerStreamList;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
E_DjiCameraManagerVideoResolution videoResolution;
|
||||||
|
E_DjiCameraManagerVideoFrameRate videoFrameRate;
|
||||||
|
} T_DjiCameraManagerVideoFormat;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t size;
|
||||||
|
union {
|
||||||
|
E_DjiCameraManagerPhotoStorageFormat photoStorageFormat[16];
|
||||||
|
E_DjiCameraManagerVideoStorageFormat videoStorageFormat[16];
|
||||||
|
E_DjiCameraManagerPhotoRatio photoRatioFormat[16];
|
||||||
|
E_DjiCameraManagerStreamSource streamSource[16];
|
||||||
|
E_DjiCameraManagerStreamSource streamStorage[16];
|
||||||
|
E_DjiCameraManagerNightSceneMode nightSceneMode[16];
|
||||||
|
};
|
||||||
|
uint32_t minValue;
|
||||||
|
uint32_t maxValue;
|
||||||
|
} T_DjiCameraManagerRangeList;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
double lowGainTempMin;
|
||||||
|
double lowGainTempMax;
|
||||||
|
double highGainTempMin;
|
||||||
|
double highGainTempMax;
|
||||||
|
} T_DjiCameraManagerIrTempMeterRange;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t totalCapacity; /* MByte */
|
||||||
|
uint32_t remainCapacity; /* MByte */
|
||||||
|
} T_DjiCameraManagerStorageInfo;
|
||||||
|
|
||||||
typedef T_DjiReturnCode (*DjiCameraManagerDownloadFileDataCallback)(T_DjiDownloadFilePacketInfo packetInfo,
|
typedef T_DjiReturnCode (*DjiCameraManagerDownloadFileDataCallback)(T_DjiDownloadFilePacketInfo packetInfo,
|
||||||
const uint8_t *data,
|
const uint8_t *data,
|
||||||
uint16_t dataLen);
|
uint16_t dataLen);
|
||||||
@ -606,6 +739,15 @@ T_DjiReturnCode DjiCameraManager_GetCameraType(E_DjiMountPosition position, E_Dj
|
|||||||
T_DjiReturnCode DjiCameraManager_GetFirmwareVersion(E_DjiMountPosition position,
|
T_DjiReturnCode DjiCameraManager_GetFirmwareVersion(E_DjiMountPosition position,
|
||||||
T_DjiCameraManagerFirmwareVersion *firmwareVersion);
|
T_DjiCameraManagerFirmwareVersion *firmwareVersion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get camera connect status.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param connectStatus: returned value of connect status
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetCameraConnectStatus(E_DjiMountPosition position,
|
||||||
|
bool *connectStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set camera working mode of the selected camera mounted position.
|
* @brief Set camera working mode of the selected camera mounted position.
|
||||||
* @note Set the camera's work mode to taking pictures, video, playback or
|
* @note Set the camera's work mode to taking pictures, video, playback or
|
||||||
@ -668,6 +810,16 @@ T_DjiReturnCode DjiCameraManager_StartShootPhoto(E_DjiMountPosition position,
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiCameraManager_StopShootPhoto(E_DjiMountPosition position);
|
T_DjiReturnCode DjiCameraManager_StopShootPhoto(E_DjiMountPosition position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get camera capturing state.
|
||||||
|
* @note L1/P1 do not support this API.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param capturingState: result of getting, see E_DjiCameraManagerCapturingState.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetCapturingState(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerCapturingState *capturingState);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the burst count in the burst take-photo mode.
|
* @brief Set the burst count in the burst take-photo mode.
|
||||||
* @param position: camera mounted position
|
* @param position: camera mounted position
|
||||||
@ -726,6 +878,16 @@ T_DjiReturnCode DjiCameraManager_SetPhotoTimeIntervalSettings(E_DjiMountPosition
|
|||||||
T_DjiReturnCode DjiCameraManager_GetPhotoTimeIntervalSettings(E_DjiMountPosition position,
|
T_DjiReturnCode DjiCameraManager_GetPhotoTimeIntervalSettings(E_DjiMountPosition position,
|
||||||
T_DjiCameraPhotoTimeIntervalSettings *intervalSetting);
|
T_DjiCameraPhotoTimeIntervalSettings *intervalSetting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get remain time of interval shooting.
|
||||||
|
* @note L1/P1 do not support this API.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param remainTime: time in seconds.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetIntervalShootingRemainTime(E_DjiMountPosition position,
|
||||||
|
uint8_t *remainTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set camera focus mode of the selected camera mounted position.
|
* @brief Set camera focus mode of the selected camera mounted position.
|
||||||
* @note Set the lens focus mode. When the focus mode is auto, the target
|
* @note Set the lens focus mode. When the focus mode is auto, the target
|
||||||
@ -884,6 +1046,33 @@ T_DjiReturnCode DjiCameraManager_GetTapZoomMultiplier(E_DjiMountPosition positio
|
|||||||
T_DjiReturnCode DjiCameraManager_TapZoomAtTarget(E_DjiMountPosition position,
|
T_DjiReturnCode DjiCameraManager_TapZoomAtTarget(E_DjiMountPosition position,
|
||||||
T_DjiCameraManagerTapZoomPosData tapZoomPos);
|
T_DjiCameraManagerTapZoomPosData tapZoomPos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get camera focus ring value range.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param rangeList: returned value of range.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetFocusRingRange(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerRangeList *rangeList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set camera focus ring value.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param value: focus ring value.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetFocusRingValue(E_DjiMountPosition 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_DjiReturnCode DjiCameraManager_GetFocusRingValue(E_DjiMountPosition position,
|
||||||
|
uint16_t *value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set camera's exposure mode of the selected camera mounted position.
|
* @brief Set camera's exposure mode of the selected camera mounted position.
|
||||||
* @note The different exposure modes define whether aperture, shutter speed,
|
* @note The different exposure modes define whether aperture, shutter speed,
|
||||||
@ -995,6 +1184,32 @@ T_DjiReturnCode DjiCameraManager_SetExposureCompensation(E_DjiMountPosition posi
|
|||||||
T_DjiReturnCode DjiCameraManager_GetExposureCompensation(E_DjiMountPosition position,
|
T_DjiReturnCode DjiCameraManager_GetExposureCompensation(E_DjiMountPosition position,
|
||||||
E_DjiCameraManagerExposureCompensation *ev);
|
E_DjiCameraManagerExposureCompensation *ev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set AE lock mode.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param enable: ture to enable, false to diasble.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetAELockEnabled(E_DjiMountPosition position,
|
||||||
|
bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get AE lock mode.
|
||||||
|
* @note Camera L1/P1 don't support this API.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param enable: result of AE lock mode.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetAELockEnabled(E_DjiMountPosition position,
|
||||||
|
bool *enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reset camera settings.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_ResetCameraSettings(E_DjiMountPosition position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Start to take video of the selected camera mounted position.
|
* @brief Start to take video of the selected camera mounted position.
|
||||||
* @note Camera must be in RECORD_VIDEO mode. For thermal imaging camera,
|
* @note Camera must be in RECORD_VIDEO mode. For thermal imaging camera,
|
||||||
@ -1012,6 +1227,230 @@ T_DjiReturnCode DjiCameraManager_StartRecordVideo(E_DjiMountPosition position);
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiCameraManager_StopRecordVideo(E_DjiMountPosition position);
|
T_DjiReturnCode DjiCameraManager_StopRecordVideo(E_DjiMountPosition position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get camera recording state.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param recordingState: result of getting, see E_DjiCameraManagerRecordingState.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetRecordingState(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerRecordingState *recordingState);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get camera recording time.
|
||||||
|
* @note L1/P1 don not support this API.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param recordingTime: result of getting, unit is seconds.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetRecordingTime(E_DjiMountPosition 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_DjiReturnCode DjiCameraManager_GetStreamSourceRange(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerRangeList *rangeList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Choose camera stream source.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param streamSource: stream source to be chose.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetStreamSource(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerStreamSource streamSource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get photo storage format range.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param rangeList: range list returned value
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetPhotoFormatStorageRange(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerRangeList *rangeList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set photo storage format.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param format: storage format.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetPhotoFormat(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerPhotoStorageFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get photo storage format.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param format: returned value of storage format.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetPhotoFormat(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerPhotoStorageFormat *format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get video storage format range.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param rangeList: range list returned value
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetVideoFormatRange(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerRangeList *rangeList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set video storage format.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param format: storage format.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetVideoStorageFormat(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerVideoStorageFormat format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get video storage format.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param format: returned value of storage format.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetVideoFormat(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerVideoStorageFormat *format);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get photo ratio range
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param rangeList: range list returned value
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetPhotoRatioRange(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerRangeList *rangeList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set camera photo ratio
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param photoRatio: ratio to be set
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetPhotoRatio(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerPhotoRatio photoRatio);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get camera photo ratio
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param photoRatio: returned value of photo ratio
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetPhotoRatio(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerPhotoRatio *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_DjiReturnCode DjiCameraManager_GetVideoResolutionFrameRate(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerVideoFormat *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_DjiReturnCode DjiCameraManager_GetNightSceneModeRange(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerRangeList *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_DjiReturnCode DjiCameraManager_SetNightSceneMode(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerNightSceneMode nightSceneMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get night scene mode.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param nightSceneMode: pointer to night scene mode.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetNightSceneMode(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerNightSceneMode *nightSceneMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get range of stream source(s) can be storaged when capturing or recording.
|
||||||
|
* @param position: camera mounted position.
|
||||||
|
* @param rangeList: returned value of range, in member streamStorage.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetStreamStorageRange(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerRangeList *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_DjiReturnCode DjiCameraManager_SetCaptureRecordingStreams(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerCaptureOrRecording streamType,
|
||||||
|
T_DjiCameraManagerStreamList *streamStorageList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the stream(s) of capture or recording mode to be storaged.
|
||||||
|
* @param position: camera mounted position.
|
||||||
|
* @param streamType: capture mode or recording mode.
|
||||||
|
* @param streamSourceList: the real return value.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetCaptureRecordingStreams(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerCaptureOrRecording streamType,
|
||||||
|
T_DjiCameraManagerStreamList *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_DjiReturnCode DjiCameraManager_SetSynchronizedSplitScreenZoomEnabled(E_DjiMountPosition position, bool enable);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set suffix name of directory or file.
|
||||||
|
* @note For file name, the setting is only valid once.
|
||||||
|
* @param position: camera mounted position.
|
||||||
|
* @param nameType: see E_DjiCameraManagerExpandNameType, select to set name of directory or file.
|
||||||
|
* @param nameSize: size of name string, must be in rang of 1 ~ 239.
|
||||||
|
* @param nameStr: Content of custom suffix name.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetCustomExpandName(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerExpandNameType nameType,
|
||||||
|
const uint8_t *nameStr,
|
||||||
|
uint32_t nameSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get custom past of lastest 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: its tell the max size of nameStr and changed to to the actually size of
|
||||||
|
* name string when function finished.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetCustomExpandName(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerExpandNameType nameType,
|
||||||
|
uint8_t *nameStr,
|
||||||
|
uint32_t *nameSize);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Download selected camera media file list.
|
* @brief Download selected camera media file list.
|
||||||
* @note The interface is a synchronous interface, which occupies more CPU resources when using it.
|
* @note The interface is a synchronous interface, which occupies more CPU resources when using it.
|
||||||
@ -1054,6 +1493,38 @@ T_DjiReturnCode DjiCameraManager_RegDownloadFileDataCallback(E_DjiMountPosition
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiCameraManager_DownloadFileByIndex(E_DjiMountPosition position, uint32_t fileIndex);
|
T_DjiReturnCode DjiCameraManager_DownloadFileByIndex(E_DjiMountPosition position, uint32_t fileIndex);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Before downloading media file(s), downloader rights should be obtained.
|
||||||
|
* @param position: the mount position of the camera
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_ObtainDownloaderRights(E_DjiMountPosition position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief After downloading media file(s), downloader rights should be released
|
||||||
|
* @note If not release rights, the pilot app is probably can't access album of camera.
|
||||||
|
* @param position: the mount position of the camera
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_ReleaseDownloaderRights(E_DjiMountPosition position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Format SD card.
|
||||||
|
* @param position: the mount position of the camera
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_FormatStorage(E_DjiMountPosition position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get storage info of SD card.
|
||||||
|
* @note Camera L1/P1 don't support this API.
|
||||||
|
* @param position: the mount position of the camera
|
||||||
|
* @param storageInfo: result of getting, storage info of SD card.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetStorageInfo(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerStorageInfo *storageInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete selected camera media file by file index.
|
* @brief Delete selected camera media file by file index.
|
||||||
* @param position: the mount position of the camera
|
* @param position: the mount position of the camera
|
||||||
@ -1112,6 +1583,86 @@ T_DjiReturnCode DjiCameraManager_SetAreaThermometryCoordinate(E_DjiMountPosition
|
|||||||
T_DjiReturnCode DjiCameraManager_GetAreaThermometryData(E_DjiMountPosition position,
|
T_DjiReturnCode DjiCameraManager_GetAreaThermometryData(E_DjiMountPosition position,
|
||||||
T_DjiCameraManagerAreaThermometryData *areaThermometryData);
|
T_DjiCameraManagerAreaThermometryData *areaThermometryData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set FFC mode.
|
||||||
|
* @param position: camera mounted position.
|
||||||
|
* @param ffcMode: mode to be set.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetFfcMode(E_DjiMountPosition position, E_DjiCameraManagerFfcMode ffcMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trigger FFC one time.
|
||||||
|
* @param position: camera mounted position.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_TriggerFfc(E_DjiMountPosition position);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set infrared camera gaim mode.
|
||||||
|
* @param position: camera mounted position.
|
||||||
|
* @param gainMode: gain mode to set.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetInfraredCameraGainMode(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerIrGainMode gainMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get temprature range of infrared camera.
|
||||||
|
* @param position: camera mounted position.
|
||||||
|
* @param tempRange: returned valued of temperature range.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetInfraredCameraGainModeTemperatureRange(E_DjiMountPosition position,
|
||||||
|
T_DjiCameraManagerIrTempMeterRange *tempRange);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set camera metering mode.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param meteringMode: metering mode
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_SetMeteringMode(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerMeteringMode meteringMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get camera metering mode.
|
||||||
|
* @param position: camera mounted position
|
||||||
|
* @param meteringMode: pointer to returned value of metering mode
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiCameraManager_GetMeteringMode(E_DjiMountPosition position,
|
||||||
|
E_DjiCameraManagerMeteringMode *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_DjiReturnCode DjiCameraManager_GetMeteringPointRegionRange(E_DjiMountPosition position,
|
||||||
|
uint8_t *hrzNum, uint8_t *vtcNum);
|
||||||
|
/**
|
||||||
|
* @brief Set metrting 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_DjiReturnCode DjiCameraManager_SetMeteringPoint(E_DjiMountPosition 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_DjiReturnCode DjiCameraManager_GetMeteringPoint(E_DjiMountPosition position,
|
||||||
|
uint8_t *x, uint8_t *y);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -312,16 +312,132 @@ extern "C" {
|
|||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_CAMERA_FOCAL_DISTANCE_INVALID, "Focal distance of camera focalize function exceed valid range. ", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_CAMERA_FOCAL_DISTANCE_INVALID, "Focal distance of camera focalize function exceed valid range. ", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_CAMERA_EXEC_FAIL, "This err code indicate camera fail to exec coressponding cmd and the low 8 bit", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_CAMERA_EXEC_FAIL, "This err code indicate camera fail to exec coressponding cmd and the low 8 bit", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_RESV, "Reserved error code", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_RESV, "Reserved error code", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_INVALID_RPY_ANGLE_CTRL_CMD, "Gimbal roll pitch yaw angle ctrl cmd param invalid ", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_INVALID_RPY_ANGLE_CTRL_CMD, "Gimbal roll pitch yaw angle ctrl cmd param invalid ", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_INVALID_DURATION_CMD, "Gimbal duration param invalid unable to exec. ", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_INVALID_DURATION_CMD, "Gimbal duration param invalid unable to exec. ", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_FAIL_TO_ARRIVE_TGT_ANGLE, "Gimbal fail to arrive target angle . ", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_FAIL_TO_ARRIVE_TGT_ANGLE, "Gimbal fail to arrive target angle . ", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_FAIL_TO_SEND_CMD_TO_GIMBAL, "Fail to send cmd to gimbal for gimbal is busy or no gimbal. ", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_FAIL_TO_SEND_CMD_TO_GIMBAL, "Fail to send cmd to gimbal for gimbal is busy or no gimbal. ", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_THIS_INDEX_OF_GIMBAL_NOT_DOING_UNIFORM_CTRL , "Fail to stop gimbal uniform ctrl because index error. ", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_GIMBAL_THIS_INDEX_OF_GIMBAL_NOT_DOING_UNIFORM_CTRL , "Fail to stop gimbal uniform ctrl because index error. ", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_FLIGHT_RESV, "Reserved error code", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_FLIGHT_RESV, "Reserved error code", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_FLIGHT_YAW_INVALID_YAW_ANGLE, "Yaw angle is lager max yaw angle. ", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_FLIGHT_YAW_INVALID_YAW_ANGLE, "Yaw angle is lager max yaw angle. ", NULL}, \
|
||||||
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_FLIGHT_YAW_TO_TGT_ANGLE_TIMEOUT, "Failed to target yaw angle because of timeout. ", NULL}, \
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_FLIGHT_YAW_TO_TGT_ANGLE_TIMEOUT, "Failed to target yaw angle because of timeout. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_FLIGHT_ACTION_YAW_OCCUPIED, "Failed to target yaw angle because of timeout. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_FLIGHT_CUR_AND_TGT_VEL_CLE_STATUE_EQUAL, "Failed to current and target vel not equal. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_PAYLOAD_RESV, "Failed to payload reserved error code. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_PAYLOAD_FAIL_TO_SEND_CMD_TO_PAYLOAD, "Failed to sned cmd to payload. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_PAYLOAD_EXEC_FAILED, "Failed to execute payload actuator. ", NULL}, \
|
||||||
|
/* waypoint v3 module error message */ \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_COMMON_SUCCESS, "Execute waypoint v3 cmd successfully. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_MISSION_ID_NOT_EXIST, "Execute waypoint v3 mission id not match. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_WAYLINE_INFO_ERROR , "Execute waypoint v3 wayline info error. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_WPMZ_FILE_VERSION_NOT_MATCH, "Execute waypoint v3 wpmz file not match. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_WPMZ_FILE_LOAD_ERROR, "Load waypoint v3 wpmz file error. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_NO_BREAK_INFO, "Execute waypoint v3 no break info error. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CMD_INVALID, "Execute waypoint v3 cmd invalid. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_START_WAYLINE_WHEN_WAYLINE_RUNNING, "Cannot start wayline when wayline running. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_BREAK_WAYLINE_IN_CUR_STATE, "Cannot break wayline in current state. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_STOP_WAYLINE_WHEN_WAYLINE_NOT_RUNNING, "Cannot stop wayline when wayline not running. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_BREAK_WAYLINE_WHEN_WAYLINE_NOT_RUNNING, "Cannot break wayline when wayline not running. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_REQUEST_DRONE_CONTROL, "Flight mission conflict, unable to obtain control auth of the aircraft. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_RESUME_WAYLINE_IN_CUR_STATE, "Failed to resume wayline in current state. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_HEIGHT_LIMIT, "Execute waypoint v3 failed due to height limit. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RADIUS_LIMIT, "Execute waypoint v3 failed due to radius limit. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CROSS_FLYLIMIT_AERA, "Execute waypoint v3 failed due to cross flylimit area. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_LOW_LIMIT, "Execute waypoint v3 failed due to low limit. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_OBSTACAL_STOP, "Execute waypoint v3 failed due to obstacal stop. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RTK_DISCONNECT, "Execute waypoint v3 failed due to rtk disconnect. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_BOUNDARY_LIMIT, "Execute waypoint v3 failed due to boundary limit. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RC_PITCH_ROLL_BREAK, "Execute waypoint v3 failed due to rc pitch roll break. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_AIRPORT_HEIGHT_LIMIT, "Execute waypoint v3 failed due to airport height limit. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_REQUEST_TAKEOFF_FAIL, "Failed to request take off. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_AUTOTAKEOFF_RUN_FAIL, "Failed to run auto take off. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_REQUEST_WAYLINE_FAIL, "Failed to request wayline. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_AGRO_PLAN_FAIL, "Failed to agro plan. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_REQUEST_QUICK_TAKEOFF_ASSIST_FAIL, "Failed to request quick take off assist. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_QUICK_TAKEOFF_ASSIST_RUN_FAIL, "Failed to run quick takeoff assist. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_VFENCE_LIMIT, "Execute waypoint v3 failed due to vfence limit. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_GPS_INVALID, "Execute waypoint v3 failed due to gps invalid. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_START_AT_CURRENT_RC_MODE, "Failed to start at current rc mode. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_HOME_POINT_NOT_RECORDED, "Execute waypoint v3 failed due to homepoint not recorded. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_LOWER_BATTERY, "Execute waypoint v3 failed due to lower battery. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RETURN_HOME, "Execute waypoint v3 failed due to return home. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ADSB_ERROR, "Execute waypoint v3 failed due to adsb error. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RC_LOST, "Execute waypoint v3 failed due to rc lost. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RTK_NOT_READY, "Execute waypoint v3 failed due to rtk not ready. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_DRONE_IS_MOVING, "Execute waypoint v3 failed due to drone is moving. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_DRONE_ON_GROUND_MOTOR_ON, "Execute waypoint v3 failed due to drone on ground motor on. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_SURFACE_FOLLOW_CAMERA_INVALID, "Execute waypoint v3 failed due to surface follow camera invalid. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_SURFACE_FOLLOW_HEIGHT_INVALID, "Execute waypoint v3 failed due to surface follow height invalid.", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_SURFACE_FOLLOW_MAP_WRONG, "Execute waypoint v3 failed due to surface follow map wrong. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_HOMEPOINT_NOT_MATCH_RTK, "Execute waypoint v3 failed due to homepoint not match rtk. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_STRONG_WIND_GOHOME, "Execute waypoint v3 failed due to strong wind gohome. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_DRONE_CRITICAL_ERROR, "Execute waypoint v3 failed due to drone critical error. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_FIND_PAYLOAD, "Execute waypoint v3 failed due to cannot find payload. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_EXECUTION_FAILED, "Execute waypoint v3 failed due to action execution failed. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_FARM_NO_PESTICIDE, "Execute waypoint v3 failed due to farm no pesticide. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RADAR_DISCONNECT, "Execute waypoint v3 failed due to radar disconnect. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_EXIT, "Execute waypoint v3 failed due to user exit. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_BREAK, "Execute waypoint v3 failed due to user break. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_SET_GOHOME, "Execute waypoint v3 failed due to user set gohome. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_AGRO_PLANNER_STATE_CHANGE, "Execute waypoint v3 failed due to user agro panner state change. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_SWITCH_RC_MODE, "Execute waypoint v3 failed due to user switch rc mode. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INIT_FAIL, "Execute waypoint v3 failed due to traj init failed. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_JOB_EXIT_BUT_MIS_RUNNING, "Execute waypoint v3 failed due to traj job exit but mis running. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_ON_GROUND_MOTOR_ON_CANNOT_GO, "Execute waypoint v3 failed due to traj on ground motor is turn on. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_START_INDEX_OR_PROG, "Execute waypoint v3 failed due to traj invalid start index. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_CSYS_MODE, "Execute waypoint v3 failed due to traj invalid csys mode. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_HEIGHT_MODE, "Execute waypoint v3 failed due to traj invalid height mode. ", NULL},\
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_FLY_WP_MODE, "Execute waypoint v3 failed due to traj invalid fly wp mode. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_YAW_MODE, "Execute waypoint v3 failed due to traj invalid yaw mode. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_TURN_DIR_MODE, "Execute waypoint v3 failed due to traj invalid turn dir mode. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_WP_TYPE, "Execute waypoint v3 failed due to traj invalid wp type. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_FIR_LAS_WP_TYPE_ERROR, "Execute waypoint v3 failed due to fir las wp type error. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_GLOB_VEL_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj wp global vel out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_NUM_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj wp num out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_LAT_LONG_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj lat or lon out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_DAMP_DIS_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj damp dis out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_MAX_VEL_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj max vel out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_VEL_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj vel out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_YAW_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj wp yaw out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_YAW_MODE_IN_VERT_SEGM, "Execute waypoint v3 failed due to traj invalid yaw mode in vert segm. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_BREAK_INFO_MISSION_ID_CHANGED, "Execute waypoint v3 failed due to traj wp break info mission id changed. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_BREAK_INFO_PROGRESS_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj wp break info progress out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_BREAK_INFO_INVALID_MISSION_STATE, "Execute waypoint v3 failed due to traj wp break info invalid mission state. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_BREAK_INFO_WP_INDEX_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj wp break info wp index out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_BREAK_LAT_LONG_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj break lat or lon out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_BREAK_INFO_WP_YAW_OUT_OF_RANGE, "Execute waypoint v3 failed due to traj break info wp yaw out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_BREAK_INFO_FLAG , "Execute waypoint v3 failed due to traj invalid break info flag. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_GET_TRAJ_INFO_FAILED, "Execute waypoint v3 failed due to traj get info failed. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_GENERATE_FAIL, "Execute waypoint v3 failed due to traj generate failed. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_LIB_RUN_FAIL, "Execute waypoint v3 failed due to traj lib run failed. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_LIB_EMERGENCY_BRAKE, "Execute waypoint v3 failed due to traj lib emergency brake. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_NOT_FOUND, "Execute waypoint v3 failed due to action not found. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_INDEX_REPEATED, "Execute waypoint v3 failed due to action index repeated. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_INFO_SIZE_TOO_LONG_OR_TOO_SHORT, "Execute waypoint v3 failed due to size too long or too short. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_EMPTY, "Execute waypoint v3 failed due to action tree empty. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_LAYER_EMPTY, "Execute waypoint v3 failed due to action tree layer empty. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_ID_REPEATED, "Execute waypoint v3 failed due to action repeated. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_NODE_CHILDREN_NUM_LT_2, "Execute waypoint v3 failed due to action mode children num less than 2. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_INDEX_OUT_OF_RANGE, "Execute waypoint v3 failed due to action index out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_ID_IS_65535, "Execute waypoint v3 failed due to action id is 65535. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_NODE_CHILDNUM_SUM_NOT_EQ_NEXT_LAYER_SIZE, "Execute waypoint v3 failed due to action node child sum not equal next layer size. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_LAYER_NUM_TOO_MORE, "Execute waypoint v3 failed due to action tree layer num too more. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_LAYER_NUM_TOO_LESS, "Execute waypoint v3 failed due to action tree layer num too less. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_GROUP_NUM_OUT_OF_RANGE, "Execute waypoint v3 failed due to action group num out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_GROUP_VALID_RANGE_ERROR, "Execute waypoint v3 failed due to action group valid range error. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_ROOT_STATUS_INVALID, "Execute waypoint v3 failed due to action tree root status invalid. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_NODE_STATUS_INVALID, "Execute waypoint v3 failed due to action tree mode status invalid. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_ACTION_GROUP_ID_OUT_OF_RANGE, "Execute waypoint v3 failed due to break info action group id out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_STATUS_TREE_SIZE_ERROR, "Execute waypoint v3 failed due to action status tree size error. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_TRIGGER_RUN_RESULT_INVALID, "Execute waypoint v3 failed due to break info trigger run result invalid. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_ACTION_GROUP_ID_REPEATED, "Execute waypoint v3 failed due to break info action group id repeated. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_ACTION_LOCATION_REPEATED, "Execute waypoint v3 failed due to break info action location repeated. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_ACTION_LOCATION_OUT_OF_RANGE, "Execute waypoint v3 failed due to break info action location out of range. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_RESUME_ID_NOT_IN_BREAK_INFO, "Execute waypoint v3 failed due to resume id not in break info. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_RESUME_INFO_MODIFY_ACTION_STATUS_FROM_NO_INTERRUPT_TO_INTERRUPT, "Execute waypoint v3 failed due to modify action status from no interrupt to interrupt. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_RESUME_FAIL_FOR_INVALID_RESUME_INFO, "Execute waypoint v3 failed due to action resume failed for invalid resume info. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTUATOR_COMMON_ACTUATOR_NOT_FOUND, "Execute waypoint v3 failed due to actuator not found. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRIGGER_NOT_FOUND, "Execute waypoint v3 failed due to trigger not found. ", NULL}, \
|
||||||
|
{DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRIGGER_SINGLE_TIME_CHECK_FAIL, "Execute waypoint v3 failed due to single time check failed. ", NULL}, \
|
||||||
|
|
||||||
#define DJI_RETURN_CODE_OK DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS /*!< Payload SDK return code represents as status is ok. */
|
#define DJI_RETURN_CODE_OK DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS /*!< Payload SDK return code represents as status is ok. */
|
||||||
#define DJI_RETURN_CODE_ERR_ALLOC DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED /*!< Payload SDK return code represents as status alloc error. */
|
#define DJI_RETURN_CODE_ERR_ALLOC DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED /*!< Payload SDK return code represents as status alloc error. */
|
||||||
@ -375,6 +491,7 @@ typedef enum {
|
|||||||
DJI_ERROR_MODULE_CAMERA_MANAGER,
|
DJI_ERROR_MODULE_CAMERA_MANAGER,
|
||||||
DJI_ERROR_MODULE_GIMBAL_MANAGER,
|
DJI_ERROR_MODULE_GIMBAL_MANAGER,
|
||||||
DJI_ERROR_MODULE_WAYPOINT_V2,
|
DJI_ERROR_MODULE_WAYPOINT_V2,
|
||||||
|
DJI_ERROR_MODULE_WAYPOINT_V3,
|
||||||
DJI_ERROR_MODULE_ERROR,
|
DJI_ERROR_MODULE_ERROR,
|
||||||
} E_DjiErrorModule;
|
} E_DjiErrorModule;
|
||||||
|
|
||||||
@ -737,6 +854,121 @@ typedef enum {
|
|||||||
DJI_ERROR_WAYPOINT_V2_MODULE_RAW_CODE_ACTUATOR_PAYLOAD_EXEC_FAILED = 0x470002,
|
DJI_ERROR_WAYPOINT_V2_MODULE_RAW_CODE_ACTUATOR_PAYLOAD_EXEC_FAILED = 0x470002,
|
||||||
} E_DjiErrorWaypointV2ModuleRawCode;
|
} E_DjiErrorWaypointV2ModuleRawCode;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_SUCCESS = 0x0000,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_MISSION_ID_NOT_EXIST = 1,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_WAYLINE_INFO_ERROR = 2,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_WPMZ_FILE_VERSION_NOT_MATCH = 3,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_WPMZ_FILE_LOAD_ERROR = 4,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_NO_BREAK_INFO = 5,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CMD_INVALID = 6,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_START_WAYLINE_WHEN_WAYLINE_RUNNING = 257,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_BREAK_WAYLINE_IN_CUR_STATE = 258,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_STOP_WAYLINE_WHEN_WAYLINE_NOT_RUNNING = 259,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_BREAK_WAYLINE_WHEN_WAYLINE_NOT_RUNNING = 260,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_REQUEST_DRONE_CONTROL = 261,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_RESUME_WAYLINE_IN_CUR_STATE = 262,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_HEIGHT_LIMIT = 513,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RADIUS_LIMIT = 514,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CROSS_FLYLIMIT_AERA = 515,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_LOW_LIMIT = 516,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_OBSTACAL_STOP = 517,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RTK_DISCONNECT = 518,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_BOUNDARY_LIMIT = 519,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RC_PITCH_ROLL_BREAK = 520,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_AIRPORT_HEIGHT_LIMIT = 521,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_REQUEST_TAKEOFF_FAIL = 522,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_AUTOTAKEOFF_RUN_FAIL = 523,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_REQUEST_WAYLINE_FAIL = 524,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_AGRO_PLAN_FAIL = 525,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_REQUEST_QUICK_TAKEOFF_ASSIST_FAIL = 526,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_QUICK_TAKEOFF_ASSIST_RUN_FAIL = 527,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_VFENCE_LIMIT = 528,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_GPS_INVALID = 769,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_START_AT_CURRENT_RC_MODE = 770,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_HOME_POINT_NOT_RECORDED = 771,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_LOWER_BATTERY = 772,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RETURN_HOME = 773,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ADSB_ERROR = 774,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RC_LOST = 775,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RTK_NOT_READY = 776,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_DRONE_IS_MOVING = 777,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_DRONE_ON_GROUND_MOTOR_ON = 778,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_SURFACE_FOLLOW_CAMERA_INVALID = 779,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_SURFACE_FOLLOW_HEIGHT_INVALID = 780,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_SURFACE_FOLLOW_MAP_WRONG = 781,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_HOMEPOINT_NOT_MATCH_RTK = 782,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_STRONG_WIND_GOHOME = 784,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_DRONE_CRITICAL_ERROR = 1023,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_FIND_PAYLOAD = 1025,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_EXECUTION_FAILED = 1026,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_FARM_NO_PESTICIDE = 1027,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RADAR_DISCONNECT = 1028,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_EXIT = 1281,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_BREAK = 1282,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_SET_GOHOME = 1283,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_AGRO_PLANNER_STATE_CHANGE = 1284,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_SWITCH_RC_MODE = 1285,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INIT_FAIL = 1536,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_JOB_EXIT_BUT_MIS_RUNNING = 1537,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_ON_GROUND_MOTOR_ON_CANNOT_GO = 1538,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_START_INDEX_OR_PROG = 1539,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_CSYS_MODE = 1540,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_HEIGHT_MODE = 1541,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_FLY_WP_MODE = 1542,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_YAW_MODE = 1543,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_TURN_DIR_MODE = 1544,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_WP_TYPE = 1545,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_FIR_LAS_WP_TYPE_ERROR = 1546,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_GLOB_VEL_OUT_OF_RANGE = 1547,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_NUM_OUT_OF_RANGE = 1548,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_LAT_LONG_OUT_OF_RANGE = 1549,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_DAMP_DIS_OUT_OF_RANGE = 1550,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_MAX_VEL_OUT_OF_RANGE = 1551,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_VEL_OUT_OF_RANGE = 1552,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_YAW_OUT_OF_RANGE = 1553,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_YAW_MODE_IN_VERT_SEGM = 1554,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_BREAK_INFO_MISSION_ID_CHANGED = 1555,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_BREAK_INFO_PROGRESS_OUT_OF_RANGE = 1556,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_BREAK_INFO_INVALID_MISSION_STATE = 1557,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_BREAK_INFO_WP_INDEX_OUT_OF_RANGE = 1558,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_BREAK_LAT_LONG_OUT_OF_RANGE = 1559,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_BREAK_INFO_WP_YAW_OUT_OF_RANGE = 1560,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_BREAK_INFO_FLAG = 1561,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_GET_TRAJ_INFO_FAILED = 1562,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_GENERATE_FAIL = 1563,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_LIB_RUN_FAIL = 1564,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_LIB_EMERGENCY_BRAKE = 1565,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_NOT_FOUND = 1588,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_INDEX_REPEATED = 1591,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_INFO_SIZE_TOO_LONG_OR_TOO_SHORT = 1592,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_EMPTY = 1593,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_LAYER_EMPTY = 1594,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_ID_REPEATED = 1595,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_NODE_CHILDREN_NUM_LT_2 = 1596,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_INDEX_OUT_OF_RANGE = 1597,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_ID_IS_65535 = 1598,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_NODE_CHILDNUM_SUM_NOT_EQ_NEXT_LAYER_SIZE = 1599,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_LAYER_NUM_TOO_MORE = 1600,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_LAYER_NUM_TOO_LESS = 1601,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_GROUP_NUM_OUT_OF_RANGE = 1602,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_GROUP_VALID_RANGE_ERROR = 1603,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_ROOT_STATUS_INVALID = 1604,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_NODE_STATUS_INVALID = 1605,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_ACTION_GROUP_ID_OUT_OF_RANGE = 1606,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_STATUS_TREE_SIZE_ERROR = 1607,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_TRIGGER_RUN_RESULT_INVALID = 1608,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_ACTION_GROUP_ID_REPEATED = 1609,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_ACTION_LOCATION_REPEATED = 1610,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_ACTION_LOCATION_OUT_OF_RANGE = 1611,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_RESUME_ID_NOT_IN_BREAK_INFO = 1612,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_RESUME_INFO_MODIFY_ACTION_STATUS_FROM_NO_INTERRUPT_TO_INTERRUPT = 1613,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_RESUME_FAIL_FOR_INVALID_RESUME_INFO = 1614,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTUATOR_COMMON_ACTUATOR_NOT_FOUND = 1634,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRIGGER_NOT_FOUND = 1649,
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRIGGER_SINGLE_TIME_CHECK_FAIL = 1650,
|
||||||
|
} E_DjiErrorWaypoint3ModuleRawCode;
|
||||||
|
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
/**
|
/**
|
||||||
* @brief DJI error code complete works. Users can search all error messages here.
|
* @brief DJI error code complete works. Users can search all error messages here.
|
||||||
@ -1016,6 +1248,120 @@ enum DjiErrorCode {
|
|||||||
DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_PAYLOAD_RESV = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V2, DJI_ERROR_WAYPOINT_V2_MODULE_RAW_CODE_ACTUATOR_PAYLOAD_RESV),
|
DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_PAYLOAD_RESV = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V2, DJI_ERROR_WAYPOINT_V2_MODULE_RAW_CODE_ACTUATOR_PAYLOAD_RESV),
|
||||||
DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_PAYLOAD_FAIL_TO_SEND_CMD_TO_PAYLOAD = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V2, DJI_ERROR_WAYPOINT_V2_MODULE_RAW_CODE_ACTUATOR_PAYLOAD_FAIL_TO_SEND_CMD_TO_PAYLOAD),
|
DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_PAYLOAD_FAIL_TO_SEND_CMD_TO_PAYLOAD = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V2, DJI_ERROR_WAYPOINT_V2_MODULE_RAW_CODE_ACTUATOR_PAYLOAD_FAIL_TO_SEND_CMD_TO_PAYLOAD),
|
||||||
DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_PAYLOAD_EXEC_FAILED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V2, DJI_ERROR_WAYPOINT_V2_MODULE_RAW_CODE_ACTUATOR_PAYLOAD_EXEC_FAILED),
|
DJI_ERROR_WAYPOINT_V2_MODULE_CODE_ACTUATOR_PAYLOAD_EXEC_FAILED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V2, DJI_ERROR_WAYPOINT_V2_MODULE_RAW_CODE_ACTUATOR_PAYLOAD_EXEC_FAILED),
|
||||||
|
|
||||||
|
/* Waypoint v3 total errors */
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_COMMON_SUCCESS = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_SUCCESS),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_MISSION_ID_NOT_EXIST = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_MISSION_ID_NOT_EXIST),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_WAYLINE_INFO_ERROR = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_WAYLINE_INFO_ERROR),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_WPMZ_FILE_VERSION_NOT_MATCH = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_WPMZ_FILE_VERSION_NOT_MATCH),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_WPMZ_FILE_LOAD_ERROR = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_WPMZ_FILE_LOAD_ERROR),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_NO_BREAK_INFO = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_NO_BREAK_INFO),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CMD_INVALID = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CMD_INVALID),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_START_WAYLINE_WHEN_WAYLINE_RUNNING = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_START_WAYLINE_WHEN_WAYLINE_RUNNING),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_BREAK_WAYLINE_IN_CUR_STATE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_BREAK_WAYLINE_IN_CUR_STATE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_STOP_WAYLINE_WHEN_WAYLINE_NOT_RUNNING = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_STOP_WAYLINE_WHEN_WAYLINE_NOT_RUNNING),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_BREAK_WAYLINE_WHEN_WAYLINE_NOT_RUNNING = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_BREAK_WAYLINE_WHEN_WAYLINE_NOT_RUNNING),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_REQUEST_DRONE_CONTROL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_REQUEST_DRONE_CONTROL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_RESUME_WAYLINE_IN_CUR_STATE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_RESUME_WAYLINE_IN_CUR_STATE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_HEIGHT_LIMIT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_HEIGHT_LIMIT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RADIUS_LIMIT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RADIUS_LIMIT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CROSS_FLYLIMIT_AERA = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CROSS_FLYLIMIT_AERA),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_LOW_LIMIT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_LOW_LIMIT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_OBSTACAL_STOP = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_OBSTACAL_STOP),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RTK_DISCONNECT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RTK_DISCONNECT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_BOUNDARY_LIMIT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_BOUNDARY_LIMIT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RC_PITCH_ROLL_BREAK = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RC_PITCH_ROLL_BREAK),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_AIRPORT_HEIGHT_LIMIT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_AIRPORT_HEIGHT_LIMIT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_REQUEST_TAKEOFF_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_REQUEST_TAKEOFF_FAIL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_AUTOTAKEOFF_RUN_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_AUTOTAKEOFF_RUN_FAIL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_REQUEST_WAYLINE_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_REQUEST_WAYLINE_FAIL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_AGRO_PLAN_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_AGRO_PLAN_FAIL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_REQUEST_QUICK_TAKEOFF_ASSIST_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_REQUEST_QUICK_TAKEOFF_ASSIST_FAIL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_QUICK_TAKEOFF_ASSIST_RUN_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_QUICK_TAKEOFF_ASSIST_RUN_FAIL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_VFENCE_LIMIT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_VFENCE_LIMIT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_GPS_INVALID = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_GPS_INVALID),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_START_AT_CURRENT_RC_MODE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_START_AT_CURRENT_RC_MODE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_HOME_POINT_NOT_RECORDED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_HOME_POINT_NOT_RECORDED),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_LOWER_BATTERY = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_LOWER_BATTERY),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RETURN_HOME = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RETURN_HOME),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ADSB_ERROR = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ADSB_ERROR),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RC_LOST = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RC_LOST),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RTK_NOT_READY = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RTK_NOT_READY),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_DRONE_IS_MOVING = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_DRONE_IS_MOVING),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_DRONE_ON_GROUND_MOTOR_ON = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_DRONE_ON_GROUND_MOTOR_ON),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_SURFACE_FOLLOW_CAMERA_INVALID = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_SURFACE_FOLLOW_CAMERA_INVALID),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_SURFACE_FOLLOW_HEIGHT_INVALID = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_SURFACE_FOLLOW_HEIGHT_INVALID),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_SURFACE_FOLLOW_MAP_WRONG = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_SURFACE_FOLLOW_MAP_WRONG),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_HOMEPOINT_NOT_MATCH_RTK = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_HOMEPOINT_NOT_MATCH_RTK),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_STRONG_WIND_GOHOME = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_STRONG_WIND_GOHOME),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_DRONE_CRITICAL_ERROR = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_DRONE_CRITICAL_ERROR),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_CANNOT_FIND_PAYLOAD = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_CANNOT_FIND_PAYLOAD),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_EXECUTION_FAILED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_EXECUTION_FAILED),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_FARM_NO_PESTICIDE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_FARM_NO_PESTICIDE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_RADAR_DISCONNECT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_RADAR_DISCONNECT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_EXIT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_EXIT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_BREAK = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_BREAK),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_SET_GOHOME = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_SET_GOHOME),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_AGRO_PLANNER_STATE_CHANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_AGRO_PLANNER_STATE_CHANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_USER_SWITCH_RC_MODE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_USER_SWITCH_RC_MODE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INIT_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INIT_FAIL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_JOB_EXIT_BUT_MIS_RUNNING = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_JOB_EXIT_BUT_MIS_RUNNING),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_ON_GROUND_MOTOR_ON_CANNOT_GO = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_ON_GROUND_MOTOR_ON_CANNOT_GO),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_START_INDEX_OR_PROG = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_START_INDEX_OR_PROG),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_CSYS_MODE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_CSYS_MODE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_HEIGHT_MODE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_HEIGHT_MODE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_FLY_WP_MODE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_FLY_WP_MODE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_YAW_MODE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_YAW_MODE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_TURN_DIR_MODE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_TURN_DIR_MODE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_WP_TYPE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_WP_TYPE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_FIR_LAS_WP_TYPE_ERROR = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_FIR_LAS_WP_TYPE_ERROR),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_GLOB_VEL_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_GLOB_VEL_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_NUM_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_NUM_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_LAT_LONG_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_LAT_LONG_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_DAMP_DIS_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_DAMP_DIS_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_MAX_VEL_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_MAX_VEL_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_VEL_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_VEL_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_YAW_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_YAW_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_YAW_MODE_IN_VERT_SEGM = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_YAW_MODE_IN_VERT_SEGM),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_BREAK_INFO_MISSION_ID_CHANGED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_BREAK_INFO_MISSION_ID_CHANGED),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_BREAK_INFO_PROGRESS_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_BREAK_INFO_PROGRESS_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_BREAK_INFO_INVALID_MISSION_STATE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_BREAK_INFO_INVALID_MISSION_STATE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_WP_BREAK_INFO_WP_INDEX_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_WP_BREAK_INFO_WP_INDEX_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_BREAK_LAT_LONG_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_BREAK_LAT_LONG_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_BREAK_INFO_WP_YAW_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_BREAK_INFO_WP_YAW_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_INVALID_BREAK_INFO_FLAG = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_INVALID_BREAK_INFO_FLAG),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_GET_TRAJ_INFO_FAILED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_GET_TRAJ_INFO_FAILED),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_GENERATE_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_GENERATE_FAIL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_LIB_RUN_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_LIB_RUN_FAIL),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRAJ_LIB_EMERGENCY_BRAKE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRAJ_LIB_EMERGENCY_BRAKE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_NOT_FOUND = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_NOT_FOUND),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_INDEX_REPEATED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_INDEX_REPEATED),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_INFO_SIZE_TOO_LONG_OR_TOO_SHORT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_INFO_SIZE_TOO_LONG_OR_TOO_SHORT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_EMPTY = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_EMPTY),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_LAYER_EMPTY = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_LAYER_EMPTY),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_ID_REPEATED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_ID_REPEATED),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_NODE_CHILDREN_NUM_LT_2 = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_NODE_CHILDREN_NUM_LT_2),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_INDEX_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_INDEX_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_ID_IS_65535 = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_ID_IS_65535),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_NODE_CHILDNUM_SUM_NOT_EQ_NEXT_LAYER_SIZE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_NODE_CHILDNUM_SUM_NOT_EQ_NEXT_LAYER_SIZE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_LAYER_NUM_TOO_MORE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_LAYER_NUM_TOO_MORE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_LAYER_NUM_TOO_LESS = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_LAYER_NUM_TOO_LESS),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_GROUP_NUM_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_GROUP_NUM_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_GROUP_VALID_RANGE_ERROR = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_GROUP_VALID_RANGE_ERROR),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_ROOT_STATUS_INVALID = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_ROOT_STATUS_INVALID),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_TREE_NODE_STATUS_INVALID = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_TREE_NODE_STATUS_INVALID),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_ACTION_GROUP_ID_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_ACTION_GROUP_ID_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_STATUS_TREE_SIZE_ERROR = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_STATUS_TREE_SIZE_ERROR),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_TRIGGER_RUN_RESULT_INVALID = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_TRIGGER_RUN_RESULT_INVALID),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_ACTION_GROUP_ID_REPEATED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_ACTION_GROUP_ID_REPEATED),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_ACTION_LOCATION_REPEATED = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_ACTION_LOCATION_REPEATED),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_BREAK_INFO_ACTION_LOCATION_OUT_OF_RANGE = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_BREAK_INFO_ACTION_LOCATION_OUT_OF_RANGE),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_RESUME_ID_NOT_IN_BREAK_INFO = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_RESUME_ID_NOT_IN_BREAK_INFO),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_RESUME_INFO_MODIFY_ACTION_STATUS_FROM_NO_INTERRUPT_TO_INTERRUPT = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_RESUME_INFO_MODIFY_ACTION_STATUS_FROM_NO_INTERRUPT_TO_INTERRUPT),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTION_COMMON_ACTION_RESUME_FAIL_FOR_INVALID_RESUME_INFO = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTION_COMMON_ACTION_RESUME_FAIL_FOR_INVALID_RESUME_INFO),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_ACTUATOR_COMMON_ACTUATOR_NOT_FOUND = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_ACTUATOR_COMMON_ACTUATOR_NOT_FOUND),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRIGGER_NOT_FOUND = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRIGGER_NOT_FOUND),
|
||||||
|
DJI_ERROR_WAYPOINT_V3_MODULE_CODE_TRIGGER_SINGLE_TIME_CHECK_FAIL = DJI_ERROR_CODE(DJI_ERROR_MODULE_WAYPOINT_V3, DJI_ERROR_WAYPOINT_V3_MODULE_RAW_CODE_TRIGGER_SINGLE_TIME_CHECK_FAIL),
|
||||||
};
|
};
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
|
|||||||
@ -520,6 +520,12 @@ typedef enum {
|
|||||||
DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX2 = DJI_DATA_SUBSCRIPTION_TOPIC(DJI_DATA_SUBSCRIPTION_MODULE_FC,
|
DJI_FC_SUBSCRIPTION_TOPIC_BATTERY_SINGLE_INFO_INDEX2 = DJI_DATA_SUBSCRIPTION_TOPIC(DJI_DATA_SUBSCRIPTION_MODULE_FC,
|
||||||
47),
|
47),
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Please refer to ::T_DjiFcSubscriptionImuAttiNaviDataWithTimestamp for information about data structure.
|
||||||
|
* @datastruct \ref T_DjiFcSubscriptionImuAttiNaviDataWithTimestamp
|
||||||
|
*/
|
||||||
|
DJI_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP = DJI_DATA_SUBSCRIPTION_TOPIC(DJI_DATA_SUBSCRIPTION_MODULE_FC, 48),
|
||||||
|
|
||||||
/*! Total number of topics that can be subscribed. */
|
/*! Total number of topics that can be subscribed. */
|
||||||
DJI_FC_SUBSCRIPTION_TOPIC_TOTAL_NUMBER,
|
DJI_FC_SUBSCRIPTION_TOPIC_TOTAL_NUMBER,
|
||||||
} E_DjiFcSubscriptionTopic;
|
} E_DjiFcSubscriptionTopic;
|
||||||
@ -1165,6 +1171,27 @@ typedef struct GimbalThreeData {
|
|||||||
GimbalAnglesData anglesData[3];
|
GimbalAnglesData anglesData[3];
|
||||||
} T_DjiFcSubscriptionThreeGimbalData;
|
} T_DjiFcSubscriptionThreeGimbalData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Struct for the topic DJI_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP. Used in M300
|
||||||
|
*/
|
||||||
|
typedef struct ImuAttiNaviDataWithTimestamp {
|
||||||
|
uint16_t version;
|
||||||
|
uint16_t flag;
|
||||||
|
dji_f32_t pn_x;
|
||||||
|
dji_f32_t pn_y;
|
||||||
|
dji_f32_t pn_z;
|
||||||
|
dji_f32_t vn_x;
|
||||||
|
dji_f32_t vn_y;
|
||||||
|
dji_f32_t vn_z;
|
||||||
|
dji_f32_t an_x;
|
||||||
|
dji_f32_t an_y;
|
||||||
|
dji_f32_t an_z;
|
||||||
|
dji_f32_t q[4];
|
||||||
|
uint16_t resv;
|
||||||
|
uint16_t cnt;
|
||||||
|
uint32_t timestamp;
|
||||||
|
} T_DjiFcSubscriptionImuAttiNaviDataWithTimestamp;
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
|||||||
@ -260,21 +260,29 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
char serialNum[32];
|
char serialNum[32];
|
||||||
} T_DjiFlightControllerGeneralInfo;
|
} T_DjiFlightControllerGeneralInfo;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
dji_f64_t latitude; /*!< unit: rad */
|
||||||
|
dji_f64_t longitude; /*!< unit: rad */
|
||||||
|
uint16_t altitude;
|
||||||
|
} T_DjiFlightControllerRidInfo;
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* @brief Initialise flight controller module, and user should call this function
|
* @brief Initialise flight controller module, and user should call this function
|
||||||
* before using flight controller features.
|
* before using flight controller features.
|
||||||
|
* @param ridInfo: Use PSDK to control the aircraft, must report the correct RID information.
|
||||||
* @return Execution result.
|
* @return Execution result.
|
||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiFlightController_Init(void);
|
T_DjiReturnCode DjiFlightController_Init(T_DjiFlightControllerRidInfo ridInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DeInitialise flight controller module.
|
* @brief DeInitialise flight controller module.
|
||||||
* @return Execution result.
|
* @return Execution result.
|
||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiFlightController_Deinit(void);
|
T_DjiReturnCode DjiFlightController_DeInit(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable/Disable RTK position function.
|
* @brief Enable/Disable RTK position function.
|
||||||
@ -519,7 +527,7 @@ T_DjiReturnCode DjiFlightController_SetHomeLocationUsingCurrentAircraftLocation(
|
|||||||
* @brief Set go home altitude.
|
* @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
|
* @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.
|
* using current altitude. Otherwise, it will climb to setting of go home altitude ,and then execute go home action.
|
||||||
* Go home altitude setting is 20m ~ 500m.
|
* Go home altitude setting is 20m ~ 1500m.
|
||||||
* @param altitude: go home altitude, unit: meter
|
* @param altitude: go home altitude, unit: meter
|
||||||
* @return Execution result.
|
* @return Execution result.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -66,6 +66,12 @@ typedef enum {
|
|||||||
/*! Reset yaw axis and pitch axis of gimbal. Reset angle of yaw axis to sum of yaw axis angle of aircraft and fine tune
|
/*! 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. */
|
* angle of yaw axis of gimbal, and reset pitch axis angle to the fine tune angle. */
|
||||||
DJI_GIMBAL_RESET_MODE_PITCH_AND_YAW = 3,
|
DJI_GIMBAL_RESET_MODE_PITCH_AND_YAW = 3,
|
||||||
|
/*! Reset only pitch axis of gimbal. */
|
||||||
|
DJI_GIMBAL_RESET_MODE_PITCH_ONLY = 4,
|
||||||
|
/*! Reset only roll axis of gimbal. */
|
||||||
|
DJI_GIMBAL_RESET_MODE_ROLL_ONLY = 5,
|
||||||
|
/*! Reset only yaw axis of gimbal. */
|
||||||
|
DJI_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
|
/*! 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
|
* 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. */
|
* downward, sum of 90 degree and fine tune angle if upward. */
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
#define DJI_GIMBAL_MANAGER_H
|
#define DJI_GIMBAL_MANAGER_H
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include <dji_gimbal.h>
|
||||||
#include "dji_typedef.h"
|
#include "dji_typedef.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -73,9 +74,10 @@ T_DjiReturnCode DjiGimbalManager_SetMode(E_DjiMountPosition mountPosition, E_Dji
|
|||||||
/**
|
/**
|
||||||
* @brief Reset the pitch and yaw of the gimbal.
|
* @brief Reset the pitch and yaw of the gimbal.
|
||||||
* @param mountPosition: gimbal mount position, input limit see enum E_DjiMountPosition
|
* @param mountPosition: gimbal mount position, input limit see enum E_DjiMountPosition
|
||||||
|
* @param mode: Reset mode, input limit see enum E_DjiGimbalResetMode
|
||||||
* @return Execution result.
|
* @return Execution result.
|
||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiGimbalManager_Reset(E_DjiMountPosition mountPosition);
|
T_DjiReturnCode DjiGimbalManager_Reset(E_DjiMountPosition mountPosition, E_DjiGimbalResetMode resetMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Rotate the angle of the gimbal.
|
* @brief Rotate the angle of the gimbal.
|
||||||
@ -86,6 +88,46 @@ T_DjiReturnCode DjiGimbalManager_Reset(E_DjiMountPosition mountPosition);
|
|||||||
*/
|
*/
|
||||||
T_DjiReturnCode DjiGimbalManager_Rotate(E_DjiMountPosition mountPosition, T_DjiGimbalManagerRotation rotation);
|
T_DjiReturnCode DjiGimbalManager_Rotate(E_DjiMountPosition mountPosition, T_DjiGimbalManagerRotation rotation);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @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 mountPosition: gimbal mount position, input limit see enum E_DjiMountPosition
|
||||||
|
* @param enabledFlag: flag specified whether enable or disable extended pitch axis angle range.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiGimbalManager_SetPitchRangeExtensionEnabled(E_DjiMountPosition mountPosition, bool enabledFlag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set max speed percentage for gimbal controller.
|
||||||
|
* @param mountPosition: gimbal mount position, input limit see enum E_DjiMountPosition
|
||||||
|
* @param axis: axis to be set.
|
||||||
|
* @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.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiGimbalManager_SetControllerMaxSpeedPercentage(E_DjiMountPosition mountPosition, E_DjiGimbalAxis axis,
|
||||||
|
uint8_t maxSpeedPercentage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set smooth factor for gimbal controller, using to smooth control.
|
||||||
|
* @param mountPosition: gimbal mount position, input limit see enum E_DjiMountPosition
|
||||||
|
* @param axis: axis to be set.
|
||||||
|
* @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.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiGimbalManager_SetControllerSmoothFactor(E_DjiMountPosition mountPosition, E_DjiGimbalAxis 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_DjiMountPosition
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiGimbalManager_RestoreFactorySettings(E_DjiMountPosition mountPosition);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "dji_typedef.h"
|
#include "dji_typedef.h"
|
||||||
|
#include "dji_hms_customization.h"
|
||||||
|
#include "dji_hms_manager.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -37,113 +39,8 @@ extern "C" {
|
|||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
typedef enum {
|
|
||||||
DJI_HMS_ERROR_LEVEL_NONE = 0,
|
|
||||||
DJI_HMS_ERROR_LEVEL_HINT,
|
|
||||||
DJI_HMS_ERROR_LEVEL_WARN,
|
|
||||||
DJI_HMS_ERROR_LEVEL_CRITICAL,
|
|
||||||
DJI_HMS_ERROR_LEVEL_FATAL,
|
|
||||||
} E_DjiHmsErrorLevel;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint32_t errorCode;
|
|
||||||
uint8_t componentIndex;
|
|
||||||
uint8_t errorLevel;
|
|
||||||
} T_DjiHmsInfo;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
T_DjiHmsInfo *hmsInfo;
|
|
||||||
uint32_t hmsInfoNum;
|
|
||||||
} T_DjiHmsInfoTable;
|
|
||||||
|
|
||||||
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_DjiHmsFileBinaryArray;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint16_t binaryArrayCount; /*!< Binary array count. */
|
|
||||||
T_DjiHmsFileBinaryArray *fileBinaryArrayList; /*!< Pointer to binary array list */
|
|
||||||
} T_DjiHmsBinaryArrayConfig;
|
|
||||||
|
|
||||||
typedef T_DjiReturnCode (*DjiHmsInfoCallback)(T_DjiHmsInfoTable hmsInfoTable);
|
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
/**
|
|
||||||
* @brief Initialise hms module, and user should call this function
|
|
||||||
* before using hms features.
|
|
||||||
* @return Execution result.
|
|
||||||
*/
|
|
||||||
T_DjiReturnCode DjiHms_Init(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Deinitialise hms module.
|
|
||||||
* @return Execution result.
|
|
||||||
*/
|
|
||||||
T_DjiReturnCode DjiHms_DeInit(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Register callback to get hms info.
|
|
||||||
* @note: Data is pushed with a frequency of 1Hz.
|
|
||||||
* @param callback: see reference of DjiHmsInfoCallback.
|
|
||||||
* @return Execution result.
|
|
||||||
*/
|
|
||||||
T_DjiReturnCode DjiHms_RegHmsInfoCallback(DjiHmsInfoCallback callback);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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_DjiHmsErrorLevel.
|
|
||||||
* @return Execution result.
|
|
||||||
*/
|
|
||||||
T_DjiReturnCode DjiHms_InjectHmsErrorCode(uint32_t errorCode, E_DjiHmsErrorLevel 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_DjiReturnCode DjiHms_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_DjiReturnCode DjiHms_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_DjiReturnCode DjiHms_RegHmsTextConfigByDirPath(E_DjiMobileAppLanguage 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 DjiHms_RegDefaultHmsTextConfigByBinaryArray set hms text configuration. When the language is not cover in
|
|
||||||
* your setting by DjiHms_RegHmsTextConfigByBinaryArray, the hms text configuration uses setting by this function.
|
|
||||||
* @param binaryArrayConfig: the binary array config for hms text configuration.
|
|
||||||
* @return Execution result.
|
|
||||||
*/
|
|
||||||
T_DjiReturnCode DjiHms_RegDefaultHmsTextConfigByBinaryArray(const T_DjiHmsBinaryArrayConfig *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_DjiReturnCode DjiHms_RegHmsTextConfigByBinaryArray(E_DjiMobileAppLanguage appLanguage,
|
|
||||||
const T_DjiHmsBinaryArrayConfig *binaryArrayConfig);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
133
psdk_lib/include/dji_hms_customization.h
Normal file
133
psdk_lib/include/dji_hms_customization.h
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file dji_hms_customization.h
|
||||||
|
* @brief This is the header file for "dji_hms_customization.c", defining the structure and
|
||||||
|
* (exported) function prototypes.
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI 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 DJI_HMS_CUSTOMIZATION_H
|
||||||
|
#define DJI_HMS_CUSTOMIZATION_H
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
typedef enum {
|
||||||
|
DJI_HMS_ERROR_LEVEL_NONE = 0,
|
||||||
|
DJI_HMS_ERROR_LEVEL_HINT,
|
||||||
|
DJI_HMS_ERROR_LEVEL_WARN,
|
||||||
|
DJI_HMS_ERROR_LEVEL_CRITICAL,
|
||||||
|
DJI_HMS_ERROR_LEVEL_FATAL,
|
||||||
|
} E_DjiHmsErrorLevel;
|
||||||
|
|
||||||
|
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_DjiHmsFileBinaryArray;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_t binaryArrayCount; /*!< Binary array count. */
|
||||||
|
T_DjiHmsFileBinaryArray *fileBinaryArrayList; /*!< Pointer to binary array list */
|
||||||
|
} T_DjiHmsBinaryArrayConfig;
|
||||||
|
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief Initialise hms customization module, and user should call this function
|
||||||
|
* before using hms customization features.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiHmsCustomization_Init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DeInitialize hms manager module.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiHmsCustomization_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_DjiHmsErrorLevel.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiHmsCustomization_InjectHmsErrorCode(uint32_t errorCode, E_DjiHmsErrorLevel 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_DjiReturnCode DjiHmsCustomization_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_DjiReturnCode DjiHmsCustomization_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_DjiReturnCode DjiHmsCustomization_RegHmsTextConfigByDirPath(E_DjiMobileAppLanguage 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 DjiHms_RegDefaultHmsTextConfigByBinaryArray set hms text configuration. When the language is not cover in
|
||||||
|
* your setting by DjiHms_RegHmsTextConfigByBinaryArray, the hms text configuration uses setting by this function.
|
||||||
|
* @param binaryArrayConfig: the binary array config for hms text configuration.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiHmsCustomization_RegDefaultHmsTextConfigByBinaryArray(const T_DjiHmsBinaryArrayConfig
|
||||||
|
*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_DjiReturnCode DjiHmsCustomization_RegHmsTextConfigByBinaryArray(E_DjiMobileAppLanguage appLanguage,
|
||||||
|
const T_DjiHmsBinaryArrayConfig *binaryArrayConfig);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // DJI_HMS_CUSTOMIZATION_H
|
||||||
|
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||||
@ -43,7 +43,9 @@ typedef struct {
|
|||||||
const char *flyAlarmInfo; /*! alarm information when the flight is in the air*/
|
const char *flyAlarmInfo; /*! alarm information when the flight is in the air*/
|
||||||
} T_DjiHmsErrCodeInfo;
|
} T_DjiHmsErrCodeInfo;
|
||||||
|
|
||||||
/*! HMS's error code table*/
|
/*! Note: This api header file will not be maintained in the future, please refer to the latest hms error code file in
|
||||||
|
* the hms sample.
|
||||||
|
*/
|
||||||
const T_DjiHmsErrCodeInfo hmsErrCodeInfoTbl[] = {
|
const T_DjiHmsErrCodeInfo hmsErrCodeInfoTbl[] = {
|
||||||
{0x16070035, "Aircraft D-RTK antenna error. Fly with caution", ""},
|
{0x16070035, "Aircraft D-RTK antenna error. Fly with caution", ""},
|
||||||
{0x16070034, "RTK flight heading inconsistent with other sources. Fly with caution", ""},
|
{0x16070034, "RTK flight heading inconsistent with other sources. Fly with caution", ""},
|
||||||
|
|||||||
80
psdk_lib/include/dji_hms_manager.h
Normal file
80
psdk_lib/include/dji_hms_manager.h
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file dji_hms_manager.h
|
||||||
|
* @brief This is the header file for "dji_hms_manager.c", defining the structure and
|
||||||
|
* (exported) function prototypes.
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI 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 DJI_HMS_MANAGER_H
|
||||||
|
#define DJI_HMS_MANAGER_H
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "dji_typedef.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
typedef struct {
|
||||||
|
uint32_t errorCode;
|
||||||
|
uint8_t componentIndex;
|
||||||
|
uint8_t errorLevel;
|
||||||
|
} T_DjiHmsInfo;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
T_DjiHmsInfo *hmsInfo;
|
||||||
|
uint32_t hmsInfoNum;
|
||||||
|
} T_DjiHmsInfoTable;
|
||||||
|
|
||||||
|
typedef T_DjiReturnCode (*DjiHmsInfoCallback)(T_DjiHmsInfoTable hmsInfoTable);
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief Initialise hms manager module, and user should call this function
|
||||||
|
* before using hms manager features.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiHmsManager_Init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DeInitialize hms manager module.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiHmsManager_DeInit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Register callback to get hms info.
|
||||||
|
* @note: Data is pushed with a frequency of 1Hz.
|
||||||
|
* @param callback: see reference of DjiHmsInfoCallback.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiHmsManager_RegHmsInfoCallback(DjiHmsInfoCallback callback);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // DJI_HMS_MANAGER_H
|
||||||
|
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||||
74
psdk_lib/include/dji_interest_point.h
Normal file
74
psdk_lib/include/dji_interest_point.h
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file dji_interest_point.h
|
||||||
|
* @version V1.0.0
|
||||||
|
* @date 2020/11/19
|
||||||
|
* @brief This is the header file for "dji_interest_point.c", defining the structure and
|
||||||
|
* (exported) function prototypes.
|
||||||
|
*
|
||||||
|
* @copyright (c) 2021 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI 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 DJI_INTEREST_POINT_H
|
||||||
|
#define DJI_INTEREST_POINT_H
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "dji_platform.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
typedef struct {
|
||||||
|
dji_f32_t curSpeed;
|
||||||
|
dji_f32_t radius;
|
||||||
|
uint8_t state;
|
||||||
|
} T_DjiInterestPointMissionState;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
dji_f64_t latitude;
|
||||||
|
dji_f64_t longitude;
|
||||||
|
dji_f32_t speed;
|
||||||
|
} T_DjiInterestPointSettings;
|
||||||
|
|
||||||
|
typedef T_DjiReturnCode (*InterestPointMissionStateCallback)(T_DjiInterestPointMissionState missionState);
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
T_DjiReturnCode DjiInterestPoint_Init(void);
|
||||||
|
|
||||||
|
T_DjiReturnCode DjiInterestPoint_DeInit(void);
|
||||||
|
|
||||||
|
T_DjiReturnCode DjiInterestPoint_Start(T_DjiInterestPointSettings settings);
|
||||||
|
|
||||||
|
T_DjiReturnCode DjiInterestPoint_Stop(void);
|
||||||
|
|
||||||
|
T_DjiReturnCode DjiInterestPoint_SetSpeed(dji_f32_t speed);
|
||||||
|
|
||||||
|
T_DjiReturnCode DjiInterestPoint_RegMissionStateCallback(InterestPointMissionStateCallback callback);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // DJI_INTEREST_POINT_H
|
||||||
|
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||||
@ -39,6 +39,14 @@ extern "C" {
|
|||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief Positioning rtcm data type.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
DJI_POSITIONING_RTCM_DATA_TYPE_RTK_ON_AIRCRAFT = 0,
|
||||||
|
DJI_POSITIONING_RTCM_DATA_TYPE_RTK_BASE_STATION = 1,
|
||||||
|
} E_DjiPositioningRtcmDataType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Data structure that describes a positioning event.
|
* @brief Data structure that describes a positioning event.
|
||||||
*/
|
*/
|
||||||
@ -84,6 +92,15 @@ typedef struct {
|
|||||||
T_DjiPositioningPositionStandardDeviation targetPointPositionStandardDeviation; /*!< Specifies position standard deviation of target points. */
|
T_DjiPositioningPositionStandardDeviation targetPointPositionStandardDeviation; /*!< Specifies position standard deviation of target points. */
|
||||||
} T_DjiPositioningPositionInfo;
|
} T_DjiPositioningPositionInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Prototype of callback function used to receive the rtk rtcm raw data.
|
||||||
|
* @param index: the index of rtcm data package.
|
||||||
|
* @param data: pointer to receive rtk rtcm data from aircraft.
|
||||||
|
* @param dataLen: receive data length of rtcm data from aircraft.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
typedef T_DjiReturnCode (*DjiReceiveRtkRtcmDataCallback)(uint8_t index, const uint8_t *data, uint16_t dataLen);
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* @brief Initialise positioning module in blocking mode. User should call this function before all other positioning
|
* @brief Initialise positioning module in blocking mode. User should call this function before all other positioning
|
||||||
@ -128,6 +145,15 @@ void DjiPositioning_SetTaskIndex(uint8_t index);
|
|||||||
T_DjiReturnCode DjiPositioning_GetPositionInformationSync(uint8_t eventCount, T_DjiPositioningEventInfo *eventInfo,
|
T_DjiReturnCode DjiPositioning_GetPositionInformationSync(uint8_t eventCount, T_DjiPositioningEventInfo *eventInfo,
|
||||||
T_DjiPositioningPositionInfo *positionInfo);
|
T_DjiPositioningPositionInfo *positionInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Register callback function used to receive rtk rtcm raw data by data type.
|
||||||
|
* @note The callback function will be called after registering. The call frequency depends on the number of satellites.
|
||||||
|
* @param callback: pointer to the callback function.
|
||||||
|
* @return Execution result.
|
||||||
|
*/
|
||||||
|
T_DjiReturnCode DjiPositioning_RegReceiveRtcmDataCallback(E_DjiPositioningRtcmDataType dataType,
|
||||||
|
DjiReceiveRtkRtcmDataCallback callback);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -122,6 +122,7 @@ typedef enum {
|
|||||||
DJI_CAMERA_TYPE_H20N = 61, /*!< Camera type is H20N. */
|
DJI_CAMERA_TYPE_H20N = 61, /*!< Camera type is H20N. */
|
||||||
DJI_CAMERA_TYPE_P1 = 50, /*!< Camera type is P1. */
|
DJI_CAMERA_TYPE_P1 = 50, /*!< Camera type is P1. */
|
||||||
DJI_CAMERA_TYPE_L1, /*!< Camera type is L1. */
|
DJI_CAMERA_TYPE_L1, /*!< Camera type is L1. */
|
||||||
|
DJI_CAMERA_TYPE_L2, /*!< Camera type is L2. */
|
||||||
DJI_CAMERA_TYPE_M30, /*!< Camera type is M30. */
|
DJI_CAMERA_TYPE_M30, /*!< Camera type is M30. */
|
||||||
DJI_CAMERA_TYPE_M30T, /*!< Camera type is M30T. */
|
DJI_CAMERA_TYPE_M30T, /*!< Camera type is M30T. */
|
||||||
DJI_CAMERA_TYPE_M3E, /*!< Camera type is M3E. */
|
DJI_CAMERA_TYPE_M3E, /*!< Camera type is M3E. */
|
||||||
@ -136,6 +137,8 @@ typedef enum {
|
|||||||
DJI_CAMERA_FILE_TYPE_DNG = 1, /*!< Media file DNG type. */
|
DJI_CAMERA_FILE_TYPE_DNG = 1, /*!< Media file DNG type. */
|
||||||
DJI_CAMERA_FILE_TYPE_MOV = 2, /*!< Media file MOV type. */
|
DJI_CAMERA_FILE_TYPE_MOV = 2, /*!< Media file MOV type. */
|
||||||
DJI_CAMERA_FILE_TYPE_MP4 = 3, /*!< Media file MP4 type. */
|
DJI_CAMERA_FILE_TYPE_MP4 = 3, /*!< Media file MP4 type. */
|
||||||
|
DJI_CAMERA_FILE_TYPE_TIFF = 5, /*!< Media file TIFF type. */
|
||||||
|
DJI_CAMERA_FILE_TYPE_PCD = 24, /*!< Media file point cloud type. */
|
||||||
DJI_CAMERA_FILE_TYPE_UNKNOWN = 255, /*!< Media file unknown type. */
|
DJI_CAMERA_FILE_TYPE_UNKNOWN = 255, /*!< Media file unknown type. */
|
||||||
} E_DjiCameraMediaFileType;
|
} E_DjiCameraMediaFileType;
|
||||||
|
|
||||||
@ -228,6 +231,7 @@ typedef enum {
|
|||||||
DJI_CHANNEL_ADDRESS_EXTENSION_PORT,
|
DJI_CHANNEL_ADDRESS_EXTENSION_PORT,
|
||||||
DJI_CHANNEL_ADDRESS_MASTER_RC_APP,
|
DJI_CHANNEL_ADDRESS_MASTER_RC_APP,
|
||||||
DJI_CHANNEL_ADDRESS_SLAVE_RC_APP,
|
DJI_CHANNEL_ADDRESS_SLAVE_RC_APP,
|
||||||
|
DJI_CHANNEL_ADDRESS_CLOUD_API,
|
||||||
} E_DjiChannelAddress;
|
} E_DjiChannelAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -34,10 +34,10 @@ extern "C" {
|
|||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
#define DJI_VERSION_MAJOR 3 /*!< DJI SDK major version num, when have incompatible API changes. Range from 0 to 99. */
|
#define DJI_VERSION_MAJOR 3 /*!< DJI SDK major version num, when have incompatible API changes. Range from 0 to 99. */
|
||||||
#define DJI_VERSION_MINOR 5 /*!< DJI SDK minor version num, when add functionality in a backwards compatible manner changes. Range from 0 to 99. */
|
#define DJI_VERSION_MINOR 6 /*!< DJI SDK minor version num, when add functionality in a backwards compatible manner changes. Range from 0 to 99. */
|
||||||
#define DJI_VERSION_MODIFY 0 /*!< DJI SDK modify version num, when have backwards compatible bug fixes changes. Range from 0 to 99. */
|
#define DJI_VERSION_MODIFY 0 /*!< DJI SDK modify version num, when have backwards compatible bug fixes changes. Range from 0 to 99. */
|
||||||
#define DJI_VERSION_BETA 0 /*!< DJI SDK version beta info, release version will be 0, when beta version release changes. Range from 0 to 255. */
|
#define DJI_VERSION_BETA 0 /*!< DJI SDK version beta info, release version will be 0, when beta version release changes. Range from 0 to 255. */
|
||||||
#define DJI_VERSION_BUILD 1765 /*!< DJI SDK version build info, when jenkins trigger build changes. Range from 0 to 65535. */
|
#define DJI_VERSION_BUILD 1882 /*!< DJI SDK version build info, when jenkins trigger build changes. Range from 0 to 65535. */
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
@ -184,7 +184,7 @@ typedef enum {
|
|||||||
* using ``DJIWaypointV2_pointOfInterest`` setting point of interest coordiate and ``DJIWaypointV2_pointOfInterestAltitude``
|
* using ``DJIWaypointV2_pointOfInterest`` setting point of interest coordiate and ``DJIWaypointV2_pointOfInterestAltitude``
|
||||||
* setting point of interset altitute.
|
* setting point of interset altitute.
|
||||||
*/
|
*/
|
||||||
DJI_WAYPOINT_V2_HEADING_TOWARDS_POINT_OD_INTEREST,
|
DJI_WAYPOINT_V2_HEADING_TOWARDS_POINT_OF_INTEREST,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The aircraft's heading rotate simultaneously with its gimbal's yaw.
|
* The aircraft's heading rotate simultaneously with its gimbal's yaw.
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -54,6 +54,22 @@ static const char *s_cameraManagerSampleSelectList[] = {
|
|||||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY] = "Thermometry test |",
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY] = "Thermometry test |",
|
||||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO] = "Get lidar ranging info |",
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO] = "Get lidar ranging info |",
|
||||||
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM] = "Set ir camera zoom param |",
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM] = "Set ir camera zoom param |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_NIGHT_SCENE_MODE] = "Set night scene mode |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAPTURE_RECORDING_STREAMS] = "Set capture or recording streams storage type |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOW_STORAGE_INFO] = "Show storage info |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FORMAT_SD_CARD] = "Format SD card |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_LINK_ZOOM] = "Set synchronized split screen zoom |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_USER_CUSTOM_DIR_FILE_NAME] = "Set custom directory or file name of media file |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RESET_CAMERA_SETTINGS] = "Reset camera settings |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_AE_LOCK_MODE] = "Set AE lock mode |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_FOCUS_RING_VALUE] = "Set focus ring value |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_CONNECT_STATUS_TEST] = "Camera connect status test |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GET_PHOTO_VIDEO_PARAM] = "Set camera photo and video storage param |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_MODE] = "Set camera metering mode |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_POINT] = "Set and get camera metering point |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FFC_MODE_AND_TRRIGER] = "Set FFC mode and trriger a FFC |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GAIN_MODE] = "Set infrared camera gain mode |",
|
||||||
|
[E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_CAMERA_STATUS] = "Get camera status, capturing & recording status etc |",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
|||||||
@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"rc_lost_action": {
|
||||||
|
"desc_cn": "失控行为",
|
||||||
|
"desc_en": "rc lost action",
|
||||||
|
"desc_range": "go_home/hover/landing",
|
||||||
|
"value": "go_home"
|
||||||
|
},
|
||||||
|
"go_home_altitude": {
|
||||||
|
"desc_cn": "返航高度",
|
||||||
|
"desc_en": "go home altitude",
|
||||||
|
"desc_range": "0 - 1500",
|
||||||
|
"value": 60
|
||||||
|
},
|
||||||
|
"flying_speed": {
|
||||||
|
"desc_cn": "飞行速度",
|
||||||
|
"desc_en": "flying speed",
|
||||||
|
"desc_range": "0 - 10",
|
||||||
|
"value": 5.0
|
||||||
|
},
|
||||||
|
"home_point_latitude": {
|
||||||
|
"desc_cn": "home点纬度",
|
||||||
|
"desc_en": "home point latitude",
|
||||||
|
"desc_range": "-90 - 90",
|
||||||
|
"value": 22.5425
|
||||||
|
},
|
||||||
|
"home_point_longitude": {
|
||||||
|
"desc_cn": "home点经度",
|
||||||
|
"desc_en": "home point longitude",
|
||||||
|
"desc_range": "-180 - 180",
|
||||||
|
"value": 113.9575
|
||||||
|
},
|
||||||
|
"rtk_enable": {
|
||||||
|
"desc_cn": "RTK开关",
|
||||||
|
"desc_en": "RTK Enable",
|
||||||
|
"desc_range": "true/false",
|
||||||
|
"value": "false"
|
||||||
|
},
|
||||||
|
"HorizontalVisualObstacleAvoidanceEnable": {
|
||||||
|
"desc_cn": "水平视觉避障开关",
|
||||||
|
"desc_en": "Horizontal Visual Avoidance",
|
||||||
|
"desc_range": "true/false",
|
||||||
|
"value": "false"
|
||||||
|
},
|
||||||
|
"HorizontalRadarObstacleAvoidanceEnable": {
|
||||||
|
"desc_cn": "水平TOF避障开关",
|
||||||
|
"desc_en": "Horizontal TOF Avoidance",
|
||||||
|
"desc_range": "true/false",
|
||||||
|
"value": "false"
|
||||||
|
},
|
||||||
|
"UpwardsVisualObstacleAvoidanceEnable": {
|
||||||
|
"desc_cn": "上视觉避障开关",
|
||||||
|
"desc_en": "Upwards Visual Avoidance",
|
||||||
|
"desc_range": "true/false",
|
||||||
|
"value": "false"
|
||||||
|
},
|
||||||
|
"UpwardsRadarObstacleAvoidanceEnable": {
|
||||||
|
"desc_cn": "上TOF开关",
|
||||||
|
"desc_en": "Upwards TOF Avoidance",
|
||||||
|
"desc_range": "true/false",
|
||||||
|
"value": "false"
|
||||||
|
},
|
||||||
|
"DownwardsVisualObstacleAvoidanceEnable": {
|
||||||
|
"desc_cn": "下视觉避障开关",
|
||||||
|
"desc_en": "Downwards Visual Avoidance",
|
||||||
|
"desc_range": "true/false",
|
||||||
|
"value": "false"
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file test_flight_controller_command_flying.h
|
||||||
|
* @brief This is the header file for "test_flight_controller_command_flying.c", defining the structure and
|
||||||
|
* (exported) function prototypes.
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI 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 TEST_FLIGHT_CONTROLLER_COMMAND_FLYING_H
|
||||||
|
#define TEST_FLIGHT_CONTROLLER_COMMAND_FLYING_H
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
void DjiUser_RunFlightControllerCommandFlyingSample(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TEST_FLIGHT_CONTROLLER_COMMAND_FLYING_H
|
||||||
|
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file test_flight_controller_entry.cpp
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI reserves the right to pursue
|
||||||
|
* legal actions against you for any loss(es) or damage(s) caused by your
|
||||||
|
* failure to do so.
|
||||||
|
*
|
||||||
|
*********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include <iostream>
|
||||||
|
#include <flight_control/test_flight_control.h>
|
||||||
|
#include "test_flight_controller_entry.h"
|
||||||
|
#include "dji_logger.h"
|
||||||
|
#include "test_flight_controller_command_flying.h"
|
||||||
|
#include <waypoint_v2/test_waypoint_v2.h>
|
||||||
|
#include <waypoint_v3/test_waypoint_v3.h>
|
||||||
|
#include <interest_point/test_interest_point.h>
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private values -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions definition ---------------------------------------------*/
|
||||||
|
void DjiUser_RunFlightControllerSample(void)
|
||||||
|
{
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
char inputSelectSample;
|
||||||
|
|
||||||
|
start:
|
||||||
|
osalHandler->TaskSleepMs(100);
|
||||||
|
|
||||||
|
std::cout
|
||||||
|
<< "\n"
|
||||||
|
<< "| Available commands: |\n"
|
||||||
|
<< "| [0] Flight controller sample - control flying with keyboard |\n"
|
||||||
|
<< "| [1] Flight controller sample - take off landing |\n"
|
||||||
|
<< "| [2] Flight controller sample - take off position ctrl landing |\n"
|
||||||
|
<< "| [3] Flight controller sample - take off go home force landing |\n"
|
||||||
|
<< "| [4] Flight controller sample - take off velocity ctrl landing |\n"
|
||||||
|
<< "| [5] Flight controller sample - arrest flying |\n"
|
||||||
|
<< "| [6] Flight controller sample - set get parameters |\n"
|
||||||
|
<< "| [7] Waypoint 2.0 sample - run airline mission by settings (only support on M300 RTK) |\n"
|
||||||
|
<< "| [8] Waypoint 3.0 sample - run airline mission by kmz file (not support on M300 RTK) |\n"
|
||||||
|
<< "| [9] Interest point sample - run interest point mission by settings (only support on M3E/M3T) |\n"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
std::cin >> inputSelectSample;
|
||||||
|
switch (inputSelectSample) {
|
||||||
|
case '0':
|
||||||
|
DjiUser_RunFlightControllerCommandFlyingSample();
|
||||||
|
goto start;
|
||||||
|
case '1':
|
||||||
|
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_LANDING);
|
||||||
|
goto start;
|
||||||
|
case '2':
|
||||||
|
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_POSITION_CTRL_LANDING);
|
||||||
|
goto start;
|
||||||
|
case '3':
|
||||||
|
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_GO_HOME_FORCE_LANDING);
|
||||||
|
goto start;
|
||||||
|
case '4':
|
||||||
|
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_VELOCITY_CTRL_LANDING);
|
||||||
|
goto start;
|
||||||
|
case '5':
|
||||||
|
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_ARREST_FLYING);
|
||||||
|
goto start;
|
||||||
|
case '6':
|
||||||
|
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM);
|
||||||
|
goto start;
|
||||||
|
case '7':
|
||||||
|
DjiTest_WaypointV2RunSample();
|
||||||
|
break;
|
||||||
|
case '8':
|
||||||
|
DjiTest_WaypointV3RunSample();
|
||||||
|
break;
|
||||||
|
case '9':
|
||||||
|
DjiTest_InterestPointRunSample();
|
||||||
|
break;
|
||||||
|
case 'q':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
USER_LOG_ERROR("Input command is invalid");
|
||||||
|
goto start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private functions definition-----------------------------------------------*/
|
||||||
|
|
||||||
|
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file test_flight_controller_entry.h
|
||||||
|
* @brief This is the header file for "test_flight_controller_entry.c", defining the structure and
|
||||||
|
* (exported) function prototypes.
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI 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 TEST_FLIGHT_CONTROLLER_ENTRY_H
|
||||||
|
#define TEST_FLIGHT_CONTROLLER_ENTRY_H
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include <gimbal_manager/test_gimbal_manager.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
void DjiUser_RunFlightControllerSample(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TEST_FLIGHT_CONTROLLER_ENTRY_H
|
||||||
|
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||||
@ -29,7 +29,12 @@
|
|||||||
#include "test_gimbal_entry.hpp"
|
#include "test_gimbal_entry.hpp"
|
||||||
#include "dji_logger.h"
|
#include "dji_logger.h"
|
||||||
#include "utils/util_misc.h"
|
#include "utils/util_misc.h"
|
||||||
|
#include "dji_gimbal.h"
|
||||||
|
#include "dji_gimbal_manager.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "dji_aircraft_info.h"
|
||||||
|
#include "dji_fc_subscription.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
@ -37,6 +42,11 @@
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_ON_FREE_MODE,
|
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_ON_FREE_MODE,
|
||||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_ON_YAW_FOLLOW_MODE,
|
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_ON_YAW_FOLLOW_MODE,
|
||||||
|
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_PITCH_RANGE_EXTENSION_MODE,
|
||||||
|
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_CONTROLLER_MAX_SPEED_PERCENTAGE,
|
||||||
|
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_CONTROLLER_SMOOTH_FACTOR,
|
||||||
|
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_RESET_GIMBAL_SETTINGS,
|
||||||
|
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_BY_KEYBOARD,
|
||||||
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_QUIT,
|
E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_QUIT,
|
||||||
} E_DjiTestGimbalManagerSampleSelect;
|
} E_DjiTestGimbalManagerSampleSelect;
|
||||||
|
|
||||||
@ -46,6 +56,16 @@ static const char *s_gimbalManagerSampleList[] = {
|
|||||||
"| [0] Gimbal manager sample - Rotate gimbal on free mode |",
|
"| [0] Gimbal manager sample - Rotate gimbal on free mode |",
|
||||||
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_ON_YAW_FOLLOW_MODE] =
|
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_ON_YAW_FOLLOW_MODE] =
|
||||||
"| [1] Gimbal manager sample - Rotate gimbal on yaw follow mode |",
|
"| [1] Gimbal manager sample - Rotate gimbal on yaw follow mode |",
|
||||||
|
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_PITCH_RANGE_EXTENSION_MODE] =
|
||||||
|
"| [2] Gimbal manager sample - Set pitch range extension mode |",
|
||||||
|
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_CONTROLLER_MAX_SPEED_PERCENTAGE] =
|
||||||
|
"| [3] Gimbal manager sample - Set controller max speed percentage |",
|
||||||
|
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_SET_CONTROLLER_SMOOTH_FACTOR] =
|
||||||
|
"| [4] Gimbal manager sample - Set controller smooth factor |",
|
||||||
|
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_RESET_GIMBAL_SETTINGS] =
|
||||||
|
"| [5] Gimbal manager sample - Reset gimbal settings |",
|
||||||
|
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_ROTATE_GIMBAL_BY_KEYBOARD] =
|
||||||
|
"| [6] Gimbal manager sample - Rotate gimbal by keyboard input and read back value |",
|
||||||
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_QUIT] =
|
[E_DJI_TEST_GIMBAL_MANAGER_SAMPLE_SELECT_QUIT] =
|
||||||
"| [q] Gimbal manager sample - Quit |",
|
"| [q] Gimbal manager sample - Quit |",
|
||||||
};
|
};
|
||||||
@ -60,6 +80,7 @@ void DjiUser_RunGimbalManagerSample(void)
|
|||||||
char inputTestCase;
|
char inputTestCase;
|
||||||
char mountPosition;
|
char mountPosition;
|
||||||
E_DjiMountPosition gimbalMountPosition;
|
E_DjiMountPosition gimbalMountPosition;
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
|
||||||
start:
|
start:
|
||||||
osalHandler->TaskSleepMs(100);
|
osalHandler->TaskSleepMs(100);
|
||||||
@ -110,6 +131,297 @@ start:
|
|||||||
case '1':
|
case '1':
|
||||||
DjiTest_GimbalManagerRunSample(gimbalMountPosition, DJI_GIMBAL_MODE_YAW_FOLLOW);
|
DjiTest_GimbalManagerRunSample(gimbalMountPosition, DJI_GIMBAL_MODE_YAW_FOLLOW);
|
||||||
goto start;
|
goto start;
|
||||||
|
case '2': {
|
||||||
|
int32_t enableFlag;
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Input enable flag: ");
|
||||||
|
scanf("%d", &enableFlag);
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_Init();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_SetPitchRangeExtensionEnabled(gimbalMountPosition, (bool)enableFlag);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set gimbal's pitch range extension mode as %d successfully!", enableFlag);
|
||||||
|
|
||||||
|
goto start;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '3': {
|
||||||
|
int32_t percentage;
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Input max speed percentage of yaw axis: ");
|
||||||
|
scanf("%d", &percentage);
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_Init();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_SetControllerMaxSpeedPercentage(gimbalMountPosition, DJI_GIMBAL_AXIS_YAW, (uint8_t)percentage);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set yaw axis's max speed percentage to %d successfully!", percentage);
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Input max speed percentage of pitch axis: ");
|
||||||
|
scanf("%d", &percentage);
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_SetControllerMaxSpeedPercentage(gimbalMountPosition, DJI_GIMBAL_AXIS_PITCH, (uint8_t)percentage);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set pitch axis's max speed percentage to %d successfully!", percentage);
|
||||||
|
|
||||||
|
goto start;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '4': {
|
||||||
|
int32_t factor;
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Input yaw axis's smooth factor: ");
|
||||||
|
scanf("%d", &factor);
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_Init();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_SetControllerSmoothFactor(gimbalMountPosition, DJI_GIMBAL_AXIS_YAW, (uint8_t)factor);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set yaw axis smooth factor to %d successfully!", factor);
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Input pitch axis's smooth factor: ");
|
||||||
|
scanf("%d", &factor);
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_SetControllerSmoothFactor(gimbalMountPosition, DJI_GIMBAL_AXIS_PITCH, (uint8_t)factor);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set pitch axis smooth factor to %d successfully!", factor);
|
||||||
|
|
||||||
|
goto start;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '5': {
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_Init();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_RestoreFactorySettings(gimbalMountPosition);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Reset gimbal factory settings successfully!");
|
||||||
|
|
||||||
|
goto start;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '6': {
|
||||||
|
uint32_t gimbalMode;
|
||||||
|
uint32_t rotateMode;
|
||||||
|
dji_f32_t pitch, roll, yaw;
|
||||||
|
T_DjiGimbalManagerRotation rotation;
|
||||||
|
T_DjiAircraftInfoBaseInfo baseInfo;
|
||||||
|
E_DjiAircraftSeries aircraftSeries;
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_Init();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Init gimbal manager error, return code 0x%08X", returnCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiAircraftInfo_GetBaseInfo(&baseInfo);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed to get aircraft base info, return code 0x%08X", returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
aircraftSeries = baseInfo.aircraftSeries;
|
||||||
|
|
||||||
|
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M300 || aircraftSeries == DJI_AIRCRAFT_SERIES_M350) {
|
||||||
|
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("DjiFcSubscription_SubscribeTopic %d return %d",
|
||||||
|
DJI_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP, returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("DjiFcSubscription_SubscribeTopic %d return %d", DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION, returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M300 || aircraftSeries == DJI_AIRCRAFT_SERIES_M350) {
|
||||||
|
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("DjiFcSubscription_SubscribeTopic %d return %d", DJI_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA, returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Subscribe topic DJI_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA succefully.");
|
||||||
|
}
|
||||||
|
else if (aircraftSeries == DJI_AIRCRAFT_SERIES_M30 || aircraftSeries == DJI_AIRCRAFT_SERIES_M3) {
|
||||||
|
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("DjiFcSubscription_SubscribeTopic %d return %d", DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Subscribe topic DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES succefully.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
T_DjiFcSubscriptionQuaternion quat;
|
||||||
|
T_DjiFcSubscriptionThreeGimbalData threeGimbalData = {0};
|
||||||
|
T_DjiFcSubscriptionGimbalAngles gimbalAngles = {0};
|
||||||
|
T_DjiDataTimestamp timestamp = {0};
|
||||||
|
dji_f32_t nPitch, nRoll, nYaw;
|
||||||
|
dji_f32_t qPitch, qRoll, qYaw;
|
||||||
|
dji_f32_t yawOffset = 0;
|
||||||
|
T_DjiFcSubscriptionImuAttiNaviDataWithTimestamp naviData = {0};
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(5);
|
||||||
|
printf("gimbal mode: 0: free, 1: fpv, 2: yaw-follow, 3: exit sample\n");
|
||||||
|
printf("rotate mode: 0: rel, 1: abs\n");
|
||||||
|
printf("Input gimbal mode, rotate mode, p, r, y(range in 0 ~ 360 deg if in abs mode): ");
|
||||||
|
|
||||||
|
scanf("%d", &gimbalMode);
|
||||||
|
if (gimbalMode == 3) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
scanf("%d %f %f %f", &rotateMode, &pitch, &roll, &yaw);
|
||||||
|
|
||||||
|
printf("gimbale mode %d, rotate mode %d, p %f, r %f, y %f\n",
|
||||||
|
gimbalMode, rotateMode, pitch, roll, yaw);
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_SetMode(gimbalMountPosition, (E_DjiGimbalMode)gimbalMode);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("DjiGimbalManager_SetMode return 0x%08X", returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
rotation.rotationMode = (E_DjiGimbalRotationMode)rotateMode;
|
||||||
|
rotation.pitch = pitch;
|
||||||
|
rotation.roll = roll;
|
||||||
|
rotation.yaw = yaw;
|
||||||
|
rotation.time = 0.5;
|
||||||
|
|
||||||
|
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M300 || aircraftSeries == DJI_AIRCRAFT_SERIES_M350) {
|
||||||
|
osalHandler->TaskSleepMs(20);
|
||||||
|
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_IMU_ATTI_NAVI_DATA_WITH_TIMESTAMP,
|
||||||
|
(uint8_t *) &naviData,
|
||||||
|
sizeof(T_DjiFcSubscriptionImuAttiNaviDataWithTimestamp),
|
||||||
|
×tamp);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("returnCode = 0x%08X", returnCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
nYaw = (dji_f64_t) atan2f(2 * naviData.q[1] * naviData.q[2] + 2 * naviData.q[0] * naviData.q[3],
|
||||||
|
-2 * naviData.q[2] * naviData.q[2] - 2 * naviData.q[3] * naviData.q[3] + 1) * 57.3;
|
||||||
|
|
||||||
|
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION,
|
||||||
|
(uint8_t *) &quat,
|
||||||
|
sizeof(T_DjiFcSubscriptionQuaternion),
|
||||||
|
×tamp);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("DjiFcSubscription_GetLatestValueOfTopic return %x%08X", returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
qYaw = (dji_f64_t) atan2f(2 * quat.q1 * quat.q2 + 2 * quat.q0 * quat.q3,
|
||||||
|
-2 * quat.q2 * quat.q2 - 2 * quat.q3 * quat.q3 + 1) * 57.3;
|
||||||
|
|
||||||
|
|
||||||
|
yawOffset = nYaw - qYaw;
|
||||||
|
|
||||||
|
if (rotation.rotationMode == DJI_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE) {
|
||||||
|
rotation.yaw += yawOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiGimbalManager_Rotate(gimbalMountPosition, rotation);
|
||||||
|
if (returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_PITCH_REACH_POSITIVE_LIMIT ||
|
||||||
|
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_PITCH_REACH_NEGATIVE_LIMIT ||
|
||||||
|
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_ROLL_REACH_POSITIVE_LIMIT ||
|
||||||
|
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_ROLL_REACH_NEGATIVE_LIMIT ||
|
||||||
|
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_YAW_REACH_POSITIVE_LIMIT ||
|
||||||
|
returnCode == DJI_ERROR_GIMBAL_MODULE_CODE_YAW_REACH_NEGATIVE_LIMIT) {
|
||||||
|
USER_LOG_WARN("Reach limitation!");
|
||||||
|
}
|
||||||
|
else if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("DjiGimbalManager_Rotate return %x%08X", returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
|
||||||
|
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M300 || aircraftSeries == DJI_AIRCRAFT_SERIES_M350) {
|
||||||
|
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_THREE_GIMBAL_DATA,
|
||||||
|
(uint8_t *) &threeGimbalData,
|
||||||
|
sizeof(T_DjiFcSubscriptionThreeGimbalData),
|
||||||
|
×tamp);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("DjiFcSubscription_GetLatestValueOfTopic return %x%08X", returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (threeGimbalData.anglesData[0].yaw < 0) {
|
||||||
|
threeGimbalData.anglesData[0].yaw = 360 + threeGimbalData.anglesData[0].yaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("reab back gimbal's (p, r, y): p=%.4f r=%.4f y=%.4f",
|
||||||
|
threeGimbalData.anglesData[gimbalMountPosition - 1].pitch,
|
||||||
|
threeGimbalData.anglesData[gimbalMountPosition - 1].roll,
|
||||||
|
threeGimbalData.anglesData[gimbalMountPosition - 1].yaw);
|
||||||
|
}
|
||||||
|
else if (aircraftSeries == DJI_AIRCRAFT_SERIES_M30 || aircraftSeries == DJI_AIRCRAFT_SERIES_M3) {
|
||||||
|
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES,
|
||||||
|
(uint8_t *) &gimbalAngles,
|
||||||
|
sizeof(T_DjiFcSubscriptionGimbalAngles),
|
||||||
|
×tamp);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("DjiFcSubscription_GetLatestValueOfTopic return %x%08X", returnCode);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gimbalAngles.z < 0) {
|
||||||
|
gimbalAngles.z = 360 + gimbalAngles.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("read back gimbal's (p, r, y): p=%.4f r=%.4f y=%.4f",
|
||||||
|
gimbalAngles.x, gimbalAngles.y, gimbalAngles.z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'q':
|
case 'q':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -117,6 +429,15 @@ start:
|
|||||||
goto start;
|
goto start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
returnCode = DjiGimbalManager_Deinit();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Deinit gimbal manager error, return code 0x%08X", returnCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Gimbal sample end");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Private functions definition-----------------------------------------------*/
|
/* Private functions definition-----------------------------------------------*/
|
||||||
|
|||||||
@ -0,0 +1,82 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file hms_manager_entry.cpp
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI reserves the right to pursue
|
||||||
|
* legal actions against you for any loss(es) or damage(s) caused by your
|
||||||
|
* failure to do so.
|
||||||
|
*
|
||||||
|
*********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "hms_manager_entry.h"
|
||||||
|
#include "dji_platform.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include "dji_logger.h"
|
||||||
|
#include "hms/test_hms.h"
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private values -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions definition ---------------------------------------------*/
|
||||||
|
void DjiUser_RunHmsManagerSample(void)
|
||||||
|
{
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
char inputSelectSample;
|
||||||
|
|
||||||
|
start:
|
||||||
|
osalHandler->TaskSleepMs(100);
|
||||||
|
|
||||||
|
std::cout
|
||||||
|
<< "\n"
|
||||||
|
<< "| Available commands: |\n"
|
||||||
|
<< "| [0] Hms manager sample - Chinese language |\n"
|
||||||
|
<< "| [1] Hms manager sample - English language |\n"
|
||||||
|
<< "| [2] Hms manager sample - Japanese language |\n"
|
||||||
|
<< "| [3] Hms manager sample - French language |\n"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
std::cin >> inputSelectSample;
|
||||||
|
switch (inputSelectSample) {
|
||||||
|
case '0':
|
||||||
|
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_CHINESE);
|
||||||
|
goto start;
|
||||||
|
case '1':
|
||||||
|
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_ENGLISH);
|
||||||
|
goto start;
|
||||||
|
case '2':
|
||||||
|
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_JAPANESE);
|
||||||
|
goto start;
|
||||||
|
case '3':
|
||||||
|
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_FRENCH);
|
||||||
|
goto start;
|
||||||
|
case 'q':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
USER_LOG_ERROR("Input command is invalid");
|
||||||
|
goto start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private functions definition-----------------------------------------------*/
|
||||||
|
|
||||||
|
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file hms_manager_entry.h
|
||||||
|
* @brief This is the header file for "hms_manager_entry.c", defining the structure and
|
||||||
|
* (exported) function prototypes.
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI 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 HMS_MANAGER_ENTRY_H
|
||||||
|
#define HMS_MANAGER_ENTRY_H
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
void DjiUser_RunHmsManagerSample(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // HMS_MANAGER_ENTRY_H
|
||||||
|
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||||
@ -111,6 +111,11 @@ FIND_LIBRARY(FFMPEG_z_LIBRARY z
|
|||||||
/usr/lib
|
/usr/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(FFMPEG_swresample_LIBRARY swresample
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib
|
||||||
|
)
|
||||||
|
|
||||||
SET(FFMPEG_LIBRARIES)
|
SET(FFMPEG_LIBRARIES)
|
||||||
IF(FFMPEG_INCLUDE_DIR)
|
IF(FFMPEG_INCLUDE_DIR)
|
||||||
IF(FFMPEG_avformat_LIBRARY)
|
IF(FFMPEG_avformat_LIBRARY)
|
||||||
@ -120,7 +125,8 @@ IF(FFMPEG_INCLUDE_DIR)
|
|||||||
SET( FFMPEG_BASIC_LIBRARIES
|
SET( FFMPEG_BASIC_LIBRARIES
|
||||||
${FFMPEG_avcodec_LIBRARY}
|
${FFMPEG_avcodec_LIBRARY}
|
||||||
${FFMPEG_avformat_LIBRARY}
|
${FFMPEG_avformat_LIBRARY}
|
||||||
${FFMPEG_avutil_LIBRARY}
|
${FFMPEG_avutil_LIBRARY}
|
||||||
|
${FFMPEG_swresample_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
# swscale is always a part of newer ffmpeg distros
|
# swscale is always a part of newer ffmpeg distros
|
||||||
@ -178,4 +184,5 @@ MARK_AS_ADVANCED(
|
|||||||
FFMPEG_gsm_LIBRARY
|
FFMPEG_gsm_LIBRARY
|
||||||
FFMPEG_swscale_LIBRARY
|
FFMPEG_swscale_LIBRARY
|
||||||
FFMPEG_z_LIBRARY
|
FFMPEG_z_LIBRARY
|
||||||
|
FFMPEG_swresample_LIBRARY
|
||||||
)
|
)
|
||||||
|
|||||||
@ -31,6 +31,8 @@ file(GLOB_RECURSE MODULE_SAMPLE_SRC
|
|||||||
../../../module_sample/camera_manager/*.c*
|
../../../module_sample/camera_manager/*.c*
|
||||||
../../../module_sample/perception/*.c*
|
../../../module_sample/perception/*.c*
|
||||||
../../../module_sample/gimbal/*.c*
|
../../../module_sample/gimbal/*.c*
|
||||||
|
../../../module_sample/flight_controller/*.c*
|
||||||
|
../../../module_sample/hms_manager/*.c*
|
||||||
../../../../sample_c/module_sample/*.c
|
../../../../sample_c/module_sample/*.c
|
||||||
)
|
)
|
||||||
file(GLOB_RECURSE MODULE_COMMON_SRC ../common/*.c*)
|
file(GLOB_RECURSE MODULE_COMMON_SRC ../common/*.c*)
|
||||||
@ -72,9 +74,11 @@ if (OpenCV_FOUND)
|
|||||||
execute_process(COMMAND opencv_version OUTPUT_VARIABLE OPENCV_VERSION)
|
execute_process(COMMAND opencv_version OUTPUT_VARIABLE OPENCV_VERSION)
|
||||||
if (${OPENCV_VERSION} STRLESS "4.0.0")
|
if (${OPENCV_VERSION} STRLESS "4.0.0")
|
||||||
add_definitions(-DOPEN_CV_VERSION_3)
|
add_definitions(-DOPEN_CV_VERSION_3)
|
||||||
else()
|
|
||||||
|
else ()
|
||||||
add_definitions(-DOPEN_CV_VERSION_4)
|
add_definitions(-DOPEN_CV_VERSION_4)
|
||||||
endif()
|
|
||||||
|
endif ()
|
||||||
else ()
|
else ()
|
||||||
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
|
message(STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data")
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
#include <dji_aircraft_info.h>
|
#include <dji_aircraft_info.h>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include "dji_sdk_config.h"
|
#include "dji_sdk_config.h"
|
||||||
|
#include "dji_config_manager.h"
|
||||||
|
|
||||||
#include "../common/osal/osal.h"
|
#include "../common/osal/osal.h"
|
||||||
#include "../common/osal/osal_fs.h"
|
#include "../common/osal/osal_fs.h"
|
||||||
@ -52,6 +53,8 @@
|
|||||||
#define USER_UTIL_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
#define USER_UTIL_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
#define USER_UTIL_MAX(a, b) (((a) > (b)) ? (a) : (b))
|
#define USER_UTIL_MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
||||||
|
#define DJI_USE_SDK_CONFIG_BY_JSON (0)
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Private values -------------------------------------------------------------*/
|
/* Private values -------------------------------------------------------------*/
|
||||||
@ -64,7 +67,7 @@ static void DjiUser_NormalExitHandler(int signalNum);
|
|||||||
/* Exported functions definition ---------------------------------------------*/
|
/* Exported functions definition ---------------------------------------------*/
|
||||||
Application::Application(int argc, char **argv)
|
Application::Application(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Application::DjiUser_SetupEnvironment();
|
Application::DjiUser_SetupEnvironment(argc, argv);
|
||||||
Application::DjiUser_ApplicationStart();
|
Application::DjiUser_ApplicationStart();
|
||||||
|
|
||||||
Osal_TaskSleepMs(3000);
|
Osal_TaskSleepMs(3000);
|
||||||
@ -74,7 +77,7 @@ Application::~Application()
|
|||||||
= default;
|
= default;
|
||||||
|
|
||||||
/* Private functions definition-----------------------------------------------*/
|
/* Private functions definition-----------------------------------------------*/
|
||||||
void Application::DjiUser_SetupEnvironment()
|
void Application::DjiUser_SetupEnvironment(int argc, char **argv)
|
||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
T_DjiOsalHandler osalHandler = {0};
|
T_DjiOsalHandler osalHandler = {0};
|
||||||
@ -83,8 +86,9 @@ void Application::DjiUser_SetupEnvironment()
|
|||||||
T_DjiLoggerConsole printConsole;
|
T_DjiLoggerConsole printConsole;
|
||||||
T_DjiLoggerConsole localRecordConsole;
|
T_DjiLoggerConsole localRecordConsole;
|
||||||
T_DjiFileSystemHandler fileSystemHandler = {0};
|
T_DjiFileSystemHandler fileSystemHandler = {0};
|
||||||
T_DjiSocketHandler socketHandler {0};
|
T_DjiSocketHandler socketHandler{0};
|
||||||
T_DjiHalNetworkHandler networkHandler = {0};
|
T_DjiHalNetworkHandler networkHandler = {0};
|
||||||
|
T_DjiUserLinkConfig linkConfig;
|
||||||
|
|
||||||
networkHandler.NetworkInit = HalNetWork_Init;
|
networkHandler.NetworkInit = HalNetWork_Init;
|
||||||
networkHandler.NetworkDeInit = HalNetWork_DeInit;
|
networkHandler.NetworkDeInit = HalNetWork_DeInit;
|
||||||
@ -163,6 +167,28 @@ void Application::DjiUser_SetupEnvironment()
|
|||||||
throw std::runtime_error("Register hal uart handler error.");
|
throw std::runtime_error("Register hal uart handler error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DJI_USE_SDK_CONFIG_BY_JSON
|
||||||
|
if (argc > 1) {
|
||||||
|
DjiUserConfigManager_LoadConfiguration(argv[1]);
|
||||||
|
} else {
|
||||||
|
DjiUserConfigManager_LoadConfiguration(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||||
|
if (linkConfig.type == DJI_USER_LINK_CONFIG_USE_UART_AND_NETWORK_DEVICE) {
|
||||||
|
returnCode = DjiPlatform_RegHalNetworkHandler(&networkHandler);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
throw std::runtime_error("Register hal network handler error");
|
||||||
|
}
|
||||||
|
} else if (linkConfig.type == DJI_USER_LINK_CONFIG_USE_UART_AND_USB_BULK_DEVICE) {
|
||||||
|
returnCode = DjiPlatform_RegHalUsbBulkHandler(&usbBulkHandler);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
throw std::runtime_error("Register hal usb bulk handler error.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/*!< Attention: Only use uart hardware connection. */
|
||||||
|
}
|
||||||
|
#else
|
||||||
#if (CONFIG_HARDWARE_CONNECTION == DJI_USE_UART_AND_USB_BULK_DEVICE)
|
#if (CONFIG_HARDWARE_CONNECTION == DJI_USE_UART_AND_USB_BULK_DEVICE)
|
||||||
returnCode = DjiPlatform_RegHalUsbBulkHandler(&usbBulkHandler);
|
returnCode = DjiPlatform_RegHalUsbBulkHandler(&usbBulkHandler);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -176,6 +202,7 @@ void Application::DjiUser_SetupEnvironment()
|
|||||||
#elif (CONFIG_HARDWARE_CONNECTION == DJI_USE_ONLY_UART)
|
#elif (CONFIG_HARDWARE_CONNECTION == DJI_USE_ONLY_UART)
|
||||||
/*!< Attention: Only use uart hardware connection.
|
/*!< Attention: Only use uart hardware connection.
|
||||||
*/
|
*/
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Attention: if you want to use camera stream view function, please uncomment it.
|
//Attention: if you want to use camera stream view function, please uncomment it.
|
||||||
@ -219,13 +246,18 @@ void Application::DjiUser_ApplicationStart()
|
|||||||
// attention: when the program is hand up ctrl-c will generate the coredump file
|
// attention: when the program is hand up ctrl-c will generate the coredump file
|
||||||
signal(SIGTERM, DjiUser_NormalExitHandler);
|
signal(SIGTERM, DjiUser_NormalExitHandler);
|
||||||
|
|
||||||
|
#if DJI_USE_SDK_CONFIG_BY_JSON
|
||||||
|
DjiUserConfigManager_GetAppInfo(&userInfo);
|
||||||
|
#else
|
||||||
returnCode = DjiUser_FillInUserInfo(&userInfo);
|
returnCode = DjiUser_FillInUserInfo(&userInfo);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
throw std::runtime_error("Fill user info error, please check user info config.");
|
throw std::runtime_error("Fill user info error, please check user info config.");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
returnCode = DjiCore_Init(&userInfo);
|
returnCode = DjiCore_Init(&userInfo);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
sleep(1);
|
||||||
throw std::runtime_error("Core init error.");
|
throw std::runtime_error("Core init error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public:
|
|||||||
~Application();
|
~Application();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void DjiUser_SetupEnvironment();
|
static void DjiUser_SetupEnvironment(int argc, char **argv);
|
||||||
static void DjiUser_ApplicationStart();
|
static void DjiUser_ApplicationStart();
|
||||||
static T_DjiReturnCode DjiUser_PrintConsole(const uint8_t *data, uint16_t dataLen);
|
static T_DjiReturnCode DjiUser_PrintConsole(const uint8_t *data, uint16_t dataLen);
|
||||||
static T_DjiReturnCode DjiUser_LocalWrite(const uint8_t *data, uint16_t dataLen);
|
static T_DjiReturnCode DjiUser_LocalWrite(const uint8_t *data, uint16_t dataLen);
|
||||||
|
|||||||
@ -0,0 +1,342 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file dji_config_manager.c
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI reserves the right to pursue
|
||||||
|
* legal actions against you for any loss(es) or damage(s) caused by your
|
||||||
|
* failure to do so.
|
||||||
|
*
|
||||||
|
*********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include <utils/util_misc.h>
|
||||||
|
#include <dji_logger.h>
|
||||||
|
#include <utils/util_file.h>
|
||||||
|
#include <dji_aircraft_info.h>
|
||||||
|
#include "dji_config_manager.h"
|
||||||
|
#include "utils/cJSON.h"
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private values -------------------------------------------------------------*/
|
||||||
|
static T_DjiUserInfo s_configManagerUserInfo = {0};
|
||||||
|
static T_DjiUserLinkConfig s_configManagerLinkInfo = {0};
|
||||||
|
static bool s_configManagerIsEnable = false;
|
||||||
|
|
||||||
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
|
static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_DjiUserInfo *userInfo);
|
||||||
|
static T_DjiReturnCode DjiUserConfigManager_GetLinkConfigInner(const char *path, T_DjiUserLinkConfig *linkConfig);
|
||||||
|
|
||||||
|
/* Exported functions definition ---------------------------------------------*/
|
||||||
|
T_DjiReturnCode DjiUserConfigManager_LoadConfiguration(const char *path)
|
||||||
|
{
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
char curFileDirPath[DJI_FILE_PATH_SIZE_MAX];
|
||||||
|
char tempFileDirPath[DJI_FILE_PATH_SIZE_MAX];
|
||||||
|
|
||||||
|
if (path == NULL) {
|
||||||
|
returnCode = DjiUserUtil_GetCurrentFileDirPath(__FILE__, DJI_FILE_PATH_SIZE_MAX,
|
||||||
|
curFileDirPath);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get file current path error, stat = 0x%08llX", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(tempFileDirPath, DJI_FILE_PATH_SIZE_MAX, "%s/dji_sdk_config.json",
|
||||||
|
curFileDirPath);
|
||||||
|
} else {
|
||||||
|
strcpy(tempFileDirPath, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Load configuration start.\r\n");
|
||||||
|
|
||||||
|
returnCode = DjiUserConfigManager_GetAppInfoInner(tempFileDirPath, &s_configManagerUserInfo);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
perror("Get app info failed.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiUserConfigManager_GetLinkConfigInner(tempFileDirPath, &s_configManagerLinkInfo);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
perror("Get link info failed.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\r\nLoad configuration successfully.\r\n");
|
||||||
|
|
||||||
|
s_configManagerIsEnable = true;
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DjiUserConfigManager_GetAppInfo(T_DjiUserInfo *userInfo)
|
||||||
|
{
|
||||||
|
memcpy(userInfo, &s_configManagerUserInfo, sizeof(T_DjiUserInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DjiUserConfigManager_GetLinkConfig(T_DjiUserLinkConfig *linkConfig)
|
||||||
|
{
|
||||||
|
memcpy(linkConfig, &s_configManagerLinkInfo, sizeof(T_DjiUserLinkConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DjiUserConfigManager_IsEnable(void)
|
||||||
|
{
|
||||||
|
return s_configManagerIsEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private functions definition-----------------------------------------------*/
|
||||||
|
static T_DjiReturnCode DjiUserConfigManager_GetAppInfoInner(const char *path, T_DjiUserInfo *userInfo)
|
||||||
|
{
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
uint32_t fileSize = 0;
|
||||||
|
uint32_t readRealSize = 0;
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
uint8_t *jsonData = NULL;
|
||||||
|
cJSON *jsonRoot = NULL;
|
||||||
|
cJSON *jsonItem = NULL;
|
||||||
|
cJSON *jsonValue = NULL;
|
||||||
|
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
returnCode = UtilFile_GetFileSizeByPath(path, &fileSize);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get file size by path failed, stat = 0x%08llX", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_DEBUG("Get config json file size is %d", fileSize);
|
||||||
|
|
||||||
|
jsonData = osalHandler->Malloc(fileSize + 1);
|
||||||
|
if (jsonData == NULL) {
|
||||||
|
USER_LOG_ERROR("Malloc failed.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilFile_GetFileDataByPath(path, 0, fileSize, jsonData, &readRealSize);
|
||||||
|
|
||||||
|
jsonData[readRealSize] = '\0';
|
||||||
|
|
||||||
|
jsonRoot = cJSON_Parse((char *) jsonData);
|
||||||
|
if (jsonRoot == NULL) {
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonItem = cJSON_GetObjectItem(jsonRoot, "dji_sdk_app_info");
|
||||||
|
if (jsonItem != NULL) {
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_name");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
strcpy(userInfo->appName, jsonValue->valuestring);
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_id");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
strcpy(userInfo->appId, jsonValue->valuestring);
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_key");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
strcpy(userInfo->appKey, jsonValue->valuestring);
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "user_app_license");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
strcpy(userInfo->appLicense, jsonValue->valuestring);
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "user_develop_account");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
strcpy(userInfo->developerAccount, jsonValue->valuestring);
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "user_baud_rate");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
strcpy(userInfo->baudRate, jsonValue->valuestring);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen(userInfo->appName) >= sizeof(userInfo->appName) ||
|
||||||
|
strlen(userInfo->appId) > sizeof(userInfo->appId) ||
|
||||||
|
strlen(userInfo->appKey) > sizeof(userInfo->appKey) ||
|
||||||
|
strlen(userInfo->appLicense) > sizeof(userInfo->appLicense) ||
|
||||||
|
strlen(userInfo->developerAccount) >= sizeof(userInfo->developerAccount) ||
|
||||||
|
strlen(userInfo->baudRate) > sizeof(userInfo->baudRate)) {
|
||||||
|
USER_LOG_ERROR("Length of user information string is beyond limit. Please check.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(userInfo->appName, "your_app_name") ||
|
||||||
|
!strcmp(userInfo->appId, "your_app_id") ||
|
||||||
|
!strcmp(userInfo->appKey, "your_app_key") ||
|
||||||
|
!strcmp(userInfo->appLicense, "your_app_license") ||
|
||||||
|
!strcmp(userInfo->developerAccount, "your_developer_account") ||
|
||||||
|
!strcmp(userInfo->baudRate, "your_baud_rate")) {
|
||||||
|
USER_LOG_ERROR(
|
||||||
|
"Please fill in correct user information to 'samples/sample_c++/platform/linux/manifold2/application/dji_sdk_config.json' file.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->Free(jsonData);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static T_DjiReturnCode DjiUserConfigManager_GetLinkConfigInner(const char *path, T_DjiUserLinkConfig *linkConfig)
|
||||||
|
{
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
uint32_t fileSize = 0;
|
||||||
|
uint32_t readRealSize = 0;
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
uint8_t *jsonData = NULL;
|
||||||
|
cJSON *jsonRoot = NULL;
|
||||||
|
cJSON *jsonItem = NULL;
|
||||||
|
cJSON *jsonValue = NULL;
|
||||||
|
cJSON *jsonConfig = NULL;
|
||||||
|
int32_t configValue;
|
||||||
|
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
|
||||||
|
returnCode = UtilFile_GetFileSizeByPath(path, &fileSize);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get file size by path failed, stat = 0x%08llX", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_DEBUG("Get config json file size is %d", fileSize);
|
||||||
|
|
||||||
|
jsonData = osalHandler->Malloc(fileSize + 1);
|
||||||
|
if (jsonData == NULL) {
|
||||||
|
USER_LOG_ERROR("Malloc failed.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilFile_GetFileDataByPath(path, 0, fileSize, jsonData, &readRealSize);
|
||||||
|
|
||||||
|
jsonData[readRealSize] = '\0';
|
||||||
|
|
||||||
|
jsonRoot = cJSON_Parse((char *) jsonData);
|
||||||
|
if (jsonRoot == NULL) {
|
||||||
|
goto jsonDataFree;
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonItem = cJSON_GetObjectItem(jsonRoot, "dji_sdk_link_config");
|
||||||
|
if (jsonItem != NULL) {
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "link_select");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
printf("\r\nSelect link type: %s\r\n", jsonValue->valuestring);
|
||||||
|
if (strcmp(jsonValue->valuestring, "use_only_uart") == 0) {
|
||||||
|
linkConfig->type = DJI_USER_LINK_CONFIG_USE_ONLY_UART;
|
||||||
|
} else if (strcmp(jsonValue->valuestring, "use_uart_and_network_device") == 0) {
|
||||||
|
linkConfig->type = DJI_USER_LINK_CONFIG_USE_UART_AND_NETWORK_DEVICE;
|
||||||
|
} else if (strcmp(jsonValue->valuestring, "use_uart_and_usb_bulk_device") == 0) {
|
||||||
|
linkConfig->type = DJI_USER_LINK_CONFIG_USE_UART_AND_USB_BULK_DEVICE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "uart_config");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "uart1_device_name");
|
||||||
|
printf("\r\nConfig uart1 device name: %s\r\n", jsonConfig->valuestring);
|
||||||
|
strcpy(linkConfig->uartConfig.uart1DeviceName, jsonConfig->valuestring);
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "uart2_device_name");
|
||||||
|
printf("Config uart2 device name: %s\r\n", jsonConfig->valuestring);
|
||||||
|
strcpy(linkConfig->uartConfig.uart2DeviceName, jsonConfig->valuestring);
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "uart2_device_enable");
|
||||||
|
printf("Config uart2 device enable: %s\r\n", jsonConfig->valuestring);
|
||||||
|
if (strcmp(jsonConfig->valuestring, "true") == 0) {
|
||||||
|
linkConfig->uartConfig.uart2DeviceEnable = true;
|
||||||
|
} else {
|
||||||
|
linkConfig->uartConfig.uart2DeviceEnable = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "network_config");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "network_device_name");
|
||||||
|
printf("\r\nConfig network device name: %s\r\n", jsonConfig->valuestring);
|
||||||
|
strcpy(linkConfig->networkConfig.networkDeviceName, jsonConfig->valuestring);
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "network_usb_adapter_vid");
|
||||||
|
printf("Config network usb adapter vid: %s\r\n", jsonConfig->valuestring);
|
||||||
|
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||||
|
linkConfig->networkConfig.networkUsbAdapterVid = configValue;
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "network_usb_adapter_pid");
|
||||||
|
printf("Config network usb adapter vid: %s\r\n", jsonConfig->valuestring);
|
||||||
|
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||||
|
linkConfig->networkConfig.networkUsbAdapterPid = configValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonValue = cJSON_GetObjectItem(jsonItem, "usb_bulk_config");
|
||||||
|
if (jsonValue != NULL) {
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_device_vid");
|
||||||
|
printf("\r\nConfig usb device vid: %s\r\n", jsonConfig->valuestring);
|
||||||
|
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||||
|
linkConfig->usbBulkConfig.usbDeviceVid = configValue;
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_device_pid");
|
||||||
|
printf("Config usb device pid: %s\r\n", jsonConfig->valuestring);
|
||||||
|
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||||
|
linkConfig->usbBulkConfig.usbDevicePid = configValue;
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_device_name");
|
||||||
|
printf("Config usb bulk1 device name: %s\r\n", jsonConfig->valuestring);
|
||||||
|
strcpy(linkConfig->usbBulkConfig.usbBulk1DeviceName, jsonConfig->valuestring);
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_interface_num");
|
||||||
|
printf("Config usb bulk1 interface num: %s\r\n", jsonConfig->valuestring);
|
||||||
|
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||||
|
linkConfig->usbBulkConfig.usbBulk1InterfaceNum = configValue;
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_endpoint_in");
|
||||||
|
printf("Config usb bulk1 endpoint in: %s\r\n", jsonConfig->valuestring);
|
||||||
|
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||||
|
linkConfig->usbBulkConfig.usbBulk1EndpointIn = configValue;
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk1_endpoint_out");
|
||||||
|
printf("Config usb bulk1 endpoint out: %s\r\n", jsonConfig->valuestring);
|
||||||
|
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||||
|
linkConfig->usbBulkConfig.usbBulk1EndpointOut = configValue;
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_device_name");
|
||||||
|
printf("Config usb bulk2 device name: %s\r\n", jsonConfig->valuestring);
|
||||||
|
strcpy(linkConfig->usbBulkConfig.usbBulk2DeviceName, jsonConfig->valuestring);
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_interface_num");
|
||||||
|
printf("Config usb bulk2 interface num: %s\r\n", jsonConfig->valuestring);
|
||||||
|
sscanf(jsonConfig->valuestring, "%X", &configValue);
|
||||||
|
linkConfig->usbBulkConfig.usbBulk2InterfaceNum = configValue;
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_endpoint_in");
|
||||||
|
printf("Config usb bulk2 endpoint in: %s\r\n", jsonConfig->valuestring);
|
||||||
|
linkConfig->usbBulkConfig.usbBulk2EndpointIn = configValue;
|
||||||
|
|
||||||
|
jsonConfig = cJSON_GetObjectItem(jsonValue, "usb_bulk2_endpoint_out");
|
||||||
|
printf("Config usb bulk2 endpoint out: %s\r\n", jsonConfig->valuestring);
|
||||||
|
linkConfig->usbBulkConfig.usbBulk2EndpointOut = configValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonDataFree:
|
||||||
|
osalHandler->Free(jsonData);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file dji_config_manager.h
|
||||||
|
* @brief This is the header file for "dji_config_manager.c", defining the structure and
|
||||||
|
* (exported) function prototypes.
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI 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 DJI_CONFIG_MANAGER_H
|
||||||
|
#define DJI_CONFIG_MANAGER_H
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "dji_platform.h"
|
||||||
|
#include "dji_core.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
#define USER_DEVICE_NAME_STR_MAX_SIZE (64)
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
typedef enum {
|
||||||
|
DJI_USER_LINK_CONFIG_USE_ONLY_UART,
|
||||||
|
DJI_USER_LINK_CONFIG_USE_UART_AND_NETWORK_DEVICE,
|
||||||
|
DJI_USER_LINK_CONFIG_USE_UART_AND_USB_BULK_DEVICE,
|
||||||
|
} E_DjiUserLinkConfigType;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
E_DjiUserLinkConfigType type;
|
||||||
|
struct {
|
||||||
|
char uart1DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
bool uart2DeviceEnable;
|
||||||
|
char uart2DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
} uartConfig;
|
||||||
|
struct {
|
||||||
|
char networkDeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
// M300/M350 RTK payload port no need
|
||||||
|
uint16_t networkUsbAdapterVid;
|
||||||
|
uint16_t networkUsbAdapterPid;
|
||||||
|
} networkConfig;
|
||||||
|
struct {
|
||||||
|
uint16_t usbDeviceVid;
|
||||||
|
uint16_t usbDevicePid;
|
||||||
|
|
||||||
|
char usbBulk1DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
uint8_t usbBulk1InterfaceNum;
|
||||||
|
uint8_t usbBulk1EndpointIn;
|
||||||
|
uint8_t usbBulk1EndpointOut;
|
||||||
|
|
||||||
|
char usbBulk2DeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
uint8_t usbBulk2InterfaceNum;
|
||||||
|
uint8_t usbBulk2EndpointIn;
|
||||||
|
uint8_t usbBulk2EndpointOut;
|
||||||
|
} usbBulkConfig;
|
||||||
|
} T_DjiUserLinkConfig;
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
T_DjiReturnCode DjiUserConfigManager_LoadConfiguration(const char *path);
|
||||||
|
void DjiUserConfigManager_GetAppInfo(T_DjiUserInfo *userInfo);
|
||||||
|
void DjiUserConfigManager_GetLinkConfig(T_DjiUserLinkConfig *linkConfig);
|
||||||
|
bool DjiUserConfigManager_IsEnable(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // DJI_CONFIG_MANAGER_H
|
||||||
|
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||||
@ -40,7 +40,7 @@ extern "C" {
|
|||||||
|
|
||||||
/*!< Attention: Select your hardware connection mode here.
|
/*!< Attention: Select your hardware connection mode here.
|
||||||
* */
|
* */
|
||||||
#define CONFIG_HARDWARE_CONNECTION DJI_USE_UART_AND_NETWORK_DEVICE
|
#define CONFIG_HARDWARE_CONNECTION DJI_USE_ONLY_UART
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"dji_sdk_app_info": {
|
||||||
|
"user_app_name": "PSDK_APPNAME",
|
||||||
|
"user_app_id": "53453",
|
||||||
|
"user_app_key": "871bf75511531682636f0db7243a9e7",
|
||||||
|
"user_app_license": "BO86stxOf200Sv9FMEZUSFCZhJhWxKG1jVYBACSnFvz42nnWEnc8vU+GKGHc/OUTxuFH+5TizymlZkuIxq6WAonqut3Y58KAcmTU6HHCVCW5HJSidwbNv0Gf3Gm+O7tc18lpHiSNRr/uEbSTJeVPkshOlcEEwpSc4tUUlRBb37BkUpZQFAPKaykyznLdxdYDlFh5OAqSl6kLltdt+A3/VOiZavKfsKHM7J9jbjsTDETe3fRRRiauE5K+s8yO6uAFLE0fwHWnanl7gPkzgNJJ53qVqnKiGwEtlim5E8WvnnaiEoxLOWrDijFOEmh9tLOU7Kx/oDEM2l9O/idaqmLxKA==",
|
||||||
|
"user_develop_account": "payloadsdk_account@163.com",
|
||||||
|
"user_baud_rate": "921600"
|
||||||
|
},
|
||||||
|
"dji_sdk_link_config": {
|
||||||
|
"link_available": "use_only_uart/use_uart_and_usb_bulk_device/use_uart_and_network_device",
|
||||||
|
"link_select": "use_uart_and_network_device",
|
||||||
|
"uart_config": {
|
||||||
|
"uart1_device_name": "/dev/ttyUSB0",
|
||||||
|
"uart2_device_enable": "true",
|
||||||
|
"uart2_device_name": "/dev/ttyACM0"
|
||||||
|
},
|
||||||
|
"network_config": {
|
||||||
|
"network_device_name": "enxf8e43b7bbc2c",
|
||||||
|
"network_usb_adapter_vid": "0x0B95",
|
||||||
|
"network_usb_adapter_pid": "0x1790"
|
||||||
|
},
|
||||||
|
"usb_bulk_config": {
|
||||||
|
"usb_device_vid": "0x0B95",
|
||||||
|
"usb_device_pid": "0x1790",
|
||||||
|
"usb_bulk1_device_name": "/dev/usb-ffs/bulk1",
|
||||||
|
"usb_bulk1_interface_num": "2",
|
||||||
|
"usb_bulk1_endpoint_in": "0x83",
|
||||||
|
"usb_bulk1_endpoint_out": "0x02",
|
||||||
|
"usb_bulk2_device_name": "/dev/usb-ffs/bulk2",
|
||||||
|
"usb_bulk2_interface_num": "3",
|
||||||
|
"usb_bulk2_endpoint_in": "0x84",
|
||||||
|
"usb_bulk2_endpoint_out": "0x03"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -27,9 +27,6 @@
|
|||||||
#include <perception/test_perception_entry.hpp>
|
#include <perception/test_perception_entry.hpp>
|
||||||
#include <flight_control/test_flight_control.h>
|
#include <flight_control/test_flight_control.h>
|
||||||
#include <gimbal/test_gimbal_entry.hpp>
|
#include <gimbal/test_gimbal_entry.hpp>
|
||||||
#include <hms/test_hms.h>
|
|
||||||
#include <waypoint_v2/test_waypoint_v2.h>
|
|
||||||
#include <waypoint_v3/test_waypoint_v3.h>
|
|
||||||
#include "application.hpp"
|
#include "application.hpp"
|
||||||
#include "fc_subscription/test_fc_subscription.h"
|
#include "fc_subscription/test_fc_subscription.h"
|
||||||
#include <gimbal_emu/test_payload_gimbal_emu.h>
|
#include <gimbal_emu/test_payload_gimbal_emu.h>
|
||||||
@ -40,7 +37,9 @@
|
|||||||
#include "widget/test_widget_speaker.h"
|
#include "widget/test_widget_speaker.h"
|
||||||
#include <power_management/test_power_management.h>
|
#include <power_management/test_power_management.h>
|
||||||
#include "data_transmission/test_data_transmission.h"
|
#include "data_transmission/test_data_transmission.h"
|
||||||
#include <camera_manager/test_camera_manager.h>
|
#include <flight_controller/test_flight_controller_entry.h>
|
||||||
|
#include <positioning/test_positioning.h>
|
||||||
|
#include <hms_manager/hms_manager_entry.h>
|
||||||
#include "camera_manager/test_camera_manager_entry.h"
|
#include "camera_manager/test_camera_manager_entry.h"
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
@ -67,16 +66,9 @@ start:
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "| Available commands: |\n"
|
<< "| Available commands: |\n"
|
||||||
<< "| [0] Fc subscribe sample - subscribe quaternion and gps data |\n"
|
<< "| [0] Fc subscribe sample - subscribe quaternion and gps data |\n"
|
||||||
<< "| [1] Flight controller sample - take off landing |\n"
|
<< "| [1] Flight controller sample - you can control flying by PSDK |\n"
|
||||||
<< "| [2] Flight controller sample - take off position ctrl landing |\n"
|
<< "| [2] Hms info manager sample - get health manger system info by language |\n"
|
||||||
<< "| [3] Flight controller sample - take off go home force landing |\n"
|
<< "| [a] Gimbal manager sample - you can control gimbal by PSDK |\n"
|
||||||
<< "| [4] Flight controller sample - take off velocity ctrl landing |\n"
|
|
||||||
<< "| [5] Flight controller sample - arrest flying |\n"
|
|
||||||
<< "| [6] Flight controller sample - set get parameters |\n"
|
|
||||||
<< "| [7] Hms info sample - get health manger system info |\n"
|
|
||||||
<< "| [8] Waypoint 2.0 sample - run airline mission by settings (only support on M300 RTK) |\n"
|
|
||||||
<< "| [9] Waypoint 3.0 sample - run airline mission by kmz file (not support on M300 RTK) |\n"
|
|
||||||
<< "| [a] Gimbal manager sample |\n"
|
|
||||||
<< "| [c] Camera stream view sample - display the camera video stream |\n"
|
<< "| [c] Camera stream view sample - display the camera video stream |\n"
|
||||||
<< "| [d] Stereo vision view sample - display the stereo image |\n"
|
<< "| [d] Stereo vision view sample - display the stereo image |\n"
|
||||||
<< "| [e] Start camera all features sample - you can operate the camera on DJI Pilot |\n"
|
<< "| [e] Start camera all features sample - you can operate the camera on DJI Pilot |\n"
|
||||||
@ -86,6 +78,7 @@ start:
|
|||||||
<< "| [i] Start power management sample - you will see notification when aircraft power off |\n"
|
<< "| [i] Start power management sample - you will see notification when aircraft power off |\n"
|
||||||
<< "| [j] Start data transmission sample - you can send or recv custom data on MSDK demo |\n"
|
<< "| [j] Start data transmission sample - you can send or recv custom data on MSDK demo |\n"
|
||||||
<< "| [k] Run camera manager sample - you can test camera's functions interactively |\n"
|
<< "| [k] Run camera manager sample - you can test camera's functions interactively |\n"
|
||||||
|
<< "| [l] Start rtk positioning sample - you can receive rtk rtcm data when rtk signal is ok |\n"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
std::cin >> inputChar;
|
std::cin >> inputChar;
|
||||||
@ -94,31 +87,10 @@ start:
|
|||||||
DjiTest_FcSubscriptionRunSample();
|
DjiTest_FcSubscriptionRunSample();
|
||||||
break;
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_LANDING);
|
DjiUser_RunFlightControllerSample();
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_POSITION_CTRL_LANDING);
|
DjiUser_RunHmsManagerSample();
|
||||||
break;
|
|
||||||
case '3':
|
|
||||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_GO_HOME_FORCE_LANDING);
|
|
||||||
break;
|
|
||||||
case '4':
|
|
||||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_VELOCITY_CTRL_LANDING);
|
|
||||||
break;
|
|
||||||
case '5':
|
|
||||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_ARREST_FLYING);
|
|
||||||
break;
|
|
||||||
case '6':
|
|
||||||
DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM);
|
|
||||||
break;
|
|
||||||
case '7':
|
|
||||||
DjiTest_HmsRunSample();
|
|
||||||
break;
|
|
||||||
case '8':
|
|
||||||
DjiTest_WaypointV2RunSample();
|
|
||||||
break;
|
|
||||||
case '9':
|
|
||||||
DjiTest_WaypointV3RunSample();
|
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
DjiUser_RunGimbalManagerSample();
|
DjiUser_RunGimbalManagerSample();
|
||||||
@ -202,6 +174,15 @@ start:
|
|||||||
case 'k':
|
case 'k':
|
||||||
DjiUser_RunCameraManagerSample();
|
DjiUser_RunCameraManagerSample();
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
returnCode = DjiTest_PositioningStartService();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("rtk positioning sample init error");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Start rtk positioning sample successfully");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "hal_network.h"
|
#include "hal_network.h"
|
||||||
#include "dji_logger.h"
|
#include "dji_logger.h"
|
||||||
|
#include "dji_config_manager.h"
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
@ -44,6 +45,8 @@ T_DjiReturnCode HalNetWork_Init(const char *ipAddr, const char *netMask, T_DjiNe
|
|||||||
{
|
{
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
char cmdStr[LINUX_CMD_STR_MAX_SIZE];
|
char cmdStr[LINUX_CMD_STR_MAX_SIZE];
|
||||||
|
char networkDeviceName[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
T_DjiUserLinkConfig linkConfig = {0};
|
||||||
|
|
||||||
if (ipAddr == NULL || netMask == NULL) {
|
if (ipAddr == NULL || netMask == NULL) {
|
||||||
USER_LOG_ERROR("hal network config param error");
|
USER_LOG_ERROR("hal network config param error");
|
||||||
@ -53,6 +56,13 @@ T_DjiReturnCode HalNetWork_Init(const char *ipAddr, const char *netMask, T_DjiNe
|
|||||||
//Attention: need root permission to config ip addr and netmask.
|
//Attention: need root permission to config ip addr and netmask.
|
||||||
memset(cmdStr, 0, sizeof(cmdStr));
|
memset(cmdStr, 0, sizeof(cmdStr));
|
||||||
|
|
||||||
|
if (DjiUserConfigManager_IsEnable()) {
|
||||||
|
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||||
|
strcpy(networkDeviceName, linkConfig.networkConfig.networkDeviceName);
|
||||||
|
} else {
|
||||||
|
strcpy(networkDeviceName, LINUX_NETWORK_DEV);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s up", LINUX_NETWORK_DEV);
|
snprintf(cmdStr, sizeof(cmdStr), "ifconfig %s up", LINUX_NETWORK_DEV);
|
||||||
ret = system(cmdStr);
|
ret = system(cmdStr);
|
||||||
if (ret != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (ret != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -81,8 +91,16 @@ T_DjiReturnCode HalNetWork_DeInit(T_DjiNetworkHandle halObj)
|
|||||||
|
|
||||||
T_DjiReturnCode HalNetWork_GetDeviceInfo(T_DjiHalNetworkDeviceInfo *deviceInfo)
|
T_DjiReturnCode HalNetWork_GetDeviceInfo(T_DjiHalNetworkDeviceInfo *deviceInfo)
|
||||||
{
|
{
|
||||||
deviceInfo->usbNetAdapter.vid = USB_NET_ADAPTER_VID;
|
T_DjiUserLinkConfig linkConfig = {0};
|
||||||
deviceInfo->usbNetAdapter.pid = USB_NET_ADAPTER_PID;
|
|
||||||
|
if (DjiUserConfigManager_IsEnable()) {
|
||||||
|
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||||
|
deviceInfo->usbNetAdapter.vid = linkConfig.networkConfig.networkUsbAdapterVid;
|
||||||
|
deviceInfo->usbNetAdapter.pid = linkConfig.networkConfig.networkUsbAdapterPid;
|
||||||
|
} else {
|
||||||
|
deviceInfo->usbNetAdapter.vid = USB_NET_ADAPTER_VID;
|
||||||
|
deviceInfo->usbNetAdapter.pid = USB_NET_ADAPTER_PID;
|
||||||
|
}
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include <dji_logger.h>
|
#include <dji_logger.h>
|
||||||
#include "hal_uart.h"
|
#include "hal_uart.h"
|
||||||
|
#include "dji_config_manager.h"
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
#define UART_DEV_NAME_STR_SIZE (128)
|
#define UART_DEV_NAME_STR_SIZE (128)
|
||||||
@ -48,20 +49,32 @@ T_DjiReturnCode HalUart_Init(E_DjiHalUartNum uartNum, uint32_t baudRate, T_DjiUa
|
|||||||
struct flock lock;
|
struct flock lock;
|
||||||
T_DjiReturnCode returnCode = DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
T_DjiReturnCode returnCode = DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
char uartName[UART_DEV_NAME_STR_SIZE];
|
char uartName[UART_DEV_NAME_STR_SIZE];
|
||||||
|
char uart1Name[UART_DEV_NAME_STR_SIZE];
|
||||||
|
char uart2Name[UART_DEV_NAME_STR_SIZE];
|
||||||
char systemCmd[DJI_SYSTEM_CMD_STR_MAX_SIZE];
|
char systemCmd[DJI_SYSTEM_CMD_STR_MAX_SIZE];
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
char lineBuf[DJI_SYSTEM_RESULT_STR_MAX_SIZE] = {0};
|
char lineBuf[DJI_SYSTEM_RESULT_STR_MAX_SIZE] = {0};
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
T_DjiUserLinkConfig linkConfig = {0};
|
||||||
|
|
||||||
uartHandleStruct = malloc(sizeof(T_UartHandleStruct));
|
uartHandleStruct = malloc(sizeof(T_UartHandleStruct));
|
||||||
if (uartHandleStruct == NULL) {
|
if (uartHandleStruct == NULL) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DjiUserConfigManager_IsEnable()) {
|
||||||
|
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||||
|
strcpy(uart1Name, linkConfig.uartConfig.uart1DeviceName);
|
||||||
|
strcpy(uart2Name, linkConfig.uartConfig.uart2DeviceName);
|
||||||
|
} else {
|
||||||
|
strcpy(uart1Name, LINUX_UART_DEV1);
|
||||||
|
strcpy(uart2Name, LINUX_UART_DEV2);
|
||||||
|
}
|
||||||
|
|
||||||
if (uartNum == DJI_HAL_UART_NUM_0) {
|
if (uartNum == DJI_HAL_UART_NUM_0) {
|
||||||
strcpy(uartName, LINUX_UART_DEV1);
|
strcpy(uartName, uart1Name);
|
||||||
} else if (uartNum == DJI_HAL_UART_NUM_1) {
|
} else if (uartNum == DJI_HAL_UART_NUM_1) {
|
||||||
strcpy(uartName, LINUX_UART_DEV2);
|
strcpy(uartName, uart2Name);
|
||||||
} else {
|
} else {
|
||||||
goto free_uart_handle;
|
goto free_uart_handle;
|
||||||
}
|
}
|
||||||
@ -88,7 +101,7 @@ T_DjiReturnCode HalUart_Init(E_DjiHalUartNum uartNum, uint32_t baudRate, T_DjiUa
|
|||||||
sprintf(systemCmd, "chmod 777 %s", uartName);
|
sprintf(systemCmd, "chmod 777 %s", uartName);
|
||||||
fp = popen(systemCmd, "r");
|
fp = popen(systemCmd, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
goto free_uart_handle;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -244,10 +257,17 @@ T_DjiReturnCode HalUart_ReadData(T_DjiUartHandle uartHandle, uint8_t *buf, uint3
|
|||||||
|
|
||||||
T_DjiReturnCode HalUart_GetStatus(E_DjiHalUartNum uartNum, T_DjiUartStatus *status)
|
T_DjiReturnCode HalUart_GetStatus(E_DjiHalUartNum uartNum, T_DjiUartStatus *status)
|
||||||
{
|
{
|
||||||
|
T_DjiUserLinkConfig linkConfig = {0};
|
||||||
|
|
||||||
if (uartNum == DJI_HAL_UART_NUM_0) {
|
if (uartNum == DJI_HAL_UART_NUM_0) {
|
||||||
status->isConnect = true;
|
status->isConnect = true;
|
||||||
} else if (uartNum == DJI_HAL_UART_NUM_1) {
|
} else if (uartNum == DJI_HAL_UART_NUM_1) {
|
||||||
status->isConnect = true;
|
if (DjiUserConfigManager_IsEnable()) {
|
||||||
|
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||||
|
status->isConnect = linkConfig.uartConfig.uart2DeviceEnable;
|
||||||
|
} else {
|
||||||
|
status->isConnect = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "hal_usb_bulk.h"
|
#include "hal_usb_bulk.h"
|
||||||
#include "dji_logger.h"
|
#include "dji_logger.h"
|
||||||
|
#include "dji_config_manager.h"
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
#define LINUX_USB_BULK_TRANSFER_TIMEOUT_MS (50)
|
#define LINUX_USB_BULK_TRANSFER_TIMEOUT_MS (50)
|
||||||
@ -52,6 +53,13 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
|||||||
{
|
{
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
struct libusb_device_handle *handle = NULL;
|
struct libusb_device_handle *handle = NULL;
|
||||||
|
T_DjiUserLinkConfig linkConfig = {0};
|
||||||
|
char usbBulk1EpInFd[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
char usbBulk1EpOutFd[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
char usbBulk2EpInFd[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
char usbBulk2EpOutFd[USER_DEVICE_NAME_STR_MAX_SIZE];
|
||||||
|
uint8_t usbBulk1InterfaceNum;
|
||||||
|
uint8_t usbBulk2InterfaceNum;
|
||||||
|
|
||||||
*usbBulkHandle = malloc(sizeof(T_HalUsbBulkObj));
|
*usbBulkHandle = malloc(sizeof(T_HalUsbBulkObj));
|
||||||
if (*usbBulkHandle == NULL) {
|
if (*usbBulkHandle == NULL) {
|
||||||
@ -67,7 +75,7 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
|||||||
}
|
}
|
||||||
|
|
||||||
handle = libusb_open_device_with_vid_pid(NULL, usbBulkInfo.vid, usbBulkInfo.pid);
|
handle = libusb_open_device_with_vid_pid(NULL, usbBulkInfo.vid, usbBulkInfo.pid);
|
||||||
if(handle == NULL) {
|
if (handle == NULL) {
|
||||||
USER_LOG_ERROR("open usb device failed");
|
USER_LOG_ERROR("open usb device failed");
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -87,23 +95,44 @@ T_DjiReturnCode HalUsbBulk_Init(T_DjiHalUsbBulkInfo usbBulkInfo, T_DjiUsbBulkHan
|
|||||||
memcpy(&((T_HalUsbBulkObj *) *usbBulkHandle)->usbBulkInfo, &usbBulkInfo, sizeof(usbBulkInfo));
|
memcpy(&((T_HalUsbBulkObj *) *usbBulkHandle)->usbBulkInfo, &usbBulkInfo, sizeof(usbBulkInfo));
|
||||||
((T_HalUsbBulkObj *) *usbBulkHandle)->interfaceNum = usbBulkInfo.channelInfo.interfaceNum;
|
((T_HalUsbBulkObj *) *usbBulkHandle)->interfaceNum = usbBulkInfo.channelInfo.interfaceNum;
|
||||||
|
|
||||||
if (usbBulkInfo.channelInfo.interfaceNum == LINUX_USB_BULK1_INTERFACE_NUM) {
|
if (DjiUserConfigManager_IsEnable()) {
|
||||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 = open(LINUX_USB_BULK1_EP_OUT_FD, O_RDWR);
|
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||||
|
usbBulk1InterfaceNum = linkConfig.usbBulkConfig.usbBulk1InterfaceNum;
|
||||||
|
usbBulk2InterfaceNum = linkConfig.usbBulkConfig.usbBulk2InterfaceNum;
|
||||||
|
snprintf(usbBulk1EpOutFd, sizeof(usbBulk1EpOutFd), "%s/ep1",
|
||||||
|
linkConfig.usbBulkConfig.usbBulk1DeviceName);
|
||||||
|
snprintf(usbBulk1EpInFd, sizeof(usbBulk1EpInFd), "%s/ep2",
|
||||||
|
linkConfig.usbBulkConfig.usbBulk1DeviceName);
|
||||||
|
snprintf(usbBulk2EpOutFd, sizeof(usbBulk2EpOutFd), "%s/ep1",
|
||||||
|
linkConfig.usbBulkConfig.usbBulk2DeviceName);
|
||||||
|
snprintf(usbBulk2EpInFd, sizeof(usbBulk2EpInFd), "%s/ep2",
|
||||||
|
linkConfig.usbBulkConfig.usbBulk2DeviceName);
|
||||||
|
} else {
|
||||||
|
usbBulk1InterfaceNum = LINUX_USB_BULK1_INTERFACE_NUM;
|
||||||
|
usbBulk2InterfaceNum = LINUX_USB_BULK2_INTERFACE_NUM;
|
||||||
|
strcpy(usbBulk1EpInFd, LINUX_USB_BULK1_EP_IN_FD);
|
||||||
|
strcpy(usbBulk1EpOutFd, LINUX_USB_BULK1_EP_OUT_FD);
|
||||||
|
strcpy(usbBulk2EpInFd, LINUX_USB_BULK2_EP_IN_FD);
|
||||||
|
strcpy(usbBulk2EpOutFd, LINUX_USB_BULK2_EP_OUT_FD);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usbBulkInfo.channelInfo.interfaceNum == usbBulk1InterfaceNum) {
|
||||||
|
((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 = open(usbBulk1EpOutFd, O_RDWR);
|
||||||
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 < 0) {
|
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 < 0) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 = open(LINUX_USB_BULK1_EP_IN_FD, O_RDWR);
|
((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 = open(usbBulk1EpInFd, O_RDWR);
|
||||||
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 < 0) {
|
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 < 0) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
} else if (usbBulkInfo.channelInfo.interfaceNum == LINUX_USB_BULK2_INTERFACE_NUM) {
|
} else if (usbBulkInfo.channelInfo.interfaceNum == usbBulk2InterfaceNum) {
|
||||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 = open(LINUX_USB_BULK2_EP_OUT_FD, O_RDWR);
|
((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 = open(usbBulk2EpOutFd, O_RDWR);
|
||||||
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 < 0) {
|
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep1 < 0) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 = open(LINUX_USB_BULK2_EP_IN_FD, O_RDWR);
|
((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 = open(usbBulk2EpInFd, O_RDWR);
|
||||||
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 < 0) {
|
if (((T_HalUsbBulkObj *) *usbBulkHandle)->ep2 < 0) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -127,8 +156,9 @@ T_DjiReturnCode HalUsbBulk_DeInit(T_DjiUsbBulkHandle usbBulkHandle)
|
|||||||
|
|
||||||
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
if (((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.isUsbHost == true) {
|
||||||
#ifdef LIBUSB_INSTALLED
|
#ifdef LIBUSB_INSTALLED
|
||||||
ret = libusb_release_interface(handle, ((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
ret = libusb_release_interface(handle,
|
||||||
if(ret != 0) {
|
((T_HalUsbBulkObj *) usbBulkHandle)->usbBulkInfo.channelInfo.interfaceNum);
|
||||||
|
if (ret != 0) {
|
||||||
USER_LOG_ERROR("release usb bulk interface failed, errno = %d", ret);
|
USER_LOG_ERROR("release usb bulk interface failed, errno = %d", ret);
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -208,19 +238,39 @@ T_DjiReturnCode HalUsbBulk_ReadData(T_DjiUsbBulkHandle usbBulkHandle, uint8_t *b
|
|||||||
|
|
||||||
T_DjiReturnCode HalUsbBulk_GetDeviceInfo(T_DjiHalUsbBulkDeviceInfo *deviceInfo)
|
T_DjiReturnCode HalUsbBulk_GetDeviceInfo(T_DjiHalUsbBulkDeviceInfo *deviceInfo)
|
||||||
{
|
{
|
||||||
//attention: this interface only be called in usb device mode.
|
T_DjiUserLinkConfig linkConfig = {0};
|
||||||
deviceInfo->vid = LINUX_USB_VID;
|
|
||||||
deviceInfo->pid = LINUX_USB_PID;
|
|
||||||
|
|
||||||
// This bulk channel is used to obtain DJI camera video stream and push 3rd-party camera video stream.
|
if (DjiUserConfigManager_IsEnable()) {
|
||||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].interfaceNum = LINUX_USB_BULK1_INTERFACE_NUM;
|
DjiUserConfigManager_GetLinkConfig(&linkConfig);
|
||||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointIn = LINUX_USB_BULK1_END_POINT_IN;
|
|
||||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointOut = LINUX_USB_BULK1_END_POINT_OUT;
|
|
||||||
|
|
||||||
// This bulk channel is used to obtain DJI perception image and download camera media file.
|
//attention: this interface only be called in usb device mode.
|
||||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].interfaceNum = LINUX_USB_BULK2_INTERFACE_NUM;
|
deviceInfo->vid = linkConfig.usbBulkConfig.usbDeviceVid;
|
||||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointIn = LINUX_USB_BULK2_END_POINT_IN;
|
deviceInfo->pid = linkConfig.usbBulkConfig.usbDevicePid;
|
||||||
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointOut = LINUX_USB_BULK2_END_POINT_OUT;
|
|
||||||
|
// This bulk channel is used to obtain DJI camera video stream and push 3rd-party camera video stream.
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].interfaceNum = linkConfig.usbBulkConfig.usbBulk1InterfaceNum;
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointIn = linkConfig.usbBulkConfig.usbBulk1EndpointIn;
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointOut = linkConfig.usbBulkConfig.usbBulk1EndpointOut;
|
||||||
|
|
||||||
|
// This bulk channel is used to obtain DJI perception image and download camera media file.
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].interfaceNum = linkConfig.usbBulkConfig.usbBulk2InterfaceNum;
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointIn = linkConfig.usbBulkConfig.usbBulk2EndpointIn;
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointOut = linkConfig.usbBulkConfig.usbBulk2EndpointOut;
|
||||||
|
} else {
|
||||||
|
//attention: this interface only be called in usb device mode.
|
||||||
|
deviceInfo->vid = LINUX_USB_VID;
|
||||||
|
deviceInfo->pid = LINUX_USB_PID;
|
||||||
|
|
||||||
|
// This bulk channel is used to obtain DJI camera video stream and push 3rd-party camera video stream.
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].interfaceNum = LINUX_USB_BULK1_INTERFACE_NUM;
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointIn = LINUX_USB_BULK1_END_POINT_IN;
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_0].endPointOut = LINUX_USB_BULK1_END_POINT_OUT;
|
||||||
|
|
||||||
|
// This bulk channel is used to obtain DJI perception image and download camera media file.
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].interfaceNum = LINUX_USB_BULK2_INTERFACE_NUM;
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointIn = LINUX_USB_BULK2_END_POINT_IN;
|
||||||
|
deviceInfo->channelInfo[DJI_HAL_USB_BULK_NUM_1].endPointOut = LINUX_USB_BULK2_END_POINT_OUT;
|
||||||
|
}
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,7 +155,7 @@ T_DjiReturnCode DjiMediaFile_GetMediaFileAttr(T_DjiMediaFileHandle mediaFileHand
|
|||||||
}
|
}
|
||||||
|
|
||||||
T_DjiReturnCode DjiMediaFile_GetDataOrg(struct _DjiMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
T_DjiReturnCode DjiMediaFile_GetDataOrg(struct _DjiMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||||
uint8_t *data, uint16_t *realLen)
|
uint8_t *data, uint32_t *realLen)
|
||||||
{
|
{
|
||||||
if (mediaFileHandle->mediaFileOptItem.getDataOrgFunc == NULL) {
|
if (mediaFileHandle->mediaFileOptItem.getDataOrgFunc == NULL) {
|
||||||
USER_LOG_ERROR("Media file handle getDataOrgFunc null error");
|
USER_LOG_ERROR("Media file handle getDataOrgFunc null error");
|
||||||
|
|||||||
@ -57,7 +57,7 @@ typedef struct {
|
|||||||
T_DjiReturnCode (*getAttrFunc)(struct _DjiMediaFile *mediaFileHandle, T_DjiCameraMediaFileAttr *mediaFileAttr);
|
T_DjiReturnCode (*getAttrFunc)(struct _DjiMediaFile *mediaFileHandle, T_DjiCameraMediaFileAttr *mediaFileAttr);
|
||||||
|
|
||||||
T_DjiReturnCode (*getDataOrgFunc)(struct _DjiMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
T_DjiReturnCode (*getDataOrgFunc)(struct _DjiMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||||
uint8_t *data, uint16_t *realLen);
|
uint8_t *data, uint32_t *realLen);
|
||||||
T_DjiReturnCode (*getFileSizeOrgFunc)(struct _DjiMediaFile *mediaFileHandle, uint32_t *fileSize);
|
T_DjiReturnCode (*getFileSizeOrgFunc)(struct _DjiMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||||
|
|
||||||
T_DjiReturnCode (*createThmFunc)(struct _DjiMediaFile *mediaFileHandle);
|
T_DjiReturnCode (*createThmFunc)(struct _DjiMediaFile *mediaFileHandle);
|
||||||
@ -91,7 +91,7 @@ T_DjiReturnCode DjiMediaFile_GetMediaFileAttr(T_DjiMediaFileHandle mediaFileHand
|
|||||||
T_DjiCameraMediaFileAttr *mediaFileAttr);
|
T_DjiCameraMediaFileAttr *mediaFileAttr);
|
||||||
|
|
||||||
T_DjiReturnCode DjiMediaFile_GetDataOrg(struct _DjiMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
T_DjiReturnCode DjiMediaFile_GetDataOrg(struct _DjiMediaFile *mediaFileHandle, uint32_t offset, uint16_t len,
|
||||||
uint8_t *data, uint16_t *realLen);
|
uint8_t *data, uint32_t *realLen);
|
||||||
T_DjiReturnCode DjiMediaFile_GetFileSizeOrg(struct _DjiMediaFile *mediaFileHandle, uint32_t *fileSize);
|
T_DjiReturnCode DjiMediaFile_GetFileSizeOrg(struct _DjiMediaFile *mediaFileHandle, uint32_t *fileSize);
|
||||||
|
|
||||||
T_DjiReturnCode DjiMediaFile_CreateThm(T_DjiMediaFileHandle mediaFileHandle);
|
T_DjiReturnCode DjiMediaFile_CreateThm(T_DjiMediaFileHandle mediaFileHandle);
|
||||||
|
|||||||
@ -770,7 +770,7 @@ static T_DjiReturnCode GetMediaFileDir(char *dirPath)
|
|||||||
static T_DjiReturnCode GetMediaFileOriginData(const char *filePath, uint32_t offset, uint32_t length, uint8_t *data)
|
static T_DjiReturnCode GetMediaFileOriginData(const char *filePath, uint32_t offset, uint32_t length, uint8_t *data)
|
||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
uint16_t realLen = 0;
|
uint32_t realLen = 0;
|
||||||
T_DjiMediaFileHandle mediaFileHandle;
|
T_DjiMediaFileHandle mediaFileHandle;
|
||||||
|
|
||||||
returnCode = DjiMediaFile_CreateHandle(filePath, &mediaFileHandle);
|
returnCode = DjiMediaFile_CreateHandle(filePath, &mediaFileHandle);
|
||||||
|
|||||||
@ -55,6 +55,7 @@ static const T_DjiTestCameraTypeStr s_cameraTypeStrList[] = {
|
|||||||
{DJI_CAMERA_TYPE_H20T, "Zenmuse H20T"},
|
{DJI_CAMERA_TYPE_H20T, "Zenmuse H20T"},
|
||||||
{DJI_CAMERA_TYPE_P1, "Zenmuse P1"},
|
{DJI_CAMERA_TYPE_P1, "Zenmuse P1"},
|
||||||
{DJI_CAMERA_TYPE_L1, "Zenmuse L1"},
|
{DJI_CAMERA_TYPE_L1, "Zenmuse L1"},
|
||||||
|
{DJI_CAMERA_TYPE_L2, "Zenmuse L2"},
|
||||||
{DJI_CAMERA_TYPE_H20N, "Zenmuse H20N"},
|
{DJI_CAMERA_TYPE_H20N, "Zenmuse H20N"},
|
||||||
{DJI_CAMERA_TYPE_M30, "M30 Camera"},
|
{DJI_CAMERA_TYPE_M30, "M30 Camera"},
|
||||||
{DJI_CAMERA_TYPE_M30T, "M30T Camera"},
|
{DJI_CAMERA_TYPE_M30T, "M30T Camera"},
|
||||||
@ -906,7 +907,8 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20T ||
|
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20T ||
|
||||||
cameraType == DJI_CAMERA_TYPE_H20N || cameraType == DJI_CAMERA_TYPE_M30 ||
|
cameraType == DJI_CAMERA_TYPE_H20N || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||||
cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E ||
|
cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E ||
|
||||||
cameraType == DJI_CAMERA_TYPE_M3T) {
|
cameraType == DJI_CAMERA_TYPE_M3T || cameraType == DJI_CAMERA_TYPE_M3T ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_L2) {
|
||||||
USER_LOG_INFO("Set mounted position %d camera's exposure mode to manual mode.",
|
USER_LOG_INFO("Set mounted position %d camera's exposure mode to manual mode.",
|
||||||
mountPosition);
|
mountPosition);
|
||||||
returnCode = DjiTest_CameraManagerSetExposureMode(mountPosition,
|
returnCode = DjiTest_CameraManagerSetExposureMode(mountPosition,
|
||||||
@ -945,7 +947,7 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20N
|
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20N
|
||||||
|| cameraType == DJI_CAMERA_TYPE_H20T || cameraType == DJI_CAMERA_TYPE_M30
|
|| cameraType == DJI_CAMERA_TYPE_H20T || cameraType == DJI_CAMERA_TYPE_M30
|
||||||
|| cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E
|
|| cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E
|
||||||
|| cameraType == DJI_CAMERA_TYPE_M3T) {
|
|| cameraType == DJI_CAMERA_TYPE_M3T || cameraType == DJI_CAMERA_TYPE_L2) {
|
||||||
USER_LOG_INFO("Set mounted position %d camera's exposure mode to manual mode.",
|
USER_LOG_INFO("Set mounted position %d camera's exposure mode to manual mode.",
|
||||||
mountPosition);
|
mountPosition);
|
||||||
returnCode = DjiTest_CameraManagerSetExposureMode(mountPosition,
|
returnCode = DjiTest_CameraManagerSetExposureMode(mountPosition,
|
||||||
@ -1245,6 +1247,876 @@ T_DjiReturnCode DjiTest_CameraManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_NIGHT_SCENE_MODE: {
|
||||||
|
E_DjiCameraManagerNightSceneMode nightSceneMode;
|
||||||
|
T_DjiCameraManagerRangeList nightSceneModeRange;
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_XT2 || cameraType == DJI_CAMERA_TYPE_XTS ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_L2 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_M3E || cameraType == DJI_CAMERA_TYPE_M3T) {
|
||||||
|
USER_LOG_INFO("Camera type %d does not support night scene mode!", cameraType);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 1: Change camera stream source to zoom camera.");
|
||||||
|
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_ZOOM_CAM);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
if (returnCode == DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||||
|
USER_LOG_WARN("For camera type %d, it does not need to change stream source.\r\n", cameraType);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 2: Get night scene mode range.");
|
||||||
|
returnCode = DjiCameraManager_GetNightSceneModeRange(mountPosition, &nightSceneModeRange);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get night scene mode range of camera at position %d failed, return code 0x%08llX",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Supported night scene mode:");
|
||||||
|
for(uint32_t i = 0; i < nightSceneModeRange.size; i++) {
|
||||||
|
printf(" %d", nightSceneModeRange.nightSceneMode[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 3: Set ningh scene mode as enable.");
|
||||||
|
returnCode = DjiCameraManager_SetNightSceneMode(mountPosition, DJI_CAMERA_MANAGER_NIGHT_SCENE_MODE_ENABLE);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set ningh scene mode as enable failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetNightSceneMode(mountPosition, &nightSceneMode);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get night scene mode failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Now the night scene mode is %d", nightSceneMode);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Sleep 2s...");
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 4: Set night scene mode as auto.");
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_H20T) {
|
||||||
|
USER_LOG_WARN("Camera H20T does not support set night scene mode as auto");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnCode = DjiCameraManager_SetNightSceneMode(mountPosition, DJI_CAMERA_MANAGER_NIGHT_SCENE_MODE_AUTO);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set ningh scene mode as auto failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetNightSceneMode(mountPosition, &nightSceneMode);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get night scene mode failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Now the night scene mode is %d", nightSceneMode);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Sleep 2s...");
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 5: Set ningt scene mode as disable.");
|
||||||
|
returnCode = DjiCameraManager_SetNightSceneMode(mountPosition, DJI_CAMERA_MANAGER_NIGHT_SCENE_MODE_DISABLE);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get lidar ranging info failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetNightSceneMode(mountPosition, &nightSceneMode);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get lidar ranging info failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Now the night scene mode is %d", nightSceneMode);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAPTURE_RECORDING_STREAMS: {
|
||||||
|
T_DjiCameraManagerStreamList streamList;
|
||||||
|
T_DjiCameraManagerStreamList getStreamList = {0};
|
||||||
|
T_DjiCameraManagerRangeList streamStorageRange = {0};
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_Z30 || cameraType == DJI_CAMERA_TYPE_XT2 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_XTS || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_L1) {
|
||||||
|
USER_LOG_INFO("Camera type %d does not support set capture or recording stream(s) to storage.",
|
||||||
|
cameraType);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_SHOOT_PHOTO);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Set camera work mode failed, position %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetStreamStorageRange(mountPosition,
|
||||||
|
&streamStorageRange);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < streamStorageRange.size; i++) {
|
||||||
|
streamList.streamStorage[i] = streamStorageRange.streamStorage[i];
|
||||||
|
}
|
||||||
|
streamList.size = streamStorageRange.size;
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 1: Select all capture stream to be storaged.");
|
||||||
|
returnCode = DjiCameraManager_SetCaptureRecordingStreams(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_CAPTURE,
|
||||||
|
&streamList);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Set capture storaged streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 2: Read back capture storage streams:");
|
||||||
|
returnCode = DjiCameraManager_GetCaptureRecordingStreams(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_CAPTURE,
|
||||||
|
&getStreamList);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Get capture storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < getStreamList.size; i++) {
|
||||||
|
USER_LOG_INFO(" stream %d is %d", i, getStreamList.streamStorage[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Sleep 2s...");
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 3: Select all video stream to be storaged.");
|
||||||
|
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_RECORD_VIDEO);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_SetCaptureRecordingStreams(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING,
|
||||||
|
&streamList);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Set recording storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 4: Read back video storage streams:");
|
||||||
|
returnCode = DjiCameraManager_GetCaptureRecordingStreams(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING,
|
||||||
|
&getStreamList);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Get capture storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < getStreamList.size; i++) {
|
||||||
|
USER_LOG_INFO(" stream %d is %d", i, getStreamList.streamStorage[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
streamList.streamStorage[0] = streamStorageRange.streamStorage[0];
|
||||||
|
streamList.size = 1;
|
||||||
|
|
||||||
|
USER_LOG_INFO("Sleep 2s...");
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 5: Select default video stream to storage.");
|
||||||
|
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_RECORD_VIDEO);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_SetCaptureRecordingStreams(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING,
|
||||||
|
&streamList);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Set recording storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Step 6: Read back video storage streams:");
|
||||||
|
returnCode = DjiCameraManager_GetCaptureRecordingStreams(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_CAPTURE_OR_RECORDING_RECORDING,
|
||||||
|
&getStreamList);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Get capture storage streams failed %d, error code: 0x%08X\r\n", mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < getStreamList.size; i++) {
|
||||||
|
USER_LOG_INFO(" stream %d is %d", i, getStreamList.streamStorage[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOW_STORAGE_INFO: {
|
||||||
|
T_DjiCameraManagerStorageInfo storageInfo;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < 30; i++) {
|
||||||
|
returnCode = DjiCameraManager_GetStorageInfo(mountPosition, &storageInfo);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_INFO("Get storage info failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("total capacity: %d, remainCapcity: %d", storageInfo.totalCapacity, storageInfo.remainCapacity);
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FORMAT_SD_CARD: {
|
||||||
|
returnCode = DjiCameraManager_FormatStorage(mountPosition);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Faile to Format SD card.");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Format SD card successfully!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_LINK_ZOOM: {
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set synchronized split screen zoom enabled");
|
||||||
|
returnCode = DjiCameraManager_SetSynchronizedSplitScreenZoomEnabled(mountPosition, true);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Sleep 5s...");
|
||||||
|
osalHandler->TaskSleepMs(5000);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set synchronized split screen zoom disabled");
|
||||||
|
returnCode = DjiCameraManager_SetSynchronizedSplitScreenZoomEnabled(mountPosition, false);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_USER_CUSTOM_DIR_FILE_NAME: {
|
||||||
|
uint8_t dirName[240] = {0};
|
||||||
|
uint32_t dirNameSize = 0;
|
||||||
|
uint8_t fileName[240] = {0};
|
||||||
|
uint32_t fileNameSize = 0;
|
||||||
|
uint8_t getNameString[100] = {0};
|
||||||
|
uint32_t getNameStringSize;
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(5);
|
||||||
|
printf("Input expand directory name: ");
|
||||||
|
scanf("%s", dirName);
|
||||||
|
dirNameSize = strlen(dirName);
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_SetCustomExpandName(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_DIR,
|
||||||
|
dirName,
|
||||||
|
dirNameSize);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set Custom expand directory name failed");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cameraType != DJI_CAMERA_TYPE_L1) {
|
||||||
|
osalHandler->TaskSleepMs(5);
|
||||||
|
printf("Input expand file name: ");
|
||||||
|
scanf("%s", fileName);
|
||||||
|
fileNameSize = strlen(fileName);
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_SetCustomExpandName(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_FILE,
|
||||||
|
fileName,
|
||||||
|
fileNameSize);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set Custom expand file name failed");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getNameStringSize = sizeof(getNameString) - 1;
|
||||||
|
returnCode = DjiCameraManager_GetCustomExpandName(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_DIR,
|
||||||
|
getNameString,
|
||||||
|
&getNameStringSize);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get Custom expand directory name failed, stat = 0x%08llX", returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
getNameString[getNameStringSize] = '\0';
|
||||||
|
USER_LOG_INFO("Latest directory name: %s", getNameString);
|
||||||
|
|
||||||
|
if (cameraType != DJI_CAMERA_TYPE_L1) {
|
||||||
|
getNameStringSize = sizeof(getNameString) - 1;
|
||||||
|
returnCode = DjiCameraManager_GetCustomExpandName(mountPosition,
|
||||||
|
DJI_CAMERA_MANAGER_EXPAND_NAME_TYPE_FILE,
|
||||||
|
getNameString,
|
||||||
|
&getNameStringSize);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get Custom expand file name failed");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
getNameString[getNameStringSize] = '\0';
|
||||||
|
USER_LOG_INFO("Latest file name: %s", getNameString);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RESET_CAMERA_SETTINGS: {
|
||||||
|
returnCode = DjiCameraManager_ResetCameraSetting(mountPosition);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("reset camera at position %d failed", mountPosition);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Reset camera settings success!");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_AE_LOCK_MODE: {
|
||||||
|
bool enable;
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20T ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_H20N || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_M3T) {
|
||||||
|
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_ZOOM_CAM);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Change camera stream source to zoom camera failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Try to set ae locked...");
|
||||||
|
returnCode = DjiCameraManager_SetAELockEnabled(mountPosition, true);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set camera ae lock mode at position %d failed", mountPosition);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
USER_LOG_INFO("Sleep 2s...");
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetAELockEnabled(mountPosition, &enable);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera ae lock mode at position %d failed", mountPosition);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("The camera ae lock mode now is %d", enable);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Try to set ae unlocked...");
|
||||||
|
returnCode = DjiCameraManager_SetAELockEnabled(mountPosition, false);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set camera ae lock mode at position %d failed", mountPosition);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
USER_LOG_INFO("Sleep 2s...");
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_P1) {
|
||||||
|
USER_LOG_INFO("Camera type %d does not support get AE lock mode, please check by yourself.",
|
||||||
|
cameraType);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnCode = DjiCameraManager_GetAELockEnabled(mountPosition, &enable);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera ae lock mode at position %d failed", mountPosition);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("The camera ae lock mode now is %d", enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_FOCUS_RING_VALUE: {
|
||||||
|
uint16_t focusRingValue;
|
||||||
|
T_DjiCameraManagerRangeList focusRingRange;
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_H20N ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_H20T || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_M30T || cameraType == DJI_CAMERA_TYPE_M3E ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_M3T) {
|
||||||
|
USER_LOG_INFO("Set camera stream source to zoom camera.");
|
||||||
|
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_ZOOM_CAM);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_WARN("Change camera stream source to zoom camera failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set camera's focus mode to manual mode.");
|
||||||
|
returnCode = DjiCameraManager_SetFocusMode(mountPosition, DJI_CAMERA_MANAGER_FOCUS_MODE_MANUAL);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set mounted position %d camera's focus mode(%d) failed,"
|
||||||
|
" error code :0x%08X.", mountPosition, DJI_CAMERA_MANAGER_FOCUS_MODE_MANUAL,
|
||||||
|
returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetFocusRingRange(mountPosition, &focusRingRange);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get range failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Focus ring vlaue range: %d to %d.", focusRingRange.minValue, focusRingRange.maxValue);
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Input focus ring value to set: ");
|
||||||
|
scanf("%d", &focusRingValue);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Try to set focus ring value as %d", focusRingValue);
|
||||||
|
returnCode = DjiCameraManager_SetFocusRingValue(mountPosition, focusRingValue);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set camera focus ring value at position %d failed", mountPosition);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
|
||||||
|
if (cameraType != DJI_CAMERA_TYPE_Z30) {
|
||||||
|
returnCode = DjiCameraManager_GetFocusRingValue(mountPosition, &focusRingValue);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera focus ring value at position %d failed", mountPosition);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Current focus ring value is %d", focusRingValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_CONNECT_STATUS_TEST: {
|
||||||
|
bool connectStatus;
|
||||||
|
uint32_t loopTime = 10;
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Please input checking time: ");
|
||||||
|
scanf("%d", &loopTime);
|
||||||
|
|
||||||
|
do {
|
||||||
|
returnCode = DjiCameraManager_GetCameraConnectStatus(mountPosition,
|
||||||
|
&connectStatus);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Camera's connect state is %d", connectStatus);
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(1500);
|
||||||
|
} while(loopTime--);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GET_PHOTO_VIDEO_PARAM: {
|
||||||
|
E_DjiCameraManagerPhotoRatio photoRatio;
|
||||||
|
E_DjiCameraManagerPhotoStorageFormat photoFormat;
|
||||||
|
E_DjiCameraManagerVideoStorageFormat videoFormat;
|
||||||
|
T_DjiCameraManagerRangeList photoRatioRange;
|
||||||
|
T_DjiCameraManagerRangeList photoFormatRange;
|
||||||
|
T_DjiCameraManagerRangeList videoFormatRange;
|
||||||
|
T_DjiCameraManagerVideoFormat videoParam;
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetPhotoRatioRange(mountPosition, &photoRatioRange);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get range failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(5);
|
||||||
|
printf("photo ratio range:");
|
||||||
|
for (uint32_t i = 0; i < photoRatioRange.size; i++) {
|
||||||
|
printf(" %d", photoRatioRange.photoRatioFormat[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetPhotoFormatStorageRange(mountPosition, &photoFormatRange);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get range failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(5);
|
||||||
|
printf("photo storage format range:");
|
||||||
|
for (uint32_t i = 0; i < photoFormatRange.size; i++) {
|
||||||
|
printf(" %d", photoFormatRange.photoStorageFormat[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetVideoFormatRange(mountPosition, &videoFormatRange);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get range failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(5);
|
||||||
|
printf("video storage format range:");
|
||||||
|
for (uint32_t i = 0; i < videoFormatRange.size; i++) {
|
||||||
|
printf(" %d", videoFormatRange.videoStorageFormat[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set camera work mode as shoot photo.");
|
||||||
|
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_SHOOT_PHOTO);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS &&
|
||||||
|
returnCode != DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||||
|
USER_LOG_ERROR("set mounted position %d camera's work mode as shoot-photo mode failed,"
|
||||||
|
" error code :0x%08X", mountPosition, returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set photo ratio to type %d", photoRatioRange.photoRatioFormat[0]);
|
||||||
|
returnCode = DjiCameraManager_SetPhotoRatio(mountPosition,
|
||||||
|
photoRatioRange.photoRatioFormat[0]);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||||
|
{
|
||||||
|
USER_LOG_ERROR("Set photo ratio failed.");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_XTS) {
|
||||||
|
USER_LOG_INFO("Camera type %d does not support get photo ratio.", cameraType);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnCode = DjiCameraManager_GetPhotoRatio(mountPosition,
|
||||||
|
&photoRatio);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera photo ratio at position %d failed, ret = 0x%08llX",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Current photo ratio type: %d", photoRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set photo storage format to type %d", photoFormatRange.photoStorageFormat[0]);
|
||||||
|
returnCode = DjiCameraManager_SetPhotoFormat(mountPosition, photoFormatRange.photoStorageFormat[0]);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||||
|
{
|
||||||
|
USER_LOG_ERROR("Set photo storage format failed.");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_XTS) {
|
||||||
|
USER_LOG_INFO("Camera type %d does not support get photo storage format.", cameraType);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnCode = DjiCameraManager_GetPhotoFormat(mountPosition, &photoFormat);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera photo storage format at position %d failed, ret = 0x%08llX",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Current photo storage format type: %d", photoFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Sleep 2s...");
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set camera work mode as record video.");
|
||||||
|
returnCode = DjiCameraManager_SetMode(mountPosition, DJI_CAMERA_MANAGER_WORK_MODE_RECORD_VIDEO);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS &&
|
||||||
|
returnCode != DJI_ERROR_CAMERA_MANAGER_MODULE_CODE_UNSUPPORTED_COMMAND) {
|
||||||
|
USER_LOG_ERROR("set mounted position %d camera's work mode as shoot-photo mode failed,"
|
||||||
|
" error code :0x%08X", mountPosition, returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set video storage format as type %d", videoFormatRange.videoStorageFormat[0]);
|
||||||
|
returnCode = DjiCameraManager_SetVideoStorageFormat(mountPosition, videoFormatRange.videoStorageFormat[0]);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||||
|
{
|
||||||
|
USER_LOG_ERROR("Set video storage format failed.");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_XTS) {
|
||||||
|
USER_LOG_INFO("Camera type %d does not support get video storage format, video resolution and frame rate.",
|
||||||
|
cameraType);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnCode = DjiCameraManager_GetVideoFormat(mountPosition, &videoFormat);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera video storage format at position %d failed, ret = 0x%08llX",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Current video stroage format: %d", videoFormat);
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetVideoResolutionFrameRate(mountPosition,
|
||||||
|
&videoParam);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera video resolution and framerate failed at position %d failed",
|
||||||
|
mountPosition);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("resolution: %d, frame rate: %d", videoParam.videoResolution, videoParam.videoFrameRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_MODE: {
|
||||||
|
E_DjiCameraManagerMeteringMode meteringMode;
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set metering mode as %d", DJI_CAMERA_MANAGER_METERING_MODE_AVERAGE);
|
||||||
|
returnCode = DjiCameraManager_SetMeteringMode(mountPosition, DJI_CAMERA_MANAGER_METERING_MODE_AVERAGE);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set camera metering mode %d failed", DJI_CAMERA_MANAGER_METERING_MODE_AVERAGE);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(200);
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetMeteringMode(mountPosition, &meteringMode);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera metering mode failed.");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Current metering mode is %d", meteringMode);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Sleep 2s...");
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set metering mode as %d", DJI_CAMERA_MANAGER_METERING_MODE_SPOT);
|
||||||
|
returnCode = DjiCameraManager_SetMeteringMode(mountPosition, DJI_CAMERA_MANAGER_METERING_MODE_SPOT);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set camera metering mode %d failed", DJI_CAMERA_MANAGER_METERING_MODE_SPOT);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(200);
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetMeteringMode(mountPosition, &meteringMode);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera metering mode failed.");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Current metering mode is %d", meteringMode);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Sleep 2s...");
|
||||||
|
osalHandler->TaskSleepMs(2000);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set metering mode as %d", DJI_CAMERA_MANAGER_METERING_MODE_CENTRAL);
|
||||||
|
returnCode = DjiCameraManager_SetMeteringMode(mountPosition, DJI_CAMERA_MANAGER_METERING_MODE_CENTRAL);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set camera metering mode %d failed", DJI_CAMERA_MANAGER_METERING_MODE_CENTRAL);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(200);
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetMeteringMode(mountPosition, &meteringMode);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get camera metering mode failed.");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
USER_LOG_INFO("Current metering mode is %d", meteringMode);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_POINT: {
|
||||||
|
int32_t x, y;
|
||||||
|
uint8_t horizonRegionNum;
|
||||||
|
uint8_t viticalRegionNum;
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_XTS) {
|
||||||
|
USER_LOG_INFO("Camera type %d does not support to set metering point.", cameraType);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetMeteringPointRegionRange(mountPosition, &horizonRegionNum, &viticalRegionNum);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get metering point region range failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("region range: horizon %d, vitical %d", horizonRegionNum, viticalRegionNum);
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(5);
|
||||||
|
printf("Input meterting point (x, y) you want to set: ");
|
||||||
|
scanf("%d %d", &x, &y);
|
||||||
|
|
||||||
|
USER_LOG_INFO("Try to set metering point as (%d, %d)", (uint8_t)x, (uint8_t)y);
|
||||||
|
returnCode = DjiCameraManager_SetMeteringPoint(mountPosition, x, y);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set metering point failed");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(500);
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetMeteringPoint(mountPosition, &x, &y);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get metering point failed");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Current metering point: (%d, %d)", x, y);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FFC_MODE_AND_TRRIGER: {
|
||||||
|
E_DjiCameraManagerFfcMode ffcMode;
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_Z30 || cameraType == DJI_CAMERA_TYPE_XT2 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_M3E) {
|
||||||
|
USER_LOG_WARN("Camera type %d don't support FFC function.", cameraType);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Input mode to set FFC (0 manual, 1 auto):");
|
||||||
|
scanf("%d", &ffcMode);
|
||||||
|
|
||||||
|
if (cameraType != DJI_CAMERA_TYPE_XTS) {
|
||||||
|
USER_LOG_INFO("Set camera stream source to infrared camera.");
|
||||||
|
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_IR_CAM);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Change camera stream source to infrared camera failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_SetFfcMode(mountPosition, ffcMode);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Set FFC mode %d failed, camera position %d, error code 0x%08llX",
|
||||||
|
ffcMode, mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_TriggerFfc(mountPosition);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Trigger FFC mode, camera position %d, error code 0x%08llX",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Trriger FFC successfully!");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GAIN_MODE: {
|
||||||
|
E_DjiCameraManagerIrGainMode gainMode;
|
||||||
|
T_DjiCameraManagerIrTempMeterRange tempRange = {0};
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_Z30 || cameraType == DJI_CAMERA_TYPE_XT2 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_H20 || cameraType == DJI_CAMERA_TYPE_P1 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_M30 ||
|
||||||
|
cameraType == DJI_CAMERA_TYPE_M3E) {
|
||||||
|
USER_LOG_WARN("Camera type %d don't support infrared function.", cameraType);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(10);
|
||||||
|
printf("Input gain mode to set (1 low, 2 high):");
|
||||||
|
scanf("%d", &gainMode);
|
||||||
|
|
||||||
|
if (cameraType != DJI_CAMERA_TYPE_XTS) {
|
||||||
|
USER_LOG_INFO("Set camera stream source to infrared camera.");
|
||||||
|
returnCode = DjiCameraManager_SetStreamSource(mountPosition, DJI_CAMERA_MANAGER_SOURCE_IR_CAM);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Change camera stream source to infrared camera failed at position %d, error code: 0x%08X\r\n",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Get temperature range of different gain mode...");
|
||||||
|
returnCode = DjiCameraManager_GetInfraredCameraGainModeTemperatureRange(mountPosition, &tempRange);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Fail to get infrared mode temperature range. position %d, error code 0x%08llX",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("low_min: %.2f, low_max: %.2f, high_min: %.2f, high_max: %.2f",
|
||||||
|
tempRange.lowGainTempMin, tempRange.lowGainTempMax,
|
||||||
|
tempRange.highGainTempMin, tempRange.highGainTempMax);
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_SetInfraredCameraGainMode(mountPosition, gainMode);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_INFO("Fail to set infrared camera gain mode. position %d, error code 0x%08llX",
|
||||||
|
mountPosition, returnCode);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Set gain mode to %d successfully!", gainMode);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_CAMERA_STATUS: {
|
||||||
|
E_DjiCameraManagerCapturingState capturingState;
|
||||||
|
E_DjiCameraManagerRecordingState recordingState;
|
||||||
|
uint16_t recordingTime;
|
||||||
|
uint8_t remainingTime;
|
||||||
|
|
||||||
|
if (cameraType == DJI_CAMERA_TYPE_L1 || cameraType == DJI_CAMERA_TYPE_P1) {
|
||||||
|
USER_LOG_INFO("Camera type %d does not support to get camera stauts such as "
|
||||||
|
"capturing state, recording state.", cameraType);
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < 30; i++) {
|
||||||
|
returnCode = DjiCameraManager_GetCapturingState(mountPosition, &capturingState);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_INFO("Get capturing state failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetRecordingState(mountPosition, &recordingState);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_INFO("Get recording state failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetRecordingTime(mountPosition, &recordingTime);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_INFO("Get recording time failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_GetIntervalShootingRemainTime(mountPosition, &remainingTime);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_INFO("Get interval shooting remain time failed!");
|
||||||
|
goto exitCameraModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("cap_state: %d, rec_state: %d, rec_time: %d, cap_remain: %d",
|
||||||
|
capturingState,
|
||||||
|
recordingState,
|
||||||
|
recordingTime,
|
||||||
|
remainingTime);
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
USER_LOG_ERROR("There is no valid command input!");
|
USER_LOG_ERROR("There is no valid command input!");
|
||||||
break;
|
break;
|
||||||
@ -1289,6 +2161,11 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_ObtainDownloaderRights(position);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Obtain downloader rights failed, error code: 0x%08X.", returnCode);
|
||||||
|
}
|
||||||
|
|
||||||
returnCode = DjiCameraManager_DownloadFileList(position, &s_meidaFileList);
|
returnCode = DjiCameraManager_DownloadFileList(position, &s_meidaFileList);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Download file list failed, error code: 0x%08X.", returnCode);
|
USER_LOG_ERROR("Download file list failed, error code: 0x%08X.", returnCode);
|
||||||
@ -1360,6 +2237,11 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj
|
|||||||
USER_LOG_WARN("Media file is not existed in sdcard.\r\n");
|
USER_LOG_WARN("Media file is not existed in sdcard.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_ReleaseDownloaderRights(position);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Release downloader rights failed, error code: 0x%08X.", returnCode);
|
||||||
|
}
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1377,6 +2259,11 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadFileListBySlices(E_DjiM
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_ObtainDownloaderRights(position);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Obtain downloader rights failed, error code: 0x%08X.", returnCode);
|
||||||
|
}
|
||||||
|
|
||||||
sliceConfig.countPerSlice = DJI_CAMERA_MANAGER_FILE_LIST_COUNT_ALL_PER_SLICE;
|
sliceConfig.countPerSlice = DJI_CAMERA_MANAGER_FILE_LIST_COUNT_ALL_PER_SLICE;
|
||||||
sliceConfig.sliceStartIndex = 0;
|
sliceConfig.sliceStartIndex = 0;
|
||||||
|
|
||||||
@ -1431,6 +2318,11 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadFileListBySlices(E_DjiM
|
|||||||
USER_LOG_WARN("Media file is not existed in sdcard.\r\n");
|
USER_LOG_WARN("Media file is not existed in sdcard.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
returnCode = DjiCameraManager_ReleaseDownloaderRights(position);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Release downloader rights failed, error code: 0x%08X.", returnCode);
|
||||||
|
}
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1463,18 +2355,21 @@ static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownlo
|
|||||||
if (s_downloadMediaFile != NULL) {
|
if (s_downloadMediaFile != NULL) {
|
||||||
fwrite(data, 1, len, s_downloadMediaFile);
|
fwrite(data, 1, len, s_downloadMediaFile);
|
||||||
}
|
}
|
||||||
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %d, fileIndex: %d\033[0m\r\n",
|
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %u, fileIndex: %d\033[0m\r\n",
|
||||||
packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex);
|
packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex);
|
||||||
printf("\033[1A");
|
printf("\033[1A");
|
||||||
USER_LOG_DEBUG("Transfer download media file data, len: %d, percent: %.1f", len, packetInfo.progressInPercent);
|
USER_LOG_DEBUG("Transfer download media file data, len: %d, percent: %.1f", len, packetInfo.progressInPercent);
|
||||||
} else if (packetInfo.downloadFileEvent == DJI_DOWNLOAD_FILE_EVENT_END) {
|
} else if (packetInfo.downloadFileEvent == DJI_DOWNLOAD_FILE_EVENT_END) {
|
||||||
if (s_downloadMediaFile != NULL) {
|
if (s_downloadMediaFile == NULL) {
|
||||||
fwrite(data, 1, len, s_downloadMediaFile);
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fwrite(data, 1, len, s_downloadMediaFile);
|
||||||
|
|
||||||
osalHandler->GetTimeMs(&downloadEndMs);
|
osalHandler->GetTimeMs(&downloadEndMs);
|
||||||
|
|
||||||
downloadSpeed = (float) packetInfo.fileSize / (float) (downloadEndMs - downloadStartMs);
|
downloadSpeed = (float) packetInfo.fileSize / (float) (downloadEndMs - downloadStartMs);
|
||||||
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %d, fileIndex: %d\033[0m\r\n",
|
printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %u, fileIndex: %d\033[0m\r\n",
|
||||||
packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex);
|
packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex);
|
||||||
printf("\033[1A");
|
printf("\033[1A");
|
||||||
printf("\r\n");
|
printf("\r\n");
|
||||||
|
|||||||
@ -56,6 +56,22 @@ typedef enum {
|
|||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY,
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_THERMOMETRY,
|
||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO,
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_LIDAR_RANGING_INFO,
|
||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM,
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_IR_CAMERA_ZOOM_PARAM,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_NIGHT_SCENE_MODE,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_CAPTURE_RECORDING_STREAMS,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SHOW_STORAGE_INFO,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FORMAT_SD_CARD,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_LINK_ZOOM,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_USER_CUSTOM_DIR_FILE_NAME,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_RESET_CAMERA_SETTINGS,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_AE_LOCK_MODE,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_FOCUS_RING_VALUE,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_CONNECT_STATUS_TEST,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GET_PHOTO_VIDEO_PARAM,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_MODE,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_METERING_POINT,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_FFC_MODE_AND_TRRIGER,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_SET_GAIN_MODE,
|
||||||
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_GET_CAMERA_STATUS,
|
||||||
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_INDEX_MAX
|
E_DJI_TEST_CAMERA_MANAGER_SAMPLE_SELECT_INDEX_MAX
|
||||||
} E_DjiTestCameraManagerSampleSelect;
|
} E_DjiTestCameraManagerSampleSelect;
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
|||||||
@ -42,7 +42,8 @@
|
|||||||
/* Private functions declaration ---------------------------------------------*/
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
static void *UserDataTransmission_Task(void *arg);
|
static void *UserDataTransmission_Task(void *arg);
|
||||||
static T_DjiReturnCode ReceiveDataFromMobile(const uint8_t *data, uint16_t len);
|
static T_DjiReturnCode ReceiveDataFromMobile(const uint8_t *data, uint16_t len);
|
||||||
static T_DjiReturnCode ReceiveDataFromOnboardComputer(const uint8_t *data, uint16_t len);
|
static T_DjiReturnCode ReceiveDataFromCloud(const uint8_t *data, uint16_t len);
|
||||||
|
static T_DjiReturnCode ReceiveDataFromExtensionPort(const uint8_t *data, uint16_t len);
|
||||||
static T_DjiReturnCode ReceiveDataFromPayload(const uint8_t *data, uint16_t len);
|
static T_DjiReturnCode ReceiveDataFromPayload(const uint8_t *data, uint16_t len);
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
@ -79,13 +80,23 @@ T_DjiReturnCode DjiTest_DataTransmissionStartService(void)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s_aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
||||||
|
s_aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T) {
|
||||||
|
channelAddress = DJI_CHANNEL_ADDRESS_CLOUD_API;
|
||||||
|
djiStat = DjiLowSpeedDataChannel_RegRecvDataCallback(channelAddress, ReceiveDataFromCloud);
|
||||||
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("register receive data from cloud error.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 ||
|
if (s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 ||
|
||||||
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 ||
|
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 ||
|
||||||
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3) {
|
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3) {
|
||||||
channelAddress = DJI_CHANNEL_ADDRESS_EXTENSION_PORT;
|
channelAddress = DJI_CHANNEL_ADDRESS_EXTENSION_PORT;
|
||||||
djiStat = DjiLowSpeedDataChannel_RegRecvDataCallback(channelAddress, ReceiveDataFromOnboardComputer);
|
djiStat = DjiLowSpeedDataChannel_RegRecvDataCallback(channelAddress, ReceiveDataFromExtensionPort);
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("register receive data from onboard coputer error.");
|
USER_LOG_ERROR("register receive data from extension port error.");
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +163,7 @@ T_DjiReturnCode DjiTest_DataTransmissionStopService(void)
|
|||||||
static void *UserDataTransmission_Task(void *arg)
|
static void *UserDataTransmission_Task(void *arg)
|
||||||
{
|
{
|
||||||
T_DjiReturnCode djiStat;
|
T_DjiReturnCode djiStat;
|
||||||
const uint8_t dataToBeSent[] = "DJI Data Transmission Test Data.\r\n";
|
const uint8_t dataToBeSent[] = "DJI Data Transmission Test Data.";
|
||||||
T_DjiDataChannelState state = {0};
|
T_DjiDataChannelState state = {0};
|
||||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
E_DjiChannelAddress channelAddress;
|
E_DjiChannelAddress channelAddress;
|
||||||
@ -177,25 +188,44 @@ static void *UserDataTransmission_Task(void *arg)
|
|||||||
USER_LOG_ERROR("get send to mobile channel state error.");
|
USER_LOG_ERROR("get send to mobile channel state error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s_aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30 ||
|
||||||
|
s_aircraftInfoBaseInfo.aircraftType == DJI_AIRCRAFT_TYPE_M30T) {
|
||||||
|
channelAddress = DJI_CHANNEL_ADDRESS_CLOUD_API;
|
||||||
|
djiStat = DjiLowSpeedDataChannel_SendData(channelAddress, dataToBeSent, sizeof(dataToBeSent));
|
||||||
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||||
|
USER_LOG_ERROR("send data to cloud error.");
|
||||||
|
|
||||||
|
djiStat = DjiLowSpeedDataChannel_GetSendDataState(channelAddress, &state);
|
||||||
|
if (djiStat == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_DEBUG(
|
||||||
|
"send to cloud state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
||||||
|
state.realtimeBandwidthBeforeFlowController, state.realtimeBandwidthAfterFlowController,
|
||||||
|
state.busyState);
|
||||||
|
} else {
|
||||||
|
USER_LOG_ERROR("get send to cloud channel state error.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 ||
|
if (s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO1 ||
|
||||||
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 ||
|
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO2 ||
|
||||||
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3) {
|
s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_PAYLOAD_PORT_NO3) {
|
||||||
channelAddress = DJI_CHANNEL_ADDRESS_EXTENSION_PORT;
|
channelAddress = DJI_CHANNEL_ADDRESS_EXTENSION_PORT;
|
||||||
djiStat = DjiLowSpeedDataChannel_SendData(channelAddress, dataToBeSent, sizeof(dataToBeSent));
|
djiStat = DjiLowSpeedDataChannel_SendData(channelAddress, dataToBeSent, sizeof(dataToBeSent));
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||||
USER_LOG_ERROR("send data to onboard computer error.");
|
USER_LOG_ERROR("send data to extension port error.");
|
||||||
|
|
||||||
djiStat = DjiLowSpeedDataChannel_GetSendDataState(channelAddress, &state);
|
djiStat = DjiLowSpeedDataChannel_GetSendDataState(channelAddress, &state);
|
||||||
if (djiStat == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (djiStat == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_DEBUG(
|
USER_LOG_DEBUG(
|
||||||
"send to onboard computer state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
"send to extension port state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
||||||
state.realtimeBandwidthBeforeFlowController, state.realtimeBandwidthAfterFlowController,
|
state.realtimeBandwidthBeforeFlowController, state.realtimeBandwidthAfterFlowController,
|
||||||
state.busyState);
|
state.busyState);
|
||||||
} else {
|
} else {
|
||||||
USER_LOG_ERROR("get send to onboard computer channel state error.");
|
USER_LOG_ERROR("get send to extension port channel state error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DjiPlatform_GetSocketHandler() != NULL) {
|
if (DjiPlatform_GetSocketHandler() != NULL) {
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
djiStat = DjiHighSpeedDataChannel_SendDataStreamData(dataToBeSent, sizeof(dataToBeSent));
|
djiStat = DjiHighSpeedDataChannel_SendDataStreamData(dataToBeSent, sizeof(dataToBeSent));
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||||
USER_LOG_ERROR("send data to data stream error.");
|
USER_LOG_ERROR("send data to data stream error.");
|
||||||
@ -208,21 +238,22 @@ static void *UserDataTransmission_Task(void *arg)
|
|||||||
} else {
|
} else {
|
||||||
USER_LOG_ERROR("get data stream state error.");
|
USER_LOG_ERROR("get data stream state error.");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else if (s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_EXTENSION_PORT) {
|
} else if (s_aircraftInfoBaseInfo.mountPosition == DJI_MOUNT_POSITION_EXTENSION_PORT) {
|
||||||
channelAddress = DJI_CHANNEL_ADDRESS_PAYLOAD_PORT_NO1;
|
channelAddress = DJI_CHANNEL_ADDRESS_PAYLOAD_PORT_NO1;
|
||||||
djiStat = DjiLowSpeedDataChannel_SendData(channelAddress, dataToBeSent, sizeof(dataToBeSent));
|
djiStat = DjiLowSpeedDataChannel_SendData(channelAddress, dataToBeSent, sizeof(dataToBeSent));
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
||||||
USER_LOG_ERROR("send data to onboard computer error.");
|
USER_LOG_ERROR("send data to extension port error.");
|
||||||
|
|
||||||
djiStat = DjiLowSpeedDataChannel_GetSendDataState(channelAddress, &state);
|
djiStat = DjiLowSpeedDataChannel_GetSendDataState(channelAddress, &state);
|
||||||
if (djiStat == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (djiStat == DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_DEBUG(
|
USER_LOG_DEBUG(
|
||||||
"send to onboard computer state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
"send to extension port state: realtimeBandwidthBeforeFlowController: %d, realtimeBandwidthAfterFlowController: %d, busyState: %d.",
|
||||||
state.realtimeBandwidthBeforeFlowController, state.realtimeBandwidthAfterFlowController,
|
state.realtimeBandwidthBeforeFlowController, state.realtimeBandwidthAfterFlowController,
|
||||||
state.busyState);
|
state.busyState);
|
||||||
} else {
|
} else {
|
||||||
USER_LOG_ERROR("get send to onboard computer channel state error.");
|
USER_LOG_ERROR("get send to extension port channel state error.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,7 +284,7 @@ static T_DjiReturnCode ReceiveDataFromMobile(const uint8_t *data, uint16_t len)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static T_DjiReturnCode ReceiveDataFromOnboardComputer(const uint8_t *data, uint16_t len)
|
static T_DjiReturnCode ReceiveDataFromCloud(const uint8_t *data, uint16_t len)
|
||||||
{
|
{
|
||||||
char *printData = NULL;
|
char *printData = NULL;
|
||||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
@ -266,7 +297,28 @@ static T_DjiReturnCode ReceiveDataFromOnboardComputer(const uint8_t *data, uint1
|
|||||||
|
|
||||||
strncpy(printData, (const char *) data, len);
|
strncpy(printData, (const char *) data, len);
|
||||||
printData[len] = '\0';
|
printData[len] = '\0';
|
||||||
USER_LOG_INFO("receive data from onboard computer: %s, len:%d.", printData, len);
|
USER_LOG_INFO("receive data from cloud: %s, len:%d.", printData, len);
|
||||||
|
DjiTest_WidgetLogAppend("receive data: %s, len:%d.", printData, len);
|
||||||
|
|
||||||
|
osalHandler->Free(printData);
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static T_DjiReturnCode ReceiveDataFromExtensionPort(const uint8_t *data, uint16_t len)
|
||||||
|
{
|
||||||
|
char *printData = NULL;
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
|
||||||
|
printData = osalHandler->Malloc(len + 1);
|
||||||
|
if (printData == NULL) {
|
||||||
|
USER_LOG_ERROR("malloc memory for printData fail.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_MEMORY_ALLOC_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy(printData, (const char *) data, len);
|
||||||
|
printData[len] = '\0';
|
||||||
|
USER_LOG_INFO("receive data from extension port: %s, len:%d.", printData, len);
|
||||||
DjiTest_WidgetLogAppend("receive data: %s, len:%d.", printData, len);
|
DjiTest_WidgetLogAppend("receive data: %s, len:%d.", printData, len);
|
||||||
|
|
||||||
osalHandler->Free(printData);
|
osalHandler->Free(printData);
|
||||||
|
|||||||
@ -147,9 +147,9 @@ T_DjiReturnCode DjiTest_FcSubscriptionRunSample(void)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 3: Get latest value of the subscribed topics in the next 20 seconds\r\n");
|
USER_LOG_INFO("--> Step 3: Get latest value of the subscribed topics in the next 10 seconds\r\n");
|
||||||
|
|
||||||
for (int i = 0; i < 20; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
osalHandler->TaskSleepMs(1000 / FC_SUBSCRIPTION_TASK_FREQ);
|
osalHandler->TaskSleepMs(1000 / FC_SUBSCRIPTION_TASK_FREQ);
|
||||||
djiStat = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_VELOCITY,
|
djiStat = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_VELOCITY,
|
||||||
(uint8_t *) &velocity,
|
(uint8_t *) &velocity,
|
||||||
@ -204,7 +204,26 @@ T_DjiReturnCode DjiTest_FcSubscriptionRunSample(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 4: Deinit fc subscription module");
|
USER_LOG_INFO("--> Step 4: Unsubscribe the topics of quaternion, velocity and gps position");
|
||||||
|
djiStat = DjiFcSubscription_UnSubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_QUATERNION);
|
||||||
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("UnSubscribe topic quaternion error.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
djiStat = DjiFcSubscription_UnSubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_VELOCITY);
|
||||||
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("UnSubscribe topic quaternion error.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
djiStat = DjiFcSubscription_UnSubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GPS_POSITION);
|
||||||
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("UnSubscribe topic quaternion error.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("--> Step 5: Deinit fc subscription module");
|
||||||
|
|
||||||
djiStat = DjiFcSubscription_DeInit();
|
djiStat = DjiFcSubscription_DeInit();
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
|||||||
@ -34,14 +34,6 @@
|
|||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
/* Private types -------------------------------------------------------------*/
|
||||||
#pragma pack(1)
|
|
||||||
typedef struct {
|
|
||||||
dji_f32_t x;
|
|
||||||
dji_f32_t y;
|
|
||||||
dji_f32_t z;
|
|
||||||
} T_DjiTestFlightControlVector3f; // pack(1)
|
|
||||||
#pragma pack()
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
E_DjiFcSubscriptionDisplayMode displayMode;
|
E_DjiFcSubscriptionDisplayMode displayMode;
|
||||||
char *displayModeStr;
|
char *displayModeStr;
|
||||||
@ -96,8 +88,6 @@ static bool DjiTest_FlightControlMoveByPositionOffset(T_DjiTestFlightControlVect
|
|||||||
float yawDesiredInDeg,
|
float yawDesiredInDeg,
|
||||||
float posThresholdInM,
|
float posThresholdInM,
|
||||||
float yawThresholdInDeg);
|
float yawThresholdInDeg);
|
||||||
static void DjiTest_FlightControlVelocityAndYawRateCtrl(T_DjiTestFlightControlVector3f offsetDesired, float yawRate,
|
|
||||||
uint32_t timeMs);
|
|
||||||
static T_DjiReturnCode DjiTest_FlightControlInit(void);
|
static T_DjiReturnCode DjiTest_FlightControlInit(void);
|
||||||
static T_DjiReturnCode DjiTest_FlightControlDeInit(void);
|
static T_DjiReturnCode DjiTest_FlightControlDeInit(void);
|
||||||
static void DjiTest_FlightControlTakeOffLandingSample(void);
|
static void DjiTest_FlightControlTakeOffLandingSample(void);
|
||||||
@ -138,11 +128,16 @@ T_DjiReturnCode DjiTest_FlightControlRunSample(E_DjiTestFlightCtrlSampleSelect f
|
|||||||
T_DjiReturnCode DjiTest_FlightControlInit(void)
|
T_DjiReturnCode DjiTest_FlightControlInit(void)
|
||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
|
T_DjiFlightControllerRidInfo ridInfo = {0};
|
||||||
|
|
||||||
s_osalHandler = DjiPlatform_GetOsalHandler();
|
s_osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
if (!s_osalHandler) return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
if (!s_osalHandler) return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
|
|
||||||
returnCode = DjiFlightController_Init();
|
ridInfo.latitude = 22.542812;
|
||||||
|
ridInfo.longitude = 113.958902;
|
||||||
|
ridInfo.altitude = 10;
|
||||||
|
|
||||||
|
returnCode = DjiFlightController_Init(ridInfo);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Init flight controller module failed, error code:0x%08llX", returnCode);
|
USER_LOG_ERROR("Init flight controller module failed, error code:0x%08llX", returnCode);
|
||||||
return returnCode;
|
return returnCode;
|
||||||
@ -236,7 +231,7 @@ T_DjiReturnCode DjiTest_FlightControlDeInit(void)
|
|||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
|
|
||||||
returnCode = DjiFlightController_Deinit();
|
returnCode = DjiFlightController_DeInit();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Deinit flight controller module failed, error code:0x%08llX",
|
USER_LOG_ERROR("Deinit flight controller module failed, error code:0x%08llX",
|
||||||
returnCode);
|
returnCode);
|
||||||
@ -325,25 +320,25 @@ void DjiTest_FlightControlPositionControlSample()
|
|||||||
USER_LOG_INFO("Successful take off\r\n");
|
USER_LOG_INFO("Successful take off\r\n");
|
||||||
DjiTest_WidgetLogAppend("Successful take off\r\n");
|
DjiTest_WidgetLogAppend("Successful take off\r\n");
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 3: Move to north:0(m), earth:6(m), up:6(m) , yaw:30(degree) from current point");
|
USER_LOG_INFO("--> Step 3: Move to north:0(m), east:6(m), up:6(m) , yaw:30(degree) from current point");
|
||||||
DjiTest_WidgetLogAppend("--> Step 3: Move to north:0(m), earth:6(m), up:6(m) , yaw:30(degree) from current point");
|
DjiTest_WidgetLogAppend("--> Step 3: Move to north:0(m), east:6(m), up:6(m) , yaw:30(degree) from current point");
|
||||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {0, 6, 6}, 30, 0.8, 1)) {
|
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {0, 6, 6}, 30, 0.8, 1)) {
|
||||||
USER_LOG_ERROR("Move to north:0(m), earth:6(m), up:6(m) , yaw:30(degree) from current point failed");
|
USER_LOG_ERROR("Move to north:0(m), east:6(m), up:6(m) , yaw:30(degree) from current point failed");
|
||||||
goto out;
|
goto out;
|
||||||
};
|
};
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 4: Move to north:6(m), earth:0(m), up:-3(m) , yaw:-30(degree) from current point");
|
USER_LOG_INFO("--> Step 4: Move to north:6(m), east:0(m), up:-3(m) , yaw:-30(degree) from current point");
|
||||||
DjiTest_WidgetLogAppend(
|
DjiTest_WidgetLogAppend(
|
||||||
"--> Step 4: Move to north:6(m), earth:0(m), up:-3(m) , yaw:-30(degree) from current point");
|
"--> Step 4: Move to north:6(m), east:0(m), up:-3(m) , yaw:-30(degree) from current point");
|
||||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {6, 0, -3}, -30, 0.8, 1)) {
|
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {6, 0, -3}, -30, 0.8, 1)) {
|
||||||
USER_LOG_ERROR("Move to north:6(m), earth:0(m), up:-3(m) , yaw:-30(degree) from current point failed");
|
USER_LOG_ERROR("Move to north:6(m), east:0(m), up:-3(m) , yaw:-30(degree) from current point failed");
|
||||||
goto out;
|
goto out;
|
||||||
};
|
};
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 5: Move to north:-6(m), earth:-6(m), up:0(m) , yaw:0(degree) from current point");
|
USER_LOG_INFO("--> Step 5: Move to north:-6(m), east:-6(m), up:0(m) , yaw:0(degree) from current point");
|
||||||
DjiTest_WidgetLogAppend("--> Step 5: Move to north:-6(m), earth:-6(m), up:0(m) , yaw:0(degree) from current point");
|
DjiTest_WidgetLogAppend("--> Step 5: Move to north:-6(m), east:-6(m), up:0(m) , yaw:0(degree) from current point");
|
||||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {-6, -6, 0}, 0, 0.8, 1)) {
|
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {-6, -6, 0}, 0, 0.8, 1)) {
|
||||||
USER_LOG_ERROR("Move to north:-6(m), earth:-6(m), up:0(m) , yaw:0(degree) from current point failed");
|
USER_LOG_ERROR("Move to north:-6(m), east:-6(m), up:0(m) , yaw:0(degree) from current point failed");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,17 +389,17 @@ void DjiTest_FlightControlGoHomeForceLandingSample()
|
|||||||
USER_LOG_INFO("Successful take off\r\n");
|
USER_LOG_INFO("Successful take off\r\n");
|
||||||
DjiTest_WidgetLogAppend("Successful take off\r\n");
|
DjiTest_WidgetLogAppend("Successful take off\r\n");
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 3: Move to north:0(m), earth:0(m), up:30(m) , yaw:0(degree) from current point");
|
USER_LOG_INFO("--> Step 3: Move to north:0(m), east:0(m), up:30(m) , yaw:0(degree) from current point");
|
||||||
DjiTest_WidgetLogAppend("--> Step 3: Move to north:0(m), earth:0(m), up:30(m) , yaw:0(degree) from current point");
|
DjiTest_WidgetLogAppend("--> Step 3: Move to north:0(m), east:0(m), up:30(m) , yaw:0(degree) from current point");
|
||||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {0, 0, 30}, 0, 0.8, 1)) {
|
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {0, 0, 30}, 0, 0.8, 1)) {
|
||||||
USER_LOG_ERROR("Move to north:0(m), earth:0(m), up:30(m) , yaw:0(degree) from current point failed");
|
USER_LOG_ERROR("Move to north:0(m), east:0(m), up:30(m) , yaw:0(degree) from current point failed");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 4: Move to north:10(m), earth:0(m), up:0(m) , yaw:0(degree) from current point");
|
USER_LOG_INFO("--> Step 4: Move to north:10(m), east:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||||
DjiTest_WidgetLogAppend("--> Step 4: Move to north:10(m), earth:0(m), up:0(m) , yaw:0(degree) from current point");
|
DjiTest_WidgetLogAppend("--> Step 4: Move to north:10(m), east:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {10, 0, 0}, 0, 0.8, 1)) {
|
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {10, 0, 0}, 0, 0.8, 1)) {
|
||||||
USER_LOG_ERROR("Move to north:10(m), earth:0(m), up:0(m) , yaw:0(degree) from current point failed");
|
USER_LOG_ERROR("Move to north:10(m), east:0(m), up:0(m) , yaw:0(degree) from current point failed");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,10 +429,10 @@ void DjiTest_FlightControlGoHomeForceLandingSample()
|
|||||||
USER_LOG_INFO("Current go home altitude is %d m\r\n", goHomeAltitude);
|
USER_LOG_INFO("Current go home altitude is %d m\r\n", goHomeAltitude);
|
||||||
DjiTest_WidgetLogAppend("Current go home altitude is %d m\r\n", goHomeAltitude);
|
DjiTest_WidgetLogAppend("Current go home altitude is %d m\r\n", goHomeAltitude);
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 7: Move to north:20(m), earth:0(m), up:0(m) , yaw:0(degree) from current point");
|
USER_LOG_INFO("--> Step 7: Move to north:20(m), east:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||||
DjiTest_WidgetLogAppend("--> Step 7: Move to north:20(m), earth:0(m), up:0(m) , yaw:0(degree) from current point");
|
DjiTest_WidgetLogAppend("--> Step 7: Move to north:20(m), east:0(m), up:0(m) , yaw:0(degree) from current point");
|
||||||
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {20, 0, 0}, 0, 0.8, 1)) {
|
if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {20, 0, 0}, 0, 0.8, 1)) {
|
||||||
USER_LOG_ERROR("Move to north:20(m), earth:0(m), up:0(m) , yaw:0(degree) from current point failed");
|
USER_LOG_ERROR("Move to north:20(m), east:0(m), up:0(m) , yaw:0(degree) from current point failed");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,9 +484,9 @@ void DjiTest_FlightControlVelocityControlSample()
|
|||||||
DjiTest_WidgetLogAppend("Successful take off\r\n");
|
DjiTest_WidgetLogAppend("Successful take off\r\n");
|
||||||
|
|
||||||
USER_LOG_INFO(
|
USER_LOG_INFO(
|
||||||
"--> Step 3: Move with north:0(m/s), earth:0(m/s), up:5(m/s), yaw:0(deg/s) from current point for 2s!");
|
"--> Step 3: Move with north:0(m/s), east:0(m/s), up:5(m/s), yaw:0(deg/s) from current point for 2s!");
|
||||||
DjiTest_WidgetLogAppend(
|
DjiTest_WidgetLogAppend(
|
||||||
"--> Step 3: Move with north:0(m/s), earth:0(m/s), up:5(m/s), yaw:0(deg/s) from current point for 2s!");
|
"--> Step 3: Move with north:0(m/s), east:0(m/s), up:5(m/s), yaw:0(deg/s) from current point for 2s!");
|
||||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {0, 0, 5.0}, 0, 2000);
|
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {0, 0, 5.0}, 0, 2000);
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 4: Emergency brake for 2s");
|
USER_LOG_INFO("--> Step 4: Emergency brake for 2s");
|
||||||
@ -509,9 +504,9 @@ void DjiTest_FlightControlVelocityControlSample()
|
|||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_INFO(
|
USER_LOG_INFO(
|
||||||
"--> Step 5: Move with north:-1.5(m/s), earth:2(m/s), up:0(m/s), yaw:20(deg/s) from current point for 2s!");
|
"--> Step 5: Move with north:-1.5(m/s), east:2(m/s), up:0(m/s), yaw:20(deg/s) from current point for 2s!");
|
||||||
DjiTest_WidgetLogAppend(
|
DjiTest_WidgetLogAppend(
|
||||||
"--> Step 5: Move with north:-1.5(m/s), earth:2(m/s), up:0(m/s), yaw:20(deg/s) from current point for 2s!");
|
"--> Step 5: Move with north:-1.5(m/s), east:2(m/s), up:0(m/s), yaw:20(deg/s) from current point for 2s!");
|
||||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {-1.5, 2, 0}, 20, 2000);
|
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {-1.5, 2, 0}, 20, 2000);
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 6: Emergency brake for 2s");
|
USER_LOG_INFO("--> Step 6: Emergency brake for 2s");
|
||||||
@ -529,9 +524,9 @@ void DjiTest_FlightControlVelocityControlSample()
|
|||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_INFO(
|
USER_LOG_INFO(
|
||||||
"--> Step 7: Move with north:3(m/s), earth:0(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.5s!");
|
"--> Step 7: Move with north:3(m/s), east:0(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.5s!");
|
||||||
DjiTest_WidgetLogAppend(
|
DjiTest_WidgetLogAppend(
|
||||||
"--> Step 7: Move with north:3(m/s), earth:0(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.5s!");
|
"--> Step 7: Move with north:3(m/s), east:0(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.5s!");
|
||||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {3, 0, 0}, 0, 2500);
|
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {3, 0, 0}, 0, 2500);
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 8: Emergency brake for 2s");
|
USER_LOG_INFO("--> Step 8: Emergency brake for 2s");
|
||||||
@ -549,9 +544,9 @@ void DjiTest_FlightControlVelocityControlSample()
|
|||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_INFO(
|
USER_LOG_INFO(
|
||||||
"--> Step 9: Move with north:-1.6(m/s), earth:-2(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.2s!");
|
"--> Step 9: Move with north:-1.6(m/s), east:-2(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.2s!");
|
||||||
DjiTest_WidgetLogAppend(
|
DjiTest_WidgetLogAppend(
|
||||||
"--> Step 9: Move with north:-1.6(m/s), earth:-2(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.2s!");
|
"--> Step 9: Move with north:-1.6(m/s), east:-2(m/s), up:0(m/s), yaw:0(deg/s) from current point for 2.2s!");
|
||||||
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {-1.6, -2, 0}, 0, 2200);
|
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {-1.6, -2, 0}, 0, 2200);
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 10: Emergency brake for 2s");
|
USER_LOG_INFO("--> Step 10: Emergency brake for 2s");
|
||||||
@ -1218,6 +1213,12 @@ bool DjiTest_FlightControlGoHomeAndConfirmLanding(void)
|
|||||||
{
|
{
|
||||||
T_DjiReturnCode djiStat;
|
T_DjiReturnCode djiStat;
|
||||||
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||||
|
E_DjiFlightControllerObstacleAvoidanceEnableStatus enableStatus;
|
||||||
|
|
||||||
|
djiStat = DjiFlightController_GetDownwardsVisualObstacleAvoidanceEnableStatus(&enableStatus);
|
||||||
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("get downwards visual obstacle avoidance enable status error");
|
||||||
|
}
|
||||||
|
|
||||||
djiStat = DjiAircraftInfo_GetBaseInfo(&aircraftInfoBaseInfo);
|
djiStat = DjiAircraftInfo_GetBaseInfo(&aircraftInfoBaseInfo);
|
||||||
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -1272,11 +1273,20 @@ bool DjiTest_FlightControlGoHomeAndConfirmLanding(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DjiTest_FlightControlCheckActionStarted(DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING)) {
|
if (enableStatus == DJI_FLIGHT_CONTROLLER_ENABLE_OBSTACLE_AVOIDANCE) {
|
||||||
return false;
|
if (!DjiTest_FlightControlCheckActionStarted(DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
while (DjiTest_FlightControlGetValueOfFlightStatus() == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR &&
|
||||||
|
DjiTest_FlightControlGetValueOfDisplayMode() ==
|
||||||
|
DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING) {
|
||||||
|
s_osalHandler->TaskSleepMs(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
while (DjiTest_FlightControlGetValueOfFlightStatus() == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR &&
|
while (DjiTest_FlightControlGetValueOfFlightStatus() == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR &&
|
||||||
DjiTest_FlightControlGetValueOfDisplayMode() == DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING) {
|
DjiTest_FlightControlGetValueOfDisplayMode() ==
|
||||||
|
DJI_FC_SUBSCRIPTION_DISPLAY_MODE_FORCE_AUTO_LANDING) {
|
||||||
s_osalHandler->TaskSleepMs(1000);
|
s_osalHandler->TaskSleepMs(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1454,11 +1464,12 @@ DjiTest_FlightControlMoveByPositionOffset(const T_DjiTestFlightControlVector3f o
|
|||||||
void DjiTest_FlightControlVelocityAndYawRateCtrl(const T_DjiTestFlightControlVector3f offsetDesired, float yawRate,
|
void DjiTest_FlightControlVelocityAndYawRateCtrl(const T_DjiTestFlightControlVector3f offsetDesired, float yawRate,
|
||||||
uint32_t timeMs)
|
uint32_t timeMs)
|
||||||
{
|
{
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
uint32_t originTime = 0;
|
uint32_t originTime = 0;
|
||||||
uint32_t currentTime = 0;
|
uint32_t currentTime = 0;
|
||||||
uint32_t elapsedTimeInMs = 0;
|
uint32_t elapsedTimeInMs = 0;
|
||||||
s_osalHandler->GetTimeMs(&originTime);
|
osalHandler->GetTimeMs(&originTime);
|
||||||
s_osalHandler->GetTimeMs(¤tTime);
|
osalHandler->GetTimeMs(¤tTime);
|
||||||
elapsedTimeInMs = currentTime - originTime;
|
elapsedTimeInMs = currentTime - originTime;
|
||||||
T_DjiFlightControllerJoystickMode joystickMode = {
|
T_DjiFlightControllerJoystickMode joystickMode = {
|
||||||
DJI_FLIGHT_CONTROLLER_HORIZONTAL_VELOCITY_CONTROL_MODE,
|
DJI_FLIGHT_CONTROLLER_HORIZONTAL_VELOCITY_CONTROL_MODE,
|
||||||
@ -1474,8 +1485,8 @@ void DjiTest_FlightControlVelocityAndYawRateCtrl(const T_DjiTestFlightControlVec
|
|||||||
|
|
||||||
while (elapsedTimeInMs <= timeMs) {
|
while (elapsedTimeInMs <= timeMs) {
|
||||||
DjiFlightController_ExecuteJoystickAction(joystickCommand);
|
DjiFlightController_ExecuteJoystickAction(joystickCommand);
|
||||||
s_osalHandler->TaskSleepMs(2);
|
osalHandler->TaskSleepMs(2);
|
||||||
s_osalHandler->GetTimeMs(¤tTime);
|
osalHandler->GetTimeMs(¤tTime);
|
||||||
elapsedTimeInMs = currentTime - originTime;
|
elapsedTimeInMs = currentTime - originTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,10 +44,20 @@ typedef enum {
|
|||||||
E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM,
|
E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM,
|
||||||
} E_DjiTestFlightCtrlSampleSelect;
|
} E_DjiTestFlightCtrlSampleSelect;
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
typedef struct {
|
||||||
|
dji_f32_t x;
|
||||||
|
dji_f32_t y;
|
||||||
|
dji_f32_t z;
|
||||||
|
} T_DjiTestFlightControlVector3f; // pack(1)
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
T_DjiReturnCode DjiTest_FlightControlRunSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect);
|
T_DjiReturnCode DjiTest_FlightControlRunSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect);
|
||||||
|
void DjiTest_FlightControlVelocityAndYawRateCtrl(const T_DjiTestFlightControlVector3f offsetDesired, float yawRate,
|
||||||
|
uint32_t timeMs);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,8 @@
|
|||||||
#include "dji_platform.h"
|
#include "dji_platform.h"
|
||||||
#include "dji_logger.h"
|
#include "dji_logger.h"
|
||||||
#include "dji_gimbal_manager.h"
|
#include "dji_gimbal_manager.h"
|
||||||
|
#include "dji_fc_subscription.h"
|
||||||
|
#include "dji_aircraft_info.h"
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
@ -73,10 +75,26 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
T_DjiGimbalManagerRotation rotation;
|
T_DjiGimbalManagerRotation rotation;
|
||||||
|
T_DjiAircraftInfoBaseInfo baseInfo;
|
||||||
|
E_DjiAircraftSeries aircraftSeries;
|
||||||
|
|
||||||
|
returnCode = DjiAircraftInfo_GetBaseInfo(&baseInfo);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed to get aircraft base info, return code 0x%08X", returnCode);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
aircraftSeries = baseInfo.aircraftSeries;
|
||||||
|
|
||||||
USER_LOG_INFO("Gimbal manager sample start");
|
USER_LOG_INFO("Gimbal manager sample start");
|
||||||
DjiTest_WidgetLogAppend("Gimbal manager sample start");
|
DjiTest_WidgetLogAppend("Gimbal manager sample start");
|
||||||
|
|
||||||
|
returnCode = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, DJI_DATA_SUBSCRIPTION_TOPIC_50_HZ, NULL);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed to subscribe topic %d, 0x%08X", DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, returnCode);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 1: Init gimbal manager module");
|
USER_LOG_INFO("--> Step 1: Init gimbal manager module");
|
||||||
DjiTest_WidgetLogAppend("--> Step 1: Init gimbal manager module");
|
DjiTest_WidgetLogAppend("--> Step 1: Init gimbal manager module");
|
||||||
returnCode = DjiGimbalManager_Init();
|
returnCode = DjiGimbalManager_Init();
|
||||||
@ -99,7 +117,7 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 3: Reset gimbal angles.\r\n");
|
USER_LOG_INFO("--> Step 3: Reset gimbal angles.\r\n");
|
||||||
returnCode = DjiGimbalManager_Reset(mountPosition);
|
returnCode = DjiGimbalManager_Reset(mountPosition, DJI_GIMBAL_RESET_MODE_PITCH_AND_YAW);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Reset gimbal failed, error code: 0x%08X", returnCode);
|
USER_LOG_ERROR("Reset gimbal failed, error code: 0x%08X", returnCode);
|
||||||
}
|
}
|
||||||
@ -108,7 +126,7 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
for (int i = 0; i < sizeof(s_rotationActionList) / sizeof(T_DjiTestGimbalActionList); ++i) {
|
for (int i = 0; i < sizeof(s_rotationActionList) / sizeof(T_DjiTestGimbalActionList); ++i) {
|
||||||
if (s_rotationActionList[i].action == DJI_TEST_GIMBAL_RESET) {
|
if (s_rotationActionList[i].action == DJI_TEST_GIMBAL_RESET) {
|
||||||
USER_LOG_INFO("Target gimbal reset.\r\n");
|
USER_LOG_INFO("Target gimbal reset.\r\n");
|
||||||
returnCode = DjiGimbalManager_Reset(mountPosition);
|
returnCode = DjiGimbalManager_Reset(mountPosition, DJI_GIMBAL_RESET_MODE_PITCH_AND_YAW);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Reset gimbal failed, error code: 0x%08X", returnCode);
|
USER_LOG_ERROR("Reset gimbal failed, error code: 0x%08X", returnCode);
|
||||||
}
|
}
|
||||||
@ -120,11 +138,22 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
USER_LOG_INFO("Target gimbal pry = (%.1f, %.1f, %.1f)",
|
|
||||||
s_rotationActionList[i].rotation.pitch, s_rotationActionList[i].rotation.roll,
|
|
||||||
s_rotationActionList[i].rotation.yaw);
|
|
||||||
|
|
||||||
rotation = s_rotationActionList[i].rotation;
|
rotation = s_rotationActionList[i].rotation;
|
||||||
|
|
||||||
|
if (aircraftSeries == DJI_AIRCRAFT_SERIES_M3 || aircraftSeries == DJI_AIRCRAFT_SERIES_M30) {
|
||||||
|
if (s_rotationActionList[i].rotation.rotationMode == DJI_GIMBAL_ROTATION_MODE_ABSOLUTE_ANGLE) {
|
||||||
|
T_DjiFcSubscriptionGimbalAngles gimbalAngles = {0};
|
||||||
|
T_DjiDataTimestamp timestamp = {0};
|
||||||
|
returnCode = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES,
|
||||||
|
(uint8_t *) &gimbalAngles,
|
||||||
|
sizeof(T_DjiFcSubscriptionGimbalAngles),
|
||||||
|
×tamp);
|
||||||
|
rotation.yaw = gimbalAngles.z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_INFO("Target gimbal pry = (%.1f, %.1f, %.1f)", rotation.pitch, rotation.roll, rotation.yaw);
|
||||||
|
|
||||||
returnCode = DjiGimbalManager_Rotate(mountPosition, rotation);
|
returnCode = DjiGimbalManager_Rotate(mountPosition, rotation);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Target gimbal pry = (%.1f, %.1f, %.1f) failed, error code: 0x%08X",
|
USER_LOG_ERROR("Target gimbal pry = (%.1f, %.1f, %.1f) failed, error code: 0x%08X",
|
||||||
@ -136,6 +165,11 @@ T_DjiReturnCode DjiTest_GimbalManagerRunSample(E_DjiMountPosition mountPosition,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
returnCode = DjiFcSubscription_UnSubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Failed to unsubscribe topic %d, 0x%08X", DJI_FC_SUBSCRIPTION_TOPIC_GIMBAL_ANGLES, returnCode);
|
||||||
|
}
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 5: Deinit gimbal manager module");
|
USER_LOG_INFO("--> Step 5: Deinit gimbal manager module");
|
||||||
DjiTest_WidgetLogAppend("--> Step 5: Deinit gimbal manager module");
|
DjiTest_WidgetLogAppend("--> Step 5: Deinit gimbal manager module");
|
||||||
returnCode = DjiGimbalManager_Deinit();
|
returnCode = DjiGimbalManager_Deinit();
|
||||||
|
|||||||
28290
samples/sample_c/module_sample/hms/data/hms_2023_05_18.json
Normal file
28290
samples/sample_c/module_sample/hms/data/hms_2023_05_18.json
Normal file
File diff suppressed because it is too large
Load Diff
30819
samples/sample_c/module_sample/hms/data/hms_2023_08_22.json
Normal file
30819
samples/sample_c/module_sample/hms/data/hms_2023_08_22.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,8 @@
|
|||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include <widget_interaction_test/test_widget_interaction.h>
|
#include <widget_interaction_test/test_widget_interaction.h>
|
||||||
#include <utils/util_misc.h>
|
#include <utils/util_misc.h>
|
||||||
|
#include <utils/cJSON.h>
|
||||||
|
#include <utils/util_file.h>
|
||||||
#include "test_hms.h"
|
#include "test_hms.h"
|
||||||
#include "dji_hms.h"
|
#include "dji_hms.h"
|
||||||
#include "dji_hms_info_table.h"
|
#include "dji_hms_info_table.h"
|
||||||
@ -52,28 +54,32 @@ static const char *oldReplaceComponentIndexStr = "%component_index";
|
|||||||
static T_DjiHmsFileBinaryArray s_EnHmsTextConfigFileBinaryArrayList[] = {
|
static T_DjiHmsFileBinaryArray s_EnHmsTextConfigFileBinaryArrayList[] = {
|
||||||
{hms_text_config_json_fileName, hms_text_config_json_fileSize, hms_text_config_json_fileBinaryArray},
|
{hms_text_config_json_fileName, hms_text_config_json_fileSize, hms_text_config_json_fileBinaryArray},
|
||||||
};
|
};
|
||||||
static bool s_hmsServiceRunFlag = false;
|
static uint8_t *s_hmsJsonData = NULL;
|
||||||
|
static E_DjiMobileAppLanguage s_hmsLanguage = DJI_MOBILE_APP_LANGUAGE_ENGLISH;
|
||||||
|
|
||||||
/* Private functions declaration ---------------------------------------------*/
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
static T_DjiReturnCode DjiTest_HmsInit(void);
|
static T_DjiReturnCode DjiTest_HmsManagerInit(void);
|
||||||
static T_DjiReturnCode DjiTest_HmsDeInit(void);
|
static T_DjiReturnCode DjiTest_HmsManagerDeInit(void);
|
||||||
static T_DjiFcSubscriptionFlightStatus DjiTest_GetValueOfFlightStatus(void);
|
static T_DjiFcSubscriptionFlightStatus DjiTest_GetValueOfFlightStatus(void);
|
||||||
static bool DjiTest_ReplaceStr(char *buffer, uint32_t bufferMaxLen, const char *target, const char *dest);
|
static bool DjiTest_ReplaceStr(char *buffer, uint32_t bufferMaxLen, const char *target, const char *dest);
|
||||||
static bool DjiTest_MarchErrCodeInfoTable(T_DjiHmsInfoTable hmsInfoTable);
|
static bool DjiTest_MarchErrCodeInfoTable(T_DjiHmsInfoTable hmsInfoTable);
|
||||||
|
static bool DjiTest_MarchErrCodeInfoTableByJson(T_DjiHmsInfoTable hmsInfoTable);
|
||||||
static T_DjiReturnCode DjiTest_HmsInfoCallback(T_DjiHmsInfoTable hmsInfoTable);
|
static T_DjiReturnCode DjiTest_HmsInfoCallback(T_DjiHmsInfoTable hmsInfoTable);
|
||||||
|
|
||||||
/* Exported functions definition ---------------------------------------------*/
|
/* Exported functions definition ---------------------------------------------*/
|
||||||
T_DjiReturnCode DjiTest_HmsRunSample(void)
|
T_DjiReturnCode DjiTest_HmsManagerRunSample(E_DjiMobileAppLanguage language)
|
||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
T_DjiOsalHandler *osalHandler;
|
T_DjiOsalHandler *osalHandler;
|
||||||
|
|
||||||
|
s_hmsLanguage = language;
|
||||||
|
|
||||||
USER_LOG_INFO("Hms Sample Start");
|
USER_LOG_INFO("Hms Sample Start");
|
||||||
DjiTest_WidgetLogAppend("Hms Sample Start");
|
DjiTest_WidgetLogAppend("Hms Sample Start");
|
||||||
|
|
||||||
USER_LOG_INFO("--> Step 1: Init hms sample");
|
USER_LOG_INFO("--> Step 1: Init hms sample");
|
||||||
DjiTest_WidgetLogAppend("--> Step 1: Init hms sample");
|
DjiTest_WidgetLogAppend("--> Step 1: Init hms sample");
|
||||||
returnCode = DjiTest_HmsInit();
|
returnCode = DjiTest_HmsManagerInit();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Hms sample init error, error code:0x%08llX", returnCode);
|
USER_LOG_ERROR("Hms sample init error, error code:0x%08llX", returnCode);
|
||||||
goto out;
|
goto out;
|
||||||
@ -82,7 +88,7 @@ T_DjiReturnCode DjiTest_HmsRunSample(void)
|
|||||||
osalHandler = DjiPlatform_GetOsalHandler();
|
osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
USER_LOG_INFO("--> Step 2: Register callback function of push HMS information");
|
USER_LOG_INFO("--> Step 2: Register callback function of push HMS information");
|
||||||
DjiTest_WidgetLogAppend("--> Step 2: Register callback function of push HMS information");
|
DjiTest_WidgetLogAppend("--> Step 2: Register callback function of push HMS information");
|
||||||
returnCode = DjiHms_RegHmsInfoCallback(DjiTest_HmsInfoCallback);
|
returnCode = DjiHmsManager_RegHmsInfoCallback(DjiTest_HmsInfoCallback);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Register callback function of push HMS information failed, error code:0x%08llX", returnCode);
|
USER_LOG_ERROR("Register callback function of push HMS information failed, error code:0x%08llX", returnCode);
|
||||||
goto out;
|
goto out;
|
||||||
@ -93,7 +99,7 @@ T_DjiReturnCode DjiTest_HmsRunSample(void)
|
|||||||
out:
|
out:
|
||||||
USER_LOG_INFO("--> Step 3: Deinit hms sample");
|
USER_LOG_INFO("--> Step 3: Deinit hms sample");
|
||||||
DjiTest_WidgetLogAppend("--> Step 3: Deinit hms sample");
|
DjiTest_WidgetLogAppend("--> Step 3: Deinit hms sample");
|
||||||
returnCode = DjiTest_HmsDeInit();
|
returnCode = DjiTest_HmsManagerDeInit();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Hms sample deinit error, error code:0x%08llX", returnCode);
|
USER_LOG_ERROR("Hms sample deinit error, error code:0x%08llX", returnCode);
|
||||||
}
|
}
|
||||||
@ -104,7 +110,7 @@ out:
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
T_DjiReturnCode DjiTest_HmsStartService(void)
|
T_DjiReturnCode DjiTest_HmsCustomizationStartService(void)
|
||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
#ifdef SYSTEM_ARCH_LINUX
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
@ -112,7 +118,7 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
|||||||
char tempPath[HMS_DIR_PATH_LEN_MAX];
|
char tempPath[HMS_DIR_PATH_LEN_MAX];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
returnCode = DjiHms_Init();
|
returnCode = DjiHmsCustomization_Init();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Hms init error, error code:0x%08llX", returnCode);
|
USER_LOG_ERROR("Hms init error, error code:0x%08llX", returnCode);
|
||||||
return returnCode;
|
return returnCode;
|
||||||
@ -129,15 +135,15 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
|||||||
snprintf(tempPath, HMS_DIR_PATH_LEN_MAX, "%shms_text/en", curFileDirPath);
|
snprintf(tempPath, HMS_DIR_PATH_LEN_MAX, "%shms_text/en", curFileDirPath);
|
||||||
|
|
||||||
//set default hms text config path
|
//set default hms text config path
|
||||||
returnCode = DjiHms_RegDefaultHmsTextConfigByDirPath(tempPath);
|
returnCode = DjiHmsCustomization_RegDefaultHmsTextConfigByDirPath(tempPath);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Add default hms text config error, stat = 0x%08llX", returnCode);
|
USER_LOG_ERROR("Add default hms text config error, stat = 0x%08llX", returnCode);
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set hms text config for English language
|
//set hms text config for English language
|
||||||
returnCode = DjiHms_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_ENGLISH,
|
returnCode = DjiHmsCustomization_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_ENGLISH,
|
||||||
tempPath);
|
tempPath);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Add hms text config error, stat = 0x%08llX", returnCode);
|
USER_LOG_ERROR("Add hms text config error, stat = 0x%08llX", returnCode);
|
||||||
return returnCode;
|
return returnCode;
|
||||||
@ -145,8 +151,8 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
|||||||
|
|
||||||
//set hms text config for Chinese language
|
//set hms text config for Chinese language
|
||||||
snprintf(tempPath, HMS_DIR_PATH_LEN_MAX, "%shms_text/cn", curFileDirPath);
|
snprintf(tempPath, HMS_DIR_PATH_LEN_MAX, "%shms_text/cn", curFileDirPath);
|
||||||
returnCode = DjiHms_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_CHINESE,
|
returnCode = DjiHmsCustomization_RegHmsTextConfigByDirPath(DJI_MOBILE_APP_LANGUAGE_CHINESE,
|
||||||
tempPath);
|
tempPath);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Add hms text config error, stat = 0x%08llX", returnCode);
|
USER_LOG_ERROR("Add hms text config error, stat = 0x%08llX", returnCode);
|
||||||
return returnCode;
|
return returnCode;
|
||||||
@ -159,7 +165,7 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
//set default hms text config
|
//set default hms text config
|
||||||
returnCode = DjiHms_RegDefaultHmsTextConfigByBinaryArray(&enHmsTextBinaryArrayConfig);
|
returnCode = DjiHmsCustomization_RegDefaultHmsTextConfigByBinaryArray(&enHmsTextBinaryArrayConfig);
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Add default hms text config error, stat = 0x%08llX", returnCode);
|
USER_LOG_ERROR("Add default hms text config error, stat = 0x%08llX", returnCode);
|
||||||
return returnCode;
|
return returnCode;
|
||||||
@ -167,18 +173,21 @@ T_DjiReturnCode DjiTest_HmsStartService(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DJI_CUSTOM_HMS_CODE_INJECT_ON
|
#if DJI_CUSTOM_HMS_CODE_INJECT_ON
|
||||||
DjiHms_InjectHmsErrorCode(0x1E020000, DJI_HMS_ERROR_LEVEL_FATAL);
|
DjiHmsCustomization_InjectHmsErrorCode(0x1E020000, DJI_HMS_ERROR_LEVEL_FATAL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s_hmsServiceRunFlag = true;
|
|
||||||
|
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Private functions definition-----------------------------------------------*/
|
/* Private functions definition-----------------------------------------------*/
|
||||||
static T_DjiReturnCode DjiTest_HmsInit(void)
|
static T_DjiReturnCode DjiTest_HmsManagerInit(void)
|
||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
|
char curFileDirPath[HMS_DIR_PATH_LEN_MAX];
|
||||||
|
char tempFileDirPath[HMS_DIR_PATH_LEN_MAX];
|
||||||
|
uint32_t fileSize = 0;
|
||||||
|
uint32_t readRealSize = 0;
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
|
||||||
returnCode = DjiFcSubscription_Init();
|
returnCode = DjiFcSubscription_Init();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -196,16 +205,38 @@ static T_DjiReturnCode DjiTest_HmsInit(void)
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_hmsServiceRunFlag == true) {
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
returnCode = DjiUserUtil_GetCurrentFileDirPath(__FILE__, HMS_DIR_PATH_LEN_MAX, curFileDirPath);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get file current path error, stat = 0x%08llX", returnCode);
|
||||||
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DjiHms_Init();
|
snprintf(tempFileDirPath, HMS_DIR_PATH_LEN_MAX, "%s/data/hms_2023_08_22.json", curFileDirPath);
|
||||||
|
|
||||||
|
returnCode = UtilFile_GetFileSizeByPath(tempFileDirPath, &fileSize);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Get file size by path failed, stat = 0x%08llX", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
USER_LOG_DEBUG("Hms json file size is %d", fileSize);
|
||||||
|
|
||||||
|
s_hmsJsonData = osalHandler->Malloc(fileSize);
|
||||||
|
if (s_hmsJsonData == NULL) {
|
||||||
|
USER_LOG_ERROR("Malloc failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilFile_GetFileDataByPath(tempFileDirPath, 0, fileSize, s_hmsJsonData, &readRealSize);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return DjiHmsManager_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static T_DjiReturnCode DjiTest_HmsDeInit(void)
|
static T_DjiReturnCode DjiTest_HmsManagerDeInit(void)
|
||||||
{
|
{
|
||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
|
||||||
returnCode = DjiFcSubscription_DeInit();
|
returnCode = DjiFcSubscription_DeInit();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -214,11 +245,11 @@ static T_DjiReturnCode DjiTest_HmsDeInit(void)
|
|||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_hmsServiceRunFlag == true) {
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
osalHandler->Free(s_hmsJsonData);
|
||||||
}
|
#endif
|
||||||
|
|
||||||
return DjiHms_DeInit();
|
return DjiHmsManager_DeInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static T_DjiFcSubscriptionFlightStatus DjiTest_GetValueOfFlightStatus(void)
|
static T_DjiFcSubscriptionFlightStatus DjiTest_GetValueOfFlightStatus(void)
|
||||||
@ -326,12 +357,67 @@ static bool DjiTest_MarchErrCodeInfoTable(T_DjiHmsInfoTable hmsInfoTable)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool DjiTest_MarchErrCodeInfoTableByJson(T_DjiHmsInfoTable hmsInfoTable)
|
||||||
|
{
|
||||||
|
cJSON *hmsJsonRoot = NULL;
|
||||||
|
cJSON *hmsErrorCode = NULL;
|
||||||
|
cJSON *hmsLanguage = NULL;
|
||||||
|
char hmsErrorCodeString[HMS_DIR_PATH_LEN_MAX] = {0};
|
||||||
|
|
||||||
|
hmsJsonRoot = cJSON_Parse((char *) s_hmsJsonData);
|
||||||
|
if (hmsJsonRoot == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < hmsInfoTable.hmsInfoNum; i++) {
|
||||||
|
if (DjiTest_GetValueOfFlightStatus() == DJI_FC_SUBSCRIPTION_FLIGHT_STATUS_IN_AIR) {
|
||||||
|
sprintf(hmsErrorCodeString, "fpv_tip_0x%08X_in_the_sky", hmsInfoTable.hmsInfo[i].errorCode);
|
||||||
|
} else {
|
||||||
|
sprintf(hmsErrorCodeString, "fpv_tip_0x%08X", hmsInfoTable.hmsInfo[i].errorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
hmsErrorCode = cJSON_GetObjectItem(hmsJsonRoot, hmsErrorCodeString);
|
||||||
|
if (hmsErrorCode != NULL) {
|
||||||
|
if (s_hmsLanguage == DJI_MOBILE_APP_LANGUAGE_CHINESE) {
|
||||||
|
hmsLanguage = cJSON_GetObjectItem(hmsErrorCode, "zh");
|
||||||
|
} else if (s_hmsLanguage == DJI_MOBILE_APP_LANGUAGE_ENGLISH) {
|
||||||
|
hmsLanguage = cJSON_GetObjectItem(hmsErrorCode, "en");
|
||||||
|
} else if (s_hmsLanguage == DJI_MOBILE_APP_LANGUAGE_JAPANESE) {
|
||||||
|
hmsLanguage = cJSON_GetObjectItem(hmsErrorCode, "ja");
|
||||||
|
} else if (s_hmsLanguage == DJI_MOBILE_APP_LANGUAGE_FRENCH) {
|
||||||
|
hmsLanguage = cJSON_GetObjectItem(hmsErrorCode, "fr");
|
||||||
|
}
|
||||||
|
if (hmsLanguage != NULL) {
|
||||||
|
if (hmsInfoTable.hmsInfo[i].errorLevel > MIN_HMS_ERROR_LEVEL &&
|
||||||
|
hmsInfoTable.hmsInfo[i].errorLevel < MID_HMS_ERROR_LEVEL) {
|
||||||
|
USER_LOG_WARN("[ErrorCode: 0x%2x]: %s", hmsInfoTable.hmsInfo[i].errorCode,
|
||||||
|
hmsLanguage->valuestring);
|
||||||
|
} else if (hmsInfoTable.hmsInfo[i].errorLevel >= MID_HMS_ERROR_LEVEL &&
|
||||||
|
hmsInfoTable.hmsInfo[i].errorLevel < MAX_HMS_ERROR_LEVEL) {
|
||||||
|
USER_LOG_ERROR("[ErrorCode: 0x%2x]: %s", hmsInfoTable.hmsInfo[i].errorCode,
|
||||||
|
hmsLanguage->valuestring);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
USER_LOG_WARN("[ErrorCode: 0x%2x] There are no matching documents for this language for now.",
|
||||||
|
hmsInfoTable.hmsInfo[i].errorCode);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
USER_LOG_WARN("[ErrorCode: 0x%2x] There are no matching documents in the current json for now.",
|
||||||
|
hmsInfoTable.hmsInfo[i].errorCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static T_DjiReturnCode DjiTest_HmsInfoCallback(T_DjiHmsInfoTable hmsInfoTable)
|
static T_DjiReturnCode DjiTest_HmsInfoCallback(T_DjiHmsInfoTable hmsInfoTable)
|
||||||
{
|
{
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
DjiTest_MarchErrCodeInfoTableByJson(hmsInfoTable);
|
||||||
|
#else
|
||||||
if (!DjiTest_MarchErrCodeInfoTable(hmsInfoTable)) {
|
if (!DjiTest_MarchErrCodeInfoTable(hmsInfoTable)) {
|
||||||
USER_LOG_ERROR("March HMS Information failed.");
|
USER_LOG_ERROR("March HMS Information failed.");
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hmsInfoTable.hmsInfoNum == 0) {
|
if (hmsInfoTable.hmsInfoNum == 0) {
|
||||||
USER_LOG_INFO("All systems of drone are running well now.");
|
USER_LOG_INFO("All systems of drone are running well now.");
|
||||||
|
|||||||
@ -39,8 +39,8 @@ extern "C" {
|
|||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
T_DjiReturnCode DjiTest_HmsRunSample(void);
|
T_DjiReturnCode DjiTest_HmsManagerRunSample(E_DjiMobileAppLanguage language);
|
||||||
T_DjiReturnCode DjiTest_HmsStartService(void);
|
T_DjiReturnCode DjiTest_HmsCustomizationStartService(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,131 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file test_interest_point.c
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI reserves the right to pursue
|
||||||
|
* legal actions against you for any loss(es) or damage(s) caused by your
|
||||||
|
* failure to do so.
|
||||||
|
*
|
||||||
|
*********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "test_interest_point.h"
|
||||||
|
#include "dji_interest_point.h"
|
||||||
|
#include "dji_logger.h"
|
||||||
|
#include "dji_flight_controller.h"
|
||||||
|
#include "flight_control/test_flight_control.h"
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private values -------------------------------------------------------------*/
|
||||||
|
static T_DjiReturnCode DjiUser_InterestPointMissionStateCallback(T_DjiInterestPointMissionState missionState);
|
||||||
|
|
||||||
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions definition ---------------------------------------------*/
|
||||||
|
T_DjiReturnCode DjiTest_InterestPointRunSample(void)
|
||||||
|
{
|
||||||
|
T_DjiReturnCode returnCode;
|
||||||
|
T_DjiInterestPointSettings interestPointSettings = {0};
|
||||||
|
T_DjiOsalHandler *osalHandler = DjiPlatform_GetOsalHandler();
|
||||||
|
T_DjiFlightControllerRidInfo ridInfo = {0};
|
||||||
|
|
||||||
|
ridInfo.latitude = 22.542812;
|
||||||
|
ridInfo.longitude = 113.958902;
|
||||||
|
ridInfo.altitude = 10;
|
||||||
|
|
||||||
|
returnCode = DjiFlightController_Init(ridInfo);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_INFO("Flight control init failed, errno=%lld", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiInterestPoint_Init();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_INFO("Point interest init failed, errno=%lld", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(1000);
|
||||||
|
DjiFlightController_ObtainJoystickCtrlAuthority();
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(1000);
|
||||||
|
DjiFlightController_StartTakeoff();
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(1000);
|
||||||
|
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {0, 0, 5}, 0, 10000);
|
||||||
|
|
||||||
|
osalHandler->TaskSleepMs(1000);
|
||||||
|
DjiTest_FlightControlVelocityAndYawRateCtrl((T_DjiTestFlightControlVector3f) {3, 0, 0}, 0, 5000);
|
||||||
|
|
||||||
|
interestPointSettings.latitude = 22.542812;
|
||||||
|
interestPointSettings.longitude = 113.958902;
|
||||||
|
|
||||||
|
returnCode = DjiInterestPoint_RegMissionStateCallback(DjiUser_InterestPointMissionStateCallback);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Register mission state callback failed, errno=%lld", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiInterestPoint_Start(interestPointSettings);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Point interest start failed, errno=%lld", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
DjiInterestPoint_SetSpeed(5.0f);
|
||||||
|
|
||||||
|
for (int i = 0; i < 60; ++i) {
|
||||||
|
USER_LOG_ERROR("Interest point mission running %d.", i);
|
||||||
|
osalHandler->TaskSleepMs(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiInterestPoint_Stop();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Point interest stop failed, errno=%lld", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
DjiFlightController_StartForceLanding();
|
||||||
|
|
||||||
|
returnCode = DjiInterestPoint_DeInit();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Point interest deinit failed, errno=%lld", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
returnCode = DjiFlightController_DeInit();
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Flight control init failed, errno=%lld", returnCode);
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Private functions definition-----------------------------------------------*/
|
||||||
|
static T_DjiReturnCode DjiUser_InterestPointMissionStateCallback(T_DjiInterestPointMissionState missionState)
|
||||||
|
{
|
||||||
|
USER_LOG_INFO("Interest point state: %d, radius: %.2f m, speed: %.2f m/s", missionState.state, missionState.radius,
|
||||||
|
missionState.curSpeed);
|
||||||
|
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
********************************************************************
|
||||||
|
* @file test_interest_point.h
|
||||||
|
* @brief This is the header file for "test_interest_point.c", defining the structure and
|
||||||
|
* (exported) function prototypes.
|
||||||
|
*
|
||||||
|
* @copyright (c) 2018 DJI. All rights reserved.
|
||||||
|
*
|
||||||
|
* All information contained herein is, and remains, the property of DJI.
|
||||||
|
* The intellectual and technical concepts contained herein are proprietary
|
||||||
|
* to DJI 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 DJI.
|
||||||
|
*
|
||||||
|
* If you receive this source code without DJI’s authorization, you may not
|
||||||
|
* further disseminate the information, and you must immediately remove the
|
||||||
|
* source code and notify DJI of its removal. DJI 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 TEST_INTEREST_POINT_H
|
||||||
|
#define TEST_INTEREST_POINT_H
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "dji_typedef.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
T_DjiReturnCode DjiTest_InterestPointRunSample(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TEST_INTEREST_POINT_H
|
||||||
|
/************************ (C) COPYRIGHT DJI Innovations *******END OF FILE******/
|
||||||
@ -32,22 +32,34 @@
|
|||||||
#include "dji_platform.h"
|
#include "dji_platform.h"
|
||||||
#include "time_sync/test_time_sync.h"
|
#include "time_sync/test_time_sync.h"
|
||||||
|
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
|
||||||
|
#include "time.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Private constants ---------------------------------------------------------*/
|
/* Private constants ---------------------------------------------------------*/
|
||||||
#define POSITIONING_TASK_FREQ (1)
|
#define POSITIONING_TASK_FREQ (1)
|
||||||
#define POSITIONING_TASK_STACK_SIZE (1024)
|
#define POSITIONING_TASK_STACK_SIZE (2048)
|
||||||
|
#define TEST_RTCM_FILE_PATH_STR_MAX_SIZE (64)
|
||||||
|
|
||||||
#define DJI_TEST_POSITIONING_EVENT_COUNT (2)
|
#define DJI_TEST_POSITIONING_EVENT_COUNT (2)
|
||||||
#define DJI_TEST_TIME_INTERVAL_AMONG_EVENTS_US (200000)
|
#define DJI_TEST_TIME_INTERVAL_AMONG_EVENTS_US (200000)
|
||||||
|
|
||||||
/* Private types -------------------------------------------------------------*/
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
/* Private functions declaration ---------------------------------------------*/
|
/* Private functions declaration ---------------------------------------------*/
|
||||||
static void *DjiTest_PositioningTask(void *arg);
|
static void *DjiTest_PositioningTask(void *arg);
|
||||||
|
static T_DjiReturnCode DjiTest_ReceiveRtkOnAircraftRtcmDataCallback(uint8_t index, const uint8_t *data,
|
||||||
|
uint16_t dataLen);
|
||||||
|
static T_DjiReturnCode DjiTest_ReceiveRtkBaseStationRtcmDataCallback(uint8_t index, const uint8_t *data,
|
||||||
|
uint16_t dataLen);
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
static T_DjiTaskHandle s_userPositioningThread;
|
static T_DjiTaskHandle s_userPositioningThread;
|
||||||
static int32_t s_eventIndex = 0;
|
static int32_t s_eventIndex = 0;
|
||||||
|
static char s_rtkOnAircraftRtcmFilePath[TEST_RTCM_FILE_PATH_STR_MAX_SIZE];
|
||||||
|
static char s_rtkBaseStationRtcmFilePath[TEST_RTCM_FILE_PATH_STR_MAX_SIZE];
|
||||||
|
|
||||||
/* Exported functions definition ---------------------------------------------*/
|
/* Exported functions definition ---------------------------------------------*/
|
||||||
T_DjiReturnCode DjiTest_PositioningStartService(void)
|
T_DjiReturnCode DjiTest_PositioningStartService(void)
|
||||||
@ -63,12 +75,40 @@ T_DjiReturnCode DjiTest_PositioningStartService(void)
|
|||||||
|
|
||||||
DjiPositioning_SetTaskIndex(0);
|
DjiPositioning_SetTaskIndex(0);
|
||||||
|
|
||||||
|
#ifndef SYSTEM_ARCH_LINUX
|
||||||
if (osalHandler->TaskCreate("user_positioning_task", DjiTest_PositioningTask,
|
if (osalHandler->TaskCreate("user_positioning_task", DjiTest_PositioningTask,
|
||||||
POSITIONING_TASK_STACK_SIZE, NULL, &s_userPositioningThread) !=
|
POSITIONING_TASK_STACK_SIZE, NULL, &s_userPositioningThread) !=
|
||||||
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("user positioning task create error.");
|
USER_LOG_ERROR("user positioning task create error.");
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
time_t currentTime = time(NULL);
|
||||||
|
struct tm *localTime = NULL;
|
||||||
|
|
||||||
|
localTime = localtime(¤tTime);
|
||||||
|
sprintf(s_rtkOnAircraftRtcmFilePath, "rtk_on_aircraft_%04d%02d%02d_%02d-%02d-%02d.rtcm",
|
||||||
|
localTime->tm_year + 1900, localTime->tm_mon + 1, localTime->tm_mday,
|
||||||
|
localTime->tm_hour, localTime->tm_min, localTime->tm_sec);
|
||||||
|
|
||||||
|
localTime = localtime(¤tTime);
|
||||||
|
sprintf(s_rtkBaseStationRtcmFilePath, "rtk_base_station_%04d%02d%02d_%02d-%02d-%02d.rtcm",
|
||||||
|
localTime->tm_year + 1900, localTime->tm_mon + 1, localTime->tm_mday,
|
||||||
|
localTime->tm_hour, localTime->tm_min, localTime->tm_sec);
|
||||||
|
#endif
|
||||||
|
djiStat = DjiPositioning_RegReceiveRtcmDataCallback(DJI_POSITIONING_RTCM_DATA_TYPE_RTK_BASE_STATION,
|
||||||
|
DjiTest_ReceiveRtkBaseStationRtcmDataCallback);
|
||||||
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Register receive rtk base station callback error.");
|
||||||
|
return djiStat;
|
||||||
|
}
|
||||||
|
|
||||||
|
djiStat = DjiPositioning_RegReceiveRtcmDataCallback(DJI_POSITIONING_RTCM_DATA_TYPE_RTK_ON_AIRCRAFT,
|
||||||
|
DjiTest_ReceiveRtkOnAircraftRtcmDataCallback);
|
||||||
|
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("Register receive rtk on aircraft callback error.");
|
||||||
|
return djiStat;
|
||||||
|
}
|
||||||
|
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -158,4 +198,51 @@ static void *DjiTest_PositioningTask(void *arg)
|
|||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int32_t DjiTest_SaveRtcmData(char *filePath, const uint8_t *data, uint32_t len)
|
||||||
|
{
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
FILE *fp = NULL;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
fp = fopen(filePath, "ab+");
|
||||||
|
if (fp == NULL) {
|
||||||
|
printf("fopen failed!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
size = fwrite(data, 1, len, fp);
|
||||||
|
if (size != len) {
|
||||||
|
fclose(fp);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fflush(fp);
|
||||||
|
fclose(fp);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static T_DjiReturnCode DjiTest_ReceiveRtkOnAircraftRtcmDataCallback(uint8_t index, const uint8_t *data,
|
||||||
|
uint16_t dataLen)
|
||||||
|
{
|
||||||
|
USER_LOG_INFO("Receive rtcm data from rtk on aircraft, index: %d, len: %d", index, dataLen);
|
||||||
|
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
DjiTest_SaveRtcmData(s_rtkOnAircraftRtcmFilePath, data, dataLen);
|
||||||
|
#endif
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static T_DjiReturnCode DjiTest_ReceiveRtkBaseStationRtcmDataCallback(uint8_t index, const uint8_t *data,
|
||||||
|
uint16_t dataLen)
|
||||||
|
{
|
||||||
|
USER_LOG_INFO("Receive rtcm data from rtk base station, index: %d, len: %d", index, dataLen);
|
||||||
|
|
||||||
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
DjiTest_SaveRtcmData(s_rtkBaseStationRtcmFilePath, data, dataLen);
|
||||||
|
#endif
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
/****************** (C) COPYRIGHT DJI Innovations *****END OF FILE****/
|
||||||
|
|||||||
2688
samples/sample_c/module_sample/utils/cJSON.c
Normal file
2688
samples/sample_c/module_sample/utils/cJSON.c
Normal file
File diff suppressed because it is too large
Load Diff
290
samples/sample_c/module_sample/utils/cJSON.h
Normal file
290
samples/sample_c/module_sample/utils/cJSON.h
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef cJSON__h
|
||||||
|
#define cJSON__h
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||||
|
#define __WINDOWS__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
|
||||||
|
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
|
||||||
|
|
||||||
|
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||||
|
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||||
|
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||||
|
|
||||||
|
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||||
|
|
||||||
|
setting default visibility to hidden by adding
|
||||||
|
-fvisibility=hidden (for gcc)
|
||||||
|
or
|
||||||
|
-xldscope=hidden (for sun cc)
|
||||||
|
to CFLAGS
|
||||||
|
|
||||||
|
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CJSON_CDECL __cdecl
|
||||||
|
#define CJSON_STDCALL __stdcall
|
||||||
|
|
||||||
|
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||||
|
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||||
|
#define CJSON_EXPORT_SYMBOLS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CJSON_HIDE_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) type CJSON_STDCALL
|
||||||
|
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
|
||||||
|
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||||
|
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
|
||||||
|
#endif
|
||||||
|
#else /* !__WINDOWS__ */
|
||||||
|
#define CJSON_CDECL
|
||||||
|
#define CJSON_STDCALL
|
||||||
|
|
||||||
|
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||||
|
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||||
|
#else
|
||||||
|
#define CJSON_PUBLIC(type) type
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* project version */
|
||||||
|
#define CJSON_VERSION_MAJOR 1
|
||||||
|
#define CJSON_VERSION_MINOR 7
|
||||||
|
#define CJSON_VERSION_PATCH 12
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/* cJSON Types: */
|
||||||
|
#define cJSON_Invalid (0)
|
||||||
|
#define cJSON_False (1 << 0)
|
||||||
|
#define cJSON_True (1 << 1)
|
||||||
|
#define cJSON_NULL (1 << 2)
|
||||||
|
#define cJSON_Number (1 << 3)
|
||||||
|
#define cJSON_String (1 << 4)
|
||||||
|
#define cJSON_Array (1 << 5)
|
||||||
|
#define cJSON_Object (1 << 6)
|
||||||
|
#define cJSON_Raw (1 << 7) /* raw json */
|
||||||
|
|
||||||
|
#define cJSON_IsReference 256
|
||||||
|
#define cJSON_StringIsConst 512
|
||||||
|
|
||||||
|
/* The cJSON structure: */
|
||||||
|
typedef struct cJSON {
|
||||||
|
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||||
|
struct cJSON *next;
|
||||||
|
struct cJSON *prev;
|
||||||
|
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||||
|
struct cJSON *child;
|
||||||
|
|
||||||
|
/* The type of the item, as above. */
|
||||||
|
int type;
|
||||||
|
|
||||||
|
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
||||||
|
char *valuestring;
|
||||||
|
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
||||||
|
int valueint;
|
||||||
|
/* The item's number, if type==cJSON_Number */
|
||||||
|
double valuedouble;
|
||||||
|
|
||||||
|
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||||
|
char *string;
|
||||||
|
} cJSON;
|
||||||
|
|
||||||
|
typedef struct cJSON_Hooks {
|
||||||
|
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
|
||||||
|
void *(CJSON_CDECL *malloc_fn)(size_t sz);
|
||||||
|
void (CJSON_CDECL *free_fn)(void *ptr);
|
||||||
|
} cJSON_Hooks;
|
||||||
|
|
||||||
|
typedef int cJSON_bool;
|
||||||
|
|
||||||
|
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||||
|
* This is to prevent stack overflows. */
|
||||||
|
#ifndef CJSON_NESTING_LIMIT
|
||||||
|
#define CJSON_NESTING_LIMIT 1000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* returns the version of cJSON as a string */
|
||||||
|
CJSON_PUBLIC(const char*)cJSON_Version(void);
|
||||||
|
|
||||||
|
/* Supply malloc, realloc and free functions to cJSON */
|
||||||
|
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks *hooks);
|
||||||
|
|
||||||
|
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||||
|
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_Parse(const char *value);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_ParseByJsonData(const uint8_t *json_data, uint16_t data_len);
|
||||||
|
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||||
|
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_ParseWithOpts(const char *value, const char **return_parse_end,
|
||||||
|
cJSON_bool require_null_terminated);
|
||||||
|
|
||||||
|
/* Render a cJSON entity to text for transfer/storage. */
|
||||||
|
CJSON_PUBLIC(char *)cJSON_Print(const cJSON *item);
|
||||||
|
/* Render a cJSON entity to text for transfer/storage without any formatting. */
|
||||||
|
CJSON_PUBLIC(char *)cJSON_PrintUnformatted(const cJSON *item);
|
||||||
|
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||||
|
CJSON_PUBLIC(char *)cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||||
|
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||||
|
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||||
|
/* Delete a cJSON entity and all subentities. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
|
||||||
|
|
||||||
|
/* Returns the number of items in an array (or object). */
|
||||||
|
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||||
|
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_GetArrayItem(const cJSON *array, int index);
|
||||||
|
/* Get item "string" from object. Case insensitive. */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_GetObjectItem(const cJSON *const object, const char *const string);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_GetObjectItemCaseSensitive(const cJSON *const object, const char *const string);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||||
|
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||||
|
CJSON_PUBLIC(const char *)cJSON_GetErrorPtr(void);
|
||||||
|
|
||||||
|
/* Check if the item is a string and return its valuestring */
|
||||||
|
CJSON_PUBLIC(char *)cJSON_GetStringValue(cJSON *item);
|
||||||
|
|
||||||
|
/* These functions check the type of an item */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON *const item);
|
||||||
|
|
||||||
|
/* These calls create a cJSON item of the appropriate type. */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateNull(void);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateTrue(void);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateFalse(void);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateBool(cJSON_bool boolean);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateNumber(double num);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateString(const char *string);
|
||||||
|
/* raw json */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateRaw(const char *raw);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateArray(void);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateObject(void);
|
||||||
|
|
||||||
|
/* Create a string where valuestring references a string so
|
||||||
|
* it will not be freed by cJSON_Delete */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateStringReference(const char *string);
|
||||||
|
/* Create an object/array that only references it's elements so
|
||||||
|
* they will not be freed by cJSON_Delete */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateObjectReference(const cJSON *child);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateArrayReference(const cJSON *child);
|
||||||
|
|
||||||
|
/* These utilities create an Array of count items.
|
||||||
|
* The parameter count cannot be greater than the number of elements in the number array, otherwise array access will be out of bounds.*/
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateIntArray(const int *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateFloatArray(const float *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_CreateStringArray(const char **strings, int count);
|
||||||
|
|
||||||
|
/* Append item to the specified array/object. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||||
|
CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||||
|
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
|
||||||
|
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
|
||||||
|
* writing to `item->string` */
|
||||||
|
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
|
||||||
|
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||||
|
CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||||
|
|
||||||
|
/* Remove/Detach items from Arrays/Objects. */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_DetachItemViaPointer(cJSON *parent, cJSON *const item);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||||
|
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||||
|
|
||||||
|
/* Update array items. */
|
||||||
|
CJSON_PUBLIC(void)
|
||||||
|
cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON *const parent, cJSON *const item, cJSON *replacement);
|
||||||
|
CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||||
|
CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem);
|
||||||
|
CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem);
|
||||||
|
|
||||||
|
/* Duplicate a cJSON item */
|
||||||
|
CJSON_PUBLIC(cJSON *)cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||||
|
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||||
|
* need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||||
|
* The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||||
|
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||||
|
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||||
|
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON *const a, const cJSON *const b, const cJSON_bool case_sensitive);
|
||||||
|
|
||||||
|
/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
|
||||||
|
* The input pointer json cannot point to a read-only address area, such as a string constant,
|
||||||
|
* but should point to a readable and writable adress area. */
|
||||||
|
CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
||||||
|
|
||||||
|
/* Helper functions for creating and adding items to an object at the same time.
|
||||||
|
* They return the added item or NULL on failure. */
|
||||||
|
CJSON_PUBLIC(cJSON*)cJSON_AddNullToObject(cJSON *const object, const char *const name);
|
||||||
|
CJSON_PUBLIC(cJSON*)cJSON_AddTrueToObject(cJSON *const object, const char *const name);
|
||||||
|
CJSON_PUBLIC(cJSON*)cJSON_AddFalseToObject(cJSON *const object, const char *const name);
|
||||||
|
CJSON_PUBLIC(cJSON*)cJSON_AddBoolToObject(cJSON *const object, const char *const name, const cJSON_bool boolean);
|
||||||
|
CJSON_PUBLIC(cJSON*)cJSON_AddNumberToObject(cJSON *const object, const char *const name, const double number);
|
||||||
|
CJSON_PUBLIC(cJSON*)cJSON_AddStringToObject(cJSON *const object, const char *const name, const char *const string);
|
||||||
|
CJSON_PUBLIC(cJSON*)cJSON_AddRawToObject(cJSON *const object, const char *const name, const char *const raw);
|
||||||
|
CJSON_PUBLIC(cJSON*)cJSON_AddObjectToObject(cJSON *const object, const char *const name);
|
||||||
|
CJSON_PUBLIC(cJSON*)cJSON_AddArrayToObject(cJSON *const object, const char *const name);
|
||||||
|
|
||||||
|
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||||
|
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
|
||||||
|
/* helper for the cJSON_SetNumberValue macro */
|
||||||
|
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||||
|
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||||
|
|
||||||
|
/* Macro for iterating over an array or object */
|
||||||
|
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||||
|
|
||||||
|
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||||
|
CJSON_PUBLIC(void *)cJSON_malloc(size_t size);
|
||||||
|
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -89,8 +89,8 @@ T_DjiReturnCode UtilFile_GetFileSizeByPath(const char *filePath, uint32_t *fileS
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
T_DjiReturnCode UtilFile_GetFileDataByPath(const char *filePath, uint32_t offset, uint16_t len,
|
T_DjiReturnCode UtilFile_GetFileDataByPath(const char *filePath, uint32_t offset, uint32_t len,
|
||||||
uint8_t *data, uint16_t *realLen)
|
uint8_t *data, uint32_t *realLen)
|
||||||
{
|
{
|
||||||
FILE *pF;
|
FILE *pF;
|
||||||
T_DjiReturnCode psdkStat;
|
T_DjiReturnCode psdkStat;
|
||||||
|
|||||||
@ -52,8 +52,8 @@ typedef struct {
|
|||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
T_DjiReturnCode UtilFile_GetCreateTime(const char *filePath, T_UtilFileCreateTime *createTime);
|
T_DjiReturnCode UtilFile_GetCreateTime(const char *filePath, T_UtilFileCreateTime *createTime);
|
||||||
T_DjiReturnCode UtilFile_GetFileSizeByPath(const char *filePath, uint32_t *fileSize);
|
T_DjiReturnCode UtilFile_GetFileSizeByPath(const char *filePath, uint32_t *fileSize);
|
||||||
T_DjiReturnCode UtilFile_GetFileDataByPath(const char *filePath, uint32_t offset, uint16_t len,
|
T_DjiReturnCode UtilFile_GetFileDataByPath(const char *filePath, uint32_t offset, uint32_t len,
|
||||||
uint8_t *data, uint16_t *realLen);
|
uint8_t *data, uint32_t *realLen);
|
||||||
T_DjiReturnCode DjiFile_Delete(const char *filePath);
|
T_DjiReturnCode DjiFile_Delete(const char *filePath);
|
||||||
|
|
||||||
T_DjiReturnCode UtilFile_GetFileSize(FILE *file, uint32_t *fileSize);
|
T_DjiReturnCode UtilFile_GetFileSize(FILE *file, uint32_t *fileSize);
|
||||||
|
|||||||
@ -384,6 +384,7 @@ static T_DjiReturnCode DjiTest_CheckFileMd5Sum(const char *path, uint8_t *buf, u
|
|||||||
file = fopen(path, "rb");
|
file = fopen(path, "rb");
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
USER_LOG_ERROR("Open tts file error.");
|
USER_LOG_ERROR("Open tts file error.");
|
||||||
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -585,7 +586,7 @@ static T_DjiReturnCode SetVolume(uint8_t volume)
|
|||||||
(int32_t) realVolume);
|
(int32_t) realVolume);
|
||||||
|
|
||||||
returnCode = DjiUserUtil_RunSystemCmd(cmdStr);
|
returnCode = DjiUserUtil_RunSystemCmd(cmdStr);
|
||||||
if (returnCode < 0) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("Set widget speaker volume error: %d", ret);
|
USER_LOG_ERROR("Set widget speaker volume error: %d", ret);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -73,7 +73,7 @@ typedef enum {
|
|||||||
E_DJI_SAMPLE_INDEX_FLIGHT_CONTROL_TAKE_OFF_VELOCITY_CTRL_LANDING = 6,
|
E_DJI_SAMPLE_INDEX_FLIGHT_CONTROL_TAKE_OFF_VELOCITY_CTRL_LANDING = 6,
|
||||||
E_DJI_SAMPLE_INDEX_FLIGHT_CONTROL_ARREST_FLYING = 7,
|
E_DJI_SAMPLE_INDEX_FLIGHT_CONTROL_ARREST_FLYING = 7,
|
||||||
E_DJI_SAMPLE_INDEX_FLIGHT_CONTROL_SET_GET_PARAM = 8,
|
E_DJI_SAMPLE_INDEX_FLIGHT_CONTROL_SET_GET_PARAM = 8,
|
||||||
E_DJI_SAMPLE_INDEX_HMS = 9,
|
E_DJI_SAMPLE_INDEX_HMS_MANAGER = 9,
|
||||||
E_DJI_SAMPLE_INDEX_GIMBAL_MANAGER_FREE_MODE = 10,
|
E_DJI_SAMPLE_INDEX_GIMBAL_MANAGER_FREE_MODE = 10,
|
||||||
E_DJI_SAMPLE_INDEX_GIMBAL_MANAGER_YAW_FOLLOW_MODE = 11,
|
E_DJI_SAMPLE_INDEX_GIMBAL_MANAGER_YAW_FOLLOW_MODE = 11,
|
||||||
E_DJI_SAMPLE_INDEX_LIVEVIEW = 12,
|
E_DJI_SAMPLE_INDEX_LIVEVIEW = 12,
|
||||||
@ -102,7 +102,7 @@ typedef enum {
|
|||||||
E_DJI_HMS_ERROR_CODE_INDEX3,
|
E_DJI_HMS_ERROR_CODE_INDEX3,
|
||||||
E_DJI_HMS_ERROR_CODE_INDEX4,
|
E_DJI_HMS_ERROR_CODE_INDEX4,
|
||||||
E_DJI_HMS_ERROR_CODE_INDEX5,
|
E_DJI_HMS_ERROR_CODE_INDEX5,
|
||||||
}E_DjiExtensionPortHmsErrorCodeIndex;
|
} E_DjiExtensionPortHmsErrorCodeIndex;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
E_DJI_HMS_ERROR_LEVEL_INDEX1 = 0,
|
E_DJI_HMS_ERROR_LEVEL_INDEX1 = 0,
|
||||||
@ -110,7 +110,7 @@ typedef enum {
|
|||||||
E_DJI_HMS_ERROR_LEVEL_INDEX3,
|
E_DJI_HMS_ERROR_LEVEL_INDEX3,
|
||||||
E_DJI_HMS_ERROR_LEVEL_INDEX4,
|
E_DJI_HMS_ERROR_LEVEL_INDEX4,
|
||||||
E_DJI_HMS_ERROR_LEVEL_INDEX5,
|
E_DJI_HMS_ERROR_LEVEL_INDEX5,
|
||||||
}E_DjiExtensionPortHmsErrorLevelIndex;
|
} E_DjiExtensionPortHmsErrorLevelIndex;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool valid;
|
bool valid;
|
||||||
@ -418,7 +418,7 @@ static void *DjiTest_WidgetInteractionTask(void *arg)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DjiHms_InjectHmsErrorCode(errorCode, errorLevel);
|
DjiHmsCustomization_InjectHmsErrorCode(errorCode, errorLevel);
|
||||||
osalHandler->TaskSleepMs(500);
|
osalHandler->TaskSleepMs(500);
|
||||||
s_isInjectErrcode = false;
|
s_isInjectErrcode = false;
|
||||||
s_isEliminateErrcode = false;
|
s_isEliminateErrcode = false;
|
||||||
@ -444,7 +444,7 @@ static void *DjiTest_WidgetInteractionTask(void *arg)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DjiHms_EliminateHmsErrorCode(errorCode);
|
DjiHmsCustomization_EliminateHmsErrorCode(errorCode);
|
||||||
osalHandler->TaskSleepMs(500);
|
osalHandler->TaskSleepMs(500);
|
||||||
s_isInjectErrcode = false;
|
s_isInjectErrcode = false;
|
||||||
s_isEliminateErrcode = false;
|
s_isEliminateErrcode = false;
|
||||||
@ -530,8 +530,8 @@ static void *DjiTest_WidgetInteractionTask(void *arg)
|
|||||||
case E_DJI_SAMPLE_INDEX_GIMBAL_MANAGER_YAW_FOLLOW_MODE:
|
case E_DJI_SAMPLE_INDEX_GIMBAL_MANAGER_YAW_FOLLOW_MODE:
|
||||||
DjiTest_GimbalManagerRunSample(s_mountPosition, DJI_GIMBAL_MODE_YAW_FOLLOW);
|
DjiTest_GimbalManagerRunSample(s_mountPosition, DJI_GIMBAL_MODE_YAW_FOLLOW);
|
||||||
break;
|
break;
|
||||||
case E_DJI_SAMPLE_INDEX_HMS:
|
case E_DJI_SAMPLE_INDEX_HMS_MANAGER:
|
||||||
DjiTest_HmsRunSample();
|
DjiTest_HmsManagerRunSample(DJI_MOBILE_APP_LANGUAGE_ENGLISH);
|
||||||
break;
|
break;
|
||||||
case E_DJI_SAMPLE_INDEX_LIVEVIEW:
|
case E_DJI_SAMPLE_INDEX_LIVEVIEW:
|
||||||
#ifdef SYSTEM_ARCH_LINUX
|
#ifdef SYSTEM_ARCH_LINUX
|
||||||
|
|||||||
@ -142,7 +142,7 @@ T_DjiReturnCode Osal_UdpSendData(T_DjiSocketHandle socketHandle, const char *ipA
|
|||||||
T_SocketHandleStruct *socketHandleStruct = (T_SocketHandleStruct *) socketHandle;
|
T_SocketHandleStruct *socketHandleStruct = (T_SocketHandleStruct *) socketHandle;
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
|
|
||||||
if (socketHandle <= 0 || ipAddr == NULL || port == 0 || buf == NULL || len == 0 || realLen == NULL) {
|
if (socketHandle == NULL || ipAddr == NULL || port == 0 || buf == NULL || len == 0 || realLen == NULL) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
project(dji_sdk_demo_linux C)
|
project(dji_sdk_demo_linux C)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
||||||
|
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
||||||
set(CMAKE_C_COMPILER "gcc")
|
set(CMAKE_C_COMPILER "gcc")
|
||||||
set(CMAKE_CXX_COMPILER "g++")
|
set(CMAKE_CXX_COMPILER "g++")
|
||||||
@ -11,10 +12,11 @@ if (NOT USE_SYSTEM_ARCH)
|
|||||||
add_definitions(-DSYSTEM_ARCH_LINUX)
|
add_definitions(-DSYSTEM_ARCH_LINUX)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
|
if (BUILD_TEST_CASES_ON MATCHES TRUE)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
||||||
|
endif ()
|
||||||
|
|
||||||
set(PACKAGE_NAME payloadsdk)
|
set(PACKAGE_NAME payloadsdk)
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
|
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
|
||||||
|
|
||||||
#define CONFIG_MODULE_SAMPLE_HMS_ON
|
#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||||
|
|
||||||
/*!< Attention: This function needs to be used together with mobile sdk mop sample.
|
/*!< Attention: This function needs to be used together with mobile sdk mop sample.
|
||||||
* */
|
* */
|
||||||
|
|||||||
@ -97,6 +97,7 @@ int main(int argc, char **argv)
|
|||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
T_DjiUserInfo userInfo;
|
T_DjiUserInfo userInfo;
|
||||||
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||||
|
T_DjiAircraftVersion aircraftInfoVersion;
|
||||||
T_DjiFirmwareVersion firmwareVersion = {
|
T_DjiFirmwareVersion firmwareVersion = {
|
||||||
.majorVersion = 1,
|
.majorVersion = 1,
|
||||||
.minorVersion = 0,
|
.minorVersion = 0,
|
||||||
@ -137,6 +138,17 @@ int main(int argc, char **argv)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (aircraftInfoBaseInfo.mountPositionType != DJI_MOUNT_POSITION_TYPE_PAYLOAD_PORT) {
|
||||||
|
returnCode = DjiAircraftInfo_GetAircraftVersion(&aircraftInfoVersion);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("get aircraft version info error");
|
||||||
|
} else {
|
||||||
|
USER_LOG_INFO("Aircraft version is V%d.%d.%d.%d", aircraftInfoVersion.debugVersion,
|
||||||
|
aircraftInfoVersion.modifyVersion, aircraftInfoVersion.minorVersion,
|
||||||
|
aircraftInfoVersion.majorVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
returnCode = DjiCore_SetAlias("PSDK_APPALIAS");
|
returnCode = DjiCore_SetAlias("PSDK_APPALIAS");
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("set alias error");
|
USER_LOG_ERROR("set alias error");
|
||||||
@ -193,6 +205,30 @@ int main(int argc, char **argv)
|
|||||||
USER_LOG_ERROR("widget speaker test init error");
|
USER_LOG_ERROR("widget speaker test init error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
||||||
|
T_DjiTestUpgradePlatformOpt linuxUpgradePlatformOpt = {
|
||||||
|
.rebootSystem = DjiUpgradePlatformLinux_RebootSystem,
|
||||||
|
.cleanUpgradeProgramFileStoreArea = DjiUpgradePlatformLinux_CleanUpgradeProgramFileStoreArea,
|
||||||
|
.createUpgradeProgramFile = DjiUpgradePlatformLinux_CreateUpgradeProgramFile,
|
||||||
|
.writeUpgradeProgramFile = DjiUpgradePlatformLinux_WriteUpgradeProgramFile,
|
||||||
|
.readUpgradeProgramFile = DjiUpgradePlatformLinux_ReadUpgradeProgramFile,
|
||||||
|
.closeUpgradeProgramFile = DjiUpgradePlatformLinux_CloseUpgradeProgramFile,
|
||||||
|
.replaceOldProgram = DjiUpgradePlatformLinux_ReplaceOldProgram,
|
||||||
|
.setUpgradeRebootState = DjiUpgradePlatformLinux_SetUpgradeRebootState,
|
||||||
|
.getUpgradeRebootState = DjiUpgradePlatformLinux_GetUpgradeRebootState,
|
||||||
|
.cleanUpgradeRebootState = DjiUpgradePlatformLinux_CleanUpgradeRebootState,
|
||||||
|
};
|
||||||
|
T_DjiTestUpgradeConfig testUpgradeConfig = {
|
||||||
|
.firmwareVersion = {1, 0, 0, 0},
|
||||||
|
.transferType = DJI_FIRMWARE_TRANSFER_TYPE_DCFTP,
|
||||||
|
.needReplaceProgramBeforeReboot = true
|
||||||
|
};
|
||||||
|
if (DjiTest_UpgradeStartService(&linuxUpgradePlatformOpt, testUpgradeConfig) !=
|
||||||
|
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("psdk upgrade init error");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MODULE_SAMPLE_MOP_CHANNEL_ON
|
#ifdef CONFIG_MODULE_SAMPLE_MOP_CHANNEL_ON
|
||||||
returnCode = DjiTest_MopChannelStartService();
|
returnCode = DjiTest_MopChannelStartService();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
@ -301,8 +337,8 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
|
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||||
returnCode = DjiTest_HmsStartService();
|
returnCode = DjiTest_HmsCustomizationStartService();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("hms test init error");
|
USER_LOG_ERROR("hms test init error");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,7 +88,7 @@ T_DjiReturnCode HalUart_Init(E_DjiHalUartNum uartNum, uint32_t baudRate, T_DjiUa
|
|||||||
sprintf(systemCmd, "chmod 777 %s", uartName);
|
sprintf(systemCmd, "chmod 777 %s", uartName);
|
||||||
fp = popen(systemCmd, "r");
|
fp = popen(systemCmd, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
goto free_uart_handle;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
project(dji_sdk_demo_on_jetson C)
|
project(dji_sdk_demo_on_jetson C)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
set(CMAKE_C_FLAGS "-pthread -std=gnu99")
|
||||||
|
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
|
||||||
set(CMAKE_C_COMPILER "gcc")
|
set(CMAKE_C_COMPILER "gcc")
|
||||||
set(CMAKE_CXX_COMPILER "g++")
|
set(CMAKE_CXX_COMPILER "g++")
|
||||||
@ -11,10 +12,11 @@ if (NOT USE_SYSTEM_ARCH)
|
|||||||
add_definitions(-DSYSTEM_ARCH_LINUX)
|
add_definitions(-DSYSTEM_ARCH_LINUX)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(COMMON_CXX_FLAGS "-std=c++11 -pthread")
|
if (BUILD_TEST_CASES_ON MATCHES TRUE)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
|
||||||
|
endif ()
|
||||||
|
|
||||||
set(PACKAGE_NAME payloadsdk)
|
set(PACKAGE_NAME payloadsdk)
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
||||||
|
|
||||||
#define CONFIG_MODULE_SAMPLE_HMS_ON
|
#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||||
|
|
||||||
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
|
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
|
||||||
|
|
||||||
|
|||||||
@ -96,6 +96,7 @@ int main(int argc, char **argv)
|
|||||||
T_DjiReturnCode returnCode;
|
T_DjiReturnCode returnCode;
|
||||||
T_DjiUserInfo userInfo;
|
T_DjiUserInfo userInfo;
|
||||||
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
T_DjiAircraftInfoBaseInfo aircraftInfoBaseInfo;
|
||||||
|
T_DjiAircraftVersion aircraftInfoVersion;
|
||||||
T_DjiFirmwareVersion firmwareVersion = {
|
T_DjiFirmwareVersion firmwareVersion = {
|
||||||
.majorVersion = 1,
|
.majorVersion = 1,
|
||||||
.minorVersion = 0,
|
.minorVersion = 0,
|
||||||
@ -136,6 +137,15 @@ int main(int argc, char **argv)
|
|||||||
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
returnCode = DjiAircraftInfo_GetAircraftVersion(&aircraftInfoVersion);
|
||||||
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
|
USER_LOG_ERROR("get aircraft version info error");
|
||||||
|
} else {
|
||||||
|
USER_LOG_INFO("Aircraft version is V%d.%d.%d.%d", aircraftInfoVersion.debugVersion,
|
||||||
|
aircraftInfoVersion.modifyVersion, aircraftInfoVersion.minorVersion,
|
||||||
|
aircraftInfoVersion.majorVersion);
|
||||||
|
}
|
||||||
|
|
||||||
returnCode = DjiCore_SetAlias("PSDK_APPALIAS");
|
returnCode = DjiCore_SetAlias("PSDK_APPALIAS");
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("set alias error");
|
USER_LOG_ERROR("set alias error");
|
||||||
@ -291,8 +301,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
|
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||||
returnCode = DjiTest_HmsStartService();
|
returnCode = DjiTest_HmsCustomizationStartService();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("hms test init error");
|
USER_LOG_ERROR("hms test init error");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -226,8 +226,8 @@ void DjiUser_StartTask(void const *argument)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MODULE_SAMPLE_HMS_ON
|
#ifdef CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||||
returnCode = DjiTest_HmsStartService();
|
returnCode = DjiTest_HmsCustomizationStartService();
|
||||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||||
USER_LOG_ERROR("hms test init error");
|
USER_LOG_ERROR("hms test init error");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
||||||
|
|
||||||
#define CONFIG_MODULE_SAMPLE_HMS_ON
|
#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON
|
||||||
|
|
||||||
/*!< Attention: Please uncomment it in gps environment.
|
/*!< Attention: Please uncomment it in gps environment.
|
||||||
* */
|
* */
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
|
# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
|
||||||
# http://www.st.com/internet/evalboard/product/252419.jsp
|
# http://www.st.com/internet/evalboard/product/252419.jsp
|
||||||
|
|
||||||
source [find interface/jlink.cfg]
|
### use stlink-v2-1
|
||||||
|
source [find interface/stlink-v2-1.cfg]
|
||||||
|
transport select hla_swd
|
||||||
|
|
||||||
transport select swd
|
### use jlink
|
||||||
|
# source [find interface/jlink.cfg]
|
||||||
|
# transport select swd
|
||||||
|
|
||||||
# increase working area to 64KB
|
# increase working area to 64KB
|
||||||
set WORKAREASIZE 0x10000
|
set WORKAREASIZE 0x10000
|
||||||
|
|||||||
@ -405,6 +405,11 @@
|
|||||||
<Files>
|
<Files>
|
||||||
<File>
|
<File>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
|
<FileName>cJSON.c</FileName>
|
||||||
|
<FilePath>..\..\..\..\..\module_sample\utils\cJSON.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileType>1</FileType>
|
||||||
<FileName>file_binary_array_list_en.c</FileName>
|
<FileName>file_binary_array_list_en.c</FileName>
|
||||||
<FilePath>..\..\..\..\..\module_sample\widget\file_binary_array_list_en.c</FilePath>
|
<FilePath>..\..\..\..\..\module_sample\widget\file_binary_array_list_en.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
@ -940,11 +945,21 @@
|
|||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
|
<FileName>dji_hms_customization.h</FileName>
|
||||||
|
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_customization.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileType>5</FileType>
|
||||||
<FileName>dji_hms_info_table.h</FileName>
|
<FileName>dji_hms_info_table.h</FileName>
|
||||||
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_info_table.h</FilePath>
|
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_info_table.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
<File>
|
<File>
|
||||||
<FileType>5</FileType>
|
<FileType>5</FileType>
|
||||||
|
<FileName>dji_hms_manager.h</FileName>
|
||||||
|
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_hms_manager.h</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileType>5</FileType>
|
||||||
<FileName>dji_liveview.h</FileName>
|
<FileName>dji_liveview.h</FileName>
|
||||||
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_liveview.h</FilePath>
|
<FilePath>..\..\..\..\..\..\..\psdk_lib\include\dji_liveview.h</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
Reference in New Issue
Block a user