Payload Sample

2024-12-31
No Rating

Sample Introduction

With the help of Payload SDKopen in new window and PSDK Tutorialopen in new window, users can develop various types of payloads that are suitable for security, inspection, survey, and other scenarios. For example, the payloads like gas monitor, parachute, lamp, and so on. Through the Payload function, users can get the ability to manage the third-party payload connected to our drone, and get the payload information and widget information. Users can also get, set, receive, and send widget data.

In Payload Sample, we divide the payload data page and payload widget page. Different payload information and payload widget information will be displayed by selecting different gimbal interfaces. The range of gimbal interfaces can refer to the PayloadIndexType in MSDK API Reference. According to the heading direction of the drone and different drone models, there are left(main) gimbal, right gimbal, upward gimbal, and so on.

Interface Calling Process

The figure below is an example of a complete interface call. Please call interfaces according to the actual scene. For detailed usage, please check the Payload management class IPayloadCenteropen in new window.

  • Please refer to PayloadBasicInfo() for the basic information of the payload.
  • Please refer to PayloadWidgetInfo() for the payload widget information.
  • Please refer to WidgetType for the settable range of different widget types. For a more detailed description, please refer to the PSDK tutorialopen in new window.
    • BUTTON widget: Default value is 0. 1 means the button is pressed.
    • SWITCH widget: “ON” is 1, “OFF” is 0.
    • RANGE widget: [0,100]
    • LIST widget: Int value of [0, N]. N is defined by the firmware of the third-party payload device manufacturer.
    • INPUT widget: Any int value. The default value is defined by the firmware of the third-party payload device manufacturer.
  • Interface calling example:
    Set the button widget of the payload on the aircraft's left(main) gimbal interface to 0, which means the button is not pressed.
IPayloadManager payloadManager = PayloadCenter.getInstance().getPayloadManager().get(PayloadIndexType.LEFT_OR_MAIN);
payloadManager.setWidgetValue(new WidgetValue(WidgetType.BUTTON, 0, 0), new CommonCallbacks.CompletionCallback() {
    @Override
    public void onSuccess() {

    }

    @Override
    public void onFailure(@NonNull IDJIError error) {

    }
});

Sample Acquisition

If you have any comments or confusion about our documentation, you can click here to give feedback and we will get back to you as soon as possible.