diff --git a/README.md b/README.md index acdaa7f..04ac488 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # DJI Payload SDK (PSDK) -![](https://img.shields.io/badge/version-V3.13.0-blue.svg) -![](https://img.shields.io/badge/platform-linux_|_rtos-pink.svg) -![](https://img.shields.io/badge/license-MIT-green.svg) +![](https://img.shields.io/badge/version-V3.13.1-purple.svg) +![](https://img.shields.io/badge/platform-linux_|_rtos-red.svg) +![](https://img.shields.io/badge/license-MIT-cyan.svg) ## What is the DJI Payload SDK? @@ -23,20 +23,20 @@ to get the latest version information. ## Latest Release -The latest release version of PSDK is 3.13.0. This version of Payload SDK mainly add some new features support and fixed some +The latest release version of PSDK is 3.13.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. -### Manifold 3 Support -- **Supports M4D series drone dock versions (DJI Pilot app temporarily unsupported)** -- **Enables PSDK advanced features for M4D** -- **Enables MOP function for M400** -- **Supports installation/uninstallation of Manifold 3 apps via DJI FlightHub** -- **Enables rendering of Manifold 3 AI app recognition results in DJI FlightHub** +### Released Feature List -### Fixes and Optimizations -- **Fixed M300 PSDK low-speed data transmission failure from payload port to onboard port** -- **Fixed M350 drone's inability to acquire real-time streams from Zenmuse P1 and Zenmuse L1** +* Supports Mavic 3TA model +### Bug Fixes and Performance Improvements +* Fixed an issue where the `DjiCore_Init` API failed on the Matrice 300. +* Fixed an issue where quaternion data subscription failed for the Matrice 350 RTK. +* Fixed occasional failures in the `DjiCore_Deinit` API. +* Fixed occasional crashes caused by custom HMS modules. +* Changed the default to not support RC-less flight. and exposed the `DjiFlightController_SetRCLostActionEnableStatus` API to disable or enable actions when the RC is lost. +Note If you need to use RC-less flight, you must call this interface to disable RC-lost actions after `DjiFlightController_Init`. See the interface header file documentation for details. ## License Payload SDK codebase is MIT-licensed. Please refer to the LICENSE file for detailed information. diff --git a/psdk_lib/include/dji_flight_controller.h b/psdk_lib/include/dji_flight_controller.h index 4f55fdc..27e97f8 100644 --- a/psdk_lib/include/dji_flight_controller.h +++ b/psdk_lib/include/dji_flight_controller.h @@ -298,6 +298,9 @@ typedef struct { /* Exported functions --------------------------------------------------------*/ /** * @brief Initialise flight controller module + * @note If flight without RC is required, call DjiFlightController_SetRCLostActionEnableStatus(DJI_FLIGHT_CONTROLLER_DISABLE_RC_LOST_ACTION) after initialization. + * Otherwise, when the remote controller goes offline, the configured RC-lost action + * (e.g., return-to-home, auto-landing, hover, etc.) will be executed. * @param ridInfo: Must report the correct RID information before using PSDK to control the aircraft. * @return Execution result. */ @@ -647,6 +650,10 @@ T_DjiReturnCode DjiFlightController_GetGeneralInfo(T_DjiFlightControllerGeneralI * if the command is disable, the aircraft will execute RC lost action when RC is lost but PSDK is running * the aircraft will execute RC lost action when RC is lost and PSDK is lost whatever the command is. * default command is disable. + * If flight without RC is required, set DJI_FLIGHT_CONTROLLER_DISABLE_RC_LOST_ACTION. + * Otherwise, when the remote controller goes offline, the configured RC-lost action + * (e.g., return-to-home, auto-landing, hover, etc.) will be executed. + * * @param executeRCLostActionOrNotWhenOnboardOn enable:1;disable:0 * @return T_DjiReturnCode error code */ diff --git a/psdk_lib/include/dji_version.h b/psdk_lib/include/dji_version.h index 400daa3..a3075c5 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 13 /*!< 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 2270 /*!< DJI SDK version build info, when jenkins trigger build changes. Range from 0 to 65535. */ +#define DJI_VERSION_BUILD 2277 /*!< 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 6f85d9f..8f787cf 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 90df0ba..9bea1bc 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 1cd1959..1dfe760 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-m33/libpayload.lib b/psdk_lib/lib/armcc_cortex-m33/libpayload.lib deleted file mode 100644 index 9948463..0000000 Binary files a/psdk_lib/lib/armcc_cortex-m33/libpayload.lib and /dev/null differ diff --git a/psdk_lib/lib/armcc_cortex-m4/libpayload.lib b/psdk_lib/lib/armcc_cortex-m4/libpayload.lib index 1d2d4f3..5279fb5 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 35fe7c4..096e47b 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 f182a01..3e15e0e 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 @@ -66,6 +66,7 @@ start: << "| [b] Slow rotate blade sample, only support on M400 |\n" << "| [c] Select FTS pwm trigger position, support on M4/M4T/M4D/M4TD |\n" << "| [d] Select FTS pwm trigger position, support on M400 |\n" + << "| [f] Flight controller sample - Set the RC lost action enable, execute the RC lost action when RC is lost |\n" << std::endl; std::cin >> inputSelectSample; @@ -114,6 +115,9 @@ start: case 'd': // for m400 DjiTest_FlightControlFtsPwmTriggerSample(DJI_MOUNT_POSITION_EXTENSION_PORT_V2_NO4, "DJI_MOUNT_POSITION_EXTENSION_PORT_V2_NO4"); break; + case 'f': + DjiTest_FlightControlRunSample(E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_RC_LOST_ACTION_STATUS_ENBALE); + break; case 'q': break; default: diff --git a/samples/sample_c++/module_sample/liveview/test_liveview_entry.cpp b/samples/sample_c++/module_sample/liveview/test_liveview_entry.cpp old mode 100644 new mode 100755 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 c28fdf1..af4a452 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 @@ -100,6 +100,7 @@ static void DjiTest_FlightControlArrestFlyingSample(void); static void DjiTest_FlightControlSetGetParamSample(void); static void DjiTest_FlightControlPassiveTriggerFtsSample(void); static void DjiTest_FlightControlSlowRotateMotorSample(void); +static void DjiTest_FlightControlRCLostActionEnableSample(void); static T_DjiReturnCode DjiTest_TriggerFtsEventCallback(void); static void DjiTest_FlightControlSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect); @@ -116,6 +117,11 @@ T_DjiReturnCode DjiTest_FlightControlRunSample(E_DjiTestFlightCtrlSampleSelect f USER_LOG_ERROR("Init flight Control sample failed,error code:0x%08llX", returnCode); return returnCode; } + returnCode = DjiFlightController_SetRCLostActionEnableStatus(DJI_FLIGHT_CONTROLLER_DISABLE_RC_LOST_ACTION); + if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) { + USER_LOG_WARN("Set RC lost action status disable failed,error code:0x%08llX, That means the aircraft will execute the RC lost Action when RC is lost — RC-less flight not supported.", returnCode); + // go through + } DjiTest_FlightControlSample(flightCtrlSampleSelect); @@ -980,6 +986,71 @@ static void DjiTest_FlightControlSlowRotateMotorSample(void) escStatus == DJI_FLIGHT_CONTROLLER_ALL_MOTOR_IN_SLOW_ROTATE_MODE ? "all" : "(error)"); } +void DjiTest_FlightControlRCLostActionEnableSample() +{ + T_DjiReturnCode returnCode; + + USER_LOG_INFO("Flight control RC-lost-action-enable sample start"); + DjiTest_WidgetLogAppend("Flight control RC-lost-action-enable sample start"); + + USER_LOG_INFO("--> Prepare: Set RC Lost action enable, set RC lost action landing"); + returnCode = DjiFlightController_SetRCLostAction(DJI_FLIGHT_CONTROLLER_RC_LOST_ACTION_LANDING); + if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) { + USER_LOG_ERROR("Set RC Lost action failed, error code: 0x%08X", returnCode); + goto out; + } + + returnCode = DjiFlightController_SetRCLostActionEnableStatus(DJI_FLIGHT_CONTROLLER_ENABLE_RC_LOST_ACTION); + if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) { + USER_LOG_ERROR("Set RC Lost action status enable failed, error code: 0x%08X", returnCode); + goto out; + } + + USER_LOG_INFO("--> Step 1: Obtain joystick control authority"); + DjiTest_WidgetLogAppend("--> Step 1: Obtain joystick control authority"); + returnCode = DjiFlightController_ObtainJoystickCtrlAuthority(); + if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) { + USER_LOG_ERROR("Obtain joystick authority failed, error code: 0x%08X", returnCode); + goto out; + } + s_osalHandler->TaskSleepMs(1000); + + USER_LOG_INFO("--> Step 2: Take off\r\n"); + DjiTest_WidgetLogAppend("--> Step 2: Take off\r\n"); + if (!DjiTest_FlightControlMonitoredTakeoff()) { + USER_LOG_ERROR("Take off failed"); + goto out; + } + USER_LOG_INFO("Successful take off\r\n"); + DjiTest_WidgetLogAppend("Successful take off\r\n"); + + 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), east:0(m), up:30(m) , yaw:0(degree) from current point"); + if (!DjiTest_FlightControlMoveByPositionOffset((T_DjiTestFlightControlVector3f) {0, 0, 30}, 0, 0.8, 1)) { + USER_LOG_ERROR("Move to north:0(m), east:0(m), up:30(m) , yaw:0(degree) from current point failed"); + goto out; + } + + USER_LOG_INFO("--> Step 4: Turn off the RC and check if it RTHs and lands..."); + s_osalHandler->TaskSleepMs(1000); + USER_LOG_INFO("--> Please Turn off the RC and check if it RTHs and lands..."); + s_osalHandler->TaskSleepMs(1000); + USER_LOG_INFO("--> Please Turn off the RC and check if it RTHs and lands..."); + s_osalHandler->TaskSleepMs(1000); + + USER_LOG_INFO("-> Step 5: Release joystick authority"); + DjiTest_WidgetLogAppend("-> Step 5: Release joystick authority"); + returnCode = DjiFlightController_ReleaseJoystickCtrlAuthority(); + if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) { + USER_LOG_ERROR("Release joystick authority failed, error code: 0x%08X", returnCode); + goto out; + } + +out: + USER_LOG_INFO("Flight control RC-lost-action-enable sample end"); + DjiTest_WidgetLogAppend("Flight control RC-lost-action-enable sample end"); +} + void DjiTest_FlightControlSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampleSelect) { switch (flightCtrlSampleSelect) { @@ -1015,6 +1086,10 @@ void DjiTest_FlightControlSample(E_DjiTestFlightCtrlSampleSelect flightCtrlSampl DjiTest_FlightControlSlowRotateMotorSample(); break; } + case E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_RC_LOST_ACTION_STATUS_ENBALE: { + DjiTest_FlightControlRCLostActionEnableSample(); + 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 c738682..cfc94d7 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 @@ -44,6 +44,7 @@ typedef enum { E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SET_GET_PARAM, E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_FTS_TRIGGER, E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_SLOW_ROTATE_BLADE, + E_DJI_TEST_FLIGHT_CTRL_SAMPLE_SELECT_RC_LOST_ACTION_STATUS_ENBALE, } E_DjiTestFlightCtrlSampleSelect; #pragma pack(1) diff --git a/samples/sample_c/platform/linux/manifold3/app_json/README.md b/samples/sample_c/platform/linux/manifold3/app_json/README.md index eab7113..b16ca8f 100644 --- a/samples/sample_c/platform/linux/manifold3/app_json/README.md +++ b/samples/sample_c/platform/linux/manifold3/app_json/README.md @@ -63,6 +63,7 @@ Description of the tags in the app.json configuration file: Indicates the English name of the application, which can be customized. The filling rules are as follows: * Maximum length limit is 32 bytes. * Only allow letters(a-zA-Z), numbers(0-9), hyphens(-), and dots(.), no other characters are permitted, and it must begin with a letter or number. + * It cannot be "null". It is recommended that the application name has a connection to its functionality, and you should try to avoid duplication with other application names. It is advisable to avoid changing the application name afterward. This field can be used to display application information, such as in the application management interface, when the PILOT language is set to English, or other languages that are not Chinese, Japanese, or French. @@ -104,7 +105,7 @@ Description of the tags in the app.json configuration file: ## description_en * Description: - Indicates the English description of the application, which should be a string not exceeding 367 bytes in length, containing a detailed custom description of the application. + Indicates the English description of the application, which should be a string not exceeding 367 bytes in length, containing a detailed custom description of the application, and it cannot be "null". The specific filling rules are as follows: * Each item within the brackets [] represents the content of each line, with the next item representing the content of the next line. If a line break is needed, multiple items can be filled in within the brackets []. This field can be used to display application information, such as in the application management interface, when the PILOT language is set to English, or other languages that are not Chinese, Japanese, or French, this field will display the application description. @@ -146,7 +147,7 @@ Description of the tags in the app.json configuration file: ## maintainer_en * Description: - Indicates the developer information of the application in English, which should be a string not exceeding 127 bytes in length. + Indicates the developer information of the application in English, which should be a string not exceeding 127 bytes in length, and it cannot be "null". This field can be used to display application information, such as in the application management interface, when the PILOT language is set to English, or other languages that are not Chinese, Japanese, or French, this field will display the developer information of the application. * Data type: string diff --git a/tools/build_dpk/build_dpk.sh b/tools/build_dpk/build_dpk.sh old mode 100644 new mode 100755 index b0db817..bc5c16d --- a/tools/build_dpk/build_dpk.sh +++ b/tools/build_dpk/build_dpk.sh @@ -89,6 +89,13 @@ if [ $(printf "%s" "$id" | wc -c) -gt 16 ]; then exit 1 fi +if [ "$id" == "null" ]; then + echo "Error, user_app_id field not comply with the specification, it should be the app id generated by the developer website's user center" + echo "Please check app.json" + echo "Document Specification: samples/sample_c/platform/linux/manifold3/app_json/README.md" + exit 1 +fi + # prase and check version field version_regex='^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' version=$(python3 -c "import json; print(json.load(open('$input_json_file'))['firmware_version'])") @@ -145,6 +152,11 @@ elif [ $(printf "%s" "$name_en" | wc -c) -gt 32 ]; then echo "Please check app.json" echo "Document Specification: samples/sample_c/platform/linux/manifold3/app_json/README.md" exit 1 +elif [ "$name_en" == "null" ]; then + echo "Error, name_en field cannot be 'null'" + echo "Please check app.json" + echo "Document Specification: samples/sample_c/platform/linux/manifold3/app_json/README.md" + exit 1 elif [[ ! $name_en =~ $regex ]]; then echo "Error, name_en field not comply with the specification" echo "Please check app.json" @@ -215,6 +227,11 @@ if [ "$desc_en" == "" ]; then echo "Please check app.json" echo "Document Specification: samples/sample_c/platform/linux/manifold3/app_json/README.md" exit 1 +elif [ "$desc_en" == "null" ]; then + echo "Error, description_en field cannot be 'null'" + echo "Please check app.json" + echo "Document Specification: samples/sample_c/platform/linux/manifold3/app_json/README.md" + exit 1 elif [ $(printf "%s" "$desc_en" | wc -c) -gt 367 ]; then echo "Error, desc_en field byte count:$(printf "%s" "$desc_en" | wc -c) over 367" echo "Please check app.json" @@ -285,6 +302,11 @@ if [ "$maintainer_en" == "" ]; then echo "Please check app.json" echo "Document Specification: samples/sample_c/platform/linux/manifold3/app_json/README.md" exit 1 +elif [ "$maintainer_en" == "null" ]; then + echo "Error, maintainer_en field cannot be 'null'" + echo "Please check app.json" + echo "Document Specification: samples/sample_c/platform/linux/manifold3/app_json/README.md" + exit 1 elif [ $(printf "%s" "$maintainer_en" | wc -c) -gt 127 ]; then echo "Error, maintainer_en field byte count:$(printf "%s" "$maintainer_en" | wc -c) over 127" echo "Please check app.json" diff --git a/tools/file2c/file2c.exe b/tools/file2c/file2c.exe old mode 100644 new mode 100755