diff --git a/README.md b/README.md index a31f1126..d8a74d2c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # DJI Payload SDK (PSDK) -![](https://img.shields.io/badge/version-V3.9.0-pink.svg) -![](https://img.shields.io/badge/platform-linux_|_rtos-cyan.svg) -![](https://img.shields.io/badge/license-MIT-blue.svg) +![](https://img.shields.io/badge/version-V3.9.1-red.svg) +![](https://img.shields.io/badge/platform-linux_|_rtos-blue.svg) +![](https://img.shields.io/badge/license-MIT-purple.svg) ## What is the DJI Payload SDK? @@ -23,23 +23,16 @@ to get the latest version information. ## Latest Release -The latest release version of PSDK is 3.9.0. This version of Payload SDK mainly add some new features support and fixed some +The latest release version of PSDK is 3.9.1. 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. -* Supports the payload camera Zenmuse H30 series. -* FlyCart 30 aircraft supports the time synchronization function. -* FlyCart 30 aircraft supports HMS functions. -* FlyCart 30 aircraft supports the data subscription function. -* Fixed the issue with inaccurate zoom multiplier retrieval for the Mavic 3 Enterprise series cameras. -* Fixed data errors on the receiving end of small data transfers from MSDK to PSDK. -* Fixed the inability of devices at payload ports 2 and 3 of the M300 RTK aircraft to perform small data transmission to devices connected to the OSDK port. -* Fixed the issue where MSDK V5 and PSDK devices could not perform small data transmission when using M300 RTK and M350 RTK aircraft. -* Fixed occasional payload negotiation failures between PSDK and the M350 RTK aircraft. -* Fixed screen flickering and glitching issues with the H20T payload camera's video stream. -* Fixed issues with retrieving the visible light camera video stream from the M3TD camera. -* Optimized the C++ camera management sample. -* Optimized memory usage strategy for STM32 platform sample by introducing CCMRAM. -> Note: For M300 RTK and M350 RTK, the camera management module now checks the payload port device's status at startup. This may occasionally result in log errors. Normal function is not affected, and this will be optimized in a future release. +* GEO Caging feature supported for the M3D series models. +* Flight control function and waypoint mission supported for the FlyCart 30 model. +* Fixed an issue with subscribing to the flight control topics for M300 RTK and M350 RTK models. +* Resolved a problem with DJI Smart Controller Enterprise not recognizing PSDK payload devices on M300 RTK. +* Fixed an issue with acquiring the camera stream without I-frames on M3D series models. +* Added the MOP 49154 channel as an alternative to the 49152 channel for subscribing to the L2 camera's real-time 3D point cloud. This enhancement avoids conflicts when subscribing to point cloud data concurrently with Pilot2 and improves the quality of the point cloud data. +> Note: When using M300 RTK with the DJI Smart Controller Enterprise to activate payloads via the OSDK interface, the remote controller will not recognize the payload device if the virtual serial port is not utilized. ## License diff --git a/psdk_lib/include/dji_aircraft_info.h b/psdk_lib/include/dji_aircraft_info.h index 5e77e242..79a513bd 100644 --- a/psdk_lib/include/dji_aircraft_info.h +++ b/psdk_lib/include/dji_aircraft_info.h @@ -46,7 +46,7 @@ typedef struct { } T_DjiMobileAppInfo; /** - * @brief Some base information of aircraft system, mainly including some constant parameters information of system. + * @brief Basic information about the aircraft system, mainly including some constant parameters information. */ typedef struct { E_DjiAircraftSeries aircraftSeries; /*!< Aircraft series. */ @@ -68,31 +68,31 @@ typedef struct { /* Exported functions --------------------------------------------------------*/ /** - * @brief Get base information of aircraft system, including aircraft type and DJI adapter type. - * @param baseInfo: pointer to memory space used to store base information of the aircraft system. + * @brief Basic information about the aircraft system, including aircraft type and DJI adapter type. + * @param baseInfo: Pointer to a memory space where the aircraft's basic information will be stored. * @return Execution result. */ T_DjiReturnCode DjiAircraftInfo_GetBaseInfo(T_DjiAircraftInfoBaseInfo *baseInfo); /** - * @brief Get information related to mobile APP. - * @note The mobile APP language and screen type is unknown if RC or APP is not connected to the aircraft system. - * @param mobileAppInfo: pointer to memory space used to store information related to mobile APP. + * @brief Get information related to mobile app. + * @note Returns unknown for app language and screen type if the RC or app is not connected to the aircraft system. + * @param mobileAppInfo: Pointer to a memory space where the mobile app information will be stored. * @return Execution result. */ T_DjiReturnCode DjiAircraftInfo_GetMobileAppInfo(T_DjiMobileAppInfo *mobileAppInfo); /** - * @brief Get connection status of payload and aircraft. + * @brief Get connection status between the payload and the aircraft. * @note Update period: 1Hz - * @param isConnected: pointer to connection status. + * @param isConnected: Pointer to connection status. * @return Execution result. */ T_DjiReturnCode DjiAircraftInfo_GetConnectionStatus(bool *isConnected); /** - * @brief Get version of aircraft. - * @param aircraftVersion: pointer to aircraft version. + * @brief Get version of the aircraft. + * @param aircraftVersion: Pointer to aircraft version. * @return Execution result. */ T_DjiReturnCode DjiAircraftInfo_GetAircraftVersion(T_DjiAircraftVersion *aircraftVersion); diff --git a/psdk_lib/include/dji_flight_controller.h b/psdk_lib/include/dji_flight_controller.h index 7a60e944..3df46c1a 100644 --- a/psdk_lib/include/dji_flight_controller.h +++ b/psdk_lib/include/dji_flight_controller.h @@ -132,7 +132,13 @@ typedef T_DjiReturnCode (*JoystickCtrlAuthorityEventCbFunc)( T_DjiFlightControllerJoystickCtrlAuthorityEventInfo eventData); /** - * @brief Horizon control mode enum in joystick mode + * @brief Prototype of callback function used to get the trigger FTS event. + * @return Execution result. + */ +typedef T_DjiReturnCode (*TriggerFtsEventCallback)(void); + +/** + * @brief Horizon control mode in joystick mode enum * @note Only when the GPS signal is good (health_flag >=3),horizontal position control (DJI_FLIGHT_CONTROLLER_HORIZONTAL_POSITION_CONTROL_MODE) * related control modes can be used. Only when GPS signal is good (health_flag >=3),or advanced sensing system is working properly with Autopilot, * horizontal velocity control(DJI_FLIGHT_CONTROLLER_HORIZONTAL_VELOCITY_CONTROL_MODE) related control modes can be used. @@ -633,6 +639,16 @@ DjiFlightController_SetRCLostActionEnableStatus(E_DjiFlightControllerRCLostActio T_DjiReturnCode DjiFlightController_GetEnableRCLostActionStatus(E_DjiFlightControllerRCLostActionEnableStatus *command); +/** + * @brief Register callback function for the trigger FTS event. + * @note The timing of the trigger of the callback function of the FTS is determined by the aircraft, and the trigger + * execution action of the FTS needs to be implemented in the callback function and the correct return value +* must be returned, otherwise the aircraft will always be triggered. + * @param callback: the callback for the trigger FTS event. + * @return Execution result. + */ +T_DjiReturnCode DjiFlightController_RegTriggerFtsEventCallback(TriggerFtsEventCallback callback); + #ifdef __cplusplus } #endif diff --git a/psdk_lib/include/dji_gimbal_manager.h b/psdk_lib/include/dji_gimbal_manager.h index 82e18020..f38f6b20 100644 --- a/psdk_lib/include/dji_gimbal_manager.h +++ b/psdk_lib/include/dji_gimbal_manager.h @@ -52,7 +52,7 @@ typedef struct { /* Exported functions --------------------------------------------------------*/ /** * @brief Initialize the gimbal manager module. - * @note This interface must be initialized after DjiCore_Init.. + * @note This interface must be initialized after DjiCore_Init. * @return Execution result. */ T_DjiReturnCode DjiGimbalManager_Init(void); diff --git a/psdk_lib/include/dji_typedef.h b/psdk_lib/include/dji_typedef.h index d9762fd9..fe806426 100644 --- a/psdk_lib/include/dji_typedef.h +++ b/psdk_lib/include/dji_typedef.h @@ -215,10 +215,8 @@ typedef enum { */ typedef enum { DJI_MOBILE_APP_SCREEN_TYPE_UNKNOWN = 255, /*!< Mobile APP screen type is unknown. */ - DJI_MOBILE_APP_SCREEN_TYPE_BIG_SCREEN = 0, /*!< The big screen of mobile device refers to a screen - * size greater than or equal to 6 inches. */ - DJI_MOBILE_APP_SCREEN_TYPE_LITTLE_SCREEN = 1, /*!< The little screen of mobile device refers to a - * screen size less than 6 inches. */ + DJI_MOBILE_APP_SCREEN_TYPE_BIG_SCREEN = 0, /*!< Screen size is 6 inches or larger. */ + DJI_MOBILE_APP_SCREEN_TYPE_LITTLE_SCREEN = 1, /*!< Screen size is less than 6 inches. */ } E_DjiMobileAppScreenType; /** @@ -250,7 +248,7 @@ typedef enum { DJI_SDK_ADAPTER_TYPE_UNKNOWN = 0, /*!< SDK adapter type is unknown. */ DJI_SDK_ADAPTER_TYPE_SKYPORT_V2 = 1, /*!< SDK adapter type is Skyport V2. */ DJI_SDK_ADAPTER_TYPE_XPORT = 2, /*!< SDK adapter type is X-Port. */ - DJI_SDK_ADAPTER_TYPE_NONE = 3, /*!< don't have any adapter outside */ + DJI_SDK_ADAPTER_TYPE_NONE = 3, /*!< No external adapter is connected. */ } E_DjiSdkAdapterType; typedef enum { @@ -268,56 +266,47 @@ typedef enum { * @brief Camera focus target point when in focus mode. */ typedef struct { - dji_f32_t focusX; /*!< Specifies horizontal zone coordinate. This parameter is between 0 and 1. - The point [0.0, 0.0] represents the top-left angle of the screen.*/ - dji_f32_t focusY; /*!< Specifies vertical zone coordinate. This parameter is between 0 and 1. */ + dji_f32_t focusX; /*!< Specifies the horizontal coordinate within the zone. Range: 0 to 1. + The point [0.0, 0.0] represents the top-left corner of the screen.*/ + dji_f32_t focusY; /*!< Specifies vertical zone coordinate. Range: 0 to 1. */ } T_DjiCameraPointInScreen; /** - * @brief Camera time interval settings when in interval shootPhoto mode. + * @brief Camera time interval settings for interval shoot-photo mode. */ typedef struct { uint8_t captureCount; /*!< Specifies the total capture count of interval settings. - * 0:reserve 1~254:number 255:keep capturing till stop */ + * 0: reserved, 1-254: specific number, 255: continuous capture until stopped. */ uint16_t timeIntervalSeconds; /*!< Specifies the interval time between two captures, unit: s*/ } T_DjiCameraPhotoTimeIntervalSettings; /** - * @brief Camera zoom speed. + * @brief Camera zoom speeds. */ typedef enum { - DJI_CAMERA_ZOOM_SPEED_SLOWEST = 72, /*!< Lens zooms in slowest speed. */ - DJI_CAMERA_ZOOM_SPEED_SLOW = 73, /*!< Lens zooms in slow speed. */ - DJI_CAMERA_ZOOM_SPEED_MODERATELY_SLOW = 74, /*!< Lens zooms in speed slightly slower than normal speed. */ - DJI_CAMERA_ZOOM_SPEED_NORMAL = 75, /*!< Lens zooms in normal speed. */ - DJI_CAMERA_ZOOM_SPEED_MODERATELY_FAST = 76, /*!< Lens zooms very in speed slightly faster than normal speed. */ - DJI_CAMERA_ZOOM_SPEED_FAST = 77, /*!< Lens zooms very in fast speed. */ - DJI_CAMERA_ZOOM_SPEED_FASTEST = 78, /*!< Lens zooms very in fastest speed. */ + DJI_CAMERA_ZOOM_SPEED_SLOWEST = 72, /*!< Slowest zoom speed. */ + DJI_CAMERA_ZOOM_SPEED_SLOW = 73, /*!< Slow zoom speed. */ + DJI_CAMERA_ZOOM_SPEED_MODERATELY_SLOW = 74, /*!< Slightly slower than normal zoom speed. */ + DJI_CAMERA_ZOOM_SPEED_NORMAL = 75, /*!< Normal zoom speed. */ + DJI_CAMERA_ZOOM_SPEED_MODERATELY_FAST = 76, /*!< Slightly faster than normal zoom speed. */ + DJI_CAMERA_ZOOM_SPEED_FAST = 77, /*!< Fast zoom speed. */ + DJI_CAMERA_ZOOM_SPEED_FASTEST = 78, /*!< Fastest zoom speed. */ } E_DjiCameraZoomSpeed; typedef enum { - /*! The number of pictures to continuously take each time in BURST mode is 2 - */ + /*! The burst mode can capture 2 pictures per trigger. */ DJI_CAMERA_BURST_COUNT_2 = 2, - /*! The number of pictures to continuously take each time in BURST mode is 3 - */ + /*! The burst mode can capture 3 pictures per trigger. */ DJI_CAMERA_BURST_COUNT_3 = 3, - /*! The number of pictures to continuously take each time in BURST mode is 5 - */ + /*! The burst mode can capture 5 pictures per trigger. */ DJI_CAMERA_BURST_COUNT_5 = 5, - /*! The number of pictures to continuously take each time in BURST mode is 7 - */ + /*! The burst mode can capture 7 pictures per trigger. */ DJI_CAMERA_BURST_COUNT_7 = 7, - /*! The number of pictures to continuously take at one time in BURST mode is - * 10, Only supported by X4S camera, X5S camera and Phantom 4 Pro camera. - */ + /*! Supports capturing 10 pictures per trigger, only supported by X4S, X5S cameras, and Phantom 4 Pro. */ DJI_CAMERA_BURST_COUNT_10 = 10, - /*! The number of pictures to continuously take at one time in BURST mode is - * 14, Only supported by X4S camera, X5S camera and Phantom 4 Pro camera. - */ + /*! Supports capturing 14 pictures per trigger, only supported by X4S, X5S cameras, and Phantom 4 Pro. */ DJI_CAMERA_BURST_COUNT_14 = 14, - /*! The camera burst shoot count value is unknown. - */ + /*! Unknown burst count. */ DJI_CAMERA_BURST_COUNT_KNOWN = 0xFF, } E_DjiCameraBurstCount; @@ -325,8 +314,8 @@ typedef enum { * @brief Camera zoom direction. */ typedef enum { - DJI_CAMERA_ZOOM_DIRECTION_OUT = 0, /*!< The lens moves in the far direction, the zoom factor becomes smaller. */ - DJI_CAMERA_ZOOM_DIRECTION_IN = 1, /*!< The lens moves in the near direction, the zoom factor becomes larger. */ + DJI_CAMERA_ZOOM_DIRECTION_OUT = 0, /*!< Zooms out, reducing the zoom factor. */ + DJI_CAMERA_ZOOM_DIRECTION_IN = 1, /*!< Zooms in, increasing the zoom factor. */ } E_DjiCameraZoomDirection; #pragma pack (1) @@ -354,55 +343,70 @@ typedef struct { bool busyState; } T_DjiDataChannelState; -typedef struct Vector3d { - int32_t x; /*!< Specifies int32 value of x for vector. */ - int32_t y; /*!< Specifies int32 value of y for vector. */ - int32_t z; /*!< Specifies int32 value of z for vector. */ +/** + * @brief Represents a vector using int32 coordinates. + */ +typedef struct Vector3d{ + int32_t x; /*!< X-coordinate of the vector. */ + int32_t y; /*!< Y-coordinate of the vector. */ + int32_t z; /*!< Z-coordinate of the vector. */ } T_DjiVector3d; -typedef struct Vector3f { - dji_f32_t x; /*!< Specifies float value of x for vector. */ - dji_f32_t y; /*!< Specifies float value of y for vector. */ - dji_f32_t z; /*!< Specifies float value of z for vector. */ +/** + * @brief Represents a vector using floating-point coordinates. + */ +typedef struct Vector3f{ + dji_f32_t x; /*!< X-coordinate of the vector. */ + dji_f32_t y; /*!< Y-coordinate of the vector. */ + dji_f32_t z; /*!< Z-coordinate of the vector. */ } T_DjiVector3f; +/** + * @brief Represents an attitude using int32 values for pitch, roll, and yaw. + */ typedef struct { - int32_t pitch; /*!< Specifies int32 value of pitch for attitude. */ - int32_t roll; /*!< Specifies int32 value of roll for attitude */ - int32_t yaw; /*!< Specifies int32 value of yaw for attitude */ + int32_t pitch; /*!< Pitch angle in degrees. */ + int32_t roll; /*!< Roll angle in degrees. */ + int32_t yaw; /*!< Yaw angle in degrees. */ } T_DjiAttitude3d; +/** + * @brief Represents an attitude using floating-point values for pitch, roll, and yaw. + */ typedef struct { - dji_f32_t pitch; /*!< Specifies float value of pitch for attitude. */ - dji_f32_t roll; /*!< Specifies float value of roll for attitude */ - dji_f32_t yaw; /*!< Specifies float value of yaw for attitude */ + dji_f32_t pitch; /*!< Pitch angle in degrees. */ + dji_f32_t roll; /*!< Roll angle in degrees. */ + dji_f32_t yaw; /*!< Yaw angle in degrees. */ } T_DjiAttitude3f; +/** + * @brief Represents a quaternion, when converted to a rotation matrix or Euler angles. + */ typedef struct { - dji_f32_t q0; /*!< w, when converted to a rotation matrix or Euler angles. */ - dji_f32_t q1; /*!< x, when converted to a rotation matrix or Euler angles. */ - dji_f32_t q2; /*!< y, when converted to a rotation matrix or Euler angles. */ - dji_f32_t q3; /*!< z, when converted to a rotation matrix or Euler angles. */ + dji_f32_t q0; /*!< Quaternion component w. */ + dji_f32_t q1; /*!< Quaternion component x. */ + dji_f32_t q2; /*!< Quaternion component y. */ + dji_f32_t q3; /*!< Quaternion component z. */ } T_DjiQuaternion4f; /** * @brief Timestamp data structure. */ typedef struct { - uint32_t millisecond; /*!< Millisecond. */ - uint32_t microsecond; /*!< Microsecond. */ + uint32_t millisecond; + uint32_t microsecond; } T_DjiDataTimestamp; /** * @brief The firmware version of payload. - * @note If majorVersion = AA, minorVersion = BB, modifyVersion = CC, debugVersion = DD, The version show in - * terminal APP is AA.BB.CC.DD + * @note The firmware version is displayed as AA.BB.CC.DD where AA is majorVersion, + * BB is minorVersion, CC is modifyVersion, and DD is debugVersion. */ typedef struct { - uint8_t majorVersion; /*!< The major version of firmware, the range is 0 ~ 99. */ - uint8_t minorVersion; /*!< The minor version of firmware, the range is 0 ~ 99. */ - uint8_t modifyVersion; /*!< The modify version of firmware, the range is 0 ~ 99. */ - uint8_t debugVersion; /*!< The debug version of firmware, the range is 0 ~ 99. */ + uint8_t majorVersion; /*!< Major version number, ranging from 0 to 99. */ + uint8_t minorVersion; /*!< Minor version number, ranging from 0 to 99. */ + uint8_t modifyVersion; /*!< Modification version number, ranging from 0 to 99. */ + uint8_t debugVersion; /*!< Debug version number, ranging from 0 to 99. */ } T_DjiFirmwareVersion; #pragma pack () diff --git a/psdk_lib/include/dji_version.h b/psdk_lib/include/dji_version.h index 5efc47bf..12d39b01 100644 --- a/psdk_lib/include/dji_version.h +++ b/psdk_lib/include/dji_version.h @@ -35,9 +35,9 @@ extern "C" { /* 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_MINOR 9 /*!< 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 1 /*!< 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_BUILD 2044 /*!< DJI SDK version build info, when jenkins trigger build changes. Range from 0 to 65535. */ +#define DJI_VERSION_BUILD 2090 /*!< DJI SDK version build info, when jenkins trigger build changes. Range from 0 to 65535. */ /* Exported types ------------------------------------------------------------*/ diff --git a/psdk_lib/lib/aarch64-linux-gnu-gcc/libpayloadsdk.a b/psdk_lib/lib/aarch64-linux-gnu-gcc/libpayloadsdk.a index bbadcf5f..ae79c8fd 100644 Binary files a/psdk_lib/lib/aarch64-linux-gnu-gcc/libpayloadsdk.a and b/psdk_lib/lib/aarch64-linux-gnu-gcc/libpayloadsdk.a differ diff --git a/psdk_lib/lib/arm-linux-gnueabi-gcc/libpayloadsdk.a b/psdk_lib/lib/arm-linux-gnueabi-gcc/libpayloadsdk.a index 390bf875..d4dc8c07 100644 Binary files a/psdk_lib/lib/arm-linux-gnueabi-gcc/libpayloadsdk.a and b/psdk_lib/lib/arm-linux-gnueabi-gcc/libpayloadsdk.a differ diff --git a/psdk_lib/lib/arm-linux-gnueabihf-gcc/libpayloadsdk.a b/psdk_lib/lib/arm-linux-gnueabihf-gcc/libpayloadsdk.a index f2714be7..868bf7a2 100644 Binary files a/psdk_lib/lib/arm-linux-gnueabihf-gcc/libpayloadsdk.a and b/psdk_lib/lib/arm-linux-gnueabihf-gcc/libpayloadsdk.a differ diff --git a/psdk_lib/lib/armcc_cortex-m4/libpayload.lib b/psdk_lib/lib/armcc_cortex-m4/libpayload.lib index 0d718a08..400c258e 100644 Binary files a/psdk_lib/lib/armcc_cortex-m4/libpayload.lib and b/psdk_lib/lib/armcc_cortex-m4/libpayload.lib differ diff --git a/psdk_lib/lib/x86_64-linux-gnu-gcc/libpayloadsdk.a b/psdk_lib/lib/x86_64-linux-gnu-gcc/libpayloadsdk.a index cb341c73..cf0147a5 100644 Binary files a/psdk_lib/lib/x86_64-linux-gnu-gcc/libpayloadsdk.a and b/psdk_lib/lib/x86_64-linux-gnu-gcc/libpayloadsdk.a differ diff --git a/samples/sample_c++/module_sample/flight_controller/test_flight_controller_entry.cpp b/samples/sample_c++/module_sample/flight_controller/test_flight_controller_entry.cpp index 5d7b3022..0d281e2c 100644 --- a/samples/sample_c++/module_sample/flight_controller/test_flight_controller_entry.cpp +++ b/samples/sample_c++/module_sample/flight_controller/test_flight_controller_entry.cpp @@ -51,17 +51,18 @@ void DjiUser_RunFlightControllerSample(void) 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" + << "| 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" + << "| [a] EU-C6 FTS trigger sample - receive fts callback to trigger parachute function (only support on M3D/M3DT) |\n" << std::endl; std::cin >> inputSelectSample; @@ -96,6 +97,9 @@ void DjiUser_RunFlightControllerSample(void) case '9': DjiTest_InterestPointRunSample(); break; + case 'a': + DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_FTS_TRIGGER); + break; case 'q': break; default: diff --git a/samples/sample_c/module_sample/camera_manager/test_camera_manager.c b/samples/sample_c/module_sample/camera_manager/test_camera_manager.c index 8edfddf5..040cc53b 100644 --- a/samples/sample_c/module_sample/camera_manager/test_camera_manager.c +++ b/samples/sample_c/module_sample/camera_manager/test_camera_manager.c @@ -39,7 +39,7 @@ #define TEST_CAMERA_MAX_INFRARED_ZOOM_FACTOR 8 #define TEST_CAMERA_MIN_INFRARED_ZOOM_FACTOR 2 -#define TEST_CAMERA_MOP_CHANNEL_SUBSCRIBE_POINT_CLOUD_CHANNEL_ID 49152 +#define TEST_CAMERA_MOP_CHANNEL_SUBSCRIBE_POINT_CLOUD_CHANNEL_ID 49154 #define TEST_CAMERA_MOP_CHANNEL_SUBSCRIBE_POINT_CLOUD_RECV_BUFFER (512 * 1024) #define TEST_CAMERA_MOP_CHANNEL_COLOR_POINTS_BUFFER (512 * 1024) #define TEST_CAMERA_MOP_CHANNEL_WAIT_TIME_MS (3 * 1000) diff --git a/samples/sample_c/module_sample/flight_control/test_flight_control.c b/samples/sample_c/module_sample/flight_control/test_flight_control.c index 896012ba..36979877 100644 --- a/samples/sample_c/module_sample/flight_control/test_flight_control.c +++ b/samples/sample_c/module_sample/flight_control/test_flight_control.c @@ -43,6 +43,8 @@ typedef struct { static T_DjiOsalHandler *s_osalHandler = NULL; static const double s_earthCenter = 6378137.0; static const double s_degToRad = 0.01745329252; +static bool s_isFtsCallbackRegistered = false; +static int32_t s_ftsTriggerCount = 0; static const T_DjiTestFlightControlDisplayModeStr s_flightControlDisplayModeStr[] = { {.displayMode = DJI_FC_SUBSCRIPTION_DISPLAY_MODE_ATTITUDE, .displayModeStr = "attitude mode"}, @@ -95,6 +97,9 @@ static void DjiTest_FlightControlPositionControlSample(void); static void DjiTest_FlightControlGoHomeForceLandingSample(void); static void DjiTest_FlightControlVelocityControlSample(void); static void DjiTest_FlightControlArrestFlyingSample(void); +static void DjiTest_FlightControlSetGetParamSample(void); +static void DjiTest_FlightControlPassiveTriggerFtsSample(void); +static T_DjiReturnCode DjiTest_TriggerFtsEventCallback(void); static void DjiTest_FlightControlSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect); /* Exported functions definition ---------------------------------------------*/ @@ -883,6 +888,42 @@ void DjiTest_FlightControlSetGetParamSample() DjiTest_WidgetLogAppend("Flight control set-get-param sample end"); } +T_DjiReturnCode DjiTest_TriggerFtsEventCallback(void) +{ + USER_LOG_INFO("Received FTS Trigger event, count = %d.", s_ftsTriggerCount); + if (s_ftsTriggerCount == 0) { + USER_LOG_WARN("Note: Simulate a trigger failure scenario and return an error value, this function will be invoked again."); + s_ftsTriggerCount++; + return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR; + } else { + USER_LOG_WARN("Note: This is an empty implementation, and the FTS signal needs to be triggered by the PWM signal."); + return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS; + } + + return DJI_ERROR_SYSTEM_MODULE_CODE_SYSTEM_ERROR; +} + +void DjiTest_FlightControlPassiveTriggerFtsSample(void) +{ + T_DjiReturnCode returnCode; + + USER_LOG_INFO("Flight control passive trigger FTS sample start."); + + if (s_isFtsCallbackRegistered == false) { + returnCode = DjiFlightController_RegTriggerFtsEventCallback(DjiTest_TriggerFtsEventCallback); + if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) { + USER_LOG_ERROR("Register trigger FTS event callback failed."); + return; + } else { + s_isFtsCallbackRegistered = true; + USER_LOG_INFO("Register trigger FTS event callback successfully." + "Please wait for the aircraft to trigger the payload to execute FTS action."); + } + } else { + USER_LOG_WARN("FTS trigger event callback has been registered, no need to register again."); + } +} + void DjiTest_FlightControlSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect) { switch (flightCtrlSampleSelect) { @@ -910,6 +951,10 @@ void DjiTest_FlightControlSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampl DjiTest_FlightControlSetGetParamSample(); break; } + case E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_FTS_TRIGGER: { + DjiTest_FlightControlPassiveTriggerFtsSample(); + break; + } default: break; } diff --git a/samples/sample_c/module_sample/flight_control/test_flight_control.h b/samples/sample_c/module_sample/flight_control/test_flight_control.h index 448ce664..f8c6ba9b 100644 --- a/samples/sample_c/module_sample/flight_control/test_flight_control.h +++ b/samples/sample_c/module_sample/flight_control/test_flight_control.h @@ -42,6 +42,7 @@ typedef enum { E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_TAKE_OFF_VELOCITY_CTRL_LANDING, E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_ARREST_FLYING, E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM, + E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_FTS_TRIGGER, } E_DjiTestFlightCtrlSampleSelect; #pragma pack(1) diff --git a/samples/sample_c/platform/rtos_freertos/stm32f4_discovery/application/dji_sdk_config.h b/samples/sample_c/platform/rtos_freertos/stm32f4_discovery/application/dji_sdk_config.h index cebf81a7..9631f136 100644 --- a/samples/sample_c/platform/rtos_freertos/stm32f4_discovery/application/dji_sdk_config.h +++ b/samples/sample_c/platform/rtos_freertos/stm32f4_discovery/application/dji_sdk_config.h @@ -40,9 +40,9 @@ extern "C" { #define CONFIG_MODULE_SAMPLE_WIDGET_SPEAKER_ON -#define CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON +// #define CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON -#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON +// #define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON #define CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON @@ -52,7 +52,7 @@ extern "C" { #define CONFIG_MODULE_SAMPLE_UPGRADE_ON -#define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON +// #define CONFIG_MODULE_SAMPLE_HMS_CUSTOMIZATION_ON /*!< Attention: Please uncomment it in gps environment. * */ diff --git a/samples/sample_c/platform/rtos_freertos/stm32f4_discovery/application/main.c b/samples/sample_c/platform/rtos_freertos/stm32f4_discovery/application/main.c index bf22f2e3..c5f24c33 100644 --- a/samples/sample_c/platform/rtos_freertos/stm32f4_discovery/application/main.c +++ b/samples/sample_c/platform/rtos_freertos/stm32f4_discovery/application/main.c @@ -55,10 +55,6 @@ void Error_Handler(void); int main(void) { - __disable_irq(); - SCB->VTOR = APPLICATION_ADDRESS; - __enable_irq(); - /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec